-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
49 lines (48 loc) · 1.43 KB
/
index.ts
File metadata and controls
49 lines (48 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { users } from "../../src/api-server/auth.ts";
import { sendUpdate } from "../../src/api-server/websocket.ts";
import { registerGlobalAction } from "../../src/plugins.ts";
registerGlobalAction({
id: "toggle-app-theme",
name: "Toggle app theme",
fields: [
{
id: "user",
type: "select",
label: "Affected user",
description: "Apps logged in as the selected user will change theme.",
default: "*",
required: true,
showSearchBar: 10,
options: {
isLazy: true,
loadOn: "render",
callback() {
return [
{ value: "*", label: "Everyone" },
...Object.keys(users).map(username=> ({value: username, label: username}))
]
},
}
},
{
id: "theme",
type: "radio",
label: "Set theme to",
default: "system",
required: true,
options: {
"light": "Light",
"dark": "Dark",
"system": "Match system",
}
}
],
perform(options) {
const username = options.user as string;
const theme = options.theme as "light"|"dark"|"system";
sendUpdate({
type: "setTheme",
theme
}, username);
},
})