mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
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:
parent
9971aa1ac8
commit
d3455eee7d
1 changed files with 10 additions and 1 deletions
|
|
@ -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"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue