@axium/client 0.32.1 → 0.33.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/cli/cache.d.ts +1 -0
- package/dist/cli/config.d.ts +10 -1
- package/dist/cli/config.js +6 -2
- package/dist/cli/index.js +16 -69
- package/dist/locales.d.ts +3 -1
- package/dist/user.d.ts +2 -2
- package/lib/SidebarLayout.svelte +16 -3
- package/locales/en.json +3 -1
- package/package.json +2 -2
- package/styles/list.css +1 -1
package/dist/cli/cache.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare const meta: Handle<z.ZodObject<{
|
|
|
34
34
|
user: z.ZodObject<{
|
|
35
35
|
id: z.ZodUUID;
|
|
36
36
|
name: z.ZodString;
|
|
37
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
38
|
email: z.ZodEmail;
|
|
38
39
|
emailVerified: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
39
40
|
preferences: z.ZodLazy<z.ZodObject<{
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PluginLoadOptions } from '@axium/core/node/plugins';
|
|
1
2
|
export declare const configDir: string;
|
|
2
3
|
export declare const axcConfigPath: string;
|
|
3
4
|
export declare function session(): {
|
|
@@ -18,9 +19,17 @@ export declare function session(): {
|
|
|
18
19
|
registeredAt: Date;
|
|
19
20
|
isAdmin: boolean;
|
|
20
21
|
isSuspended: boolean;
|
|
22
|
+
username?: string | null | undefined;
|
|
21
23
|
emailVerified?: Date | null | undefined;
|
|
22
24
|
};
|
|
23
25
|
name?: string | null | undefined;
|
|
24
26
|
};
|
|
25
|
-
export
|
|
27
|
+
export interface LoadConfigOptions {
|
|
28
|
+
plugins?: PluginLoadOptions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param safe whether to run code from plugins
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadConfig(options?: LoadConfigOptions): Promise<void>;
|
|
26
35
|
export declare function saveConfig(): void;
|
package/dist/cli/config.js
CHANGED
|
@@ -18,7 +18,11 @@ export function session() {
|
|
|
18
18
|
io.exit('No session data available.', 3);
|
|
19
19
|
return cache.meta.data.session;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param safe whether to run code from plugins
|
|
24
|
+
*/
|
|
25
|
+
export async function loadConfig(options = {}) {
|
|
22
26
|
try {
|
|
23
27
|
Object.assign(config, io.readJSON(axcConfigPath, ClientConfig));
|
|
24
28
|
if (config.server)
|
|
@@ -26,7 +30,7 @@ export async function loadConfig(safe) {
|
|
|
26
30
|
if (config.token)
|
|
27
31
|
setToken(config.token);
|
|
28
32
|
for (const plugin of config.plugins ?? [])
|
|
29
|
-
await loadPlugin('client', plugin, axcConfigPath,
|
|
33
|
+
await loadPlugin('client', plugin, axcConfigPath, options.plugins);
|
|
30
34
|
}
|
|
31
35
|
catch (e) {
|
|
32
36
|
io.warn('Failed to load config: ' + io.errorText(e));
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { formatBytes } from '@axium/core';
|
|
3
|
-
import {
|
|
3
|
+
import { createPluginCommand, outputDaemonStatus } from '@axium/core/node';
|
|
4
4
|
import { _findPlugin, plugins } from '@axium/core/plugins';
|
|
5
5
|
import { CommanderError, program } from 'commander';
|
|
6
6
|
import * as io from 'ioium/node';
|
|
@@ -20,11 +20,11 @@ const debug = z.stringbool().default(false).parse(process.env.DEBUG?.toLowerCase
|
|
|
20
20
|
if (debug)
|
|
21
21
|
io._setDebugOutput(true);
|
|
22
22
|
useUserAgent(clientUA);
|
|
23
|
-
await loadConfig(safe);
|
|
23
|
+
await loadConfig({ plugins: { safe } });
|
|
24
24
|
cache.load();
|
|
25
25
|
process.on('SIGHUP', () => {
|
|
26
26
|
io.info('Reloading configuration due to SIGHUP.');
|
|
27
|
-
void loadConfig(safe);
|
|
27
|
+
void loadConfig({ plugins: { safe } });
|
|
28
28
|
});
|
|
29
29
|
program
|
|
30
30
|
.version($pkg.version)
|
|
@@ -74,7 +74,19 @@ program
|
|
|
74
74
|
if (opt.socket && config.token)
|
|
75
75
|
await connectSocket({ rejectUnauthorized: !opt.insecure });
|
|
76
76
|
});
|
|
77
|
-
const axcPlugin =
|
|
77
|
+
const axcPlugin = createPluginCommand('client', program, {
|
|
78
|
+
safe,
|
|
79
|
+
loadedBy: () => axcConfigPath,
|
|
80
|
+
enabled: config.plugins,
|
|
81
|
+
enable(spec) {
|
|
82
|
+
config.plugins.push(spec);
|
|
83
|
+
saveConfig();
|
|
84
|
+
},
|
|
85
|
+
disable(spec) {
|
|
86
|
+
config.plugins = config.plugins.filter(p => p !== spec);
|
|
87
|
+
saveConfig();
|
|
88
|
+
},
|
|
89
|
+
});
|
|
78
90
|
axcPlugin
|
|
79
91
|
.command('run')
|
|
80
92
|
.description('Run a plugin')
|
|
@@ -83,71 +95,6 @@ axcPlugin
|
|
|
83
95
|
const plugin = _findPlugin(search);
|
|
84
96
|
await plugin._client?.run?.();
|
|
85
97
|
});
|
|
86
|
-
axcPlugin
|
|
87
|
-
.command('list')
|
|
88
|
-
.alias('ls')
|
|
89
|
-
.description('List loaded plugins')
|
|
90
|
-
.option('-l, --long', 'use the long listing format')
|
|
91
|
-
.option('--no-versions', 'do not show plugin versions')
|
|
92
|
-
.action(opt => {
|
|
93
|
-
if (!plugins.size) {
|
|
94
|
-
console.log('No plugins loaded.');
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (!opt.long) {
|
|
98
|
-
console.log(plugins.keys().toArray().join(', '));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
console.log(styleText('whiteBright', plugins.size + ' plugin(s) loaded:'));
|
|
102
|
-
for (const plugin of plugins.values()) {
|
|
103
|
-
console.log(plugin.name, opt.versions ? plugin.version : '');
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
axcPlugin
|
|
107
|
-
.command('info')
|
|
108
|
-
.description('Get information about a plugin')
|
|
109
|
-
.argument('<plugin>', 'the plugin to get information about')
|
|
110
|
-
.action((search) => {
|
|
111
|
-
const plugin = _findPlugin(search);
|
|
112
|
-
for (const line of pluginText(plugin))
|
|
113
|
-
console.log(line);
|
|
114
|
-
});
|
|
115
|
-
axcPlugin
|
|
116
|
-
.command('add')
|
|
117
|
-
.description('Add a plugin')
|
|
118
|
-
.option('-k, --keep-going', 'continue adding plugins even if one fails')
|
|
119
|
-
.argument('<spec...>', 'the plugin specifier (e.g. a package name) to add')
|
|
120
|
-
.action(async (specs, { keepGoing }) => {
|
|
121
|
-
for (const spec of specs) {
|
|
122
|
-
try {
|
|
123
|
-
if (config.plugins.includes(spec))
|
|
124
|
-
throw `Plugin "${spec}" is already added.`;
|
|
125
|
-
const plugin = await loadPlugin('client', spec, axcConfigPath, safe);
|
|
126
|
-
if (!plugin)
|
|
127
|
-
throw `Failed to load a client plugin from "${spec}".`;
|
|
128
|
-
config.plugins.push(spec);
|
|
129
|
-
saveConfig();
|
|
130
|
-
console.log('Added plugin:', plugin.name, styleText('dim', 'v' + plugin.version));
|
|
131
|
-
}
|
|
132
|
-
catch (e) {
|
|
133
|
-
if (keepGoing)
|
|
134
|
-
io.error(e);
|
|
135
|
-
else
|
|
136
|
-
io.exit(e);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
axcPlugin
|
|
141
|
-
.command('remove')
|
|
142
|
-
.alias('rm')
|
|
143
|
-
.description('Remove a plugin')
|
|
144
|
-
.argument('<plugin>', 'the plugin to remove')
|
|
145
|
-
.action((search) => {
|
|
146
|
-
const plugin = _findPlugin(search);
|
|
147
|
-
config.plugins = config.plugins.filter(p => p !== plugin.specifier);
|
|
148
|
-
plugins.delete(plugin.name);
|
|
149
|
-
saveConfig();
|
|
150
|
-
});
|
|
151
98
|
const axcCache = program.command('cache').description('Manage the local cache');
|
|
152
99
|
axcCache
|
|
153
100
|
.command('info')
|
package/dist/locales.d.ts
CHANGED
|
@@ -91,7 +91,8 @@ declare let currentLoaded: {
|
|
|
91
91
|
readonly success: "Success";
|
|
92
92
|
readonly unknown: "Unknown";
|
|
93
93
|
readonly unnamed: "Unnamed";
|
|
94
|
-
readonly
|
|
94
|
+
readonly user_display_name: "Name";
|
|
95
|
+
readonly username: "Username";
|
|
95
96
|
readonly yes: "Yes";
|
|
96
97
|
};
|
|
97
98
|
readonly page: {
|
|
@@ -100,6 +101,7 @@ declare let currentLoaded: {
|
|
|
100
101
|
readonly delete_account_confirm: "Are you sure you want to delete your account?";
|
|
101
102
|
readonly edit_email: "Email Address";
|
|
102
103
|
readonly edit_name: "What do you want to be called?";
|
|
104
|
+
readonly edit_username: "Pick a unique username";
|
|
103
105
|
readonly email_verified_on: "Email verified on {date}";
|
|
104
106
|
readonly greeting: "Welcome, {name}";
|
|
105
107
|
readonly passkeys: {
|
package/dist/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NewSessionResponse, Passkey, PasskeyChangeable, Session, User, UserPublic, Verification } from '@axium/core';
|
|
1
|
+
import type { NewSessionResponse, Passkey, PasskeyChangeable, Session, User, UserChangeable, UserPublic, Verification } from '@axium/core';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import Cache from './cache.js';
|
|
4
4
|
export declare function login(userId: string): Promise<NewSessionResponse>;
|
|
@@ -18,7 +18,7 @@ export declare function register(_data: Record<string, unknown>): Promise<void>;
|
|
|
18
18
|
declare const userCache: Cache<[string], UserPublic>;
|
|
19
19
|
export { userCache as apiUserCache };
|
|
20
20
|
export declare function userInfo(userId: string): Promise<UserPublic>;
|
|
21
|
-
export declare function updateUser(userId: string, data: Record<string, FormDataEntryValue>): Promise<User>;
|
|
21
|
+
export declare function updateUser(userId: string, data: UserChangeable | Record<string, FormDataEntryValue>): Promise<User>;
|
|
22
22
|
export declare function fullUserInfo(userId: string): Promise<User & {
|
|
23
23
|
sessions: Session[];
|
|
24
24
|
}>;
|
package/lib/SidebarLayout.svelte
CHANGED
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
display: inline-flex;
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
gap: 0.5em;
|
|
60
|
-
background-color: var(--bg-alt);
|
|
61
60
|
padding: 1em;
|
|
62
61
|
padding-left: 0;
|
|
63
62
|
border-radius: 0 1em 1em 0;
|
|
@@ -71,6 +70,7 @@
|
|
|
71
70
|
flex-direction: row;
|
|
72
71
|
justify-content: space-around;
|
|
73
72
|
gap: 1em;
|
|
73
|
+
background-color: var(--bg-alt);
|
|
74
74
|
padding: 0.5em;
|
|
75
75
|
z-index: 6;
|
|
76
76
|
|
|
@@ -80,10 +80,11 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.item {
|
|
83
|
-
padding: 0.
|
|
83
|
+
padding: 0.5em 1em;
|
|
84
84
|
border-radius: 0.25em 1em 1em 0.25em;
|
|
85
85
|
|
|
86
86
|
@media (width < 700px) {
|
|
87
|
+
padding: 0.3em 0.5em;
|
|
87
88
|
flex: 1 1 0;
|
|
88
89
|
border-radius: 1em;
|
|
89
90
|
padding: 1em;
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
.item:hover {
|
|
95
|
-
background-color: var(--bg-
|
|
96
|
+
background-color: var(--bg-alt);
|
|
96
97
|
cursor: pointer;
|
|
97
98
|
}
|
|
98
99
|
|
|
@@ -121,4 +122,16 @@
|
|
|
121
122
|
display: none;
|
|
122
123
|
}
|
|
123
124
|
}
|
|
125
|
+
|
|
126
|
+
:global(:has(.sidebar-theme-alt)) .sidebar {
|
|
127
|
+
background-color: var(--bg-alt);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (width >= 700px) {
|
|
131
|
+
:not(:has(.sidebar-theme-alt)) .sidebar-content {
|
|
132
|
+
border-radius: 1em;
|
|
133
|
+
background-color: var(--bg-menu);
|
|
134
|
+
margin: 0 1em 1em 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
124
137
|
</style>
|
package/locales/en.json
CHANGED
|
@@ -85,7 +85,8 @@
|
|
|
85
85
|
"success": "Success",
|
|
86
86
|
"unknown": "Unknown",
|
|
87
87
|
"unnamed": "Unnamed",
|
|
88
|
-
"
|
|
88
|
+
"user_display_name": "Name",
|
|
89
|
+
"username": "Username",
|
|
89
90
|
"yes": "Yes"
|
|
90
91
|
},
|
|
91
92
|
"page": {
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
"delete_account_confirm": "Are you sure you want to delete your account?",
|
|
95
96
|
"edit_email": "Email Address",
|
|
96
97
|
"edit_name": "What do you want to be called?",
|
|
98
|
+
"edit_username": "Pick a unique username",
|
|
97
99
|
"email_verified_on": "Email verified on {date}",
|
|
98
100
|
"greeting": "Welcome, {name}",
|
|
99
101
|
"passkeys": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"author": "James Prevett <jp@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"build": "tsc"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@axium/core": ">=0.
|
|
52
|
+
"@axium/core": ">=0.35.0",
|
|
53
53
|
"ioium": "^1.0.2",
|
|
54
54
|
"semver": "^7.7.4",
|
|
55
55
|
"svelte": "^5.36.0",
|