feat(desktop): permissions

This commit is contained in:
Adam
2025-12-27 05:16:39 -06:00
parent c523ca4127
commit 21eba5f987
17 changed files with 586 additions and 60 deletions

View File

@@ -86,6 +86,17 @@ export namespace Permission {
return state().pending
}
export function list() {
const { pending } = state()
const result: Info[] = []
for (const items of Object.values(pending)) {
for (const item of Object.values(items)) {
result.push(item.info)
}
}
return result.sort((a, b) => a.id.localeCompare(b.id))
}
export async function ask(input: {
type: Info["type"]
title: Info["title"]

View File

@@ -1532,6 +1532,28 @@ export namespace Server {
return c.json(true)
},
)
.get(
"/permission",
describeRoute({
summary: "List pending permissions",
description: "Get all pending permission requests across all sessions.",
operationId: "permission.list",
responses: {
200: {
description: "List of pending permissions",
content: {
"application/json": {
schema: resolver(Permission.Info.array()),
},
},
},
},
}),
async (c) => {
const permissions = Permission.list()
return c.json(permissions)
},
)
.get(
"/command",
describeRoute({