fix: explain API access is unavailable in the desktop app (#2499)

Creating a developer token in the Wails build failed with a confusing
"Unhandled route: POST /api/unlock" error, because the desktop app does
not expose an HTTP API for the token to be used against. Hide the token
creation form in the desktop build and show an explanatory message
instead.

Fixes #2471

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-05 15:26:40 +07:00 committed by GitHub
parent 9971aa1ac8
commit d3455eee7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,10 +13,12 @@ import { Separator } from "src/components/ui/separator";
import { useAlbyMe } from "src/hooks/useAlbyMe";
import { copyToClipboard } from "src/lib/clipboard";
import { AuthTokenResponse } from "src/types";
import { isHttpMode } from "src/utils/isHttpMode";
import { request } from "src/utils/request";
export default function DeveloperSettings() {
const { data: albyMe } = useAlbyMe();
const _isHttpMode = isHttpMode();
const [token, setToken] = React.useState<string>();
const [tokenPermission, setTokenPermission] = React.useState<string>();
const [expiryDays, setExpiryDays] = React.useState<string>("365");
@ -103,7 +105,14 @@ export default function DeveloperSettings() {
be removed entirely in the future.
</div>
</div>
{!token && !showCreateTokenForm && (
{!_isHttpMode && (
<div className="text-sm text-muted-foreground">
API access is not available in the desktop app because it does not
expose an HTTP API. To use the API, install the Alby Hub server
version instead.
</div>
)}
{_isHttpMode && !token && !showCreateTokenForm && (
<div>
<Button
size={"lg"}