Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ 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).

### Changed

- **Restarting a container is one step on newer servers** — on Unraid API 4.36.0
Expand All @@ -56,6 +73,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
Expand All @@ -68,6 +90,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.
Expand Down
2 changes: 1 addition & 1 deletion HANDOFF.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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**.
Expand All @@ -109,7 +109,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.

Expand Down Expand Up @@ -155,7 +155,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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
query Ping {
__typename
}

query FetchContainerLogs($id: PrefixedID!, $tail: Int) {
docker {
logs(id: $id, tail: $tail) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.).
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -77,6 +83,8 @@ open class ApolloClientFactory @Inject constructor() {
.readTimeout(10, TimeUnit.MINUTES)
.writeTimeout(10, TimeUnit.MINUTES)
.addInterceptor(logging)
.followRedirects(false)
.followSslRedirects(false)
.build()
}

Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ data class ProbeOutcome(
/** The version query failed validation: the API is older than 4.15.0. */
val versionFieldMissing: Boolean = false,
val access: KeyAccess = KeyAccess.Unknown,
/** Set with [Detection.Failed]: the transport exception (a certificate problem is told apart by the caller). */
val cause: Throwable? = null,
/** Set with [Detection.Failed] when the server answered with an error NOVA does not classify: its own text. */
val failureText: String? = null,
) {
fun toCapabilities(target: CapabilityTarget?) = ServerCapabilities(
target = target,
Expand All @@ -54,21 +58,21 @@ internal fun classifyErrors(errors: List<Error>): ErrorClass = when {
else -> ErrorClass.Other
}

private fun Error.code(): Any? = extensions?.get("code")
internal fun Error.code(): Any? = extensions?.get("code")

private sealed interface VersionStep {
data class Got(val unraid: String?, val apiText: String?) : VersionStep
data object Missing : VersionStep
data object Unknown : VersionStep
data object Rejected : VersionStep
data object Failed : VersionStep
data class Failed(val cause: Throwable? = null, val text: String? = null) : VersionStep
}

private sealed interface AccessStep {
data class Got(val access: KeyAccess.Known) : AccessStep
data object Unknown : AccessStep
data object Rejected : AccessStep
data object TransportFailed : AccessStep
data class TransportFailed(val cause: Throwable? = null) : AccessStep
}

/**
Expand All @@ -80,7 +84,7 @@ internal suspend fun probeCapabilities(client: ApolloClient): ProbeOutcome {
val version = probeVersion(client)
when (version) {
VersionStep.Rejected -> return ProbeOutcome(Detection.KeyRejected)
VersionStep.Failed -> return ProbeOutcome(Detection.Failed)
is VersionStep.Failed -> return ProbeOutcome(Detection.Failed, cause = version.cause, failureText = version.text)
else -> Unit
}
val versionKnown = version is VersionStep.Got || version == VersionStep.Missing
Expand All @@ -98,7 +102,8 @@ internal suspend fun probeCapabilities(client: ApolloClient): ProbeOutcome {
is AccessStep.Got -> base.copy(access = access.access)
AccessStep.Unknown -> base
AccessStep.Rejected -> ProbeOutcome(Detection.KeyRejected)
AccessStep.TransportFailed -> if (versionKnown) base else ProbeOutcome(Detection.Failed)
is AccessStep.TransportFailed ->
if (versionKnown) base else ProbeOutcome(Detection.Failed, cause = access.cause)
}
}

Expand All @@ -112,15 +117,15 @@ private suspend fun probeVersion(client: ApolloClient): VersionStep = try {
ErrorClass.KeyRejected -> VersionStep.Rejected
ErrorClass.ValidationFailed -> VersionStep.Missing
ErrorClass.Forbidden -> VersionStep.Unknown
ErrorClass.Other -> VersionStep.Failed
ErrorClass.Other -> VersionStep.Failed(text = errors.first().message)
}
// Transport failure, or a body without data and without errors.
else -> VersionStep.Failed
else -> VersionStep.Failed(cause = resp.exception)
}
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
VersionStep.Failed
VersionStep.Failed(cause = e)
}

private suspend fun probeAccess(client: ApolloClient): AccessStep = try {
Expand All @@ -141,10 +146,10 @@ private suspend fun probeAccess(client: ApolloClient): AccessStep = try {
// FORBIDDEN (a key without ME:READ_ANY), validation and any other error: fail open.
else -> AccessStep.Unknown
}
else -> AccessStep.TransportFailed
else -> AccessStep.TransportFailed(resp.exception)
}
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
AccessStep.TransportFailed
AccessStep.TransportFailed(e)
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ enum class ErrorReason {
/** The server is fine but the service behind this domain (Docker, VM manager) is turned off. */
ServiceOff,

/**
* The server answered with a redirect (3xx). The app does not follow it, because the API key
* would go with it (ADR-0051); the message names where it points so the user can enter that
* address. The server is reachable, so this is not a [isConnectionProblem].
*/
Redirected,

/** Any other error the server reported; its own text is shown. */
ServerError,
;
Expand Down
Loading
Loading