feat(gateway): add tailscale auth + pam

This commit is contained in:
Peter Steinberger
2025-12-21 00:44:39 +00:00
parent d69064f364
commit 053c8d5731
14 changed files with 417 additions and 7 deletions

View File

@@ -30,6 +30,8 @@ type Pending = {
export type GatewayBrowserClientOptions = {
url: string;
token?: string;
username?: string;
password?: string;
clientName?: string;
clientVersion?: string;
platform?: string;
@@ -96,6 +98,14 @@ export class GatewayBrowserClient {
}
private sendConnect() {
const auth =
this.opts.token || this.opts.password || this.opts.username
? {
token: this.opts.token,
username: this.opts.username,
password: this.opts.password,
}
: undefined;
const params = {
minProtocol: 2,
maxProtocol: 2,
@@ -107,7 +117,7 @@ export class GatewayBrowserClient {
instanceId: this.opts.instanceId,
},
caps: [],
auth: this.opts.token ? { token: this.opts.token } : undefined,
auth,
userAgent: navigator.userAgent,
locale: navigator.language,
};

View File

@@ -3,6 +3,7 @@ const KEY = "clawdis.control.settings.v1";
export type UiSettings = {
gatewayUrl: string;
token: string;
username: string;
sessionKey: string;
};
@@ -15,6 +16,7 @@ export function loadSettings(): UiSettings {
const defaults: UiSettings = {
gatewayUrl: defaultUrl,
token: "",
username: "",
sessionKey: "main",
};
@@ -28,6 +30,8 @@ export function loadSettings(): UiSettings {
? parsed.gatewayUrl.trim()
: defaults.gatewayUrl,
token: typeof parsed.token === "string" ? parsed.token : defaults.token,
username:
typeof parsed.username === "string" ? parsed.username : defaults.username,
sessionKey:
typeof parsed.sessionKey === "string" && parsed.sessionKey.trim()
? parsed.sessionKey.trim()
@@ -41,4 +45,3 @@ export function loadSettings(): UiSettings {
export function saveSettings(next: UiSettings) {
localStorage.setItem(KEY, JSON.stringify(next));
}