@axium/server 0.18.2 → 0.18.4
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/build/client/_app/immutable/chunks/{BvHJY3uo.js → BPkdKBlw.js} +1 -1
- package/build/client/_app/immutable/chunks/BPkdKBlw.js.br +0 -0
- package/build/client/_app/immutable/chunks/BPkdKBlw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Br3pmvj9.js → C2G00Wo_.js} +1 -1
- package/build/client/_app/immutable/chunks/C2G00Wo_.js.br +0 -0
- package/build/client/_app/immutable/chunks/C2G00Wo_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DGggq7PZ.js → Che41mwa.js} +1 -1
- package/build/client/_app/immutable/chunks/Che41mwa.js.br +0 -0
- package/build/client/_app/immutable/chunks/Che41mwa.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{C1nOBSvD.js → DOU_MWYN.js} +2 -2
- package/build/client/_app/immutable/chunks/DOU_MWYN.js.br +0 -0
- package/build/client/_app/immutable/chunks/DOU_MWYN.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.Q0IljhGV.js → app.BbBU38hK.js} +2 -2
- package/build/client/_app/immutable/entry/app.BbBU38hK.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BbBU38hK.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.Da9-9H3m.js +1 -0
- package/build/client/_app/immutable/entry/start.Da9-9H3m.js.br +2 -0
- package/build/client/_app/immutable/entry/start.Da9-9H3m.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.Co8h7Wzc.js → 1.Cmx8cGI-.js} +1 -1
- package/build/client/_app/immutable/nodes/1.Cmx8cGI-.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.Cmx8cGI-.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.CzUUjv5D.js → 3.CHH7rvxu.js} +1 -1
- package/build/client/_app/immutable/nodes/3.CHH7rvxu.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CHH7rvxu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{4.C4UhmqdK.js → 4.D9IcRvFq.js} +1 -1
- package/build/client/_app/immutable/nodes/4.D9IcRvFq.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.D9IcRvFq.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.C2-lE2kM.js +1 -0
- package/build/client/_app/immutable/nodes/5.C2-lE2kM.js.br +2 -0
- package/build/client/_app/immutable/nodes/5.C2-lE2kM.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.BBiAuqXe.js → 6.BIv1GUh7.js} +1 -1
- package/build/client/_app/immutable/nodes/6.BIv1GUh7.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BIv1GUh7.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/chunks/{1-Bxj6uY_D.js → 1-CbHAdNVA.js} +2 -2
- package/build/server/chunks/{1-Bxj6uY_D.js.map → 1-CbHAdNVA.js.map} +1 -1
- package/build/server/chunks/{3-B8XM00zf.js → 3-D-f3CysO.js} +2 -2
- package/build/server/chunks/{3-B8XM00zf.js.map → 3-D-f3CysO.js.map} +1 -1
- package/build/server/chunks/{4-rWZmsmZJ.js → 4-DzUqqu1u.js} +2 -2
- package/build/server/chunks/{4-rWZmsmZJ.js.map → 4-DzUqqu1u.js.map} +1 -1
- package/build/server/chunks/{5-BQyd9qam.js → 5-C4XhViZP.js} +2 -2
- package/build/server/chunks/{5-BQyd9qam.js.map → 5-C4XhViZP.js.map} +1 -1
- package/build/server/chunks/{6-uUMo7iR2.js → 6-BosXK7US.js} +2 -2
- package/build/server/chunks/{6-uUMo7iR2.js.map → 6-BosXK7US.js.map} +1 -1
- package/build/server/chunks/{hooks.server-C9d9yKyi.js → hooks.server-DmgUjoZV.js} +3 -2
- package/build/server/chunks/hooks.server-DmgUjoZV.js.map +1 -0
- package/build/server/index.js +2 -2
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +6 -6
- package/build/server/manifest.js.map +1 -1
- package/dist/api/session.js +1 -2
- package/dist/api/users.js +1 -2
- package/dist/auth.js +1 -14
- package/dist/cli.js +133 -225
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/database.js +158 -254
- package/dist/serve.d.ts +1 -0
- package/dist/serve.js +1 -2
- package/package.json +1 -1
- package/web/hooks.server.ts +2 -1
- package/build/client/_app/immutable/chunks/Br3pmvj9.js.br +0 -0
- package/build/client/_app/immutable/chunks/Br3pmvj9.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BvHJY3uo.js.br +0 -0
- package/build/client/_app/immutable/chunks/BvHJY3uo.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C1nOBSvD.js.br +0 -0
- package/build/client/_app/immutable/chunks/C1nOBSvD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DGggq7PZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/DGggq7PZ.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Q0IljhGV.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Q0IljhGV.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BKfmGsvo.js +0 -1
- package/build/client/_app/immutable/entry/start.BKfmGsvo.js.br +0 -2
- package/build/client/_app/immutable/entry/start.BKfmGsvo.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.Co8h7Wzc.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.Co8h7Wzc.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.CzUUjv5D.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CzUUjv5D.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.C4UhmqdK.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.C4UhmqdK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.BiedHsaj.js +0 -1
- package/build/client/_app/immutable/nodes/5.BiedHsaj.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.BiedHsaj.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.BBiAuqXe.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BBiAuqXe.js.gz +0 -0
- package/build/server/chunks/hooks.server-C9d9yKyi.js.map +0 -1
package/build/server/manifest.js
CHANGED
|
@@ -10,15 +10,15 @@ return {
|
|
|
10
10
|
assets: new Set(["icons/brands.svg","icons/light.svg","icons/regular.svg","icons/solid.svg","styles.css"]),
|
|
11
11
|
mimeTypes: {".svg":"image/svg+xml",".css":"text/css"},
|
|
12
12
|
_: {
|
|
13
|
-
client: {start:"_app/immutable/entry/start.
|
|
13
|
+
client: {start:"_app/immutable/entry/start.Da9-9H3m.js",app:"_app/immutable/entry/app.BbBU38hK.js",imports:["_app/immutable/entry/start.Da9-9H3m.js","_app/immutable/chunks/DOU_MWYN.js","_app/immutable/chunks/D5lcOOwR.js","_app/immutable/chunks/B3bf7yrh.js","_app/immutable/chunks/DCs3KlJy.js","_app/immutable/entry/app.BbBU38hK.js","_app/immutable/chunks/B3bf7yrh.js","_app/immutable/chunks/D5lcOOwR.js","_app/immutable/chunks/DCs3KlJy.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/ct9jA5hl.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
|
14
14
|
nodes: [
|
|
15
15
|
__memo(() => import('./chunks/0-CUfr8UwD.js')),
|
|
16
|
-
__memo(() => import('./chunks/1-
|
|
16
|
+
__memo(() => import('./chunks/1-CbHAdNVA.js')),
|
|
17
17
|
__memo(() => import('./chunks/2-c1bljkMr.js')),
|
|
18
|
-
__memo(() => import('./chunks/3-
|
|
19
|
-
__memo(() => import('./chunks/4-
|
|
20
|
-
__memo(() => import('./chunks/5-
|
|
21
|
-
__memo(() => import('./chunks/6-
|
|
18
|
+
__memo(() => import('./chunks/3-D-f3CysO.js')),
|
|
19
|
+
__memo(() => import('./chunks/4-DzUqqu1u.js')),
|
|
20
|
+
__memo(() => import('./chunks/5-C4XhViZP.js')),
|
|
21
|
+
__memo(() => import('./chunks/6-BosXK7US.js'))
|
|
22
22
|
],
|
|
23
23
|
routes: [
|
|
24
24
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sources":["../../.svelte-kit/adapter-node/manifest.js"],"sourcesContent":["export const manifest = (() => {\nfunction __memo(fn) {\n\tlet value;\n\treturn () => value ??= (value = fn());\n}\n\nreturn {\n\tappDir: \"_app\",\n\tappPath: \"_app\",\n\tassets: new Set([\"icons/brands.svg\",\"icons/light.svg\",\"icons/regular.svg\",\"icons/solid.svg\",\"styles.css\"]),\n\tmimeTypes: {\".svg\":\"image/svg+xml\",\".css\":\"text/css\"},\n\t_: {\n\t\tclient: {start:\"_app/immutable/entry/start.
|
|
1
|
+
{"version":3,"file":"manifest.js","sources":["../../.svelte-kit/adapter-node/manifest.js"],"sourcesContent":["export const manifest = (() => {\nfunction __memo(fn) {\n\tlet value;\n\treturn () => value ??= (value = fn());\n}\n\nreturn {\n\tappDir: \"_app\",\n\tappPath: \"_app\",\n\tassets: new Set([\"icons/brands.svg\",\"icons/light.svg\",\"icons/regular.svg\",\"icons/solid.svg\",\"styles.css\"]),\n\tmimeTypes: {\".svg\":\"image/svg+xml\",\".css\":\"text/css\"},\n\t_: {\n\t\tclient: {start:\"_app/immutable/entry/start.Da9-9H3m.js\",app:\"_app/immutable/entry/app.BbBU38hK.js\",imports:[\"_app/immutable/entry/start.Da9-9H3m.js\",\"_app/immutable/chunks/DOU_MWYN.js\",\"_app/immutable/chunks/D5lcOOwR.js\",\"_app/immutable/chunks/B3bf7yrh.js\",\"_app/immutable/chunks/DCs3KlJy.js\",\"_app/immutable/entry/app.BbBU38hK.js\",\"_app/immutable/chunks/B3bf7yrh.js\",\"_app/immutable/chunks/D5lcOOwR.js\",\"_app/immutable/chunks/DCs3KlJy.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/ct9jA5hl.js\"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},\n\t\tnodes: [\n\t\t\t__memo(() => import('./nodes/0.js')),\n\t\t\t__memo(() => import('./nodes/1.js')),\n\t\t\t__memo(() => import('./nodes/2.js')),\n\t\t\t__memo(() => import('./nodes/3.js')),\n\t\t\t__memo(() => import('./nodes/4.js')),\n\t\t\t__memo(() => import('./nodes/5.js')),\n\t\t\t__memo(() => import('./nodes/6.js'))\n\t\t],\n\t\troutes: [\n\t\t\t{\n\t\t\t\tid: \"/_axium/default\",\n\t\t\t\tpattern: /^\\/_axium\\/default\\/?$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 2 },\n\t\t\t\tendpoint: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"/account\",\n\t\t\t\tpattern: /^\\/account\\/?$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 3 },\n\t\t\t\tendpoint: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"/login\",\n\t\t\t\tpattern: /^\\/login\\/?$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 4 },\n\t\t\t\tendpoint: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"/logout\",\n\t\t\t\tpattern: /^\\/logout\\/?$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 5 },\n\t\t\t\tendpoint: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"/register\",\n\t\t\t\tpattern: /^\\/register\\/?$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 6 },\n\t\t\t\tendpoint: null\n\t\t\t}\n\t\t],\n\t\tprerendered_routes: new Set([]),\n\t\tmatchers: async () => {\n\t\t\t\n\t\t\treturn { };\n\t\t},\n\t\tserver_assets: {}\n\t}\n}\n})();\n\nexport const prerendered = new Set([]);\n\nexport const base = \"\";"],"names":[],"mappings":"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"}
|
package/dist/api/session.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { error } from '@sveltejs/kit';
|
|
2
2
|
import { omit } from 'utilium';
|
|
3
3
|
import { getSessionAndUser } from '../auth.js';
|
|
4
|
-
import {
|
|
4
|
+
import { database as db } from '../database.js';
|
|
5
5
|
import { getToken, stripUser, withError } from '../requests.js';
|
|
6
6
|
import { addRoute } from '../routes.js';
|
|
7
7
|
addRoute({
|
|
@@ -20,7 +20,6 @@ addRoute({
|
|
|
20
20
|
const token = getToken(event);
|
|
21
21
|
if (!token)
|
|
22
22
|
error(401, 'Missing token');
|
|
23
|
-
connect();
|
|
24
23
|
const result = await db
|
|
25
24
|
.deleteFrom('sessions')
|
|
26
25
|
.where('sessions.token', '=', token)
|
package/dist/api/users.js
CHANGED
|
@@ -6,7 +6,7 @@ import { omit, pick } from 'utilium';
|
|
|
6
6
|
import * as z from 'zod';
|
|
7
7
|
import { checkAuthForUser, createPasskey, createVerification, getPasskey, getPasskeysByUserId, getSessions, getUser, useVerification, } from '../auth.js';
|
|
8
8
|
import { config } from '../config.js';
|
|
9
|
-
import {
|
|
9
|
+
import { database as db } from '../database.js';
|
|
10
10
|
import { createSessionData, parseBody, stripUser, withError } from '../requests.js';
|
|
11
11
|
import { addRoute } from '../routes.js';
|
|
12
12
|
const challenges = new Map();
|
|
@@ -18,7 +18,6 @@ addRoute({
|
|
|
18
18
|
path: '/api/user_id',
|
|
19
19
|
async POST(event) {
|
|
20
20
|
const { value } = await parseBody(event, z.object({ using: z.literal('email'), value: z.email() }));
|
|
21
|
-
connect();
|
|
22
21
|
const { id } = await db
|
|
23
22
|
.selectFrom('users')
|
|
24
23
|
.select('id')
|
package/dist/auth.js
CHANGED
|
@@ -2,21 +2,18 @@ import { error } from '@sveltejs/kit';
|
|
|
2
2
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
3
3
|
import { omit } from 'utilium';
|
|
4
4
|
import * as acl from './acl.js';
|
|
5
|
-
import {
|
|
5
|
+
import { database as db, userFromId } from './database.js';
|
|
6
6
|
import { getToken, withError } from './requests.js';
|
|
7
7
|
export async function getUser(id) {
|
|
8
|
-
connect();
|
|
9
8
|
return await db.selectFrom('users').selectAll().where('id', '=', id).executeTakeFirstOrThrow();
|
|
10
9
|
}
|
|
11
10
|
export async function updateUser({ id, ...user }) {
|
|
12
|
-
connect();
|
|
13
11
|
const query = db.updateTable('users').set(user).where('id', '=', id);
|
|
14
12
|
return await query.returningAll().executeTakeFirstOrThrow();
|
|
15
13
|
}
|
|
16
14
|
const in30days = () => new Date(Date.now() + 2592000000);
|
|
17
15
|
const in10minutes = () => new Date(Date.now() + 600000);
|
|
18
16
|
export async function createSession(userId, elevated = false) {
|
|
19
|
-
connect();
|
|
20
17
|
const session = {
|
|
21
18
|
id: randomUUID(),
|
|
22
19
|
userId,
|
|
@@ -29,7 +26,6 @@ export async function createSession(userId, elevated = false) {
|
|
|
29
26
|
return session;
|
|
30
27
|
}
|
|
31
28
|
export async function getSessionAndUser(token) {
|
|
32
|
-
connect();
|
|
33
29
|
const result = await db
|
|
34
30
|
.selectFrom('sessions')
|
|
35
31
|
.selectAll()
|
|
@@ -42,7 +38,6 @@ export async function getSessionAndUser(token) {
|
|
|
42
38
|
return result;
|
|
43
39
|
}
|
|
44
40
|
export async function getSession(sessionId) {
|
|
45
|
-
connect();
|
|
46
41
|
return await db
|
|
47
42
|
.selectFrom('sessions')
|
|
48
43
|
.selectAll()
|
|
@@ -51,7 +46,6 @@ export async function getSession(sessionId) {
|
|
|
51
46
|
.executeTakeFirstOrThrow();
|
|
52
47
|
}
|
|
53
48
|
export async function getSessions(userId) {
|
|
54
|
-
connect();
|
|
55
49
|
return await db.selectFrom('sessions').selectAll().where('userId', '=', userId).where('sessions.expires', '>', new Date()).execute();
|
|
56
50
|
}
|
|
57
51
|
/**
|
|
@@ -61,7 +55,6 @@ export async function getSessions(userId) {
|
|
|
61
55
|
export async function createVerification(role, userId, expires) {
|
|
62
56
|
const token = randomBytes(64).toString('base64url');
|
|
63
57
|
const verification = { userId, token, expires: new Date(Date.now() + expires * 1000), role };
|
|
64
|
-
connect();
|
|
65
58
|
await db.insertInto('verifications').values(verification).executeTakeFirstOrThrow();
|
|
66
59
|
setTimeout(() => {
|
|
67
60
|
void db.deleteFrom('verifications').where('verifications.token', '=', verification.token).execute();
|
|
@@ -69,7 +62,6 @@ export async function createVerification(role, userId, expires) {
|
|
|
69
62
|
return verification;
|
|
70
63
|
}
|
|
71
64
|
export async function useVerification(role, userId, token) {
|
|
72
|
-
connect();
|
|
73
65
|
const query = db
|
|
74
66
|
.deleteFrom('verifications')
|
|
75
67
|
.where('verifications.token', '=', token)
|
|
@@ -78,20 +70,16 @@ export async function useVerification(role, userId, token) {
|
|
|
78
70
|
return await query.returningAll().executeTakeFirst();
|
|
79
71
|
}
|
|
80
72
|
export async function getPasskey(id) {
|
|
81
|
-
connect();
|
|
82
73
|
return await db.selectFrom('passkeys').selectAll().where('id', '=', id).executeTakeFirstOrThrow();
|
|
83
74
|
}
|
|
84
75
|
export async function createPasskey(passkey) {
|
|
85
|
-
connect();
|
|
86
76
|
const result = await db.insertInto('passkeys').values(passkey).returningAll().executeTakeFirstOrThrow();
|
|
87
77
|
return result;
|
|
88
78
|
}
|
|
89
79
|
export async function getPasskeysByUserId(userId) {
|
|
90
|
-
connect();
|
|
91
80
|
return await db.selectFrom('passkeys').selectAll().where('userId', '=', userId).execute();
|
|
92
81
|
}
|
|
93
82
|
export async function updatePasskeyCounter(id, newCounter) {
|
|
94
|
-
connect();
|
|
95
83
|
await db.updateTable('passkeys').set({ counter: newCounter }).where('id', '=', id).executeTakeFirstOrThrow();
|
|
96
84
|
const passkey = await getPasskey(id);
|
|
97
85
|
if (!passkey)
|
|
@@ -119,7 +107,6 @@ export async function checkAuthForItem(event, itemType, itemId, permission) {
|
|
|
119
107
|
const token = getToken(event, true);
|
|
120
108
|
if (!token)
|
|
121
109
|
error(401, 'Missing token');
|
|
122
|
-
connect();
|
|
123
110
|
const session = await getSessionAndUser(token).catch(() => null);
|
|
124
111
|
const item = await db
|
|
125
112
|
.selectFrom(itemType)
|
package/dist/cli.js
CHANGED
|
@@ -90,12 +90,23 @@ program
|
|
|
90
90
|
.option('-c, --config <path>', 'path to the config file');
|
|
91
91
|
program.on('option:debug', () => config.set({ debug: true }));
|
|
92
92
|
program.on('option:config', () => void config.load(program.opts().config));
|
|
93
|
+
const noDBErrorExit = ['init', 'serve', 'check'];
|
|
93
94
|
program.hook('preAction', async function (_, action) {
|
|
94
95
|
await config.loadDefaults();
|
|
95
96
|
const opt = action.optsWithGlobals();
|
|
96
97
|
opt.force && output.warn('--force: Protections disabled.');
|
|
97
98
|
if (opt.debug === false)
|
|
98
99
|
config.set({ debug: false });
|
|
100
|
+
try {
|
|
101
|
+
db.connect();
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
if (!noDBErrorExit.includes(action.name()))
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
program.hook('postAction', async () => {
|
|
109
|
+
await db.database.destroy();
|
|
99
110
|
});
|
|
100
111
|
// Options shared by multiple (sub)commands
|
|
101
112
|
const opts = {
|
|
@@ -147,56 +158,30 @@ axiumDB
|
|
|
147
158
|
.description('Drop the Axium database and user')
|
|
148
159
|
.addOption(opts.force)
|
|
149
160
|
.action(async (opt) => {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
process.exit(2);
|
|
160
|
-
}
|
|
161
|
-
await db.uninstall(opt).catch(exit);
|
|
162
|
-
}
|
|
163
|
-
catch (e_1) {
|
|
164
|
-
env_1.error = e_1;
|
|
165
|
-
env_1.hasError = true;
|
|
166
|
-
}
|
|
167
|
-
finally {
|
|
168
|
-
const result_1 = __disposeResources(env_1);
|
|
169
|
-
if (result_1)
|
|
170
|
-
await result_1;
|
|
171
|
-
}
|
|
161
|
+
const stats = await db.count('users', 'passkeys', 'sessions').catch(exit);
|
|
162
|
+
if (!opt.force)
|
|
163
|
+
for (const key of ['users', 'passkeys', 'sessions']) {
|
|
164
|
+
if (stats[key] == 0)
|
|
165
|
+
continue;
|
|
166
|
+
output.warn(`Database has existing ${key}. Use --force if you really want to drop the database.`);
|
|
167
|
+
process.exit(2);
|
|
168
|
+
}
|
|
169
|
+
await db.uninstall(opt).catch(exit);
|
|
172
170
|
});
|
|
173
171
|
axiumDB
|
|
174
172
|
.command('wipe')
|
|
175
173
|
.description('Wipe the database')
|
|
176
174
|
.addOption(opts.force)
|
|
177
175
|
.action(async (opt) => {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
process.exit(2);
|
|
188
|
-
}
|
|
189
|
-
await db.wipe(opt).catch(exit);
|
|
190
|
-
}
|
|
191
|
-
catch (e_2) {
|
|
192
|
-
env_2.error = e_2;
|
|
193
|
-
env_2.hasError = true;
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
const result_2 = __disposeResources(env_2);
|
|
197
|
-
if (result_2)
|
|
198
|
-
await result_2;
|
|
199
|
-
}
|
|
176
|
+
const stats = await db.count('users', 'passkeys', 'sessions').catch(exit);
|
|
177
|
+
if (!opt.force)
|
|
178
|
+
for (const key of ['users', 'passkeys', 'sessions']) {
|
|
179
|
+
if (stats[key] == 0)
|
|
180
|
+
continue;
|
|
181
|
+
output.warn(`Database has existing ${key}. Use --force if you really want to wipe the database.`);
|
|
182
|
+
process.exit(2);
|
|
183
|
+
}
|
|
184
|
+
await db.wipe(opt).catch(exit);
|
|
200
185
|
});
|
|
201
186
|
axiumDB
|
|
202
187
|
.command('check')
|
|
@@ -210,20 +195,7 @@ axiumDB
|
|
|
210
195
|
.description('Remove expired rows')
|
|
211
196
|
.addOption(opts.force)
|
|
212
197
|
.action(async (opt) => {
|
|
213
|
-
|
|
214
|
-
try {
|
|
215
|
-
const _ = __addDisposableResource(env_3, db.connect(), true);
|
|
216
|
-
await db.clean(opt).catch(exit);
|
|
217
|
-
}
|
|
218
|
-
catch (e_3) {
|
|
219
|
-
env_3.error = e_3;
|
|
220
|
-
env_3.hasError = true;
|
|
221
|
-
}
|
|
222
|
-
finally {
|
|
223
|
-
const result_3 = __disposeResources(env_3);
|
|
224
|
-
if (result_3)
|
|
225
|
-
await result_3;
|
|
226
|
-
}
|
|
198
|
+
await db.clean(opt).catch(exit);
|
|
227
199
|
});
|
|
228
200
|
axiumDB
|
|
229
201
|
.command('rotate-password')
|
|
@@ -326,31 +298,18 @@ axiumPlugin
|
|
|
326
298
|
.description('Remove a plugin')
|
|
327
299
|
.argument('<plugin>', 'the plugin to remove')
|
|
328
300
|
.action(async (search, opt) => {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
saveConfigTo(path, data);
|
|
342
|
-
}
|
|
343
|
-
plugins.delete(plugin);
|
|
344
|
-
}
|
|
345
|
-
catch (e_4) {
|
|
346
|
-
env_4.error = e_4;
|
|
347
|
-
env_4.hasError = true;
|
|
348
|
-
}
|
|
349
|
-
finally {
|
|
350
|
-
const result_4 = __disposeResources(env_4);
|
|
351
|
-
if (result_4)
|
|
352
|
-
await result_4;
|
|
353
|
-
}
|
|
301
|
+
const plugin = resolvePlugin(search);
|
|
302
|
+
if (!plugin)
|
|
303
|
+
exit(`Can't find a plugin matching "${search}"`);
|
|
304
|
+
const specifier = getSpecifier(plugin);
|
|
305
|
+
await plugin.hooks.remove?.(opt);
|
|
306
|
+
for (const [path, data] of configFiles) {
|
|
307
|
+
if (!data.plugins)
|
|
308
|
+
continue;
|
|
309
|
+
data.plugins = data.plugins.filter(p => p !== specifier);
|
|
310
|
+
saveConfigTo(path, data);
|
|
311
|
+
}
|
|
312
|
+
plugins.delete(plugin);
|
|
354
313
|
});
|
|
355
314
|
axiumPlugin
|
|
356
315
|
.command('init')
|
|
@@ -361,23 +320,10 @@ axiumPlugin
|
|
|
361
320
|
.addOption(opts.check)
|
|
362
321
|
.argument('<plugin>', 'the plugin to initialize')
|
|
363
322
|
.action(async (search, opt) => {
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
exit(`Can't find a plugin matching "${search}"`);
|
|
369
|
-
const _ = __addDisposableResource(env_5, db.connect(), true);
|
|
370
|
-
await plugin.hooks.db_init?.({ force: false, ...opt, skip: true });
|
|
371
|
-
}
|
|
372
|
-
catch (e_5) {
|
|
373
|
-
env_5.error = e_5;
|
|
374
|
-
env_5.hasError = true;
|
|
375
|
-
}
|
|
376
|
-
finally {
|
|
377
|
-
const result_5 = __disposeResources(env_5);
|
|
378
|
-
if (result_5)
|
|
379
|
-
await result_5;
|
|
380
|
-
}
|
|
323
|
+
const plugin = resolvePlugin(search);
|
|
324
|
+
if (!plugin)
|
|
325
|
+
exit(`Can't find a plugin matching "${search}"`);
|
|
326
|
+
await plugin.hooks.db_init?.({ force: false, ...opt, skip: true });
|
|
381
327
|
});
|
|
382
328
|
const axiumApps = program.command('apps').description('Manage Axium apps').addOption(opts.global);
|
|
383
329
|
axiumApps
|
|
@@ -404,7 +350,6 @@ const lookup = new Argument('<user>', 'the UUID or email of the user to operate
|
|
|
404
350
|
const value = await (lookup.includes('@') ? z.email() : z.uuid())
|
|
405
351
|
.parseAsync(lookup.toLowerCase())
|
|
406
352
|
.catch(() => exit('Invalid user ID or email.'));
|
|
407
|
-
db.connect();
|
|
408
353
|
const result = await db.database
|
|
409
354
|
.selectFrom('users')
|
|
410
355
|
.where(value.includes('@') ? 'email' : 'id', '=', value)
|
|
@@ -450,90 +395,77 @@ program
|
|
|
450
395
|
.option('--untag <tag...>', 'Remove tags from the user')
|
|
451
396
|
.option('--delete', 'Delete the user')
|
|
452
397
|
.action(async (_user, opt) => {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
.catch(() => false);
|
|
482
|
-
if (!confirmed)
|
|
483
|
-
console.log(styleText('dim', '> Delete aborted.'));
|
|
484
|
-
else
|
|
485
|
-
await db.database
|
|
486
|
-
.deleteFrom('users')
|
|
487
|
-
.where('id', '=', user.id)
|
|
488
|
-
.executeTakeFirstOrThrow()
|
|
489
|
-
.then(() => console.log(styleText(['red', 'bold'], '> Deleted')))
|
|
490
|
-
.catch(e => exit('Failed to delete user: ' + e.message));
|
|
491
|
-
}
|
|
492
|
-
catch (e_6) {
|
|
493
|
-
env_7.error = e_6;
|
|
494
|
-
env_7.hasError = true;
|
|
495
|
-
}
|
|
496
|
-
finally {
|
|
497
|
-
__disposeResources(env_7);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
console.log([
|
|
501
|
-
user.isAdmin && styleText('redBright', 'Administrator'),
|
|
502
|
-
'UUID: ' + user.id,
|
|
503
|
-
'Name: ' + user.name,
|
|
504
|
-
`Email: ${user.email}, ${user.emailVerified ? 'verified on ' + formatDateRange(user.emailVerified) : styleText(config.auth.email_verification ? 'yellow' : 'dim', 'not verified')}`,
|
|
505
|
-
'Registered ' + formatDateRange(user.registeredAt),
|
|
506
|
-
`Roles: ${user.roles.length ? user.roles.join(', ') : styleText('dim', '(none)')}`,
|
|
507
|
-
`Tags: ${user.tags.length ? user.tags.join(', ') : styleText('dim', '(none)')}`,
|
|
508
|
-
]
|
|
509
|
-
.filter(Boolean)
|
|
510
|
-
.join('\n'));
|
|
511
|
-
if (opt.sessions) {
|
|
512
|
-
const sessions = await db.database.selectFrom('sessions').where('userId', '=', user.id).selectAll().execute();
|
|
513
|
-
console.log(styleText('bold', 'Sessions:'));
|
|
514
|
-
if (!sessions.length)
|
|
515
|
-
console.log(styleText('dim', '(none)'));
|
|
398
|
+
let user = await _user;
|
|
399
|
+
const [updatedRoles, roles, rolesDiff] = diffUpdate(user.roles, opt.addRole, opt.removeRole);
|
|
400
|
+
const [updatedTags, tags, tagsDiff] = diffUpdate(user.tags, opt.tag, opt.untag);
|
|
401
|
+
if (updatedRoles || updatedTags) {
|
|
402
|
+
user = await db.database
|
|
403
|
+
.updateTable('users')
|
|
404
|
+
.set({ roles, tags })
|
|
405
|
+
.returningAll()
|
|
406
|
+
.executeTakeFirstOrThrow()
|
|
407
|
+
.then(u => {
|
|
408
|
+
if (updatedRoles && rolesDiff)
|
|
409
|
+
console.log(`> Updated roles: ${rolesDiff}`);
|
|
410
|
+
if (updatedTags && tagsDiff)
|
|
411
|
+
console.log(`> Updated tags: ${tagsDiff}`);
|
|
412
|
+
return u;
|
|
413
|
+
})
|
|
414
|
+
.catch(e => exit('Failed to update user roles: ' + e.message));
|
|
415
|
+
}
|
|
416
|
+
if (opt.delete) {
|
|
417
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
418
|
+
try {
|
|
419
|
+
const rl = __addDisposableResource(env_1, readline(), false);
|
|
420
|
+
const confirmed = await rl
|
|
421
|
+
.question(`Are you sure you want to delete ${userText(user, true)}? (y/N) `)
|
|
422
|
+
.then(v => z.stringbool().parseAsync(v))
|
|
423
|
+
.catch(() => false);
|
|
424
|
+
if (!confirmed)
|
|
425
|
+
console.log(styleText('dim', '> Delete aborted.'));
|
|
516
426
|
else
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
427
|
+
await db.database
|
|
428
|
+
.deleteFrom('users')
|
|
429
|
+
.where('id', '=', user.id)
|
|
430
|
+
.executeTakeFirstOrThrow()
|
|
431
|
+
.then(() => console.log(styleText(['red', 'bold'], '> Deleted')))
|
|
432
|
+
.catch(e => exit('Failed to delete user: ' + e.message));
|
|
520
433
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
434
|
+
catch (e_1) {
|
|
435
|
+
env_1.error = e_1;
|
|
436
|
+
env_1.hasError = true;
|
|
437
|
+
}
|
|
438
|
+
finally {
|
|
439
|
+
__disposeResources(env_1);
|
|
527
440
|
}
|
|
528
441
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
442
|
+
console.log([
|
|
443
|
+
user.isAdmin && styleText('redBright', 'Administrator'),
|
|
444
|
+
'UUID: ' + user.id,
|
|
445
|
+
'Name: ' + user.name,
|
|
446
|
+
`Email: ${user.email}, ${user.emailVerified ? 'verified on ' + formatDateRange(user.emailVerified) : styleText(config.auth.email_verification ? 'yellow' : 'dim', 'not verified')}`,
|
|
447
|
+
'Registered ' + formatDateRange(user.registeredAt),
|
|
448
|
+
`Roles: ${user.roles.length ? user.roles.join(', ') : styleText('dim', '(none)')}`,
|
|
449
|
+
`Tags: ${user.tags.length ? user.tags.join(', ') : styleText('dim', '(none)')}`,
|
|
450
|
+
]
|
|
451
|
+
.filter(Boolean)
|
|
452
|
+
.join('\n'));
|
|
453
|
+
if (opt.sessions) {
|
|
454
|
+
const sessions = await db.database.selectFrom('sessions').where('userId', '=', user.id).selectAll().execute();
|
|
455
|
+
console.log(styleText('bold', 'Sessions:'));
|
|
456
|
+
if (!sessions.length)
|
|
457
|
+
console.log(styleText('dim', '(none)'));
|
|
458
|
+
else
|
|
459
|
+
for (const session of sessions) {
|
|
460
|
+
console.log(`\t${session.id}\tcreated ${formatDateRange(session.created).padEnd(40)}\texpires ${formatDateRange(session.expires).padEnd(40)}\t${session.elevated ? styleText('yellow', '(elevated)') : ''}`);
|
|
461
|
+
}
|
|
532
462
|
}
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
463
|
+
if (opt.passkeys) {
|
|
464
|
+
const passkeys = await db.database.selectFrom('passkeys').where('userId', '=', user.id).selectAll().execute();
|
|
465
|
+
console.log(styleText('bold', 'Passkeys:'));
|
|
466
|
+
for (const passkey of passkeys) {
|
|
467
|
+
console.log(`\t${passkey.id}: created ${formatDateRange(passkey.createdAt).padEnd(40)} used ${passkey.counter} times. ${passkey.deviceType}, ${passkey.backedUp ? '' : 'not '}backed up; transports are [${passkey.transports.join(', ')}], ${passkey.name ? 'named ' + JSON.stringify(passkey.name) : 'unnamed'}.`);
|
|
468
|
+
}
|
|
537
469
|
}
|
|
538
470
|
});
|
|
539
471
|
program
|
|
@@ -541,23 +473,10 @@ program
|
|
|
541
473
|
.description('Toggle whether a user is an administrator')
|
|
542
474
|
.addArgument(lookup)
|
|
543
475
|
.action(async (_user) => {
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
const isAdmin = !user.isAdmin;
|
|
549
|
-
await db.database.updateTable('users').set({ isAdmin }).where('id', '=', user.id).executeTakeFirstOrThrow();
|
|
550
|
-
console.log(`${userText(user)} is ${isAdmin ? 'now' : 'no longer'} an administrator. (${styleText(['whiteBright', 'bold'], isAdmin.toString())})`);
|
|
551
|
-
}
|
|
552
|
-
catch (e_8) {
|
|
553
|
-
env_8.error = e_8;
|
|
554
|
-
env_8.hasError = true;
|
|
555
|
-
}
|
|
556
|
-
finally {
|
|
557
|
-
const result_7 = __disposeResources(env_8);
|
|
558
|
-
if (result_7)
|
|
559
|
-
await result_7;
|
|
560
|
-
}
|
|
476
|
+
const user = await _user;
|
|
477
|
+
const isAdmin = !user.isAdmin;
|
|
478
|
+
await db.database.updateTable('users').set({ isAdmin }).where('id', '=', user.id).executeTakeFirstOrThrow();
|
|
479
|
+
console.log(`${userText(user)} is ${isAdmin ? 'now' : 'no longer'} an administrator. (${styleText(['whiteBright', 'bold'], isAdmin.toString())})`);
|
|
561
480
|
});
|
|
562
481
|
program
|
|
563
482
|
.command('status')
|
|
@@ -565,37 +484,24 @@ program
|
|
|
565
484
|
.description('Get information about the server')
|
|
566
485
|
.addOption(opts.host)
|
|
567
486
|
.action(async () => {
|
|
568
|
-
|
|
487
|
+
console.log('Axium Server v' + program.version());
|
|
488
|
+
console.log(styleText('whiteBright', 'Debug mode:'), config.debug ? styleText('yellow', 'enabled') : 'disabled');
|
|
489
|
+
console.log(styleText('whiteBright', 'Loaded config files:'), config.files.keys().toArray().join(', '));
|
|
490
|
+
process.stdout.write(styleText('whiteBright', 'Database: '));
|
|
569
491
|
try {
|
|
570
|
-
console.log(
|
|
571
|
-
console.log(styleText('whiteBright', 'Debug mode:'), config.debug ? styleText('yellow', 'enabled') : 'disabled');
|
|
572
|
-
console.log(styleText('whiteBright', 'Loaded config files:'), config.files.keys().toArray().join(', '));
|
|
573
|
-
process.stdout.write(styleText('whiteBright', 'Database: '));
|
|
574
|
-
const _ = __addDisposableResource(env_9, db.connect(), true);
|
|
575
|
-
try {
|
|
576
|
-
console.log(await db.statText());
|
|
577
|
-
}
|
|
578
|
-
catch {
|
|
579
|
-
output.error('Unavailable');
|
|
580
|
-
}
|
|
581
|
-
console.log(styleText('whiteBright', 'Loaded plugins:'), Array.from(plugins)
|
|
582
|
-
.map(plugin => plugin.name)
|
|
583
|
-
.join(', ') || styleText('dim', '(none)'));
|
|
584
|
-
for (const plugin of plugins) {
|
|
585
|
-
if (!plugin.statusText)
|
|
586
|
-
continue;
|
|
587
|
-
console.log(styleText('bold', plugin.name), plugin.version + ':');
|
|
588
|
-
console.log(await plugin.statusText());
|
|
589
|
-
}
|
|
492
|
+
console.log(await db.statText());
|
|
590
493
|
}
|
|
591
|
-
catch
|
|
592
|
-
|
|
593
|
-
env_9.hasError = true;
|
|
494
|
+
catch {
|
|
495
|
+
output.error('Unavailable');
|
|
594
496
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
497
|
+
console.log(styleText('whiteBright', 'Loaded plugins:'), Array.from(plugins)
|
|
498
|
+
.map(plugin => plugin.name)
|
|
499
|
+
.join(', ') || styleText('dim', '(none)'));
|
|
500
|
+
for (const plugin of plugins) {
|
|
501
|
+
if (!plugin.statusText)
|
|
502
|
+
continue;
|
|
503
|
+
console.log(styleText('bold', plugin.name), plugin.version + ':');
|
|
504
|
+
console.log(await plugin.statusText());
|
|
599
505
|
}
|
|
600
506
|
});
|
|
601
507
|
program
|
|
@@ -622,11 +528,13 @@ program
|
|
|
622
528
|
.description('Start the Axium server')
|
|
623
529
|
.option('-p, --port <port>', 'the port to listen on')
|
|
624
530
|
.option('--ssl <prefix>', 'the prefix for the cert.pem and key.pem SSL files')
|
|
531
|
+
.option('-B, --build', 'the path to a built SvelteKit server handler')
|
|
625
532
|
.action(async (opt) => {
|
|
626
533
|
const server = await serve({
|
|
627
534
|
secure: opt.ssl ? true : config.web.secure,
|
|
628
535
|
ssl_cert: opt.ssl ? join(opt.ssl, 'cert.pem') : config.web.ssl_cert,
|
|
629
536
|
ssl_key: opt.ssl ? join(opt.ssl, 'key.pem') : config.web.ssl_key,
|
|
537
|
+
build: opt.build ?? config.web.build,
|
|
630
538
|
});
|
|
631
539
|
const port = !Number.isNaN(Number.parseInt(opt.port ?? '')) ? Number.parseInt(opt.port) : config.web.port;
|
|
632
540
|
server.listen(port, () => {
|
package/dist/config.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface Config extends Record<string, unknown> {
|
|
|
37
37
|
show_duplicate_state: boolean;
|
|
38
38
|
web: Record<string, unknown> & {
|
|
39
39
|
assets: string;
|
|
40
|
+
build: string;
|
|
40
41
|
disable_cache: boolean;
|
|
41
42
|
port: number;
|
|
42
43
|
prefix: string;
|
|
@@ -100,6 +101,7 @@ export declare const FileSchema: z.ZodObject<{
|
|
|
100
101
|
show_duplicate_state: z.ZodOptional<z.ZodBoolean>;
|
|
101
102
|
web: z.ZodOptional<z.ZodObject<{
|
|
102
103
|
assets: z.ZodOptional<z.ZodString>;
|
|
104
|
+
build: z.ZodOptional<z.ZodString>;
|
|
103
105
|
disable_cache: z.ZodOptional<z.ZodBoolean>;
|
|
104
106
|
port: z.ZodOptional<z.ZodNumber>;
|
|
105
107
|
prefix: z.ZodOptional<z.ZodString>;
|