odant-work 1.0.67 → 1.0.69
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/package-manifest.json +9 -9
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +21 -21
- package/$server/$folder/handlers/pages/form/$handler/form.js +3 -10
- package/$server/$folder/lib/explorer/explorer.js +27 -30
- package/package.json +1 -1
- package/sources/client/handler.js +15 -27
- package/sources/host/auto-updater.js +109 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.69",
|
|
4
4
|
"createdAt": 1795100682741,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1795531799936,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "f8cc866fdf19cc60af10f67331d4f64d5781933bdbca4fa576e6b7e41d338e91",
|
|
9
|
+
"package-lock.json": "974c12e461c03b97c923460cec355b3b7dac2ba4a80b9fdbda140df7b1855964",
|
|
10
10
|
"sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
|
|
11
11
|
"sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
|
|
12
12
|
"sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
|
|
13
13
|
"sources/client/folder.js": "a1f711199a5defd52ea3ad98878d812f08d349428109dddf9305c5e6beb64844",
|
|
14
|
-
"sources/client/handler.js": "
|
|
14
|
+
"sources/client/handler.js": "8c19284248fbe61272ef9e59c72e5beaf5cfd3cfab1ee03d0796901d95679b6c",
|
|
15
15
|
"sources/client/index.js": "037ff635b149a617adf1219d34f0ba9dd936d5f60cea59e62d276a49468c3dc3",
|
|
16
16
|
"sources/client/readme.md": "a50aa4aa3a90606b2f446e2d29166aa26175ae87539901299e9347322ae4a2fe",
|
|
17
17
|
"sources/client/user.js": "bd5de82f24ae437291c22c06d21ea32847fdd5b6bc8e6be5efb37058680c9c9f",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"sources/data/time.js": "cb34c1137685e83265938bb007859dfc1fca3548588d1663ee01e1affc87a09a",
|
|
37
37
|
"sources/data/workspace.js": "afbc007c16a26e86de2753794e0e7387218e97aba378047a5f37ea7961e3e921",
|
|
38
38
|
"sources/host/auth-methods.js": "d3373f072a0b31f1c689beffba144c334c848cb4a0a0a3a74f6146ff8e1292d0",
|
|
39
|
-
"sources/host/auto-updater.js": "
|
|
39
|
+
"sources/host/auto-updater.js": "fbab9f06c508e079a8c055a1ca7a9fd61bba22ba396f5f85204883cbe19b79e9",
|
|
40
40
|
"sources/host/babel-merge.js": "11d5b65cae03aeabd09f06f65bee78f6fd0131eab125cc87c0dcaaf2d10e08a5",
|
|
41
41
|
"sources/host/config.js": "f41058d2ef46afc0ac5e262a0f31064d3288ab3794c4d45c0761498e775f60ae",
|
|
42
42
|
"sources/host/email-utils.js": "618f474b92c85675aeeb7584c1ef7d73441b9efc1463b9b836e7facb86e5d558",
|
|
@@ -690,7 +690,7 @@
|
|
|
690
690
|
"$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js": "e59ce816ef95d3ed4da5e18818fb0e81d55dfbbe50b7ff06cdf43e3b106f18ee",
|
|
691
691
|
"$server/$folder/$class/handlers/pages/form/readme.md": "6760a39b22785b6370ed4a525b0602c104f7beb64e9e9847894d7c6560902531",
|
|
692
692
|
"$server/$folder/$class/handlers/pages/storage/$handler/class.js": "145bd7569e5018554eb0e90a27dbeb52d44eb64629268bca7c588d2f1acc44af",
|
|
693
|
-
"$server/$folder/$class/handlers/pages/storage/$handler/storage.js": "
|
|
693
|
+
"$server/$folder/$class/handlers/pages/storage/$handler/storage.js": "d9c740f3cf300d6563e7760c946ff5250471a2b9f1785512998137ccf617f518",
|
|
694
694
|
"$server/$folder/$class/icon.png": "b0c0d28bb28125dac7e1305bca10569fb055d856261455d336931bc57a4705c1",
|
|
695
695
|
"$server/$folder/$class/readme.md": "065de50c55b84bd4a01155d96040e14ebffe51accb6dc828bd62af8f7e131c3c",
|
|
696
696
|
"$server/$folder/$file/$audio/handlers/preview/$handler/class.js": "a001a5e9aca1a07b906ed08a2b107ae8dd27f26351c294ea8d7b0f1e584b57c7",
|
|
@@ -777,7 +777,7 @@
|
|
|
777
777
|
"$server/$folder/handlers/methods/help/$handler/class.js": "ff54bf976cbdc846d7c1b46ff12b111e99a3f4831240a4e420b73c98c0355a5c",
|
|
778
778
|
"$server/$folder/handlers/methods/info/$handler/class.js": "8752efb28abdcfad4e8ce56cfebcd8bb09ec0735cba7b84156d248bfcb0f9db0",
|
|
779
779
|
"$server/$folder/handlers/pages/form/$handler/class.js": "3902d3e1a8742afa2625410f97c68a3afac2559bd3d8f37044338edf7386d4df",
|
|
780
|
-
"$server/$folder/handlers/pages/form/$handler/form.js": "
|
|
780
|
+
"$server/$folder/handlers/pages/form/$handler/form.js": "8f179f5828e0ccbed6ce7f32500638d51cb04e11c9ac02d817117486b6ad92a2",
|
|
781
781
|
"$server/$folder/handlers/readme.md": "1167594c32f46323d229098a72e80a9865005c347373fdacef5af69838a0f8eb",
|
|
782
782
|
"$server/$folder/lib/calendar-form/calendar-form.js": "3035cab0a489c891d7dd7ed52ae5c475068b97361a1f7c855d500a0823614d1c",
|
|
783
783
|
"$server/$folder/lib/chat-item/chat-item.js": "6af09b84e5ef31c7e22007ba763bccf874d642afeff359414400ec36d4d5c560",
|
|
@@ -792,7 +792,7 @@
|
|
|
792
792
|
"$server/$folder/lib/dot/readme.md": "22d9981d9b1b39e870623f8eedcc562ed4f6c6638d0ddeb853244bd55df3c60f",
|
|
793
793
|
"$server/$folder/lib/editor-form/editor-form.js": "7dee223a9613df2f7091e0d330142252a87a438062de9cec56002943745e5ba1",
|
|
794
794
|
"$server/$folder/lib/email/settings.js": "25e13ecf12b84e5fd6bcac955b1e0dc47bf09b72a98776e8ce1e1f01617aef9d",
|
|
795
|
-
"$server/$folder/lib/explorer/explorer.js": "
|
|
795
|
+
"$server/$folder/lib/explorer/explorer.js": "96004ccf61f456c1b3118a6e5180d851a268f0e0caa9cf0bc5e9dfa077e6d060",
|
|
796
796
|
"$server/$folder/lib/file-viewer/file-viewer.js": "b183fd61b72fcc7baba3e44e16ddf3800553596313711a7bc4dd91f3e1e260ab",
|
|
797
797
|
"$server/$folder/lib/icon/icon.js": "fdb15cf37421b60d3362f3c47a2a759a2faafe194547841718ad448df36462d0",
|
|
798
798
|
"$server/$folder/lib/icon/user/user.js": "481da79de754c244f0151c91d03a503c0452902575e4dc8bc2b3171c0fad3a2e",
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
icon: 'bootstrap:database-fill-gear',
|
|
3
|
-
imports: '~/lib//explorer.js',
|
|
4
|
-
extends: 'item-explorer',
|
|
5
|
-
hideTops: 0,
|
|
6
|
-
hideRoots: 1,
|
|
7
|
-
showSize: true,
|
|
8
|
-
itemsSelector: 'entries',
|
|
9
|
-
async ready() {
|
|
10
|
-
if (this.$item) {
|
|
11
|
-
this.$context = this.$item;
|
|
12
|
-
this.$item = undefined;
|
|
13
|
-
this.$item = await this.$context.storage_folder;
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
$public: {
|
|
17
|
-
get allowUse() {
|
|
18
|
-
return this.$item?.
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
icon: 'bootstrap:database-fill-gear',
|
|
3
|
+
imports: '~/lib//explorer.js',
|
|
4
|
+
extends: 'item-explorer',
|
|
5
|
+
hideTops: 0,
|
|
6
|
+
hideRoots: 1,
|
|
7
|
+
showSize: true,
|
|
8
|
+
itemsSelector: 'entries',
|
|
9
|
+
async ready() {
|
|
10
|
+
if (this.$item) {
|
|
11
|
+
this.$context = this.$item;
|
|
12
|
+
this.$item = undefined;
|
|
13
|
+
this.$item = await this.$context.storage_folder;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
$public: {
|
|
17
|
+
get allowUse() {
|
|
18
|
+
return this.$item?.constructor?.name !== '$file';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -184,8 +184,7 @@ ODA({is: 'work-form',
|
|
|
184
184
|
<div :flex="ODA.states?.mobileMode"></div>
|
|
185
185
|
<item-node-explorer no-flex :$item="rootItem"></item-node-explorer>
|
|
186
186
|
<div flex></div>
|
|
187
|
-
<oda-button ~if="
|
|
188
|
-
<oda-button id="consultantBtn" shadow icon="bootstrap:robot" @tap="askConsultant" title="Спросить ИИ-консультанта по текущей форме" :icon-size info-invert style="border-radius: 50%; margin-right: 8px; flex-shrink: 0;"></oda-button>
|
|
187
|
+
<oda-button ~if="showConsultantBtn" id="consultantBtn" shadow icon="bootstrap:robot" @tap="askConsultant" title="Спросить ИИ-консультанта по текущей форме" :icon-size info-invert style="border-radius: 50%; margin-right: 8px; flex-shrink: 0;"></oda-button>
|
|
189
188
|
<oda-button shadow icon="communication:call" @tap="call" title="Call..." :icon-size success style="border-radius: 50%;margin-right:32px;"></oda-button>
|
|
190
189
|
<slot name="top-panel"></slot>
|
|
191
190
|
<div class="view-selector" no-flex horizontal style="justify-content: space-between; overflow: hidden;">
|
|
@@ -907,15 +906,9 @@ ODA({is: 'work-form',
|
|
|
907
906
|
_syncingClassTreeFocus: false,
|
|
908
907
|
view_control: null,
|
|
909
908
|
_noClassTreeFlag: false,
|
|
910
|
-
get
|
|
909
|
+
get showConsultantBtn() {
|
|
911
910
|
const t = this.currentItem?.type;
|
|
912
|
-
return t
|
|
913
|
-
},
|
|
914
|
-
openDataPage() {
|
|
915
|
-
const target = this.currentItem;
|
|
916
|
-
const execFn = (typeof window !== 'undefined' && (window.top?.execute || window.execute)) || null;
|
|
917
|
-
if (target && execFn)
|
|
918
|
-
execFn(target, { page: 'data' });
|
|
911
|
+
return Boolean(t) && !['$server', '$base', '$project', '$structure', '$user'].includes(t);
|
|
919
912
|
},
|
|
920
913
|
get hasClassTree() {
|
|
921
914
|
if (this._noClassTreeFlag)
|
|
@@ -31,6 +31,8 @@ export default {
|
|
|
31
31
|
bookmarks: [],
|
|
32
32
|
focusedPage: '',
|
|
33
33
|
get hasBookmarks() {
|
|
34
|
+
if (typeof window !== 'undefined' && window !== window.top)
|
|
35
|
+
return false;
|
|
34
36
|
return !this.mobile && Array.isArray(this.bookmarks) && this.bookmarks.length > 0 && this.visibleMode === 'main';
|
|
35
37
|
},
|
|
36
38
|
get bookmarkTabItems() {
|
|
@@ -101,6 +103,8 @@ export default {
|
|
|
101
103
|
* через ~props логический `hidden` не применяет, поэтому кнопка висела всегда.
|
|
102
104
|
*/
|
|
103
105
|
_buildLeftButtons() {
|
|
106
|
+
if (typeof window !== 'undefined' && window !== window.top)
|
|
107
|
+
return [];
|
|
104
108
|
const user = WORK.USER;
|
|
105
109
|
const buttons = [];
|
|
106
110
|
if (top.RTCCaller?.current_call) {
|
|
@@ -197,7 +201,7 @@ export default {
|
|
|
197
201
|
get icon() {
|
|
198
202
|
return this.$handler?.icon;
|
|
199
203
|
},
|
|
200
|
-
hideRoots:
|
|
204
|
+
hideRoots: 2,
|
|
201
205
|
hideTops: 0,
|
|
202
206
|
itemsSelector: 'items',
|
|
203
207
|
|
|
@@ -373,7 +377,7 @@ export default {
|
|
|
373
377
|
}
|
|
374
378
|
catch { /* ignore */ }
|
|
375
379
|
},
|
|
376
|
-
_upsertBookmarkForUrl(pageUrl, $item = null
|
|
380
|
+
_upsertBookmarkForUrl(pageUrl, $item = null) {
|
|
377
381
|
if (!pageUrl)
|
|
378
382
|
return null;
|
|
379
383
|
const short = $item?.short || $item?.path || this._extractShortFromUrl(pageUrl);
|
|
@@ -384,8 +388,7 @@ export default {
|
|
|
384
388
|
if (!bm) {
|
|
385
389
|
const lastSeg = String(short || '').split('/').filter(Boolean).pop() || '';
|
|
386
390
|
const dated = CORE?.$file?.formatDatedFileLabel?.($item?.id || lastSeg, $item?.DATA?.label);
|
|
387
|
-
const
|
|
388
|
-
const label = pagePrefix ? `${pagePrefix} · ${baseLabel}` : baseLabel;
|
|
391
|
+
const label = dated || $item?.DATA?.label || $item?.label || this._defaultLabelForShort(short);
|
|
389
392
|
bm = {
|
|
390
393
|
url: pageUrl,
|
|
391
394
|
hash,
|
|
@@ -393,17 +396,15 @@ export default {
|
|
|
393
396
|
stateKey: itemStateKey,
|
|
394
397
|
label,
|
|
395
398
|
title: `${label} (${short})`,
|
|
396
|
-
icon:
|
|
399
|
+
icon: this._defaultIconForItem($item, short),
|
|
397
400
|
};
|
|
398
401
|
list.push(bm);
|
|
399
402
|
this.bookmarks = list;
|
|
400
|
-
|
|
401
|
-
setTimeout(() => this._hydrateBookmarkMeta(bm, { cachedOnly: true }), 800);
|
|
403
|
+
setTimeout(() => this._hydrateBookmarkMeta(bm, { cachedOnly: true }), 800);
|
|
402
404
|
}
|
|
403
405
|
else if ($item) {
|
|
404
|
-
const
|
|
405
|
-
const
|
|
406
|
-
const icon = pageIcon || this._defaultIconForItem($item, short);
|
|
406
|
+
const label = $item?.DATA?.label || $item?.label || bm.label;
|
|
407
|
+
const icon = this._defaultIconForItem($item, short);
|
|
407
408
|
if (itemStateKey)
|
|
408
409
|
bm.stateKey = itemStateKey;
|
|
409
410
|
if (bm.label !== label || bm.icon !== icon) {
|
|
@@ -676,30 +677,22 @@ export default {
|
|
|
676
677
|
window.execute = async ($item, nav) => {
|
|
677
678
|
if (!$item)
|
|
678
679
|
return;
|
|
679
|
-
let pageHandlerMeta = null;
|
|
680
680
|
if ($item.type === '$handler') {
|
|
681
681
|
const rawHPath = String($item.path || $item.short || '');
|
|
682
|
-
const
|
|
682
|
+
const mForm = rawHPath.match(/^(.*?)\/(?:~|\$[^/]+(?:\/\$[^/]+)*)\/handlers\/pages\/form(?:\/([^/$]+))?/);
|
|
683
683
|
const rawSelf = $item[R]?.target || $item;
|
|
684
684
|
const ctx = (Object.prototype.hasOwnProperty.call(rawSelf, '$context') || Object.prototype.hasOwnProperty.call($item, '$context'))
|
|
685
685
|
? await $item.$context
|
|
686
686
|
: null;
|
|
687
687
|
if (ctx && ctx.type !== '$handler') {
|
|
688
|
-
const
|
|
689
|
-
const viewId = pageName === 'form' ? (mPage?.[3] || ($item.id && $item.id !== 'form' ? $item.id : '')) : '';
|
|
690
|
-
pageHandlerMeta = pageName !== 'form'
|
|
691
|
-
? { page: pageName, label: $item.DATA?.label || $item.label || pageName, icon: $item.DATA?.icon || $item.icon || '' }
|
|
692
|
-
: null;
|
|
688
|
+
const viewId = mForm?.[2] || ($item.id && $item.id !== 'form' ? $item.id : '');
|
|
693
689
|
$item = ctx;
|
|
694
|
-
|
|
695
|
-
...(nav && typeof nav === 'object' ? nav : {}),
|
|
696
|
-
...(pageName !== 'form' ? { page: pageName } : (viewId ? { view: viewId } : {})),
|
|
697
|
-
};
|
|
690
|
+
if (viewId)
|
|
691
|
+
nav = { ...(nav && typeof nav === 'object' ? nav : {}), view: viewId };
|
|
698
692
|
}
|
|
699
693
|
}
|
|
700
|
-
const pageName = ($item.type !== '$handler' && nav?.page) ? String(nav.page) : ($item.page || 'form');
|
|
701
694
|
const short = $item?.short ?? $item?.path ?? '';
|
|
702
|
-
const dataRoot = ($item?.type !== '$handler'
|
|
695
|
+
const dataRoot = ($item?.type !== '$handler') ? this._resolveDataRootPath(short, $item) : '';
|
|
703
696
|
const openShort = dataRoot || short;
|
|
704
697
|
const navKey = openShort || '/';
|
|
705
698
|
const effectiveNav = dataRoot
|
|
@@ -714,13 +707,12 @@ export default {
|
|
|
714
707
|
}
|
|
715
708
|
let hash = '#' + openShort;
|
|
716
709
|
if ($item.type !== '$handler')
|
|
717
|
-
hash += '/~/handlers/pages/' +
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
const bm = this._upsertBookmarkForUrl(fullUrl, openShort === short ? $item : null, pageLabelPrefix, pageHandlerMeta?.icon || (pageName === 'data' ? 'carbon:data-base' : ''));
|
|
710
|
+
hash += '/~/handlers/pages/' + ($item.page || 'form');
|
|
711
|
+
const isTop = typeof window === 'undefined' || window === window.top;
|
|
712
|
+
if (isTop)
|
|
713
|
+
history.replaceState(null, '', window.location.pathname + hash);
|
|
714
|
+
const fullUrl = encodeURI(window.location.origin + openShort + ($item.type !== '$handler' ? '/~/handlers/pages/' + ($item.page || 'form') : '') + '/index.html');
|
|
715
|
+
const bm = isTop ? this._upsertBookmarkForUrl(fullUrl, openShort === short ? $item : null) : null;
|
|
724
716
|
if (openShort !== short && bm) {
|
|
725
717
|
const itemStateKey = ($item && ('_stateKey' in Object($item)) && $item._stateKey) ? String($item._stateKey) : '';
|
|
726
718
|
if (itemStateKey && itemStateKey.includes('#place:') && itemStateKey.includes('->')) {
|
|
@@ -786,6 +778,11 @@ export default {
|
|
|
786
778
|
}
|
|
787
779
|
}
|
|
788
780
|
}
|
|
781
|
+
const isTop = typeof window === 'undefined' || window === window.top;
|
|
782
|
+
if (!isTop) {
|
|
783
|
+
this.load_page();
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
789
786
|
const restored = this._restoreBookmarksState();
|
|
790
787
|
const hasInitialHash = Boolean(window.location.hash && window.location.hash !== '#');
|
|
791
788
|
if (!hasInitialHash && restored?.activeUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.69",
|
|
4
4
|
"description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sources/work.js",
|
|
@@ -67,36 +67,17 @@ export class $handler extends $class{
|
|
|
67
67
|
}
|
|
68
68
|
async execute(...params) {
|
|
69
69
|
const rawPath = String(this.path || this.short || '');
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const pageName = pageMatch[1];
|
|
74
|
-
const subView = pageMatch[2] || '';
|
|
70
|
+
const formViewMatch = rawPath.match(/\/handlers\/pages\/form(?:\/([^/$]+))?/);
|
|
71
|
+
if (formViewMatch && window.execute) {
|
|
72
|
+
const viewId = formViewMatch[1] || (this.id && this.id !== 'form' ? this.id : '');
|
|
75
73
|
const rawSelf = this[R]?.target || this;
|
|
76
74
|
const hasOwnCtx = Object.prototype.hasOwnProperty.call(rawSelf, '$context') || Object.prototype.hasOwnProperty.call(this, '$context');
|
|
77
75
|
const ctx = hasOwnCtx ? await this.$context : null;
|
|
78
|
-
const ev = params?.[0];
|
|
79
|
-
if (ev?.ctrlKey || ev?.shiftKey || ev?.metaKey) {
|
|
80
|
-
const targetShort = (ctx && ctx.type !== '$handler' ? ctx.short : this.short) || '';
|
|
81
|
-
const url = (ctx && ctx.type !== '$handler')
|
|
82
|
-
? `${targetShort}/~/handlers/pages/${pageName}/`
|
|
83
|
-
: `${this.short}/`;
|
|
84
|
-
window.open(encodeURI(url), '_blank');
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
let nav;
|
|
88
|
-
if (pageName === 'form') {
|
|
89
|
-
const viewId = subView || (this.id && this.id !== 'form' ? this.id : '');
|
|
90
|
-
nav = viewId ? { view: viewId } : undefined;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
nav = { page: pageName };
|
|
94
|
-
}
|
|
95
76
|
if (ctx && ctx.type !== '$handler') {
|
|
96
|
-
|
|
77
|
+
window.execute(ctx, viewId ? { view: viewId } : undefined);
|
|
97
78
|
return;
|
|
98
79
|
}
|
|
99
|
-
|
|
80
|
+
window.execute(this, viewId ? { view: viewId } : undefined);
|
|
100
81
|
return;
|
|
101
82
|
}
|
|
102
83
|
|
|
@@ -106,11 +87,18 @@ export class $handler extends $class{
|
|
|
106
87
|
return;
|
|
107
88
|
}
|
|
108
89
|
|
|
109
|
-
if (this.short.includes('form') &&
|
|
110
|
-
|
|
90
|
+
if (this.short.includes('form') && window.execute) {
|
|
91
|
+
window.execute(this);
|
|
111
92
|
return;
|
|
112
93
|
}
|
|
113
|
-
|
|
94
|
+
const pageMatch = rawPath.match(/\/handlers\/pages\/([^/$]+)/);
|
|
95
|
+
const rawSelf = this[R]?.target || this;
|
|
96
|
+
const hasOwnCtx = Object.prototype.hasOwnProperty.call(rawSelf, '$context') || Object.prototype.hasOwnProperty.call(this, '$context');
|
|
97
|
+
const ctx = hasOwnCtx ? await this.$context : null;
|
|
98
|
+
const url = (pageMatch && ctx && ctx.type !== '$handler')
|
|
99
|
+
? `${ctx.short || ctx.path || ''}/~/handlers/pages/${pageMatch[1]}/`
|
|
100
|
+
: `${this.short}/`;
|
|
101
|
+
window.open(encodeURI(url), '_blank');
|
|
114
102
|
}
|
|
115
103
|
async showSettings(...params) {
|
|
116
104
|
const module = await this.getModule();
|
|
@@ -430,6 +430,46 @@ export function extractTgzBufferToDir(tgzBuffer, targetDir) {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
+
const LEGACY_REMOVED_SYSTEM_PATHS = [
|
|
434
|
+
'$server/$folder/$class/handlers/pages/form/builder',
|
|
435
|
+
'$server/$folder/$class/$structure/handlers/pages/form/data',
|
|
436
|
+
'$server/$folder/$class/$structure/handlers/pages/form/database',
|
|
437
|
+
'$server/$folder/$class/$structure/handlers/pages/form/gantt',
|
|
438
|
+
'$server/$folder/$class/$structure/handlers/pages/form/messengers',
|
|
439
|
+
'$server/$folder/$class/$structure/handlers/pages/form/scheduler',
|
|
440
|
+
'$server/$folder/$class/$structure/handlers/pages/form/search',
|
|
441
|
+
'$server/$folder/$class/$structure/handlers/pages/form/staff',
|
|
442
|
+
'$server/$folder/$class/$structure/$server/handlers/pages/form/license',
|
|
443
|
+
'$server/$folder/$class/$structure/$base/handlers/methods/archive',
|
|
444
|
+
'$server/$folder/$class/$structure/$project/handlers/methods/archive',
|
|
445
|
+
'$server/$folder/$class/$structure/$server/handlers/methods/npm',
|
|
446
|
+
'ORGANIZATIONS/$domain/handlers/methods/restore',
|
|
447
|
+
'PROJECTS/$domain/handlers/methods/restore',
|
|
448
|
+
];
|
|
449
|
+
|
|
450
|
+
function pruneEmptyParents(targetPath, absRoot) {
|
|
451
|
+
let cur = path.dirname(targetPath);
|
|
452
|
+
const rootWithSep = absRoot.endsWith(path.sep) ? absRoot : absRoot + path.sep;
|
|
453
|
+
while (cur !== absRoot && cur.startsWith(rootWithSep)) {
|
|
454
|
+
try {
|
|
455
|
+
if (!fs.existsSync(cur)) {
|
|
456
|
+
cur = path.dirname(cur);
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (fs.readdirSync(cur).length === 0) {
|
|
460
|
+
fs.rmdirSync(cur);
|
|
461
|
+
cur = path.dirname(cur);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
catch {
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
433
473
|
/**
|
|
434
474
|
* Применить новую версию пакета из распакованной директории `sourceDir` к рабочей директории `rootDir`,
|
|
435
475
|
* гарантируя полное сохранение пользовательских баз, настроек, файлов и изменённых пользователем классов.
|
|
@@ -455,13 +495,18 @@ export function applyUpdateFromDirectory({
|
|
|
455
495
|
updatedCore: [],
|
|
456
496
|
updatedClean: [],
|
|
457
497
|
added: [],
|
|
498
|
+
removedObsolete: [],
|
|
499
|
+
removedLegacy: [],
|
|
458
500
|
preservedUserModified: [],
|
|
459
501
|
skippedProtected: [],
|
|
460
502
|
dependenciesChanged: false,
|
|
461
503
|
};
|
|
462
504
|
|
|
463
|
-
const newManifestFiles = {
|
|
505
|
+
const newManifestFiles = {};
|
|
506
|
+
const seenInSource = new Set();
|
|
507
|
+
const seenInSourceLower = new Set();
|
|
464
508
|
const upstreamBackupRoot = path.join(absRoot, '#system', 'updates', `upstream-${targetVersion}`);
|
|
509
|
+
const removedBackupRoot = path.join(absRoot, '#system', 'updates', `removed-${targetVersion}`);
|
|
465
510
|
|
|
466
511
|
// Проверим, изменились ли dependencies в package.json
|
|
467
512
|
let oldPkg = null;
|
|
@@ -498,6 +543,9 @@ export function applyUpdateFromDirectory({
|
|
|
498
543
|
if (!stat.isFile())
|
|
499
544
|
continue;
|
|
500
545
|
|
|
546
|
+
seenInSource.add(rel);
|
|
547
|
+
seenInSourceLower.add(rel.toLowerCase());
|
|
548
|
+
|
|
501
549
|
const dstFile = path.join(absRoot, rel);
|
|
502
550
|
let newBuf = fs.readFileSync(srcFile);
|
|
503
551
|
if (rel === 'package.json' && isHostWrapperPkg && newPkg) {
|
|
@@ -583,6 +631,66 @@ export function applyUpdateFromDirectory({
|
|
|
583
631
|
|
|
584
632
|
walkSource(absSource);
|
|
585
633
|
|
|
634
|
+
// Удаляем устаревшие файлы прошлой поставки, исчезнувшие из нового релиза
|
|
635
|
+
// (только если файл не защищён и не был изменён пользователем, либо относится к системному ядру)
|
|
636
|
+
for (const [rawOldRel, oldHash] of Object.entries(oldManifest.files || {})) {
|
|
637
|
+
const rel = normalizeRelPath(rawOldRel);
|
|
638
|
+
if (!rel)
|
|
639
|
+
continue;
|
|
640
|
+
const stillInSource = seenInSource.has(rel)
|
|
641
|
+
|| (process.platform === 'win32' && seenInSourceLower.has(rel.toLowerCase()));
|
|
642
|
+
if (stillInSource || isProtectedUserPath(rel))
|
|
643
|
+
continue;
|
|
644
|
+
const dstFile = path.join(absRoot, rel);
|
|
645
|
+
if (!fs.existsSync(dstFile))
|
|
646
|
+
continue;
|
|
647
|
+
try {
|
|
648
|
+
const stat = fs.statSync(dstFile);
|
|
649
|
+
if (!stat.isFile())
|
|
650
|
+
continue;
|
|
651
|
+
const diskHash = sha256File(dstFile);
|
|
652
|
+
if (isCoreEnginePath(rel) || (oldHash && diskHash === oldHash)) {
|
|
653
|
+
fs.rmSync(dstFile, { force: true });
|
|
654
|
+
pruneEmptyParents(dstFile, absRoot);
|
|
655
|
+
report.removedObsolete.push(rel);
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
// Пользователь менял удалённый из поставки файл — сохраняем на диске и в манифесте
|
|
659
|
+
if (oldHash)
|
|
660
|
+
newManifestFiles[rel] = oldHash;
|
|
661
|
+
report.preservedUserModified.push(rel);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
catch { /* ignore */ }
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Разовая зачистка известных упразднённых системных папок (для серверов, обновившихся до появления удаления устаревших файлов)
|
|
668
|
+
for (const legacyRel of LEGACY_REMOVED_SYSTEM_PATHS) {
|
|
669
|
+
const rel = normalizeRelPath(legacyRel);
|
|
670
|
+
if (!rel || isProtectedUserPath(rel))
|
|
671
|
+
continue;
|
|
672
|
+
const legacyAbs = path.join(absRoot, rel);
|
|
673
|
+
const inSourceAbs = path.join(absSource, rel);
|
|
674
|
+
if (!fs.existsSync(legacyAbs) || fs.existsSync(inSourceAbs))
|
|
675
|
+
continue;
|
|
676
|
+
try {
|
|
677
|
+
const backupAbs = path.join(removedBackupRoot, rel);
|
|
678
|
+
fs.mkdirSync(path.dirname(backupAbs), { recursive: true });
|
|
679
|
+
fs.cpSync(legacyAbs, backupAbs, { recursive: true });
|
|
680
|
+
fs.rmSync(legacyAbs, { recursive: true, force: true });
|
|
681
|
+
pruneEmptyParents(legacyAbs, absRoot);
|
|
682
|
+
report.removedLegacy.push(rel);
|
|
683
|
+
const relLow = rel.toLowerCase();
|
|
684
|
+
const prefix = relLow + '/';
|
|
685
|
+
for (const k of Object.keys(newManifestFiles)) {
|
|
686
|
+
const kl = normalizeRelPath(k).toLowerCase();
|
|
687
|
+
if (kl === relLow || kl.startsWith(prefix))
|
|
688
|
+
delete newManifestFiles[k];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
catch { /* ignore */ }
|
|
692
|
+
}
|
|
693
|
+
|
|
586
694
|
// Очистка устаревшей дублирующей ветки MODELS/Halogen (объединена с MODELS/Local) с сохранением скачанных весов
|
|
587
695
|
try {
|
|
588
696
|
const legacyHalogen = path.join(absRoot, 'MODELS', 'Halogen');
|