diff --git a/README.md b/README.md index f936ff0..50636cf 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Requisiti: SDK Sailfish in `~/SailfishOS`, build engine Docker. ## Installazione sul telefono ```sh -devel-su rpm -Uvh harbour-server-0.1.0-1.aarch64.rpm +devel-su rpm -Uvh harbour-server-0.1.1-1.aarch64.rpm ``` Poi, all'apertura: indicare indirizzo (es. `http://192.168.3.21:8792`) e token. diff --git a/qml/pages/StatusPage.qml b/qml/pages/StatusPage.qml index 2694922..3d7fa10 100644 --- a/qml/pages/StatusPage.qml +++ b/qml/pages/StatusPage.qml @@ -52,6 +52,23 @@ Page { function sshFailed() { var d = statusClient.data; return (d && d.access && d.access.ssh_failed_24h !== undefined) ? d.access.ssh_failed_24h : 0 } function updatesTotal() { var d = statusClient.data; return (d && d.updates && d.updates.total !== undefined) ? d.updates.total : 0 } function updatesSecurity() { var d = statusClient.data; return (d && d.updates && d.updates.security !== undefined) ? d.updates.security : 0 } + function updatesPackages() { + var d = statusClient.data + return (d && d.updates && d.updates.packages) ? d.updates.packages : [] + } + // Il dettaglio deve rendere verificabile uno zero: senza la data delle + // liste apt "nessun aggiornamento" e' indistinguibile da "non ho guardato". + function updatesDetail() { + var d = statusClient.data + if (!d || !d.updates) return "" + var parts = [] + if (d.updates.total > 0 && updatesPackages().length > 0) + parts.push(updatesPackages().join(", ")) + parts.push(qsTr("di sicurezza: ") + updatesSecurity()) + if (d.updates.lists_updated_at) + parts.push(qsTr("liste apt: ") + statusClient.fmtStamp(d.updates.lists_updated_at)) + return parts.join(" · ") + } function vpnText() { var d = statusClient.data if (!d || !d.net || !d.net.interfaces || d.net.interfaces.length === 0) return "nessuna" @@ -200,7 +217,7 @@ Page { width: parent.width - 2 * Theme.paddingLarge title: qsTr("Aggiornamenti") value: updatesTotal() === 0 ? qsTr("nessuno") : String(updatesTotal()) - detail: qsTr("di cui di sicurezza: ") + updatesSecurity() + detail: updatesDetail() progress: -1 level: updatesSecurity() > 0 ? 1 : 0 } diff --git a/rpm/harbour-server.spec b/rpm/harbour-server.spec index fa65b7b..975d4db 100644 --- a/rpm/harbour-server.spec +++ b/rpm/harbour-server.spec @@ -1,6 +1,6 @@ Name: harbour-server Summary: Parametri del server in una schermata -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Qt/Qt License: MIT @@ -23,6 +23,13 @@ schermata sola. Il formato consumato (schema status/1) non dipende dalla macchina: qualunque host che serva lo stesso JSON funziona senza modifiche. %changelog +* Wed Oct 28 2026 Carlo Baratto - 0.1.1-1 +- Card Aggiornamenti: il dettaglio mostra i pacchetti in attesa e la data + delle liste apt ("liste apt: 28/10 09:09"), così un "nessuno" è + verificabile e non indistinguibile da una lettura fallita. Corrisponde ai + nuovi campi updates.packages e updates.lists_updated_at dello schema + status/1 (caso reale: dist-upgrade automatico delle bind9-* mentre Webmin + mostrava ancora 3 update pendenti) * Tue Oct 27 2026 Carlo Baratto - 0.1.0-1 - Prima release: schermata unica con i parametri del server letti da /v1/status (schema status/1), soglie giallo/rosso, aggiornamento diff --git a/src/main.cpp b/src/main.cpp index 6013672..4260f3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,9 +15,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) // AppConfigLocation = ~/.config/harbour/server (zona persistente). app->setOrganizationName(QStringLiteral("harbour")); app->setApplicationName(QStringLiteral("server")); - app->setApplicationVersion(QStringLiteral("0.1.0")); + app->setApplicationVersion(QStringLiteral("0.1.1")); - qDebug() << "harbour-server v0.1.0 build" << __DATE__ << __TIME__; + qDebug() << "harbour-server v0.1.1 build" << __DATE__ << __TIME__; Settings settings; StatusClient status(&settings); diff --git a/src/statusclient.cpp b/src/statusclient.cpp index 5745c1b..eee30a9 100644 --- a/src/statusclient.cpp +++ b/src/statusclient.cpp @@ -187,3 +187,13 @@ QString StatusClient::fmtNum(double value, int decimals) const { return QLocale::system().toString(value, 'f', decimals); } + +QString StatusClient::fmtStamp(const QString &iso) const +{ + if (iso.isEmpty()) + return QString(); + QDateTime dt = QDateTime::fromString(iso, Qt::ISODate); + if (!dt.isValid()) + return iso; + return dt.toLocalTime().toString(QStringLiteral("dd/MM HH:mm")); +} diff --git a/src/statusclient.h b/src/statusclient.h index ca63dee..1049728 100644 --- a/src/statusclient.h +++ b/src/statusclient.h @@ -42,6 +42,8 @@ public: Q_INVOKABLE QString fmtUptime(qint64 seconds) const; Q_INVOKABLE QString fmtAge(double hours) const; Q_INVOKABLE QString fmtNum(double value, int decimals) const; + // ISO 8601 dal server (UTC) -> "28/10 09:09" nell'ora locale del telefono. + Q_INVOKABLE QString fmtStamp(const QString &iso) const; signals: void changed();