odant-work 1.0.96 → 1.0.98
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/#system/auto-update.json.4727984.tmp +15 -0
- package/#system/license-base-WORK-PAK-BED9C508.lic.json.4714304.tmp +0 -0
- package/#system/package-manifest.json +778 -781
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +4 -69
- package/$server/$folder/$class/ai/system.md +1 -1
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +4 -1
- package/$server/$folder/handlers/pages/form/$handler/class.js +41 -14
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +100 -2
- package/$server/$folder/handlers/readme.md +1 -1
- package/$server/$folder/lib/explorer/explorer.js +5 -2
- package/$server/$folder/lib/menu/menu.js +49 -8
- package/$server/$folder/lib/readme.md +0 -1
- package/$server/$folder/lib/tree/tree.js +67 -11
- package/AGENTS.md +1 -1
- package/package.json +1 -1
- package/sources/client/handler.js +13 -3
- package/sources/client.js +6 -1
- package/sources/host/auth-methods.js +73 -15
- package/sources/modules/rag/config.js +2 -2
- package/sources/modules/rag/embed-worker.js +10 -1
- package/sources/modules/rag/extract.js +3 -1
- package/sources/modules/rag/indexer.js +3 -3
- package/sources/modules/user-profile/user-profile.js +14 -3
- package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +0 -7
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +0 -43
- package/$server/$folder/lib/file-viewer/file-viewer.js +0 -9
|
@@ -65,8 +65,18 @@ export class $handler extends $class{
|
|
|
65
65
|
get allowUse(){
|
|
66
66
|
return this.DATA?.allowUse;
|
|
67
67
|
}
|
|
68
|
+
_baseImportPath(item = this) {
|
|
69
|
+
const p = String(item?.path || '');
|
|
70
|
+
const s = String(item?.short || '');
|
|
71
|
+
const ctxShort = String(item?.$context?.short || '').replace(/\/+$/, '');
|
|
72
|
+
if (ctxShort && ctxShort !== '/' && (s.startsWith('/~/') || p.startsWith('/~/')))
|
|
73
|
+
return ctxShort + (s.startsWith('/~/') ? s : p);
|
|
74
|
+
if (p && !p.startsWith('/~/'))
|
|
75
|
+
return p;
|
|
76
|
+
return s || p;
|
|
77
|
+
}
|
|
68
78
|
async import(path, is){
|
|
69
|
-
path =
|
|
79
|
+
path = this._baseImportPath(this) + '/~/' + (path || 'class.js');
|
|
70
80
|
if(!path.endsWith('.js'))
|
|
71
81
|
path += '.js';
|
|
72
82
|
const module = await import(path);
|
|
@@ -83,7 +93,7 @@ export class $handler extends $class{
|
|
|
83
93
|
}
|
|
84
94
|
if (!comp || typeof comp !== 'object')
|
|
85
95
|
return null;
|
|
86
|
-
const rawPath = this.
|
|
96
|
+
const rawPath = this._baseImportPath(this) || this.id;
|
|
87
97
|
const want = is || comp.is || rawExport.tag || makeViewTag(this.id, rawPath);
|
|
88
98
|
// Клонируем описание компонента с сохранением дескрипторов (геттеры/сеттеры),
|
|
89
99
|
// чтобы регистрация в WORK/ODA не мутировала кэшированный ES-модуль.
|
|
@@ -163,7 +173,7 @@ export class $handler extends $class{
|
|
|
163
173
|
async getModule() {
|
|
164
174
|
const $item = Reactor.activate(this);
|
|
165
175
|
$item.$context = await $item.$context;
|
|
166
|
-
const module = await import(`${
|
|
176
|
+
const module = await import(`${this._baseImportPath($item)}/~/class.js`);
|
|
167
177
|
return module.default;
|
|
168
178
|
}
|
|
169
179
|
}
|
package/sources/client.js
CHANGED
|
@@ -465,17 +465,22 @@ WORK.login = async function(force = false){
|
|
|
465
465
|
try { sessionStorage.removeItem('work.pendingInviteToken'); } catch { /* ignore */ }
|
|
466
466
|
}
|
|
467
467
|
WORK.uid = uid;
|
|
468
|
+
WORK._anonExitSynced = false;
|
|
468
469
|
await WORK.syncAuthUI();
|
|
469
470
|
WORK.refreshChatUnread?.();
|
|
470
471
|
WORK.notifyAuth?.({ uid, reason: 'login' });
|
|
471
472
|
return res;
|
|
472
473
|
}
|
|
474
|
+
const hadAuth = Boolean(WORK.uid);
|
|
473
475
|
if (WORK.uid)
|
|
474
476
|
await WORK.removeCurrentPushSubscription?.();
|
|
475
477
|
WORK.uid = '';
|
|
476
478
|
WORK.USER = undefined;
|
|
477
479
|
WORK.chatUnread = { total: 0, byThread: {}, byNode: {}, byPeer: {} };
|
|
478
|
-
|
|
480
|
+
if (hadAuth || !WORK._anonExitSynced) {
|
|
481
|
+
WORK._anonExitSynced = true;
|
|
482
|
+
await WORK.fetch("/", 'user_exit', {}, {}).catch(() => {});
|
|
483
|
+
}
|
|
479
484
|
await WORK.syncAuthUI();
|
|
480
485
|
WORK.notifyAuth?.({ uid: '', reason: 'logout' });
|
|
481
486
|
})();
|
|
@@ -19,6 +19,21 @@ const UID_RE = /^[0-9A-F]{16}$/;
|
|
|
19
19
|
/** Незавершённые входы: challengeId → { value, uid, expiresAt }. Одноразовые, со сроком. */
|
|
20
20
|
const pendingLogins = new Map();
|
|
21
21
|
|
|
22
|
+
/** Незавершённые регистрации (до проверки кода): registrationId → { id, uid, email, code, at, attempts }. */
|
|
23
|
+
const pendingRegistrations = new Map();
|
|
24
|
+
|
|
25
|
+
/** Подтверждённые кодом регистрации (ожидание подписи ключа): registrationId → credentials. */
|
|
26
|
+
const pendingVerifiedRegistrations = new Map();
|
|
27
|
+
|
|
28
|
+
function prunePendingRegistrations(now = Date.now()) {
|
|
29
|
+
for (const [id, r] of pendingRegistrations)
|
|
30
|
+
if (!r?.at || now - r.at > REGISTER_CODE_TTL_MS)
|
|
31
|
+
pendingRegistrations.delete(id);
|
|
32
|
+
for (const [id, c] of pendingVerifiedRegistrations)
|
|
33
|
+
if (!c?.at || now - c.at > REGISTER_CODE_TTL_MS)
|
|
34
|
+
pendingVerifiedRegistrations.delete(id);
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
/** Отправки кода по адресу: защита от почтовой бомбардировки и перебора. */
|
|
23
38
|
const startsByEmail = new Map();
|
|
24
39
|
|
|
@@ -78,7 +93,7 @@ async function isFirstOrBossUser(uid) {
|
|
|
78
93
|
|
|
79
94
|
export const authMethods = {
|
|
80
95
|
async user_register_start(params = {}) {
|
|
81
|
-
let { uid, email, inviteToken } = params.post || {};
|
|
96
|
+
let { uid, email, inviteToken, registrationId: postRegId } = params.post || {};
|
|
82
97
|
if (!email || typeof email !== 'string')
|
|
83
98
|
throw new Error("Не указан email");
|
|
84
99
|
const expected = uidOfEmail(email);
|
|
@@ -87,8 +102,24 @@ export const authMethods = {
|
|
|
87
102
|
uid = expected;
|
|
88
103
|
let session = params.session;
|
|
89
104
|
throttleStart(session, email);
|
|
105
|
+
const now = Date.now();
|
|
106
|
+
prunePendingRegistrations(now);
|
|
107
|
+
const rawRegId = postRegId ?? params.registrationId;
|
|
108
|
+
let regId;
|
|
109
|
+
if (rawRegId != null && rawRegId !== '') {
|
|
110
|
+
regId = String(rawRegId).trim();
|
|
111
|
+
if (regId.length > 64 || pendingRegistrations.has(regId) || pendingVerifiedRegistrations.has(regId))
|
|
112
|
+
throw new Error("Неверный registrationId");
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
regId = crypto.randomUUID();
|
|
116
|
+
}
|
|
117
|
+
if (pendingRegistrations.size >= 10_000)
|
|
118
|
+
throw new Error("Слишком много незавершённых регистраций, повторите позже");
|
|
90
119
|
let code = crypto.randomInt(0, 1_000_000).toString().padStart(6, '0');
|
|
91
|
-
|
|
120
|
+
const reg = { id: regId, uid, email, code, at: now, attempts: 0 };
|
|
121
|
+
session.registration = reg;
|
|
122
|
+
pendingRegistrations.set(regId, reg);
|
|
92
123
|
delete session.credentials;
|
|
93
124
|
if (DEV_MODE) {
|
|
94
125
|
console.log('[DEV] Registration code for', email, ':', code);
|
|
@@ -152,25 +183,38 @@ export const authMethods = {
|
|
|
152
183
|
},
|
|
153
184
|
|
|
154
185
|
async user_register_process(params = {}) {
|
|
155
|
-
let { name, surname, patronymic } = params.post || {};
|
|
156
|
-
let { code, session } = params;
|
|
157
|
-
const
|
|
186
|
+
let { name, surname, patronymic, registrationId: postRegId } = params.post || {};
|
|
187
|
+
let { code, session, registrationId: queryRegId } = params;
|
|
188
|
+
const regId = String(queryRegId || postRegId || '').trim();
|
|
189
|
+
prunePendingRegistrations();
|
|
190
|
+
const reg = regId
|
|
191
|
+
? (pendingRegistrations.get(regId) || (session.registration?.id === regId ? session.registration : null))
|
|
192
|
+
: session.registration;
|
|
158
193
|
if (!reg || Date.now() - reg.at > REGISTER_CODE_TTL_MS) {
|
|
159
|
-
|
|
194
|
+
if (reg?.id)
|
|
195
|
+
pendingRegistrations.delete(reg.id);
|
|
196
|
+
if (!reg || session.registration === reg)
|
|
197
|
+
delete session.registration;
|
|
160
198
|
throw new Error("Срок действия проверочного кода истёк");
|
|
161
199
|
}
|
|
162
200
|
if (++reg.attempts > REGISTER_MAX_ATTEMPTS) {
|
|
163
|
-
|
|
201
|
+
if (reg.id)
|
|
202
|
+
pendingRegistrations.delete(reg.id);
|
|
203
|
+
if (session.registration === reg)
|
|
204
|
+
delete session.registration;
|
|
164
205
|
throw new Error("Превышено число попыток ввода кода, запросите новый");
|
|
165
206
|
}
|
|
166
207
|
if (!sameCode(reg.code, code)) {
|
|
167
208
|
audit('register_code_fail', { email: reg.email, attempts: reg.attempts, params });
|
|
168
209
|
throw new Error("Введен неверный проверочный код");
|
|
169
210
|
}
|
|
170
|
-
|
|
211
|
+
if (reg.id)
|
|
212
|
+
pendingRegistrations.delete(reg.id);
|
|
213
|
+
if (session.registration === reg)
|
|
214
|
+
delete session.registration;
|
|
171
215
|
const { uid, email } = reg;
|
|
172
216
|
let label = ((surname || '') + ' ' + (name || '') + ' ' + (patronymic || '')).trim() || email;
|
|
173
|
-
|
|
217
|
+
const credentials = {
|
|
174
218
|
uid,
|
|
175
219
|
service: "WORK (Extensible Fractal File System)",
|
|
176
220
|
origin: HOST,
|
|
@@ -180,14 +224,21 @@ export const authMethods = {
|
|
|
180
224
|
challenge: crypto.randomUUID(),
|
|
181
225
|
verified: true,
|
|
182
226
|
};
|
|
227
|
+
session.credentials = credentials;
|
|
228
|
+
if (reg.id)
|
|
229
|
+
pendingVerifiedRegistrations.set(reg.id, { ...credentials, at: Date.now() });
|
|
183
230
|
return session.credentials;
|
|
184
231
|
},
|
|
185
232
|
|
|
186
233
|
async user_register_finish(params = {}) {
|
|
187
|
-
let { credentials: { uid: postUid, icon, surname, name, patronymic, publicKey, time } = {}, signature, inviteToken } = params.post || {};
|
|
234
|
+
let { credentials: { uid: postUid, icon, surname, name, patronymic, publicKey, time } = {}, signature, inviteToken, registrationId: postRegId } = params.post || {};
|
|
188
235
|
let session = params.session;
|
|
189
|
-
|
|
190
|
-
|
|
236
|
+
const regId = String(postRegId || params.registrationId || '').trim();
|
|
237
|
+
prunePendingRegistrations();
|
|
238
|
+
// uid и email — только из проверенной кодом регистрации (в сессии или по registrationId)
|
|
239
|
+
const pendingVerified = regId ? pendingVerifiedRegistrations.get(regId) : null;
|
|
240
|
+
const verified = (pendingVerified?.verified ? pendingVerified : null)
|
|
241
|
+
|| (session.credentials?.verified ? session.credentials : null);
|
|
191
242
|
if (!verified || !UID_RE.test(verified.uid))
|
|
192
243
|
throw new Error("registration failed: адрес не подтверждён");
|
|
193
244
|
const { uid, email } = verified;
|
|
@@ -204,7 +255,7 @@ export const authMethods = {
|
|
|
204
255
|
{ name: "RSASSA-PKCS1-v1_5" },
|
|
205
256
|
PK,
|
|
206
257
|
Buffer.from(signature, "base64"),
|
|
207
|
-
new TextEncoder().encode(
|
|
258
|
+
new TextEncoder().encode(verified.challenge)
|
|
208
259
|
);
|
|
209
260
|
}
|
|
210
261
|
catch {
|
|
@@ -212,9 +263,13 @@ export const authMethods = {
|
|
|
212
263
|
}
|
|
213
264
|
if (!isValid) {
|
|
214
265
|
// Одноразовый challenge: после неверной подписи требуется заново подтвердить код
|
|
266
|
+
if (regId)
|
|
267
|
+
pendingVerifiedRegistrations.delete(regId);
|
|
215
268
|
delete session.credentials;
|
|
216
269
|
throw new Error("registration failed");
|
|
217
270
|
}
|
|
271
|
+
if (regId)
|
|
272
|
+
pendingVerifiedRegistrations.delete(regId);
|
|
218
273
|
|
|
219
274
|
let iconBytes = null;
|
|
220
275
|
let base64Image = typeof icon === 'string' ? icon.split(';base64,').pop() : null;
|
|
@@ -411,9 +466,12 @@ export const authMethods = {
|
|
|
411
466
|
const { session } = params;
|
|
412
467
|
const uid = session?.uid;
|
|
413
468
|
if (!uid) {
|
|
414
|
-
|
|
469
|
+
// Анонимная сессия: не затираем незавершённую регистрацию (registration / credentials),
|
|
470
|
+
// чтобы фоновый user_exit при переподключении WebSocket или в другой вкладке не срывал ввод кода.
|
|
471
|
+
if (session)
|
|
472
|
+
delete session.challenge;
|
|
415
473
|
const { time } = params.post || {};
|
|
416
|
-
if (time)
|
|
474
|
+
if (time && session)
|
|
417
475
|
delete session[time];
|
|
418
476
|
return "Выход выполнен";
|
|
419
477
|
}
|
|
@@ -27,8 +27,8 @@ export const CONFIG = {
|
|
|
27
27
|
maxFileBytes: 20 * 1024 * 1024,
|
|
28
28
|
maxTextChars: 400_000,
|
|
29
29
|
/** Корневые папки и имена, которые не индексируются никогда. */
|
|
30
|
-
excludeRoots: ['node_modules', 'sources', 'oda', 'tests', 'scripts', 'torus'],
|
|
31
|
-
excludeNames: ['node_modules', '#secret', '#system', 'INDEX', '.git', '.svn', '.index', '.RAG', '.cursor', '.vscode'],
|
|
30
|
+
excludeRoots: ['node_modules', 'sources', 'oda', 'tests', 'scripts', 'torus', 'license-server'],
|
|
31
|
+
excludeNames: ['node_modules', '#secret', '#system', '#runtime', '#weights', '#datasets', '#adapters', '#cache', '#tmp', '#downloads', '#media', 'INDEX', '.git', '.svn', '.index', '.RAG', '.cursor', '.vscode'],
|
|
32
32
|
/** Текст, извлекаемый как есть. */
|
|
33
33
|
textExts: ['md', 'markdown', 'txt', 'csv', 'tsv', 'yaml', 'yml', 'skill', 'ai', 'chat', 'rst', 'adoc'],
|
|
34
34
|
/** Документы, извлекаемые Kreuzberg / разбором таблиц. */
|
|
@@ -7,6 +7,9 @@ import { pipeline, env } from '@huggingface/transformers';
|
|
|
7
7
|
|
|
8
8
|
// модели — вне дерева индексации и вне git; WORK_RAG_CACHE — общее хранилище (прогоны eval)
|
|
9
9
|
env.cacheDir = process.env.WORK_RAG_CACHE || './.index/hf';
|
|
10
|
+
const ragThreads = Math.max(1, Math.min(2, Number(process.env.WORK_RAG_THREADS) || 2));
|
|
11
|
+
if (env.backends?.onnx?.wasm)
|
|
12
|
+
env.backends.onnx.wasm.numThreads = ragThreads;
|
|
10
13
|
|
|
11
14
|
let extractor = null;
|
|
12
15
|
let loadedKey = '';
|
|
@@ -14,7 +17,13 @@ let loadedKey = '';
|
|
|
14
17
|
async function getExtractor(model, dtype) {
|
|
15
18
|
const key = model + '|' + dtype;
|
|
16
19
|
if (!extractor || loadedKey !== key) {
|
|
17
|
-
extractor = await pipeline('feature-extraction', model, {
|
|
20
|
+
extractor = await pipeline('feature-extraction', model, {
|
|
21
|
+
dtype,
|
|
22
|
+
session_options: {
|
|
23
|
+
intraOpNumThreads: ragThreads,
|
|
24
|
+
interOpNumThreads: 1,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
18
27
|
loadedKey = key;
|
|
19
28
|
}
|
|
20
29
|
return extractor;
|
|
@@ -68,7 +68,7 @@ export function isExcluded(p, { allowHidden = false } = {}) {
|
|
|
68
68
|
if (excludeRoots.has(segs[0]))
|
|
69
69
|
return true;
|
|
70
70
|
for (const s of segs) {
|
|
71
|
-
if (excludeNames.has(s))
|
|
71
|
+
if (excludeNames.has(s) || s[0] === '#')
|
|
72
72
|
return true;
|
|
73
73
|
if (!allowHidden && s[0] === '.')
|
|
74
74
|
return true;
|
|
@@ -87,6 +87,8 @@ export function kindOf(p) {
|
|
|
87
87
|
if (name === 'class.js') {
|
|
88
88
|
const meta = segs[segs.length - 2];
|
|
89
89
|
const owner = segs[segs.length - 3];
|
|
90
|
+
if (meta === '$handler' || meta === '$method' || meta === '$trigger')
|
|
91
|
+
return null;
|
|
90
92
|
if (meta?.[0] === '$' && (owner === undefined || owner[0] !== '$'))
|
|
91
93
|
return 'class';
|
|
92
94
|
return null;
|
|
@@ -79,8 +79,8 @@ async function drain() {
|
|
|
79
79
|
failures++;
|
|
80
80
|
note(p + ': ' + e.message);
|
|
81
81
|
}
|
|
82
|
-
// уступить циклу событий между документами, чтобы
|
|
83
|
-
await new Promise(r => setTimeout(r,
|
|
82
|
+
// уступить циклу событий между документами, чтобы фоновая индексация не загружала систему
|
|
83
|
+
await new Promise(r => setTimeout(r, 50));
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
finally {
|
|
@@ -234,7 +234,7 @@ export async function reconcile() {
|
|
|
234
234
|
if (onDisk.has(p))
|
|
235
235
|
continue;
|
|
236
236
|
// снимки из лент индексируются принудительно и обходом не видны — проверяем наличие файла
|
|
237
|
-
if (fs.existsSync(diskOf(p)))
|
|
237
|
+
if (!isExcluded(p) && kindOf(p) && fs.existsSync(diskOf(p)))
|
|
238
238
|
continue;
|
|
239
239
|
store.removeDocs(p);
|
|
240
240
|
reconcileState.removed++;
|
|
@@ -347,8 +347,10 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
347
347
|
case 'changed':
|
|
348
348
|
case 'unregistered': {
|
|
349
349
|
try {
|
|
350
|
-
const
|
|
350
|
+
const registrationId = globalThis.crypto?.randomUUID?.() || WORK.genGUID?.() || (Date.now().toString(36) + Math.random().toString(36).slice(2));
|
|
351
|
+
const regPayload = { ...this.params, registrationId, ...(this.pendingInviteToken ? { inviteToken: this.pendingInviteToken } : {}) };
|
|
351
352
|
const res = await WORK.fetch("/", 'user_register_start', {}, regPayload);
|
|
353
|
+
this._registrationId = registrationId;
|
|
352
354
|
if (res && typeof res === 'object' && res.autoCode) {
|
|
353
355
|
this.text = res.message || 'Идет процесс регистрации ключа безопасности...';
|
|
354
356
|
await this._onCode({ detail: { value: res.autoCode } });
|
|
@@ -370,9 +372,10 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
370
372
|
this.text = "Идет процесс регистрации ключа безопасности...";
|
|
371
373
|
this.showCode = false;
|
|
372
374
|
let code = await e.detail.value;
|
|
375
|
+
const regQuery = { code, ...(this._registrationId ? { registrationId: this._registrationId } : {}) };
|
|
373
376
|
|
|
374
377
|
// 1. Проверяем код и получаем challenge
|
|
375
|
-
let options = await WORK.fetch("/", 'user_register_process',
|
|
378
|
+
let options = await WORK.fetch("/", 'user_register_process', regQuery, this.params);
|
|
376
379
|
|
|
377
380
|
// 2. Создаем ключи
|
|
378
381
|
const keyPair = await window.crypto.subtle.generateKey({
|
|
@@ -391,8 +394,14 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
391
394
|
// 3. Подписываем challenge
|
|
392
395
|
let signature = await crypto.subtle.sign({ name: "RSASSA-PKCS1-v1_5" }, keyPair.privateKey, new TextEncoder().encode(options.challenge));
|
|
393
396
|
signature = WORK.arrayBufferToBase64(signature);
|
|
394
|
-
const finishPayload = {
|
|
397
|
+
const finishPayload = {
|
|
398
|
+
signature,
|
|
399
|
+
credentials: this.params,
|
|
400
|
+
...(this._registrationId ? { registrationId: this._registrationId } : {}),
|
|
401
|
+
...(this.pendingInviteToken ? { inviteToken: this.pendingInviteToken } : {}),
|
|
402
|
+
};
|
|
395
403
|
const resp = await WORK.fetch("/", 'user_register_finish', {}, finishPayload);
|
|
404
|
+
this._registrationId = '';
|
|
396
405
|
if (this.pendingInviteToken) {
|
|
397
406
|
try { sessionStorage.removeItem('work.pendingInviteToken'); } catch { /* ignore */ }
|
|
398
407
|
this.pendingInviteToken = '';
|
|
@@ -414,6 +423,8 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
414
423
|
this.isLogin = undefined;
|
|
415
424
|
}
|
|
416
425
|
catch (e) {
|
|
426
|
+
if (/неверный проверочный код/i.test(e?.message || ''))
|
|
427
|
+
this.showCode = true;
|
|
417
428
|
this.text = e.message;
|
|
418
429
|
}
|
|
419
430
|
},
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
icon: 'bootstrap:database-fill-gear',
|
|
3
|
-
/** Хранилище — только роль BOSS. */
|
|
4
|
-
roles: ['BOSS'],
|
|
5
|
-
component: {
|
|
6
|
-
imports: '~/lib//explorer.js',
|
|
7
|
-
extends: 'item-explorer',
|
|
8
|
-
hideTops: 0,
|
|
9
|
-
hideRoots: 1,
|
|
10
|
-
showSize: true,
|
|
11
|
-
cleanStructure: false,
|
|
12
|
-
itemsSelector: 'entries',
|
|
13
|
-
_resolvedStorageFolder: null,
|
|
14
|
-
async ready() {
|
|
15
|
-
await this._switchToStorageFolder();
|
|
16
|
-
},
|
|
17
|
-
async attached() {
|
|
18
|
-
await this._switchToStorageFolder();
|
|
19
|
-
},
|
|
20
|
-
$observers: {
|
|
21
|
-
async _itemChanged($item) {
|
|
22
|
-
if ($item && $item !== this._resolvedStorageFolder) {
|
|
23
|
-
await this._switchToStorageFolder();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
async _switchToStorageFolder() {
|
|
28
|
-
const src = this.$item;
|
|
29
|
-
if (!src || src === this._resolvedStorageFolder) return;
|
|
30
|
-
this.$context = src;
|
|
31
|
-
const sf = await src.storage_folder;
|
|
32
|
-
if (sf && this.$item === src) {
|
|
33
|
-
this._resolvedStorageFolder = sf;
|
|
34
|
-
this.$item = sf;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
$public: {
|
|
38
|
-
get allowUse() {
|
|
39
|
-
return this.$item?.constructor?.name !== '$file';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|