diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3199ea6..15de2454 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,39 @@ release version + date and opens a fresh `[Unreleased]`.
demo entry exists, and removing it (the bin icon in the server list) throws
everything away. Adding a real server while in the demo switches to it.
+- **NOVA hides the buttons your API key cannot use** — with a read-only key (the
+ VIEWER role), the Docker, VMs and Array tabs and the container, VM and
+ notification sheets no longer show Start, Stop, Restart, Update, parity check,
+ Archive or Delete buttons. One note in their place says "View only" and which
+ permission the key would need, for example DOCKER:UPDATE_ANY, with a link to
+ the list of permissions. A key with only some permissions keeps exactly the
+ buttons it may use. If NOVA cannot find out what the key may do, it shows the
+ buttons as before. And if the server still refuses an action, the message now
+ names the missing permission instead of "Forbidden resource" (#315, #316).
+
+- **"Test" in the Add server sheet now checks the key** — it used to report
+ "Connected" for any key, even a wrong one. Now a key the server does not accept
+ fails the test, and a working key shows the Unraid and API version and whether it
+ is "View only" or can control Docker, VMs and so on. The API Key field has a
+ hint and a "Which permissions?" link to the table of what each feature needs
+ (#315, #316).
+
+- **Alerts outside the app (opt-in)** — Settings → Notifications → "Alerts from
+ your servers" lets NOVA check your servers in the background and tell you
+ about new Unraid alerts and warnings, and about an array that is not started
+ or is degraded. It is off by default; while it is off, NOVA does nothing in
+ the background. Switching it on asks for permission to show notifications
+ (Android 13 and later). You choose how often NOVA checks (every 15 minutes to
+ 3 hours), whether warnings count or only alerts, and whether to check on
+ Wi-Fi only; "Send test notification" shows that it works, and each server's
+ last check is listed under the switch. The checks go only to your own
+ servers, with the API key you saved, and a read-only key is enough. They use
+ only https addresses with a trusted certificate: a server that has only an
+ http address is not checked, and the screen says so. The demo server is never
+ checked. Android decides when a check runs, so an alert can come late,
+ sometimes by an hour or more while the phone is idle. Phones whose maker stops
+ background work may need a setting changed; the section links to tips (#321).
+
### Changed
- **Restarting a container is one step on newer servers** — on Unraid API 4.36.0
@@ -56,6 +89,11 @@ release version + date and opens a fresh `[Unreleased]`.
### Fixed
+- **Resume on a paused container now works** — the Resume button in the Docker tab asked the
+ server to start the container, which Docker refuses for a paused one, so the container stayed
+ paused and the app showed an error. Resume now sends the "unpause" action; Start on a stopped
+ container is unchanged (#345).
+
- **A turned-off service no longer makes the whole server look offline** — with
VMs or Docker switched off, the pill at the top used to read "Offline" even
though the server answered. Now only a server that really cannot be reached
@@ -68,6 +106,29 @@ release version + date and opens a fresh `[Unreleased]`.
every time you open it or come back to it, so the notice is on the first
screen.
+- **NOVA no longer sends your API key along when a server redirects it** — it
+ used to follow a redirect and take the key with it, to another address or from
+ https down to plain http. Now a redirect is not followed: the tab, **Test**
+ and the action message say "The server redirects to …" and name the address,
+ and you enter that address in the server's settings. This is what Unraid does
+ when you type an `http` address while its SSL setting is Yes or Strict: it
+ points to the `https` address, which is the one to enter (#354).
+
+- **The Overview explains why it could not load and keeps its attention card** —
+ when every part of the Overview failed, it always said "Can't reach the server".
+ It now gives the same reason as the tabs, for example that the server did not
+ accept the key. And with Docker or VMs switched off, the "Needs attention" card
+ stays, because the server itself is still reachable (#217).
+
+- **The "Needs attention" card also appears when Docker or VMs are off, and unknown
+ counts show a dash** — the card used to disappear whenever Docker or the VM
+ manager was switched off on the server, or the API key may not read them, even
+ though the server answered and the array needed you. It now stays. And the
+ Containers and Virtual machines cards show "—" instead of "0 running · all
+ healthy" or "0 configured" while NOVA does not know the numbers yet (not
+ loaded, turned off, not allowed or not reachable). A server that really has
+ none still shows 0 (#356).
+
## [0.1.48] - 2026-11-13
The Overview now tells you when something on your server needs you, and the Docker tab can search and group containers by Compose project. A new "Needs attention" card at the top of the Overview lists what needs you, most urgent first; on a healthy server it is not there, so a quiet Overview is normal. The Docker tab has a search field with a clear button, and a new "Compose" option for the Docker view (Settings, Layout) groups containers by their Compose project. The 0.1.48 beta confirmed the search, the Compose option and the quiet Overview on a real phone. Some groundwork in this release has no visible change yet (detecting the server's API version and what the API key may do, and the rules for later opt-in alerts). As in 0.1.47, NOVA does not install updates itself: "Download" opens the release file in your browser.
diff --git a/HANDOFF.md b/HANDOFF.md
index 8c29d288..bad68b0e 100644
--- a/HANDOFF.md
+++ b/HANDOFF.md
@@ -111,7 +111,7 @@ _Toolchain raised in the 0.1.28 cycle — see ADR-0023 (AGP-9) / ADR-0024
app/src/main/
├── graphql/io/github/nofuturekid/nova/
│ ├── schema.graphqls hand-written subset of the unraid/api generated-schema.graphql
-│ ├── queries.graphql Ping, GetServerInfo/Metrics/NetworkThroughput/Display/Array/DockerContainers/Vms,
+│ ├── queries.graphql GetServerInfo/Metrics/NetworkThroughput/Display/Array/DockerContainers/Vms,
│ │ notifications (overview + list), plugins, plugin ops, installed .plg, NetworkInterfaces, FetchContainerLogs
│ ├── mutations.graphql Array, Docker (start/stop/pause/unpause/update/updateAll), Vm (start/stop/pause/resume/
│ │ forceStop/reboot/reset), parityCheck, notification actions
@@ -260,6 +260,7 @@ JSON-scalar decision rationale (incl. why-not-String): [ADR-0007](docs/adr/0007-
- **JSON scalar → kotlin.Any via Apollo's `AnyAdapter`** — the Unraid GraphQL `JSON` scalar serialises as inline JSON values (objects/arrays/primitives), not pre-stringified text. Custom `kotlin.String` adapters crash. We map it to `kotlin.Any` with `com.apollographql.apollo.api.AnyAdapter` (public, built-in). Don't try to write your own with `reader.readAny()` — that's `@ApolloInternal`.
- **Update check** lives under `data/update/`: `UpdateRepository` polls `https://api.github.com/repos/hellwand/nova/releases` (installed versions up to 0.1.42 still carry the old `nofuturekid/nova` name and reach it through GitHub's redirect; no auth, 60 req/h rate limit fine for on-start checks), `UpdateDialog` only sends the browser to the release's APK (or the release page when it has no APK) with `ACTION_VIEW`; the app downloads and installs nothing itself and declares no `REQUEST_INSTALL_PACKAGES` in any flavor (ADR-0046). The check is compiled into both flavors and disabled at runtime when `BuildConfig.HAS_UPDATER` is false (`store`). The Settings screen exposes the "Include pre-releases" toggle + manual "Check now". Banner on MainScreen dismisses per-tag via `dismissedUpdateTag` in DataStore.
- Cleartext HTTP requires `android:usesCleartextTraffic="true"` in the manifest. LAN access against `http://192.168.x.x` needs this. The base-config in `network_security_config.xml` permits cleartext; the GitHub hosts (`api.github.com`, `github.com`, `objects.githubusercontent.com`) are pinned to HTTPS.
+- **Alerts outside the app** (ADR-0048) live under `data/alerts/`: `AlertScheduler` is the only door to WorkManager and does nothing, not even ask for the instance, while the switch is off (WorkManager is initialised on demand, `NovaApp` is its `Configuration.Provider`, the automatic initializer is removed in the manifest); `AlertCheckWorker` runs `AlertCheckRunner`, which probes each checkable server through `ServerProbe` (https addresses with verified trust only, no redirects; a server without one is `NotEncrypted`; the demo entry is skipped by `isBackgroundCheckable()`), decides with the pure `evaluateAlerts` and posts through `AlertNotifier`. The per-server memory and the last-check record are in `ServerAlertState`, stored through `AlertStateStore`. The Settings section is `ui/screens/settings/AlertsSection.kt` with `AlertsViewModel` (permission flow, test notification, last-check lines); it reads only the settings store. Background work exists only while the switch is on; ADR-0017's foreground-only rule still holds for every screen stream.
- **Unraid 7.4 refuses oversized requests** (cost 1,000, depth 20, 100 aliases, 5,000 tokens). `GraphqlRequestLimitsTest` fails CI when an operation passes 70 % of any limit; numbers and sources under "Unraid 7.4 request limits (#320)" below.
- **CI `test` job (ADR-0036) can transiently fail at Gradle _configuration_** with a plugin-not-resolvable error (e.g. `com.google.devtools.ksp` not found) on a plugin-portal/registry blip — it fetches plugins fresh under PR `cache-read-only`. **Re-run the job; it is not a code defect** (see ADR-0036 "Known consequence — transient plugin-fetch in the `test` job" note; PR #163 2026-05-19).
diff --git a/README.md b/README.md
index 0f5eb66a..a715cfdf 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,7 @@ It talks to your server through the official Unraid API (the Connect plugin's Gr
- **Docker** — every container with status; start / stop / restart / pause, jump straight to a container's Web UI, see which have image updates and update one — or all — in a tap
- **VMs** — VM state with start / stop / pause / resume
- **Multiple servers** — switch between them; each remembers its own local and remote address
+- **Alerts outside the app** — optional, off by default: NOVA checks your servers in the background and notifies you of new Unraid alerts and warnings and of an array that is not started or is degraded ([details](#alerts-outside-the-app))
- **Live network speed** — upload/download on the Overview card (needs Unraid API 4.35.0 or newer); the NIC inventory sits under Settings → Network interfaces (vendor, model and link speed only with a third-party API plugin)
- **Stay current** — the GitHub APK checks GitHub for new releases and shows a notice on the Overview; **Download** lets your browser fetch the file, and you open it to install (NOVA does not install updates itself; the F-Droid build is updated by F-Droid)
@@ -63,6 +64,32 @@ NOVA surfaces what Unraid's GraphQL API exposes today. A few things commonly ask
If something on this list (or off it) matters to you, an issue or a 👍 on an existing one is the best signal.
+## Alerts outside the app
+
+NOVA can tell you about a problem on your server without you opening the app. It is **off by default**: with the switch off NOVA does nothing in the background. You switch it on under **Settings → Notifications → Alerts from your servers**.
+
+**What is checked.** For each of your servers, NOVA asks for its unread Unraid notifications and for the state of its array, and notifies you of:
+
+- every **new** unread Unraid notification of importance alert or warning (once per notification, never twice; "Alerts only" leaves out warnings);
+- an array that **is not started**, and an array that **is degraded**. Unraid itself does not notify about these.
+
+Disk temperatures, disk errors, SMART warnings, parity checks and pools reach you through Unraid's own notifications, so they appear as the first kind. The first check after you switch on only notes what is already there and shows nothing. A server that cannot be reached is never an alert; the Settings section lists each server's last check instead. Unraid raises one warning each time a parity check starts, so you will see that one with "Alerts and warnings".
+
+**How often.** Every 30 minutes by default; you can pick 15 minutes, 1 hour or 3 hours, and "Only on Wi-Fi". Android decides the exact time and may batch checks with other apps' work, so an alert can come late, sometimes by an hour or more while the phone lies still (Doze). On Android 13 and later an app you have not opened for 8 days is limited to about one check a day.
+
+**What it needs.**
+
+- Notifications allowed for NOVA. On Android 13 and later NOVA asks when you switch the alerts on; if you refuse, the alerts stay off.
+- An **https address** for the server. **A plain-http address is never contacted in the background**, because nobody is looking at the phone and the API key would travel in clear text. A server that has only an http address is not checked, and Settings says "not checked in the background because the connection is not encrypted". The certificate must be one your phone trusts, or the one you pinned for the local address; a changed or untrusted certificate is reported in Settings and never accepted without you. Redirects are not followed in the background.
+- An API key that can read notifications and the array: a key with the VIEWER role is enough (from the Unraid API's source code; we have not yet tried the background check with such a key on a real server). Nothing is ever changed on the server.
+- Unraid must keep the notification as unread, which it does by default ("Browser" delivery on). If you turned that off for an importance, those notifications do not reach NOVA.
+
+**What it never does.** No Google services, no push service or relay run by this project, no server plugin, no foreground service, no exact alarms, no request to ignore battery optimisation. The checks go only to your own servers. The demo server is never checked. Switching the alerts off cancels the work and removes what NOVA posted.
+
+**Phones that stop background work.** Some makers (Huawei, Xiaomi, Samsung and others) stop apps in the background more strictly than Android does, and the checks may then not run at all. Settings has a link to [dontkillmyapp.com](https://dontkillmyapp.com) (opened by your browser, only when you tap it) and, when Android restricts the app, a shortcut to the battery settings. On EMUI, for example, you need Battery → App launch → NOVA → Manage manually. Whether a check ran is visible in the "Last check" lines in Settings.
+
+**Instant alerts with Unraid's own agents.** If you want alerts the moment they happen, let Unraid send them itself. For example, with the ntfy agent (from Unraid's source, not tried by this project): Settings → Notifications in the Unraid web UI → the ntfy.sh agent with your own ntfy server and a topic → tick "Agents" for warnings and alerts → subscribe to the topic in the ntfy app. The agent adds an icon link to every message, and that image is hosted on GitHub. This needs no NOVA setting.
+
## Look & feel
A deliberately dark, glassy Material 3 design — dense cards, a single accent color, restrained motion. Tuned for quick checks, not for living in.
@@ -82,7 +109,7 @@ A few things bend to taste in **Settings**:
2. On your Unraid server, generate an **API key**: web UI → _Settings → Management Access → API / Connect_ (which rights it needs: [API key permissions](#api-key-permissions)).
3. Open the app → **Add server** and fill in:
- **Server name** — a label, e.g. `Tower`
- - **Local host** — its address on your home network, e.g. `192.168.1.10`. Flip **Use SSL (HTTPS)** if the server uses HTTPS; for a self-signed certificate also enable **Trust self-signed certificate** and confirm it once
+ - **Local host** — its address on your home network, e.g. `192.168.1.10`. Flip **Use SSL (HTTPS)** if the server uses HTTPS; for a self-signed certificate also enable **Trust self-signed certificate** and confirm it once. If your server's _Use SSL/TLS_ setting is _Yes_ or _Strict_, it answers a plain `http` request with a redirect to `https`; NOVA does not follow redirects (the API key would travel with it), so enter the address it names, with **Use SSL (HTTPS)** on. A tab or **Test** shows it as "The server redirects to …"
- **Remote host (Unraid Connect)** — optional, e.g. `your-server.unraid.net`, for when you're away (with its own **Use SSL (HTTPS)** switch)
- **API Key** — the one you just generated
4. Tap **Test** (next to the local and/or remote connection), then **Save**. The pill in the top bar flips between **Local** and **Remote**.
@@ -109,7 +136,7 @@ Requires an Unraid 7.x server with the API/Connect plugin enabled. All app featu
NOVA talks to your server with one API key per server. **NOVA never needs the ADMIN role or any permission to manage API keys.** Pick whichever of these suits you:
-- **Simplest, read-only: a key with the VIEWER role.** It can see everything NOVA shows and cannot change anything, except that servers older than Unraid API 4.37.4 let every key archive and delete notifications [^4]. Buttons that need more rights are refused by the server.
+- **Simplest, read-only: a key with the VIEWER role.** It can see everything NOVA shows and cannot change anything, except that servers older than Unraid API 4.37.4 let every key archive and delete notifications [^4]. NOVA hides the buttons that need more rights.
- **Simplest, full control: a key with the ADMIN role.** It can do everything NOVA offers. It can also do much more, which NOVA never uses.
- **Least privilege: the VIEWER role plus only the controls you want.** See the table below.
@@ -155,7 +182,7 @@ The command shape, with the VIEWER role and `DOCKER:UPDATE_ANY`, was run live an
### When a permission is missing
-The server decides, not NOVA. An action the key may not do is refused with the message **"Forbidden resource"** and nothing changes on the server (confirmed live for container actions with a VIEWER key). A read the key may not do is refused the same way, so that screen fails to load. A key the server does not accept at all is answered with "API key validation failed". A later version of NOVA will hide the controls a key cannot use instead of showing buttons that are refused.
+The server decides, not NOVA. An action the key may not do is refused with the message **"Forbidden resource"** and nothing changes on the server (confirmed live for container actions with a VIEWER key). A read the key may not do is refused the same way, so that screen fails to load. A key the server does not accept at all is answered with "API key validation failed". NOVA asks the server what the key may do and hides the controls it cannot use, with one "View only" note in their place that names the permission. If NOVA cannot find that out, it shows the buttons, and a refused action then says which permission is missing.
### Which Unraid API version you need
@@ -173,6 +200,7 @@ Unraid® is a registered trademark of Lime Technology, Inc. NOVA is an independe
- **Full policy:**
- **Your API key stays on your device.** It's encrypted at rest using Android Keystore via Google's Tink library, and explicitly excluded from cloud backup / device-transfer.
- **No analytics, no telemetry, no tracking services.** The app talks to your Unraid server's API; in the GitHub (`direct`) build it also asks GitHub's API for app updates (at app start, when the app returns from the background or you come back to the main screen from Settings or the server list, when you open Settings, or on "Check now"); and it loads container icons from the URLs your own server supplies (often GitHub or a CDN).
+- **Background checks only if you switch them on.** With "Alerts from your servers" on, NOVA asks your own servers, in the background and over verified https only, for their unread alerts and warnings and their array state, as often as you chose. Nothing else is contacted for it, and with the switch off nothing runs in the background. See [Alerts outside the app](#alerts-outside-the-app).
- **Update downloads** are made by your browser, not by NOVA: the update sheet opens the release's APK on GitHub, shows its SHA-256 so you can compare it with the downloaded file, and the app itself downloads and installs nothing. See [ADR-0046](./docs/adr/0046-update-via-browser-download.md).
- **Source is the spec.** Audit, fork, run yourself — GPL v3.
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 98b8a77e..a154dc83 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -190,6 +190,7 @@ dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
+ testImplementation(libs.kotlinx.coroutines.debug)
testImplementation(libs.androidx.work.testing)
// Store-screenshot rendering (StoreScreenshots.kt) — test scope only,
@@ -218,4 +219,10 @@ tasks.withType().configureEach {
} else {
filter.excludeTestsMatching("*StoreScreenshots")
}
+ // StallWatch (test rule) writes its dump of a stalled test here as well as to build/stall-dumps:
+ // CI already uploads the HTML report directory, also when the job fails. Set at execution time,
+ // so the path is not a task input.
+ doFirst {
+ systemProperty("nova.stallDumpCopyDir", reports.html.outputLocation.get().asFile.resolve("stall-dumps").path)
+ }
}
diff --git a/app/src/main/graphql/io/github/nofuturekid/nova/queries.graphql b/app/src/main/graphql/io/github/nofuturekid/nova/queries.graphql
index b9b792de..f5bae79c 100644
--- a/app/src/main/graphql/io/github/nofuturekid/nova/queries.graphql
+++ b/app/src/main/graphql/io/github/nofuturekid/nova/queries.graphql
@@ -1,7 +1,3 @@
-query Ping {
- __typename
-}
-
query FetchContainerLogs($id: PrefixedID!, $tail: Int) {
docker {
logs(id: $id, tail: $tail) {
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertCheckRunner.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertCheckRunner.kt
index cb64ad80..fab7e093 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertCheckRunner.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertCheckRunner.kt
@@ -34,6 +34,7 @@ class AlertCheckRunner internal constructor(
private val notifier: AlertNotifier,
private val cancelWork: suspend () -> Unit,
private val serverTimeoutMs: Long,
+ private val now: () -> Long = System::currentTimeMillis,
) {
@Inject
constructor(
@@ -70,8 +71,9 @@ class AlertCheckRunner internal constructor(
val posted = notifier.post(ref, evaluation)
// Not stored when Android refused the post, so the next check tries again. Not stored either
// when the server was deleted while the check ran, which would leave state nobody removes.
- if (posted && evaluation.nextState != previous && stillSaved(server.id)) {
- states.put(server.id, evaluation.nextState)
+ // The last-check record is for the settings line only; it changes nothing that is posted.
+ if (posted && stillSaved(server.id)) {
+ states.put(server.id, evaluation.nextState.copy(lastCheck = CheckRecord(now(), result.toOutcome())))
}
return ServerCheck(ref, result, posted = evaluation.toPost.size, folded = evaluation.foldedCount)
}
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertNotifier.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertNotifier.kt
index 0490c48b..6ea4a886 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertNotifier.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertNotifier.kt
@@ -52,6 +52,15 @@ class AlertNotifier @Inject constructor(
/** False when the user (or Android 13+, without the permission) blocks NOVA's notifications. */
fun canPost(): Boolean = compat.areNotificationsEnabled()
+ /**
+ * True when the user switched off one of NOVA's two channels in Android's settings. Read-only:
+ * the worker posts as before, Android just drops what goes into such a channel. A channel that
+ * does not exist yet is not blocked.
+ */
+ fun blockedChannel(): Boolean = listOf(ALERTS_CHANNEL_ID, WARNINGS_CHANNEL_ID).any {
+ compat.getNotificationChannel(it)?.importance == NotificationManager.IMPORTANCE_NONE
+ }
+
/** Creates the two channels. Safe to call again: an existing channel is left as the user set it. */
fun ensureChannels() {
compat.createNotificationChannel(
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertState.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertState.kt
index dfe0a478..ba851063 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertState.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/alerts/AlertState.kt
@@ -22,4 +22,29 @@ data class ServerAlertState(
val conditionsBaselined: Boolean = false,
/** Array conditions that held at the last successful read, a subset of [STATE_ALERT_KEYS]. */
val openConditions: Set = emptySet(),
+ /**
+ * How the last check of this server went, for the settings screen's last-check line only.
+ * It plays no part in what is posted: [evaluateAlerts] leaves it alone and the check runner
+ * sets it after every run.
+ */
+ val lastCheck: CheckRecord? = null,
)
+
+/** How one check of one server ended. Mirrors [ProbeResult], without the data. */
+@Serializable
+enum class CheckOutcome { Ok, Unreachable, NotEncrypted, CertificateProblem, KeyMissing, KeyUnreadable, Rejected }
+
+/** When ([atEpochMs]) and how ([outcome]) a server was last checked in the background. */
+@Serializable
+data class CheckRecord(val atEpochMs: Long, val outcome: CheckOutcome)
+
+/** The [CheckOutcome] a probe result is recorded as. */
+fun ProbeResult.toOutcome(): CheckOutcome = when (this) {
+ is ProbeResult.Ok -> CheckOutcome.Ok
+ ProbeResult.Unreachable -> CheckOutcome.Unreachable
+ ProbeResult.NotEncrypted -> CheckOutcome.NotEncrypted
+ ProbeResult.CertificateProblem -> CheckOutcome.CertificateProblem
+ ProbeResult.KeyMissing -> CheckOutcome.KeyMissing
+ ProbeResult.KeyUndecryptable -> CheckOutcome.KeyUnreadable
+ is ProbeResult.Rejected -> CheckOutcome.Rejected
+}
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/api/ApolloClientFactory.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/api/ApolloClientFactory.kt
index e48ce76a..5160d541 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/api/ApolloClientFactory.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/api/ApolloClientFactory.kt
@@ -14,7 +14,11 @@ import javax.inject.Inject
import javax.inject.Singleton
/**
- * Builds per-server [ApolloClient] instances. Four variants:
+ * Builds per-server [ApolloClient] instances. Four variants. None of them follows a redirect
+ * (ADR-0051): every client here sends the API key, and OkHttp would send it on to whatever a 3xx
+ * answer's `Location` names, another host or plain http. A redirect comes back as the response
+ * (an `ApolloHttpException` with the status and the `Location` header) and is reported as
+ * [io.github.nofuturekid.nova.data.repository.ErrorReason.Redirected].
*
* - [build] — short timeouts (8 s connect, 15 s read/write). Used for
* polling queries and short-lived mutations (start/stop/pause/etc.).
@@ -28,9 +32,9 @@ import javax.inject.Singleton
* Per ADR-0016 these get their own client so the polling timeout
* doesn't have to be relaxed globally.
*
- * - [buildBackground] — the polling client for the background alert check: no redirect is
- * followed and no cleartext connection is made, so the API key stays on the https address it
- * was sent to. Only the background check uses it; the foreground is unchanged.
+ * - [buildBackground] — the polling client for the background alert check: like the others it
+ * follows no redirect, and on top of that no cleartext connection is made, so the API key stays
+ * on the https address it was sent to. Only the background check uses it.
*
* - [buildWs] — WebSocket-only client for GraphQL subscriptions. Reuses
* the existing self-signed TLS pin (ADR-0041) via [applyTrust]. Uses
@@ -50,7 +54,7 @@ open class ApolloClientFactory @Inject constructor() {
const val WS_PING_INTERVAL_S = 15L
}
- private val baseHttpClient: OkHttpClient by lazy {
+ internal val baseHttpClient: OkHttpClient by lazy {
val logging = HttpLoggingInterceptor().apply {
level = if (io.github.nofuturekid.nova.BuildConfig.DEBUG)
HttpLoggingInterceptor.Level.BASIC
@@ -62,10 +66,12 @@ open class ApolloClientFactory @Inject constructor() {
.readTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.addInterceptor(logging)
+ .followRedirects(false)
+ .followSslRedirects(false)
.build()
}
- private val longRunningHttpClient: OkHttpClient by lazy {
+ internal val longRunningHttpClient: OkHttpClient by lazy {
val logging = HttpLoggingInterceptor().apply {
level = if (io.github.nofuturekid.nova.BuildConfig.DEBUG)
HttpLoggingInterceptor.Level.BASIC
@@ -77,6 +83,8 @@ open class ApolloClientFactory @Inject constructor() {
.readTimeout(10, TimeUnit.MINUTES)
.writeTimeout(10, TimeUnit.MINUTES)
.addInterceptor(logging)
+ .followRedirects(false)
+ .followSslRedirects(false)
.build()
}
@@ -115,8 +123,9 @@ open class ApolloClientFactory @Inject constructor() {
open fun build(baseUrl: String, apiKey: String, trust: TlsTrust = TlsTrust.Default): ApolloClient =
cached("short", baseHttpClient, baseUrl, apiKey, trust)
- /** Same as [build] but for the background alert check ([backgroundHttpClient]): https only,
- * no redirect is followed. The foreground variants are not affected. */
+ /** Same as [build] but for the background alert check ([backgroundHttpClient]): https only.
+ * Like every client here it follows no redirect; the background client states that itself
+ * so it does not depend on the base client. */
fun buildBackground(baseUrl: String, apiKey: String, trust: TlsTrust = TlsTrust.Default): ApolloClient =
cached("bg", backgroundHttpClient, baseUrl, apiKey, trust)
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoState.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoState.kt
index 28b106ae..4d8a794a 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoState.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoState.kt
@@ -104,11 +104,18 @@ data class DemoState(
private fun withContainer(id: String, f: (Container) -> Container) =
copy(containers = containers.map { if (it.id == id) f(it) else it })
- fun startContainer(id: String) = withContainer(id) { it.copy(status = ContainerStatus.Running) }
+ /** Docker refuses `start` for a paused container; it needs [unpauseContainer] (#345). */
+ fun startContainer(id: String) = withContainer(id) {
+ if (it.status == ContainerStatus.Paused) it else it.copy(status = ContainerStatus.Running)
+ }
+
+ fun unpauseContainer(id: String) = withContainer(id) {
+ if (it.status == ContainerStatus.Paused) it.copy(status = ContainerStatus.Running) else it
+ }
fun stopContainer(id: String) = withContainer(id) { it.copy(status = ContainerStatus.Exited) }
/** Restart ends running, also for a container that was stopped. */
- fun restartContainer(id: String) = startContainer(id)
+ fun restartContainer(id: String) = withContainer(id) { it.copy(status = ContainerStatus.Running) }
fun pauseContainer(id: String) = withContainer(id) {
if (it.status == ContainerStatus.Running) it.copy(status = ContainerStatus.Paused) else it
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoUnraid.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoUnraid.kt
index 801c6fb4..2953cbd3 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoUnraid.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/demo/DemoUnraid.kt
@@ -156,7 +156,8 @@ class DemoUnraid internal constructor(
fun startArray() = act { it.startArray() }
fun stopArray() = act { it.stopArray() }
- fun startContainer(id: String) = act { it.startContainer(id) }
+ fun startContainer(id: String, paused: Boolean) =
+ act { if (paused) it.unpauseContainer(id) else it.startContainer(id) }
fun stopContainer(id: String) = act { it.stopContainer(id) }
fun restartContainer(id: String) = act { it.restartContainer(id) }
fun pauseContainer(id: String) = act { it.pauseContainer(id) }
diff --git a/app/src/main/kotlin/io/github/nofuturekid/nova/data/local/SettingsStore.kt b/app/src/main/kotlin/io/github/nofuturekid/nova/data/local/SettingsStore.kt
index 47751a24..0c193b0f 100644
--- a/app/src/main/kotlin/io/github/nofuturekid/nova/data/local/SettingsStore.kt
+++ b/app/src/main/kotlin/io/github/nofuturekid/nova/data/local/SettingsStore.kt
@@ -242,6 +242,9 @@ class SettingsStore @Inject constructor(
runCatching { json.decodeFromString
+
+ Background checks (optional)
+
+ Only while you have switched on “Alerts from your
+ servers” (off by default), NOVA asks each of your servers
+ for its unread alerts and its array state, in the background,
+ every 15 minutes to 3 hours as you choose. These requests go
+ only to your own servers, only to https addresses with a
+ verified certificate, and with no redirect followed. The demo
+ server is never contacted. With the switch off, nothing runs
+ in the background.
+
+
Container icons