mirror of
https://github.com/tale/headplane.git
synced 2026-08-20 09:52:19 +00:00
Add key expiry disable/enable toggle (#554)
This commit is contained in:
@@ -44,6 +44,11 @@ export interface Capabilities {
|
||||
* the `hskey-authreq-` prefix. Introduced in 0.29.0.
|
||||
*/
|
||||
readonly registerKeyIncludesAuthReqPrefix: boolean;
|
||||
|
||||
/**
|
||||
* Disabling of key expiry was introduced in 0.29.0.
|
||||
*/
|
||||
readonly keyExpiryCanBeDisabled: boolean;
|
||||
}
|
||||
|
||||
export function capabilitiesFor(version: ServerVersion): Capabilities {
|
||||
@@ -52,5 +57,6 @@ export function capabilitiesFor(version: ServerVersion): Capabilities {
|
||||
nodeTagsAreFlat: gte(version, "0.28.0"),
|
||||
nodeOwnerIsImmutable: gte(version, "0.28.0"),
|
||||
registerKeyIncludesAuthReqPrefix: gte(version, "0.29.0"),
|
||||
keyExpiryCanBeDisabled: gte(version, "0.29.0"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface NodeApi {
|
||||
expire(id: string): Promise<void>;
|
||||
rename(id: string, newName: string): Promise<void>;
|
||||
setTags(id: string, tags: string[]): Promise<void>;
|
||||
toggleExpiry(nodeId: string, disableExpiry: boolean): Promise<void>;
|
||||
/**
|
||||
* Reassign a node to a different user. Only present when
|
||||
* `capabilities.nodeOwnerIsImmutable` is false (Headscale < 0.28).
|
||||
@@ -104,6 +105,13 @@ export function makeNodeApi(
|
||||
body: { tags },
|
||||
});
|
||||
},
|
||||
toggleExpiry: async (nodeId, disableExpiry) => {
|
||||
await transport.request({
|
||||
method: "POST",
|
||||
path: `v1/node/${nodeId}/expire?disableExpiry=${disableExpiry}`,
|
||||
apiKey,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
if (!capabilities.nodeOwnerIsImmutable) {
|
||||
|
||||
Reference in New Issue
Block a user