@abraca/nuxt 2.47.0 → 2.48.0
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/module.json +1 -1
- package/dist/runtime/components/AEditor.vue +11 -1
- package/dist/runtime/components/aware/AMedia.d.vue.ts +1 -1
- package/dist/runtime/components/aware/AMedia.vue.d.ts +1 -1
- package/dist/runtime/plugin-abracadabra.client.js +20 -3
- package/dist/runtime/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -149,7 +149,10 @@ watchEffect(() => {
|
|
|
149
149
|
const storage = editorInstance.editor?.storage?.metaField;
|
|
150
150
|
if (!storage) return;
|
|
151
151
|
storage.pageMeta = docMeta ?? null;
|
|
152
|
-
storage.updateMeta = (patch) =>
|
|
152
|
+
storage.updateMeta = (patch) => {
|
|
153
|
+
writeTreeMeta(patch);
|
|
154
|
+
emit("updateMeta", patch);
|
|
155
|
+
};
|
|
153
156
|
storage.mentionItems = (connectedUsers.value ?? []).map((u) => ({
|
|
154
157
|
id: u.publicKey || u.name,
|
|
155
158
|
label: u.name,
|
|
@@ -158,6 +161,7 @@ watchEffect(() => {
|
|
|
158
161
|
});
|
|
159
162
|
let metaInitDone = false;
|
|
160
163
|
function handleMetaUpdate(patch) {
|
|
164
|
+
writeTreeMeta(patch);
|
|
161
165
|
emit("updateMeta", patch);
|
|
162
166
|
}
|
|
163
167
|
function initDocumentMeta(ed) {
|
|
@@ -229,6 +233,12 @@ function writeTreeLabel(label) {
|
|
|
229
233
|
syncingFromEditor = false;
|
|
230
234
|
});
|
|
231
235
|
}
|
|
236
|
+
function writeTreeMeta(patch) {
|
|
237
|
+
const e = _treeMap.data[props.docId];
|
|
238
|
+
if (!e) return;
|
|
239
|
+
const meta = { ...e.meta ?? {}, ...patch };
|
|
240
|
+
_treeMap.set(props.docId, { ...e, meta, updatedAt: Date.now() });
|
|
241
|
+
}
|
|
232
242
|
function syncHeader(ed, isRemoteUpdate, initialSyncDone) {
|
|
233
243
|
const action = decideTitleSync({
|
|
234
244
|
headerText: getHeaderText(ed),
|
|
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
12
12
|
awareness: boolean;
|
|
13
13
|
tag: "video" | "audio";
|
|
14
14
|
live: boolean;
|
|
15
|
-
total: boolean;
|
|
16
15
|
controls: boolean;
|
|
16
|
+
total: boolean;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
12
12
|
awareness: boolean;
|
|
13
13
|
tag: "video" | "audio";
|
|
14
14
|
live: boolean;
|
|
15
|
-
total: boolean;
|
|
16
15
|
controls: boolean;
|
|
16
|
+
total: boolean;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -167,6 +167,18 @@ function fromBase64Url(str) {
|
|
|
167
167
|
for (let i = 0; i < b.length; i++) a[i] = b.charCodeAt(i);
|
|
168
168
|
return a;
|
|
169
169
|
}
|
|
170
|
+
function jwtRoleClaim(token) {
|
|
171
|
+
if (!token) return null;
|
|
172
|
+
const payload = token.split(".")[1];
|
|
173
|
+
if (!payload) return null;
|
|
174
|
+
try {
|
|
175
|
+
const json = new TextDecoder().decode(fromBase64Url(payload));
|
|
176
|
+
const role = JSON.parse(json).role;
|
|
177
|
+
return typeof role === "string" && role ? role : null;
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
170
182
|
async function fetchServerInfo(baseUrl) {
|
|
171
183
|
try {
|
|
172
184
|
const res = await fetch(`${baseUrl}/info`);
|
|
@@ -592,6 +604,7 @@ export default defineNuxtPlugin({
|
|
|
592
604
|
isReady.value = false;
|
|
593
605
|
synced.value = false;
|
|
594
606
|
status.value = "disconnected";
|
|
607
|
+
effectiveRole.value = null;
|
|
595
608
|
if (identityState.value === "connectionBlocked") {
|
|
596
609
|
identityState.value = _identityStateBeforeBlock;
|
|
597
610
|
}
|
|
@@ -623,7 +636,7 @@ export default defineNuxtPlugin({
|
|
|
623
636
|
_initPromise = init(url);
|
|
624
637
|
await _initPromise;
|
|
625
638
|
}
|
|
626
|
-
async function switchSpace(serverUrl, spaceRootId) {
|
|
639
|
+
async function switchSpace(serverUrl, spaceRootId, opts) {
|
|
627
640
|
if (serverUrl !== currentServerUrl.value) await switchServer(serverUrl);
|
|
628
641
|
const idx = savedServers.value.findIndex((s) => s.url === serverUrl);
|
|
629
642
|
const alreadyActive = idx >= 0 && savedServers.value[idx].entryDocId === spaceRootId;
|
|
@@ -638,7 +651,7 @@ export default defineNuxtPlugin({
|
|
|
638
651
|
_initPromise = init(serverUrl);
|
|
639
652
|
await _initPromise;
|
|
640
653
|
}
|
|
641
|
-
await navigateTo(abraConfig.docBasePath ?? "/doc");
|
|
654
|
+
if (opts?.navigate !== false) await navigateTo(abraConfig.docBasePath ?? "/doc");
|
|
642
655
|
}
|
|
643
656
|
async function claimAccount() {
|
|
644
657
|
if (!client.value || !keystore.value) {
|
|
@@ -1291,6 +1304,10 @@ export default defineNuxtPlugin({
|
|
|
1291
1304
|
addLog(`Login failed: ${e instanceof Error ? e.message : String(e)}`, "auth");
|
|
1292
1305
|
}
|
|
1293
1306
|
}
|
|
1307
|
+
if (!effectiveRole.value && _client.isTokenValid()) {
|
|
1308
|
+
const seededRole = jwtRoleClaim(_client.token);
|
|
1309
|
+
if (seededRole) effectiveRole.value = seededRole;
|
|
1310
|
+
}
|
|
1294
1311
|
_client.updateMe({ displayName: userName.value }).catch(() => {
|
|
1295
1312
|
});
|
|
1296
1313
|
if (_client.isTokenValid() && !tm.hasSession) {
|
|
@@ -1331,7 +1348,7 @@ export default defineNuxtPlugin({
|
|
|
1331
1348
|
}
|
|
1332
1349
|
}
|
|
1333
1350
|
const server = savedServers.value.find((s) => s.url === serverUrl);
|
|
1334
|
-
const docId =
|
|
1351
|
+
const docId = server?.entryDocId ?? configEntryDocId ?? server?.cachedSpaces?.[0]?.id ?? spacesInfo?.spaces?.[0]?.id ?? info?.root_doc_id ?? void 0;
|
|
1335
1352
|
if (!docId) {
|
|
1336
1353
|
connectionError.value = "No entry document found. Configure entryDocId or ensure the server has spaces.";
|
|
1337
1354
|
addLog("No entry document \u2014 cannot connect", "system");
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -563,7 +563,9 @@ export interface AbracadabraState {
|
|
|
563
563
|
addServer: (url: string) => Promise<void>;
|
|
564
564
|
removeServer: (url: string) => void;
|
|
565
565
|
switchServer: (url: string) => Promise<void>;
|
|
566
|
-
switchSpace: (serverUrl: string, spaceDocId: string
|
|
566
|
+
switchSpace: (serverUrl: string, spaceDocId: string, opts?: {
|
|
567
|
+
navigate?: boolean;
|
|
568
|
+
}) => Promise<void>;
|
|
567
569
|
refreshSpaces: () => Promise<void>;
|
|
568
570
|
createSpace: (opts: {
|
|
569
571
|
name: string;
|