@axium/server 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acl.d.ts +26 -46
- package/dist/acl.js +42 -62
- package/dist/api/acl.js +11 -3
- package/dist/api/admin.js +3 -6
- package/dist/api/metadata.js +4 -11
- package/dist/audit.d.ts +0 -3
- package/dist/audit.js +0 -8
- package/dist/auth.d.ts +10 -5
- package/dist/auth.js +29 -23
- package/dist/cli.d.ts +8 -2
- package/dist/cli.js +18 -606
- package/dist/config.js +6 -5
- package/dist/database.d.ts +413 -29
- package/dist/database.js +522 -247
- package/dist/db.json +71 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +833 -0
- package/package.json +6 -4
- package/routes/account/+page.svelte +11 -13
- package/routes/admin/config/+page.svelte +2 -2
- package/routes/admin/plugins/+page.svelte +41 -4
- package/schemas/config.json +207 -0
- package/schemas/db.json +636 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"assets",
|
|
32
32
|
"dist",
|
|
33
33
|
"routes",
|
|
34
|
+
"schemas",
|
|
34
35
|
"svelte.config.js",
|
|
35
36
|
"web.tsconfig.json",
|
|
36
37
|
"template.html",
|
|
@@ -38,15 +39,16 @@
|
|
|
38
39
|
"axium.service"
|
|
39
40
|
],
|
|
40
41
|
"bin": {
|
|
41
|
-
"axium": "dist/
|
|
42
|
+
"axium": "dist/main.js"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsc",
|
|
46
|
+
"build:schemas": "mkdir -p schemas && npx axium config schema -j > schemas/config.json && npx axium db schema -j > schemas/db.json",
|
|
45
47
|
"clean": "rm -rf build .svelte-kit node_modules/{.vite,.vite-temp}"
|
|
46
48
|
},
|
|
47
49
|
"peerDependencies": {
|
|
48
|
-
"@axium/client": ">=0.
|
|
49
|
-
"@axium/core": ">=0.
|
|
50
|
+
"@axium/client": ">=0.9.0",
|
|
51
|
+
"@axium/core": ">=0.12.0",
|
|
50
52
|
"kysely": "^0.28.0",
|
|
51
53
|
"utilium": "^2.3.8",
|
|
52
54
|
"zod": "^4.0.5"
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
const { data }: PageProps = $props();
|
|
9
9
|
const { canVerify } = data;
|
|
10
10
|
|
|
11
|
-
const dialogs = $state<Record<string, HTMLDialogElement>>({});
|
|
12
|
-
|
|
13
11
|
let verificationSent = $state(false);
|
|
14
12
|
let currentSession = $state(data.currentSession);
|
|
15
13
|
let user = $state(data.user);
|
|
@@ -27,7 +25,7 @@
|
|
|
27
25
|
</svelte:head>
|
|
28
26
|
|
|
29
27
|
{#snippet action(name: string, i: string = 'pen')}
|
|
30
|
-
<button style:display="contents"
|
|
28
|
+
<button style:display="contents" commandfor={name} command="show-modal">
|
|
31
29
|
<Icon {i} --size="16px" />
|
|
32
30
|
</button>
|
|
33
31
|
{/snippet}
|
|
@@ -45,7 +43,7 @@
|
|
|
45
43
|
<p>{user.name}</p>
|
|
46
44
|
{@render action('edit_name')}
|
|
47
45
|
</div>
|
|
48
|
-
<FormDialog
|
|
46
|
+
<FormDialog id="edit_name" submit={_editUser} submitText="Change">
|
|
49
47
|
<div>
|
|
50
48
|
<label for="name">What do you want to be called?</label>
|
|
51
49
|
<input name="name" type="text" value={user.name || ''} required />
|
|
@@ -67,7 +65,7 @@
|
|
|
67
65
|
</p>
|
|
68
66
|
{@render action('edit_email')}
|
|
69
67
|
</div>
|
|
70
|
-
<FormDialog
|
|
68
|
+
<FormDialog id="edit_email" submit={_editUser} submitText="Change">
|
|
71
69
|
<div>
|
|
72
70
|
<label for="email">Email Address</label>
|
|
73
71
|
<input name="email" type="email" value={user.email || ''} required />
|
|
@@ -80,11 +78,11 @@
|
|
|
80
78
|
<ClipboardCopy value={user.id} --size="16px" />
|
|
81
79
|
</div>
|
|
82
80
|
<span>
|
|
83
|
-
<button class="signout"
|
|
84
|
-
<button style:cursor="pointer"
|
|
85
|
-
<Logout
|
|
81
|
+
<button class="signout" command="show-modal" commandfor="logout">Sign Out</button>
|
|
82
|
+
<button style:cursor="pointer" command="show-modal" commandfor="delete" class="danger">Delete Account</button>
|
|
83
|
+
<Logout />
|
|
86
84
|
<FormDialog
|
|
87
|
-
|
|
85
|
+
id="delete"
|
|
88
86
|
submit={() => deleteUser(user.id).then(() => (window.location.href = '/'))}
|
|
89
87
|
submitText="Delete Account"
|
|
90
88
|
submitDanger
|
|
@@ -110,9 +108,9 @@
|
|
|
110
108
|
<p class="subtle"><i>Unnamed</i></p>
|
|
111
109
|
{/if}
|
|
112
110
|
<p>Created {passkey.createdAt.toLocaleString()}</p>
|
|
113
|
-
{@render action('edit_passkey
|
|
111
|
+
{@render action('edit_passkey:' + passkey.id)}
|
|
114
112
|
{#if passkeys.length > 1}
|
|
115
|
-
{@render action('delete_passkey
|
|
113
|
+
{@render action('delete_passkey:' + passkey.id, 'trash')}
|
|
116
114
|
{:else}
|
|
117
115
|
<dfn title="You must have at least one passkey" class="disabled">
|
|
118
116
|
<Icon i="trash-slash" --fill="#888" --size="16px" />
|
|
@@ -120,7 +118,7 @@
|
|
|
120
118
|
{/if}
|
|
121
119
|
</div>
|
|
122
120
|
<FormDialog
|
|
123
|
-
|
|
121
|
+
id={'edit_passkey:' + passkey.id}
|
|
124
122
|
submit={data => {
|
|
125
123
|
if (typeof data.name != 'string') throw 'Passkey name must be a string';
|
|
126
124
|
passkey.name = data.name;
|
|
@@ -134,7 +132,7 @@
|
|
|
134
132
|
</div>
|
|
135
133
|
</FormDialog>
|
|
136
134
|
<FormDialog
|
|
137
|
-
|
|
135
|
+
id={'delete_passkey:' + passkey.id}
|
|
138
136
|
submit={() => deletePasskey(passkey.id).then(() => passkeys.splice(passkeys.indexOf(passkey), 1))}
|
|
139
137
|
submitText="Delete"
|
|
140
138
|
submitDanger={true}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
<pre>{JSON.stringify(data.config, null, 4)}</pre>
|
|
12
12
|
|
|
13
|
-
<h2>Loaded Files</h2>
|
|
13
|
+
<h2 id="files">Loaded Files</h2>
|
|
14
14
|
|
|
15
15
|
{#each Object.entries(data.files) as [path, config]}
|
|
16
16
|
<details>
|
|
17
17
|
<summary>{path}</summary>
|
|
18
|
-
<pre>{JSON.stringify(config, null, 4)}</pre>
|
|
18
|
+
<pre id={path}>{JSON.stringify(config, null, 4)}</pre>
|
|
19
19
|
</details>
|
|
20
20
|
{/each}
|
|
21
21
|
|
|
@@ -9,11 +9,21 @@
|
|
|
9
9
|
<h2>Plugins</h2>
|
|
10
10
|
|
|
11
11
|
{#each data.plugins as plugin}
|
|
12
|
-
<
|
|
13
|
-
<p><strong>Loaded from</strong> {plugin.path} by {plugin._loadedBy ?? '<unknown>'}</p>
|
|
14
|
-
<p><strong>Version:</strong> {plugin.version}</p>
|
|
15
|
-
<p><strong>Author:</strong> {plugin.author}</p>
|
|
12
|
+
<h3>{plugin.name}<span class="version">{plugin.version}</span></h3>
|
|
16
13
|
<p>
|
|
14
|
+
<strong>Loaded from</strong>
|
|
15
|
+
{#if plugin.path.endsWith('/package.json')}
|
|
16
|
+
<span class="path plugin-path">{plugin.path.slice(0, -13)}</span>
|
|
17
|
+
{:else}
|
|
18
|
+
<span class="path">{plugin.path}</span>
|
|
19
|
+
{/if}
|
|
20
|
+
{#if plugin._loadedBy}
|
|
21
|
+
by
|
|
22
|
+
<a class="path" href="/admin/config#{plugin._loadedBy}">{plugin._loadedBy}</a>
|
|
23
|
+
{/if}
|
|
24
|
+
</p>
|
|
25
|
+
<p><strong>Author:</strong> {plugin.author}</p>
|
|
26
|
+
<p class="apps">
|
|
17
27
|
<strong>Provided apps:</strong>
|
|
18
28
|
{#if plugin.apps?.length}
|
|
19
29
|
{#each plugin.apps as app, i}
|
|
@@ -25,3 +35,30 @@
|
|
|
25
35
|
{:else}
|
|
26
36
|
<i>No plugins loaded.</i>
|
|
27
37
|
{/each}
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.version {
|
|
41
|
+
font-family: monospace;
|
|
42
|
+
font-size: 0.9em;
|
|
43
|
+
color: #aaa;
|
|
44
|
+
margin-left: 1em;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.version::before {
|
|
48
|
+
content: 'v';
|
|
49
|
+
color: #888;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.path {
|
|
53
|
+
font-family: monospace;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.plugin-path::after {
|
|
57
|
+
content: '/package.json';
|
|
58
|
+
color: #888;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.apps a {
|
|
62
|
+
text-decoration: underline;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"admin_api": {
|
|
6
|
+
"type": "boolean"
|
|
7
|
+
},
|
|
8
|
+
"allow_new_users": {
|
|
9
|
+
"type": "boolean"
|
|
10
|
+
},
|
|
11
|
+
"apps": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"disabled": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": {}
|
|
22
|
+
},
|
|
23
|
+
"audit": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"allow_raw": {
|
|
27
|
+
"type": "boolean"
|
|
28
|
+
},
|
|
29
|
+
"retention": {
|
|
30
|
+
"type": "number",
|
|
31
|
+
"minimum": 0
|
|
32
|
+
},
|
|
33
|
+
"min_severity": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": [
|
|
36
|
+
"emergency",
|
|
37
|
+
"alert",
|
|
38
|
+
"critical",
|
|
39
|
+
"error",
|
|
40
|
+
"warning",
|
|
41
|
+
"notice",
|
|
42
|
+
"info",
|
|
43
|
+
"debug",
|
|
44
|
+
"Emergency",
|
|
45
|
+
"Alert",
|
|
46
|
+
"Critical",
|
|
47
|
+
"Error",
|
|
48
|
+
"Warning",
|
|
49
|
+
"Notice",
|
|
50
|
+
"Info",
|
|
51
|
+
"Debug"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"auto_suspend": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"enum": [
|
|
57
|
+
"emergency",
|
|
58
|
+
"alert",
|
|
59
|
+
"critical",
|
|
60
|
+
"error",
|
|
61
|
+
"warning",
|
|
62
|
+
"notice",
|
|
63
|
+
"info",
|
|
64
|
+
"debug",
|
|
65
|
+
"Emergency",
|
|
66
|
+
"Alert",
|
|
67
|
+
"Critical",
|
|
68
|
+
"Error",
|
|
69
|
+
"Warning",
|
|
70
|
+
"Notice",
|
|
71
|
+
"Info",
|
|
72
|
+
"Debug"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"additionalProperties": {}
|
|
77
|
+
},
|
|
78
|
+
"auth": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"passkey_probation": {
|
|
82
|
+
"type": "number"
|
|
83
|
+
},
|
|
84
|
+
"rp_id": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"rp_name": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"secure_cookies": {
|
|
91
|
+
"type": "boolean"
|
|
92
|
+
},
|
|
93
|
+
"verification_timeout": {
|
|
94
|
+
"type": "number"
|
|
95
|
+
},
|
|
96
|
+
"email_verification": {
|
|
97
|
+
"type": "boolean"
|
|
98
|
+
},
|
|
99
|
+
"header_only": {
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"additionalProperties": {}
|
|
104
|
+
},
|
|
105
|
+
"db": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"properties": {
|
|
108
|
+
"host": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"port": {
|
|
112
|
+
"type": "number"
|
|
113
|
+
},
|
|
114
|
+
"password": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
},
|
|
117
|
+
"user": {
|
|
118
|
+
"type": "string"
|
|
119
|
+
},
|
|
120
|
+
"database": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": {}
|
|
125
|
+
},
|
|
126
|
+
"debug": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"debug_home": {
|
|
130
|
+
"type": "boolean"
|
|
131
|
+
},
|
|
132
|
+
"log": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"level": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"enum": [
|
|
138
|
+
"error",
|
|
139
|
+
"warn",
|
|
140
|
+
"notice",
|
|
141
|
+
"info",
|
|
142
|
+
"debug"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"console": {
|
|
146
|
+
"type": "boolean"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"additionalProperties": {}
|
|
150
|
+
},
|
|
151
|
+
"origin": {
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
154
|
+
"request_size_limit": {
|
|
155
|
+
"type": "number",
|
|
156
|
+
"minimum": 0
|
|
157
|
+
},
|
|
158
|
+
"show_duplicate_state": {
|
|
159
|
+
"type": "boolean"
|
|
160
|
+
},
|
|
161
|
+
"web": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"properties": {
|
|
164
|
+
"disable_cache": {
|
|
165
|
+
"type": "boolean"
|
|
166
|
+
},
|
|
167
|
+
"port": {
|
|
168
|
+
"type": "number",
|
|
169
|
+
"minimum": 1,
|
|
170
|
+
"maximum": 65535
|
|
171
|
+
},
|
|
172
|
+
"prefix": {
|
|
173
|
+
"type": "string"
|
|
174
|
+
},
|
|
175
|
+
"routes": {
|
|
176
|
+
"type": "string"
|
|
177
|
+
},
|
|
178
|
+
"secure": {
|
|
179
|
+
"type": "boolean"
|
|
180
|
+
},
|
|
181
|
+
"ssl_key": {
|
|
182
|
+
"type": "string"
|
|
183
|
+
},
|
|
184
|
+
"ssl_cert": {
|
|
185
|
+
"type": "string"
|
|
186
|
+
},
|
|
187
|
+
"build": {
|
|
188
|
+
"type": "string"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"additionalProperties": {}
|
|
192
|
+
},
|
|
193
|
+
"include": {
|
|
194
|
+
"type": "array",
|
|
195
|
+
"items": {
|
|
196
|
+
"type": "string"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"plugins": {
|
|
200
|
+
"type": "array",
|
|
201
|
+
"items": {
|
|
202
|
+
"type": "string"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"additionalProperties": {}
|
|
207
|
+
}
|