clickgo 3.16.27 → 4.0.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/README.md +20 -9
- package/dist/app/{demo/res/video.mp4 → demo.cga} +0 -0
- package/dist/app/task.cga +0 -0
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/captcha.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/drawer.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/jodit.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/mpegts.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/novnc.cgc +0 -0
- package/dist/control/page.cgc +0 -0
- package/dist/control/pdf.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/qrcode.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/control/tplink.cgc +0 -0
- package/dist/control/tuieditor.cgc +0 -0
- package/dist/control/tuiviewer.cgc +0 -0
- package/dist/control/tums.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/ext/tums-player/audio.wasm +0 -0
- package/dist/ext/tums-player/decoder.worker.js +129 -0
- package/dist/ext/tums-player/libaudio.js +1 -0
- package/dist/ext/tums-player/libaudio.wasm +0 -0
- package/dist/ext/tums-player/libffmpeg.js +1 -0
- package/dist/ext/tums-player/libffmpeg.wasm +0 -0
- package/dist/ext/tums-player/libs.worker.js +92 -0
- package/dist/ext/tums-player/tums-player.umd.min.js +35 -0
- package/dist/ext/tums-player/webgl.js +2 -0
- package/dist/ext/tums-player/webgl.worker.js +42 -0
- package/dist/global.css +1 -1
- package/dist/index.js +1 -187
- package/dist/theme/dark.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +16 -10
- package/dist/app/demo/app.js +0 -60
- package/dist/app/demo/config.json +0 -249
- package/dist/app/demo/form/control/alayout2/alayout2.js +0 -43
- package/dist/app/demo/form/control/alayout2/alayout2.xml +0 -16
- package/dist/app/demo/form/control/alert/alert.js +0 -43
- package/dist/app/demo/form/control/alert/alert.xml +0 -32
- package/dist/app/demo/form/control/arteditor/arteditor.js +0 -75
- package/dist/app/demo/form/control/arteditor/arteditor.xml +0 -12
- package/dist/app/demo/form/control/arteditor/img.js +0 -61
- package/dist/app/demo/form/control/arteditor/img.xml +0 -6
- package/dist/app/demo/form/control/block/block.css +0 -1
- package/dist/app/demo/form/control/block/block.scss +0 -17
- package/dist/app/demo/form/control/block/block.xml +0 -7
- package/dist/app/demo/form/control/box/box.js +0 -87
- package/dist/app/demo/form/control/box/box.xml +0 -23
- package/dist/app/demo/form/control/button/button.css +0 -1
- package/dist/app/demo/form/control/button/button.js +0 -62
- package/dist/app/demo/form/control/button/button.scss +0 -18
- package/dist/app/demo/form/control/button/button.xml +0 -133
- package/dist/app/demo/form/control/calendar/calendar.js +0 -62
- package/dist/app/demo/form/control/calendar/calendar.xml +0 -34
- package/dist/app/demo/form/control/captcha/captcha.js +0 -60
- package/dist/app/demo/form/control/captcha/captcha.xml +0 -10
- package/dist/app/demo/form/control/check/check.js +0 -65
- package/dist/app/demo/form/control/check/check.xml +0 -17
- package/dist/app/demo/form/control/circle/circle.xml +0 -36
- package/dist/app/demo/form/control/content/content.js +0 -58
- package/dist/app/demo/form/control/content/content.xml +0 -16
- package/dist/app/demo/form/control/date/date.js +0 -56
- package/dist/app/demo/form/control/date/date.xml +0 -28
- package/dist/app/demo/form/control/datepanel/datepanel.js +0 -63
- package/dist/app/demo/form/control/datepanel/datepanel.xml +0 -32
- package/dist/app/demo/form/control/daterange/daterange.js +0 -54
- package/dist/app/demo/form/control/daterange/daterange.xml +0 -22
- package/dist/app/demo/form/control/delete/delete.js +0 -58
- package/dist/app/demo/form/control/delete/delete.xml +0 -20
- package/dist/app/demo/form/control/desc/desc.js +0 -82
- package/dist/app/demo/form/control/desc/desc.xml +0 -44
- package/dist/app/demo/form/control/dialog/dialog.js +0 -47
- package/dist/app/demo/form/control/dialog/dialog.xml +0 -32
- package/dist/app/demo/form/control/drawer/drawer.js +0 -45
- package/dist/app/demo/form/control/drawer/drawer.xml +0 -34
- package/dist/app/demo/form/control/echarts/echarts.js +0 -137
- package/dist/app/demo/form/control/echarts/echarts.xml +0 -12
- package/dist/app/demo/form/control/empty/empty.js +0 -44
- package/dist/app/demo/form/control/empty/empty.xml +0 -9
- package/dist/app/demo/form/control/file/file.js +0 -60
- package/dist/app/demo/form/control/file/file.xml +0 -25
- package/dist/app/demo/form/control/flow/flow.css +0 -1
- package/dist/app/demo/form/control/flow/flow.js +0 -97
- package/dist/app/demo/form/control/flow/flow.scss +0 -18
- package/dist/app/demo/form/control/flow/flow.xml +0 -101
- package/dist/app/demo/form/control/form/form.css +0 -1
- package/dist/app/demo/form/control/form/form.js +0 -77
- package/dist/app/demo/form/control/form/form.scss +0 -5
- package/dist/app/demo/form/control/form/form.xml +0 -29
- package/dist/app/demo/form/control/grid/grid.js +0 -45
- package/dist/app/demo/form/control/grid/grid.xml +0 -27
- package/dist/app/demo/form/control/group/group.js +0 -50
- package/dist/app/demo/form/control/group/group.xml +0 -46
- package/dist/app/demo/form/control/hske/hske.js +0 -44
- package/dist/app/demo/form/control/hske/hske.xml +0 -19
- package/dist/app/demo/form/control/html/html.js +0 -70
- package/dist/app/demo/form/control/html/html.xml +0 -18
- package/dist/app/demo/form/control/icon/icon.xml +0 -49
- package/dist/app/demo/form/control/iconview/iconview.js +0 -191
- package/dist/app/demo/form/control/iconview/iconview.xml +0 -45
- package/dist/app/demo/form/control/img/img.xml +0 -26
- package/dist/app/demo/form/control/imgviewer/imgviewer.js +0 -46
- package/dist/app/demo/form/control/imgviewer/imgviewer.xml +0 -9
- package/dist/app/demo/form/control/jodit/jodit.js +0 -75
- package/dist/app/demo/form/control/jodit/jodit.xml +0 -24
- package/dist/app/demo/form/control/label/label.js +0 -51
- package/dist/app/demo/form/control/label/label.xml +0 -34
- package/dist/app/demo/form/control/layout/layout.js +0 -45
- package/dist/app/demo/form/control/layout/layout.xml +0 -18
- package/dist/app/demo/form/control/link/link.js +0 -53
- package/dist/app/demo/form/control/link/link.xml +0 -30
- package/dist/app/demo/form/control/list/list.css +0 -1
- package/dist/app/demo/form/control/list/list.js +0 -394
- package/dist/app/demo/form/control/list/list.scss +0 -7
- package/dist/app/demo/form/control/list/list.xml +0 -150
- package/dist/app/demo/form/control/loading/loading.xml +0 -8
- package/dist/app/demo/form/control/map/map.js +0 -217
- package/dist/app/demo/form/control/map/map.xml +0 -44
- package/dist/app/demo/form/control/marquee/marquee.js +0 -64
- package/dist/app/demo/form/control/marquee/marquee.xml +0 -33
- package/dist/app/demo/form/control/menu/menu.js +0 -67
- package/dist/app/demo/form/control/menu/menu.xml +0 -125
- package/dist/app/demo/form/control/monaco/monaco.js +0 -136
- package/dist/app/demo/form/control/monaco/monaco.xml +0 -28
- package/dist/app/demo/form/control/mpegts/mpegts.js +0 -70
- package/dist/app/demo/form/control/mpegts/mpegts.xml +0 -11
- package/dist/app/demo/form/control/nav/nav.js +0 -71
- package/dist/app/demo/form/control/nav/nav.xml +0 -106
- package/dist/app/demo/form/control/page/page.js +0 -51
- package/dist/app/demo/form/control/page/page.xml +0 -22
- package/dist/app/demo/form/control/palette/palette.js +0 -46
- package/dist/app/demo/form/control/palette/palette.xml +0 -16
- package/dist/app/demo/form/control/panel/panel.js +0 -117
- package/dist/app/demo/form/control/panel/panel.xml +0 -16
- package/dist/app/demo/form/control/panel/test1.js +0 -105
- package/dist/app/demo/form/control/panel/test1.xml +0 -22
- package/dist/app/demo/form/control/panel/test2.xml +0 -4
- package/dist/app/demo/form/control/pdf/pdf.js +0 -78
- package/dist/app/demo/form/control/pdf/pdf.xml +0 -12
- package/dist/app/demo/form/control/pdf/test.pdf +0 -0
- package/dist/app/demo/form/control/progress/progress.js +0 -63
- package/dist/app/demo/form/control/progress/progress.xml +0 -9
- package/dist/app/demo/form/control/property/property.js +0 -166
- package/dist/app/demo/form/control/property/property.xml +0 -6
- package/dist/app/demo/form/control/qrcode/qrcode.js +0 -45
- package/dist/app/demo/form/control/qrcode/qrcode.xml +0 -13
- package/dist/app/demo/form/control/radio/radio.js +0 -62
- package/dist/app/demo/form/control/radio/radio.xml +0 -15
- package/dist/app/demo/form/control/scroll/scroll.js +0 -52
- package/dist/app/demo/form/control/scroll/scroll.xml +0 -38
- package/dist/app/demo/form/control/select/select.js +0 -286
- package/dist/app/demo/form/control/select/select.xml +0 -141
- package/dist/app/demo/form/control/setting/setting.xml +0 -11
- package/dist/app/demo/form/control/sgroup/sgroup.xml +0 -28
- package/dist/app/demo/form/control/step/step.js +0 -61
- package/dist/app/demo/form/control/step/step.xml +0 -16
- package/dist/app/demo/form/control/svg/svg.js +0 -61
- package/dist/app/demo/form/control/svg/svg.xml +0 -24
- package/dist/app/demo/form/control/switch/switch.js +0 -64
- package/dist/app/demo/form/control/switch/switch.xml +0 -29
- package/dist/app/demo/form/control/tab/tab.js +0 -113
- package/dist/app/demo/form/control/tab/tab.xml +0 -22
- package/dist/app/demo/form/control/table/table.js +0 -233
- package/dist/app/demo/form/control/table/table.xml +0 -97
- package/dist/app/demo/form/control/tag/tag.js +0 -44
- package/dist/app/demo/form/control/tag/tag.xml +0 -52
- package/dist/app/demo/form/control/text/text.js +0 -127
- package/dist/app/demo/form/control/text/text.xml +0 -70
- package/dist/app/demo/form/control/timeline/timeline.js +0 -43
- package/dist/app/demo/form/control/timeline/timeline.xml +0 -19
- package/dist/app/demo/form/control/tip/tip.js +0 -43
- package/dist/app/demo/form/control/tip/tip.xml +0 -42
- package/dist/app/demo/form/control/tplink/tplink.js +0 -74
- package/dist/app/demo/form/control/tplink/tplink.xml +0 -13
- package/dist/app/demo/form/control/tuieditor/tuieditor.js +0 -73
- package/dist/app/demo/form/control/tuieditor/tuieditor.xml +0 -22
- package/dist/app/demo/form/control/tuiviewer/tuiviewer.js +0 -45
- package/dist/app/demo/form/control/tuiviewer/tuiviewer.xml +0 -14
- package/dist/app/demo/form/control/uploader/uploader.js +0 -91
- package/dist/app/demo/form/control/uploader/uploader.xml +0 -15
- package/dist/app/demo/form/control/vflow/vflow.css +0 -1
- package/dist/app/demo/form/control/vflow/vflow.js +0 -112
- package/dist/app/demo/form/control/vflow/vflow.scss +0 -22
- package/dist/app/demo/form/control/vflow/vflow.xml +0 -89
- package/dist/app/demo/form/control/video/video.js +0 -47
- package/dist/app/demo/form/control/video/video.xml +0 -14
- package/dist/app/demo/form/control/web/web.js +0 -43
- package/dist/app/demo/form/control/web/web.xml +0 -4
- package/dist/app/demo/form/control/xterm/xterm.js +0 -100
- package/dist/app/demo/form/control/xterm/xterm.xml +0 -6
- package/dist/app/demo/form/event/form/form.css +0 -1
- package/dist/app/demo/form/event/form/form.js +0 -180
- package/dist/app/demo/form/event/form/form.scss +0 -24
- package/dist/app/demo/form/event/form/form.xml +0 -16
- package/dist/app/demo/form/event/other/other.js +0 -78
- package/dist/app/demo/form/event/other/other.xml +0 -5
- package/dist/app/demo/form/event/screen/screen.js +0 -86
- package/dist/app/demo/form/event/screen/screen.xml +0 -9
- package/dist/app/demo/form/event/task/task.js +0 -111
- package/dist/app/demo/form/event/task/task.xml +0 -20
- package/dist/app/demo/form/main.css +0 -1
- package/dist/app/demo/form/main.js +0 -521
- package/dist/app/demo/form/main.scss +0 -9
- package/dist/app/demo/form/main.xml +0 -160
- package/dist/app/demo/form/method/acontrol/acontrol.js +0 -53
- package/dist/app/demo/form/method/acontrol/acontrol.xml +0 -5
- package/dist/app/demo/form/method/aform/aform.js +0 -123
- package/dist/app/demo/form/method/aform/aform.xml +0 -60
- package/dist/app/demo/form/method/aform/sd.js +0 -58
- package/dist/app/demo/form/method/aform/sd.xml +0 -7
- package/dist/app/demo/form/method/core/core.js +0 -111
- package/dist/app/demo/form/method/core/core.xml +0 -23
- package/dist/app/demo/form/method/dom/dom.css +0 -1
- package/dist/app/demo/form/method/dom/dom.js +0 -251
- package/dist/app/demo/form/method/dom/dom.scss +0 -10
- package/dist/app/demo/form/method/dom/dom.xml +0 -76
- package/dist/app/demo/form/method/form/form.js +0 -287
- package/dist/app/demo/form/method/form/form.xml +0 -74
- package/dist/app/demo/form/method/form/test.xml +0 -5
- package/dist/app/demo/form/method/fs/fs.js +0 -230
- package/dist/app/demo/form/method/fs/fs.xml +0 -18
- package/dist/app/demo/form/method/fs/text.js +0 -48
- package/dist/app/demo/form/method/fs/text.xml +0 -3
- package/dist/app/demo/form/method/native/native.js +0 -128
- package/dist/app/demo/form/method/native/native.xml +0 -22
- package/dist/app/demo/form/method/storage/storage.js +0 -95
- package/dist/app/demo/form/method/storage/storage.xml +0 -18
- package/dist/app/demo/form/method/system/system.js +0 -88
- package/dist/app/demo/form/method/system/system.xml +0 -14
- package/dist/app/demo/form/method/task/locale1.json +0 -3
- package/dist/app/demo/form/method/task/locale2.json +0 -3
- package/dist/app/demo/form/method/task/task.js +0 -196
- package/dist/app/demo/form/method/task/task.xml +0 -61
- package/dist/app/demo/form/method/theme/theme.js +0 -107
- package/dist/app/demo/form/method/theme/theme.xml +0 -12
- package/dist/app/demo/form/method/tool/tool.js +0 -143
- package/dist/app/demo/form/method/tool/tool.xml +0 -40
- package/dist/app/demo/form/method/zip/zip.js +0 -137
- package/dist/app/demo/form/method/zip/zip.xml +0 -12
- package/dist/app/demo/form/solution/backpanel/backpanel.js +0 -89
- package/dist/app/demo/form/solution/backpanel/backpanel.xml +0 -31
- package/dist/app/demo/global.css +0 -3
- package/dist/app/demo/res/custombtn.cgc +0 -0
- package/dist/app/demo/res/icon.svg +0 -5
- package/dist/app/demo/res/img.jpg +0 -0
- package/dist/app/demo/res/marker.svg +0 -5
- package/dist/app/demo/res/r-1.svg +0 -32
- package/dist/app/demo/res/r-2.svg +0 -38
- package/dist/app/demo/res/sql.svg +0 -25
- package/dist/app/demo/res/txt.svg +0 -21
- package/dist/app/demo/res/zip.svg +0 -21
- package/dist/app/task/app.js +0 -57
- package/dist/app/task/config.json +0 -29
- package/dist/app/task/form/bar/bar.js +0 -419
- package/dist/app/task/form/bar/bar.xml +0 -46
- package/dist/app/task/form/desktop/desktop.xml +0 -1
- package/dist/app/task/locale/en.json +0 -11
- package/dist/app/task/locale/ja.json +0 -11
- package/dist/app/task/locale/sc.json +0 -11
- package/dist/app/task/locale/tc.json +0 -11
- package/dist/clickgo.d.ts +0 -22
- package/dist/clickgo.js +0 -109
- package/dist/index.d.ts +0 -55
- package/dist/lib/control.d.ts +0 -53
- package/dist/lib/control.js +0 -606
- package/dist/lib/core.d.ts +0 -47
- package/dist/lib/core.js +0 -1028
- package/dist/lib/dom.d.ts +0 -75
- package/dist/lib/dom.js +0 -2176
- package/dist/lib/form.d.ts +0 -222
- package/dist/lib/form.js +0 -3033
- package/dist/lib/fs.d.ts +0 -35
- package/dist/lib/fs.js +0 -1241
- package/dist/lib/native.d.ts +0 -43
- package/dist/lib/native.js +0 -228
- package/dist/lib/storage.d.ts +0 -6
- package/dist/lib/storage.js +0 -227
- package/dist/lib/task.d.ts +0 -32
- package/dist/lib/task.js +0 -1875
- package/dist/lib/theme.d.ts +0 -8
- package/dist/lib/theme.js +0 -195
- package/dist/lib/tool.d.ts +0 -122
- package/dist/lib/tool.js +0 -1054
- package/dist/lib/zip.d.ts +0 -40
- package/dist/lib/zip.js +0 -397
- package/dist/theme/blue.cgt +0 -0
- package/dist/theme/byterun.cgt +0 -0
- package/types/index.d.ts +0 -1374
package/dist/lib/fs.js
DELETED
|
@@ -1,1241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.mount = mount;
|
|
46
|
-
exports.unmount = unmount;
|
|
47
|
-
exports.getContent = getContent;
|
|
48
|
-
exports.putContent = putContent;
|
|
49
|
-
exports.readLink = readLink;
|
|
50
|
-
exports.symlink = symlink;
|
|
51
|
-
exports.unlink = unlink;
|
|
52
|
-
exports.stats = stats;
|
|
53
|
-
exports.isDir = isDir;
|
|
54
|
-
exports.isFile = isFile;
|
|
55
|
-
exports.mkdir = mkdir;
|
|
56
|
-
exports.rmdir = rmdir;
|
|
57
|
-
exports.rmdirDeep = rmdirDeep;
|
|
58
|
-
exports.chmod = chmod;
|
|
59
|
-
exports.rename = rename;
|
|
60
|
-
exports.readDir = readDir;
|
|
61
|
-
exports.copyFolder = copyFolder;
|
|
62
|
-
exports.copyFile = copyFile;
|
|
63
|
-
const tool = __importStar(require("./tool"));
|
|
64
|
-
const task = __importStar(require("./task"));
|
|
65
|
-
const form = __importStar(require("./form"));
|
|
66
|
-
const core = __importStar(require("./core"));
|
|
67
|
-
const native = __importStar(require("./native"));
|
|
68
|
-
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/app.js', '/app/demo/config.json', '/app/demo/form/', '/app/demo/form/control/', '/app/demo/form/control/alayout2/', '/app/demo/form/control/alayout2/alayout2.js', '/app/demo/form/control/alayout2/alayout2.xml', '/app/demo/form/control/alert/', '/app/demo/form/control/alert/alert.js', '/app/demo/form/control/alert/alert.xml', '/app/demo/form/control/arteditor/', '/app/demo/form/control/arteditor/arteditor.js', '/app/demo/form/control/arteditor/arteditor.xml', '/app/demo/form/control/arteditor/img.js', '/app/demo/form/control/arteditor/img.xml', '/app/demo/form/control/block/', '/app/demo/form/control/block/block.css', '/app/demo/form/control/block/block.xml', '/app/demo/form/control/box/', '/app/demo/form/control/box/box.js', '/app/demo/form/control/box/box.xml', '/app/demo/form/control/button/', '/app/demo/form/control/button/button.css', '/app/demo/form/control/button/button.js', '/app/demo/form/control/button/button.xml', '/app/demo/form/control/calendar/', '/app/demo/form/control/calendar/calendar.js', '/app/demo/form/control/calendar/calendar.xml', '/app/demo/form/control/captcha/', '/app/demo/form/control/captcha/captcha.js', '/app/demo/form/control/captcha/captcha.xml', '/app/demo/form/control/check/', '/app/demo/form/control/check/check.js', '/app/demo/form/control/check/check.xml', '/app/demo/form/control/circle/', '/app/demo/form/control/circle/circle.xml', '/app/demo/form/control/content/', '/app/demo/form/control/content/content.js', '/app/demo/form/control/content/content.xml', '/app/demo/form/control/date/', '/app/demo/form/control/date/date.js', '/app/demo/form/control/date/date.xml', '/app/demo/form/control/datepanel/', '/app/demo/form/control/datepanel/datepanel.js', '/app/demo/form/control/datepanel/datepanel.xml', '/app/demo/form/control/daterange/', '/app/demo/form/control/daterange/daterange.js', '/app/demo/form/control/daterange/daterange.xml', '/app/demo/form/control/delete/', '/app/demo/form/control/delete/delete.js', '/app/demo/form/control/delete/delete.xml', '/app/demo/form/control/desc/', '/app/demo/form/control/desc/desc.js', '/app/demo/form/control/desc/desc.xml', '/app/demo/form/control/dialog/', '/app/demo/form/control/dialog/dialog.js', '/app/demo/form/control/dialog/dialog.xml', '/app/demo/form/control/drawer/', '/app/demo/form/control/drawer/drawer.js', '/app/demo/form/control/drawer/drawer.xml', '/app/demo/form/control/echarts/', '/app/demo/form/control/echarts/echarts.js', '/app/demo/form/control/echarts/echarts.xml', '/app/demo/form/control/empty/', '/app/demo/form/control/empty/empty.js', '/app/demo/form/control/empty/empty.xml', '/app/demo/form/control/file/', '/app/demo/form/control/file/file.js', '/app/demo/form/control/file/file.xml', '/app/demo/form/control/flow/', '/app/demo/form/control/flow/flow.css', '/app/demo/form/control/flow/flow.js', '/app/demo/form/control/flow/flow.xml', '/app/demo/form/control/form/', '/app/demo/form/control/form/form.css', '/app/demo/form/control/form/form.js', '/app/demo/form/control/form/form.xml', '/app/demo/form/control/grid/', '/app/demo/form/control/grid/grid.js', '/app/demo/form/control/grid/grid.xml', '/app/demo/form/control/group/', '/app/demo/form/control/group/group.js', '/app/demo/form/control/group/group.xml', '/app/demo/form/control/hske/', '/app/demo/form/control/hske/hske.js', '/app/demo/form/control/hske/hske.xml', '/app/demo/form/control/html/', '/app/demo/form/control/html/html.js', '/app/demo/form/control/html/html.xml', '/app/demo/form/control/icon/', '/app/demo/form/control/icon/icon.xml', '/app/demo/form/control/iconview/', '/app/demo/form/control/iconview/iconview.js', '/app/demo/form/control/iconview/iconview.xml', '/app/demo/form/control/img/', '/app/demo/form/control/img/img.xml', '/app/demo/form/control/imgviewer/', '/app/demo/form/control/imgviewer/imgviewer.js', '/app/demo/form/control/imgviewer/imgviewer.xml', '/app/demo/form/control/jodit/', '/app/demo/form/control/jodit/jodit.js', '/app/demo/form/control/jodit/jodit.xml', '/app/demo/form/control/label/', '/app/demo/form/control/label/label.js', '/app/demo/form/control/label/label.xml', '/app/demo/form/control/layout/', '/app/demo/form/control/layout/layout.js', '/app/demo/form/control/layout/layout.xml', '/app/demo/form/control/link/', '/app/demo/form/control/link/link.js', '/app/demo/form/control/link/link.xml', '/app/demo/form/control/list/', '/app/demo/form/control/list/list.css', '/app/demo/form/control/list/list.js', '/app/demo/form/control/list/list.xml', '/app/demo/form/control/loading/', '/app/demo/form/control/loading/loading.xml', '/app/demo/form/control/map/', '/app/demo/form/control/map/map.js', '/app/demo/form/control/map/map.xml', '/app/demo/form/control/marquee/', '/app/demo/form/control/marquee/marquee.js', '/app/demo/form/control/marquee/marquee.xml', '/app/demo/form/control/menu/', '/app/demo/form/control/menu/menu.js', '/app/demo/form/control/menu/menu.xml', '/app/demo/form/control/monaco/', '/app/demo/form/control/monaco/monaco.js', '/app/demo/form/control/monaco/monaco.xml', '/app/demo/form/control/mpegts/', '/app/demo/form/control/mpegts/mpegts.js', '/app/demo/form/control/mpegts/mpegts.xml', '/app/demo/form/control/nav/', '/app/demo/form/control/nav/nav.js', '/app/demo/form/control/nav/nav.xml', '/app/demo/form/control/page/', '/app/demo/form/control/page/page.js', '/app/demo/form/control/page/page.xml', '/app/demo/form/control/palette/', '/app/demo/form/control/palette/palette.js', '/app/demo/form/control/palette/palette.xml', '/app/demo/form/control/panel/', '/app/demo/form/control/panel/panel.js', '/app/demo/form/control/panel/panel.xml', '/app/demo/form/control/panel/test1.js', '/app/demo/form/control/panel/test1.xml', '/app/demo/form/control/panel/test2.xml', '/app/demo/form/control/pdf/', '/app/demo/form/control/pdf/pdf.js', '/app/demo/form/control/pdf/pdf.xml', '/app/demo/form/control/pdf/test.pdf', '/app/demo/form/control/progress/', '/app/demo/form/control/progress/progress.js', '/app/demo/form/control/progress/progress.xml', '/app/demo/form/control/property/', '/app/demo/form/control/property/property.js', '/app/demo/form/control/property/property.xml', '/app/demo/form/control/qrcode/', '/app/demo/form/control/qrcode/qrcode.js', '/app/demo/form/control/qrcode/qrcode.xml', '/app/demo/form/control/radio/', '/app/demo/form/control/radio/radio.js', '/app/demo/form/control/radio/radio.xml', '/app/demo/form/control/scroll/', '/app/demo/form/control/scroll/scroll.js', '/app/demo/form/control/scroll/scroll.xml', '/app/demo/form/control/select/', '/app/demo/form/control/select/select.js', '/app/demo/form/control/select/select.xml', '/app/demo/form/control/setting/', '/app/demo/form/control/setting/setting.xml', '/app/demo/form/control/sgroup/', '/app/demo/form/control/sgroup/sgroup.xml', '/app/demo/form/control/step/', '/app/demo/form/control/step/step.js', '/app/demo/form/control/step/step.xml', '/app/demo/form/control/svg/', '/app/demo/form/control/svg/svg.js', '/app/demo/form/control/svg/svg.xml', '/app/demo/form/control/switch/', '/app/demo/form/control/switch/switch.js', '/app/demo/form/control/switch/switch.xml', '/app/demo/form/control/tab/', '/app/demo/form/control/tab/tab.js', '/app/demo/form/control/tab/tab.xml', '/app/demo/form/control/table/', '/app/demo/form/control/table/table.js', '/app/demo/form/control/table/table.xml', '/app/demo/form/control/tag/', '/app/demo/form/control/tag/tag.js', '/app/demo/form/control/tag/tag.xml', '/app/demo/form/control/text/', '/app/demo/form/control/text/text.js', '/app/demo/form/control/text/text.xml', '/app/demo/form/control/timeline/', '/app/demo/form/control/timeline/timeline.js', '/app/demo/form/control/timeline/timeline.xml', '/app/demo/form/control/tip/', '/app/demo/form/control/tip/tip.js', '/app/demo/form/control/tip/tip.xml', '/app/demo/form/control/tplink/', '/app/demo/form/control/tplink/tplink.js', '/app/demo/form/control/tplink/tplink.xml', '/app/demo/form/control/tuieditor/', '/app/demo/form/control/tuieditor/tuieditor.js', '/app/demo/form/control/tuieditor/tuieditor.xml', '/app/demo/form/control/tuiviewer/', '/app/demo/form/control/tuiviewer/tuiviewer.js', '/app/demo/form/control/tuiviewer/tuiviewer.xml', '/app/demo/form/control/uploader/', '/app/demo/form/control/uploader/uploader.js', '/app/demo/form/control/uploader/uploader.xml', '/app/demo/form/control/vflow/', '/app/demo/form/control/vflow/vflow.css', '/app/demo/form/control/vflow/vflow.js', '/app/demo/form/control/vflow/vflow.xml', '/app/demo/form/control/video/', '/app/demo/form/control/video/video.js', '/app/demo/form/control/video/video.xml', '/app/demo/form/control/web/', '/app/demo/form/control/web/web.js', '/app/demo/form/control/web/web.xml', '/app/demo/form/control/xterm/', '/app/demo/form/control/xterm/xterm.js', '/app/demo/form/control/xterm/xterm.xml', '/app/demo/form/event/', '/app/demo/form/event/form/', '/app/demo/form/event/form/form.css', '/app/demo/form/event/form/form.js', '/app/demo/form/event/form/form.xml', '/app/demo/form/event/other/', '/app/demo/form/event/other/other.js', '/app/demo/form/event/other/other.xml', '/app/demo/form/event/screen/', '/app/demo/form/event/screen/screen.js', '/app/demo/form/event/screen/screen.xml', '/app/demo/form/event/task/', '/app/demo/form/event/task/task.js', '/app/demo/form/event/task/task.xml', '/app/demo/form/main.css', '/app/demo/form/main.js', '/app/demo/form/main.xml', '/app/demo/form/method/', '/app/demo/form/method/acontrol/', '/app/demo/form/method/acontrol/acontrol.js', '/app/demo/form/method/acontrol/acontrol.xml', '/app/demo/form/method/aform/', '/app/demo/form/method/aform/aform.js', '/app/demo/form/method/aform/aform.xml', '/app/demo/form/method/aform/sd.js', '/app/demo/form/method/aform/sd.xml', '/app/demo/form/method/core/', '/app/demo/form/method/core/core.js', '/app/demo/form/method/core/core.xml', '/app/demo/form/method/dom/', '/app/demo/form/method/dom/dom.css', '/app/demo/form/method/dom/dom.js', '/app/demo/form/method/dom/dom.xml', '/app/demo/form/method/form/', '/app/demo/form/method/form/form.js', '/app/demo/form/method/form/form.xml', '/app/demo/form/method/form/test.xml', '/app/demo/form/method/fs/', '/app/demo/form/method/fs/fs.js', '/app/demo/form/method/fs/fs.xml', '/app/demo/form/method/fs/text.js', '/app/demo/form/method/fs/text.xml', '/app/demo/form/method/native/', '/app/demo/form/method/native/native.js', '/app/demo/form/method/native/native.xml', '/app/demo/form/method/storage/', '/app/demo/form/method/storage/storage.js', '/app/demo/form/method/storage/storage.xml', '/app/demo/form/method/system/', '/app/demo/form/method/system/system.js', '/app/demo/form/method/system/system.xml', '/app/demo/form/method/task/', '/app/demo/form/method/task/locale1.json', '/app/demo/form/method/task/locale2.json', '/app/demo/form/method/task/task.js', '/app/demo/form/method/task/task.xml', '/app/demo/form/method/theme/', '/app/demo/form/method/theme/theme.js', '/app/demo/form/method/theme/theme.xml', '/app/demo/form/method/tool/', '/app/demo/form/method/tool/tool.js', '/app/demo/form/method/tool/tool.xml', '/app/demo/form/method/zip/', '/app/demo/form/method/zip/zip.js', '/app/demo/form/method/zip/zip.xml', '/app/demo/form/solution/', '/app/demo/form/solution/backpanel/', '/app/demo/form/solution/backpanel/backpanel.js', '/app/demo/form/solution/backpanel/backpanel.xml', '/app/demo/global.css', '/app/demo/res/', '/app/demo/res/custombtn.cgc', '/app/demo/res/icon.svg', '/app/demo/res/img.jpg', '/app/demo/res/marker.svg', '/app/demo/res/r-1.svg', '/app/demo/res/r-2.svg', '/app/demo/res/sql.svg', '/app/demo/res/txt.svg', '/app/demo/res/video.mp4', '/app/demo/res/zip.svg', '/app/task/', '/app/task/app.js', '/app/task/config.json', '/app/task/form/', '/app/task/form/bar/', '/app/task/form/bar/bar.js', '/app/task/form/bar/bar.xml', '/app/task/form/desktop/', '/app/task/form/desktop/desktop.xml', '/app/task/locale/', '/app/task/locale/en.json', '/app/task/locale/ja.json', '/app/task/locale/sc.json', '/app/task/locale/tc.json', '/clickgo.d.ts', '/clickgo.js', '/clickgo.ts', '/control/', '/control/arteditor.cgc', '/control/box.cgc', '/control/captcha.cgc', '/control/common.cgc', '/control/desc.cgc', '/control/drawer.cgc', '/control/echarts.cgc', '/control/form.cgc', '/control/iconview.cgc', '/control/jodit.cgc', '/control/map.cgc', '/control/monaco.cgc', '/control/mpegts.cgc', '/control/nav.cgc', '/control/page.cgc', '/control/pdf.cgc', '/control/property.cgc', '/control/qrcode.cgc', '/control/table.cgc', '/control/task.cgc', '/control/tplink.cgc', '/control/tuieditor.cgc', '/control/tuiviewer.cgc', '/control/web.cgc', '/control/xterm.cgc', '/ext/', '/ext/toastui-editor-all.min.js', '/ext/tplinkhd.min.js', '/global.css', '/icon.png', '/index.d.ts', '/index.js', '/index.ts', '/lib/', '/lib/control.d.ts', '/lib/control.js', '/lib/control.ts', '/lib/core.d.ts', '/lib/core.js', '/lib/core.ts', '/lib/dom.d.ts', '/lib/dom.js', '/lib/dom.ts', '/lib/form.d.ts', '/lib/form.js', '/lib/form.ts', '/lib/fs.d.ts', '/lib/fs.js', '/lib/fs.ts', '/lib/native.d.ts', '/lib/native.js', '/lib/native.ts', '/lib/storage.d.ts', '/lib/storage.js', '/lib/storage.ts', '/lib/task.d.ts', '/lib/task.js', '/lib/task.ts', '/lib/theme.d.ts', '/lib/theme.js', '/lib/theme.ts', '/lib/tool.d.ts', '/lib/tool.js', '/lib/tool.ts', '/lib/zip.d.ts', '/lib/zip.js', '/lib/zip.ts', '/notosans-regular.ttf', '/theme/', '/theme/blue.cgt', '/theme/byterun.cgt', '/theme/dark.cgt', '/theme/light.cgt'];
|
|
69
|
-
const localeData = {
|
|
70
|
-
'en': {
|
|
71
|
-
'apply-unmount': 'Are you sure to unmount the "?" mount point?',
|
|
72
|
-
},
|
|
73
|
-
'sc': {
|
|
74
|
-
'apply-unmount': '确定卸载“?”挂载点吗?'
|
|
75
|
-
},
|
|
76
|
-
'tc': {
|
|
77
|
-
'apply-unmount': '確定卸載「?」掛載點嗎?'
|
|
78
|
-
},
|
|
79
|
-
'ja': {
|
|
80
|
-
'apply-unmount': '「?」マウントポイントをアンマウントしてよろしいですか?'
|
|
81
|
-
},
|
|
82
|
-
'ko': {
|
|
83
|
-
'apply-unmount': '"?" 마운트 지점을 언마운트하시겠습니까?'
|
|
84
|
-
},
|
|
85
|
-
'th': {
|
|
86
|
-
'apply-unmount': 'คุณแน่ใจหรือว่าต้องการยกเลิกการติดตั้งจุดติดตั้ง "?"'
|
|
87
|
-
},
|
|
88
|
-
'es': {
|
|
89
|
-
'apply-unmount': '¿Está seguro de que desea desmontar el punto de montaje "?"'
|
|
90
|
-
},
|
|
91
|
-
'de': {
|
|
92
|
-
'apply-unmount': 'Möchten Sie den Einhängepunkt "?" wirklich demontieren?'
|
|
93
|
-
},
|
|
94
|
-
'fr': {
|
|
95
|
-
'apply-unmount': 'Voulez-vous vraiment démonter le point de montage "?"'
|
|
96
|
-
},
|
|
97
|
-
'pt': {
|
|
98
|
-
'apply-unmount': 'Tem certeza de que deseja desmontar o ponto de montagem "?"'
|
|
99
|
-
},
|
|
100
|
-
'ru': {
|
|
101
|
-
'apply-unmount': 'Вы уверены, что хотите отмонтировать точку монтирования "?"'
|
|
102
|
-
},
|
|
103
|
-
'vi': {
|
|
104
|
-
'apply-unmount': 'Bạn có chắc chắn muốn tháo dỡ điểm gắn "?" không?'
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const mounts = {};
|
|
108
|
-
function getMountName(path) {
|
|
109
|
-
const io = path.slice(9).indexOf('/');
|
|
110
|
-
return io === -1 ? path.slice(9) : path.slice(9, io + 9);
|
|
111
|
-
}
|
|
112
|
-
function mount(name, handler, taskId) {
|
|
113
|
-
if (mounts[name]) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
if (!/^[a-zA-Z][\w]+$/.test(name)) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (taskId) {
|
|
120
|
-
const t = task.list[taskId];
|
|
121
|
-
if (t) {
|
|
122
|
-
const val = 'fs./mounted/' + name + '/w';
|
|
123
|
-
if (!t.runtime.permissions.includes(val)) {
|
|
124
|
-
t.runtime.permissions.push(val);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
handler.date = new Date();
|
|
129
|
-
mounts[name] = handler;
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
function unmount(name) {
|
|
133
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
var _a, _b;
|
|
135
|
-
if (!mounts[name]) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
const loc = (_b = (_a = localeData[core.config.locale]) === null || _a === void 0 ? void 0 : _a['apply-unmount']) !== null && _b !== void 0 ? _b : localeData['en']['apply-unmount'];
|
|
139
|
-
if (!(yield form.superConfirm(loc.replace('?', '/mount/' + tool.escapeHTML(name) + '/')))) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
delete mounts[name];
|
|
143
|
-
return true;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
function getContent(path, options, taskId) {
|
|
147
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
var _a, _b, _c;
|
|
149
|
-
path = tool.urlResolve('/', path);
|
|
150
|
-
const fpath = path.slice(8);
|
|
151
|
-
if (typeof options === 'string') {
|
|
152
|
-
options = {
|
|
153
|
-
'encoding': options
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
options !== null && options !== void 0 ? options : (options = {});
|
|
158
|
-
}
|
|
159
|
-
const encoding = options.encoding;
|
|
160
|
-
const start = options.start;
|
|
161
|
-
const end = options.end;
|
|
162
|
-
if (path.startsWith('/clickgo/') || path.startsWith('http:') || path.startsWith('https:') || path.startsWith('file:')) {
|
|
163
|
-
let ourl = '';
|
|
164
|
-
if (path.startsWith('/clickgo/')) {
|
|
165
|
-
if (!clickgoFiles.includes(fpath)) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
ourl = tool.urlResolve(__dirname, './').slice(0, -1) + fpath;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
ourl = path;
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
const rand = '?' + ((_a = options.cache) !== null && _a !== void 0 ? _a : Math.random().toString());
|
|
175
|
-
let blob = null;
|
|
176
|
-
const headers = {};
|
|
177
|
-
if (start !== null && start !== void 0 ? start : end) {
|
|
178
|
-
headers['range'] = `bytes=${start !== null && start !== void 0 ? start : '0'}-${end !== null && end !== void 0 ? end : ''}`;
|
|
179
|
-
}
|
|
180
|
-
if (options.progress) {
|
|
181
|
-
blob = yield tool.request(ourl + (!ourl.startsWith(loader.cdn) ? rand : ''), {
|
|
182
|
-
'headers': headers,
|
|
183
|
-
'progress': options.progress,
|
|
184
|
-
'responseType': 'blob'
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
blob = yield (yield fetch(ourl + (!ourl.startsWith(loader.cdn) ? rand : ''), {
|
|
189
|
-
'headers': headers
|
|
190
|
-
})).blob();
|
|
191
|
-
}
|
|
192
|
-
if (!blob) {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
if (!encoding) {
|
|
196
|
-
return blob;
|
|
197
|
-
}
|
|
198
|
-
return yield new Promise(function (resolve) {
|
|
199
|
-
const fr = new FileReader();
|
|
200
|
-
fr.addEventListener('load', function () {
|
|
201
|
-
resolve(fr.result);
|
|
202
|
-
});
|
|
203
|
-
fr.readAsText(blob, encoding);
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
catch (_d) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
211
|
-
const r = yield task.checkPermission('fs.' + path + 'r', false, undefined, taskId);
|
|
212
|
-
if (!r[0]) {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
if (path.startsWith('/mounted/')) {
|
|
216
|
-
const name = getMountName(path);
|
|
217
|
-
const hanlder = mounts[name];
|
|
218
|
-
if (!hanlder) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return (_c = (_b = hanlder.getContent) === null || _b === void 0 ? void 0 : _b.call(hanlder, path.slice(9 + name.length), options)) !== null && _c !== void 0 ? _c : null;
|
|
222
|
-
}
|
|
223
|
-
if (options.progress) {
|
|
224
|
-
delete options.progress;
|
|
225
|
-
}
|
|
226
|
-
const rtn = yield native.invoke('cg-fs-getContent', native.getToken(), fpath, options);
|
|
227
|
-
if (!rtn) {
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
if (typeof rtn === 'string') {
|
|
231
|
-
return rtn;
|
|
232
|
-
}
|
|
233
|
-
return new Blob([rtn], {
|
|
234
|
-
'type': tool.getMimeByPath(path).mime
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
else if (path.startsWith('/package/') || path.startsWith('/current/')) {
|
|
238
|
-
if (!taskId) {
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
if (path.startsWith('/current/')) {
|
|
242
|
-
return getContent(task.list[taskId].current + fpath, options, taskId);
|
|
243
|
-
}
|
|
244
|
-
const file = task.list[taskId].app.files[fpath];
|
|
245
|
-
if (!file) {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
if (typeof file === 'string') {
|
|
249
|
-
return file;
|
|
250
|
-
}
|
|
251
|
-
if (!options.encoding) {
|
|
252
|
-
if (start === undefined && end === undefined) {
|
|
253
|
-
return file;
|
|
254
|
-
}
|
|
255
|
-
return file.slice(start, end, file.type);
|
|
256
|
-
}
|
|
257
|
-
const encoding = options.encoding;
|
|
258
|
-
return new Promise(function (resolve) {
|
|
259
|
-
const fr = new FileReader();
|
|
260
|
-
fr.addEventListener('load', function () {
|
|
261
|
-
resolve(fr.result);
|
|
262
|
-
});
|
|
263
|
-
fr.readAsText(file, encoding);
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function putContent(path_1, data_1) {
|
|
272
|
-
return __awaiter(this, arguments, void 0, function* (path, data, options = {}, taskId) {
|
|
273
|
-
var _a, _b;
|
|
274
|
-
path = tool.urlResolve('/', path);
|
|
275
|
-
const fpath = path.slice(8);
|
|
276
|
-
if (path.startsWith('/clickgo/')) {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
280
|
-
const r = yield task.checkPermission('fs.' + path + 'w', false, undefined, taskId);
|
|
281
|
-
if (!r[0]) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
if (path.startsWith('/mounted/')) {
|
|
285
|
-
const name = getMountName(path);
|
|
286
|
-
const hanlder = mounts[name];
|
|
287
|
-
if (!hanlder) {
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
return (_b = (_a = hanlder.putContent) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length), data, options)) !== null && _b !== void 0 ? _b : false;
|
|
291
|
-
}
|
|
292
|
-
let buf = undefined;
|
|
293
|
-
if (data instanceof Blob) {
|
|
294
|
-
buf = new Uint8Array(yield data.arrayBuffer());
|
|
295
|
-
}
|
|
296
|
-
return native.invoke('cg-fs-putContent', native.getToken(), fpath, buf !== null && buf !== void 0 ? buf : data, options);
|
|
297
|
-
}
|
|
298
|
-
else if (path.startsWith('/package/')) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
else if (path.startsWith('/current/')) {
|
|
302
|
-
if (!taskId) {
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
return putContent(task.list[taskId].current + fpath, data, options, taskId);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
function readLink(path, encoding, taskId) {
|
|
313
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
-
var _a, _b;
|
|
315
|
-
path = tool.urlResolve('/', path);
|
|
316
|
-
const fpath = path.slice(8);
|
|
317
|
-
if (path.startsWith('/clickgo/')) {
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
321
|
-
const r = yield task.checkPermission('fs.' + path + 'r', false, undefined, taskId);
|
|
322
|
-
if (!r[0]) {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
if (path.startsWith('/mounted/')) {
|
|
326
|
-
const name = getMountName(path);
|
|
327
|
-
const hanlder = mounts[name];
|
|
328
|
-
if (!hanlder) {
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
return (_b = (_a = hanlder.readLink) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length), encoding)) !== null && _b !== void 0 ? _b : null;
|
|
332
|
-
}
|
|
333
|
-
return native.invoke('cg-fs-readLink', native.getToken(), fpath, encoding);
|
|
334
|
-
}
|
|
335
|
-
else if (path.startsWith('/package/')) {
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
else if (path.startsWith('/current/')) {
|
|
339
|
-
if (!taskId) {
|
|
340
|
-
return null;
|
|
341
|
-
}
|
|
342
|
-
return task.list[taskId].current;
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
function symlink(filePath, linkPath, type, taskId) {
|
|
350
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
var _a, _b;
|
|
352
|
-
filePath = tool.urlResolve('/', filePath);
|
|
353
|
-
linkPath = tool.urlResolve('/', linkPath);
|
|
354
|
-
if (filePath.startsWith('/clickgo/')) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
else if (filePath.startsWith('/storage/') || filePath.startsWith('/mounted/')) {
|
|
358
|
-
const r = yield task.checkPermission('fs.' + filePath + 'w', false, undefined, taskId);
|
|
359
|
-
if (!r[0]) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
if (filePath.startsWith('/mounted/')) {
|
|
363
|
-
const fname = getMountName(filePath);
|
|
364
|
-
const lname = getMountName(linkPath);
|
|
365
|
-
if (fname !== lname) {
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
const hanlder = mounts[fname];
|
|
369
|
-
if (!hanlder) {
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
372
|
-
return (_b = (_a = hanlder.symlink) === null || _a === void 0 ? void 0 : _a.call(hanlder, filePath.slice(9 + fname.length), linkPath.slice(9 + fname.length), type)) !== null && _b !== void 0 ? _b : false;
|
|
373
|
-
}
|
|
374
|
-
return native.invoke('cg-fs-symlink', native.getToken(), filePath.slice(8), linkPath.slice(8), type);
|
|
375
|
-
}
|
|
376
|
-
else if (filePath.startsWith('/package/')) {
|
|
377
|
-
return false;
|
|
378
|
-
}
|
|
379
|
-
else if (filePath.startsWith('/current/')) {
|
|
380
|
-
if (!taskId) {
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
if (linkPath.startsWith('/current/')) {
|
|
384
|
-
linkPath = task.list[taskId].current + linkPath.slice(8);
|
|
385
|
-
}
|
|
386
|
-
return symlink(task.list[taskId].current + filePath.slice(8), linkPath, type, taskId);
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
function unlink(path, taskId) {
|
|
394
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
-
var _a, _b;
|
|
396
|
-
path = tool.urlResolve('/', path);
|
|
397
|
-
const fpath = path.slice(8);
|
|
398
|
-
if (path.startsWith('/clickgo/')) {
|
|
399
|
-
return false;
|
|
400
|
-
}
|
|
401
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
402
|
-
const r = yield task.checkPermission('fs.' + path + 'w', false, undefined, taskId);
|
|
403
|
-
if (!r[0]) {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
if (path.startsWith('/mounted/')) {
|
|
407
|
-
const name = getMountName(path);
|
|
408
|
-
const hanlder = mounts[name];
|
|
409
|
-
if (!hanlder) {
|
|
410
|
-
return false;
|
|
411
|
-
}
|
|
412
|
-
return (_b = (_a = hanlder.unlink) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length))) !== null && _b !== void 0 ? _b : false;
|
|
413
|
-
}
|
|
414
|
-
return native.invoke('cg-fs-unlink', native.getToken(), fpath);
|
|
415
|
-
}
|
|
416
|
-
else if (path.startsWith('/package/')) {
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
else if (path.startsWith('/current/')) {
|
|
420
|
-
if (!taskId) {
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
return unlink(task.list[taskId].current + fpath, taskId);
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
function getClickGoStats(path) {
|
|
431
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
-
if (path.endsWith('/')) {
|
|
433
|
-
const date = new Date();
|
|
434
|
-
const ms = date.getTime();
|
|
435
|
-
return {
|
|
436
|
-
isFile: function () {
|
|
437
|
-
return false;
|
|
438
|
-
},
|
|
439
|
-
isDirectory: function () {
|
|
440
|
-
return true;
|
|
441
|
-
},
|
|
442
|
-
isSymbolicLink: function () {
|
|
443
|
-
return false;
|
|
444
|
-
},
|
|
445
|
-
'size': 0,
|
|
446
|
-
'blksize': 0,
|
|
447
|
-
'atimeMs': ms,
|
|
448
|
-
'mtimeMs': ms,
|
|
449
|
-
'ctimeMs': ms,
|
|
450
|
-
'birthtimeMs': ms,
|
|
451
|
-
'atime': date,
|
|
452
|
-
'mtime': date,
|
|
453
|
-
'ctime': date,
|
|
454
|
-
'birthtime': date
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
try {
|
|
459
|
-
const res = yield fetch(tool.urlResolve(__dirname, './').slice(0, -1) + path, {
|
|
460
|
-
'headers': {
|
|
461
|
-
'range': `bytes=0-1`
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
const hdate = res.headers.get('date');
|
|
465
|
-
const hmdate = res.headers.get('last-modified');
|
|
466
|
-
let hlength = res.headers.get('content-range');
|
|
467
|
-
if (hlength) {
|
|
468
|
-
const lio = hlength.lastIndexOf('/');
|
|
469
|
-
hlength = hlength.slice(lio + 1);
|
|
470
|
-
}
|
|
471
|
-
let date = new Date();
|
|
472
|
-
let mdate = date;
|
|
473
|
-
if (hdate) {
|
|
474
|
-
date = new Date(hdate);
|
|
475
|
-
}
|
|
476
|
-
if (hmdate) {
|
|
477
|
-
mdate = new Date(hmdate);
|
|
478
|
-
}
|
|
479
|
-
const ms = date.getTime();
|
|
480
|
-
const mms = mdate.getTime();
|
|
481
|
-
return {
|
|
482
|
-
isFile: function () {
|
|
483
|
-
return true;
|
|
484
|
-
},
|
|
485
|
-
isDirectory: function () {
|
|
486
|
-
return false;
|
|
487
|
-
},
|
|
488
|
-
isSymbolicLink: function () {
|
|
489
|
-
return false;
|
|
490
|
-
},
|
|
491
|
-
'size': hlength ? parseInt(hlength) : 0,
|
|
492
|
-
'blksize': hlength ? parseInt(hlength) : 0,
|
|
493
|
-
'atimeMs': ms,
|
|
494
|
-
'mtimeMs': mms,
|
|
495
|
-
'ctimeMs': mms,
|
|
496
|
-
'birthtimeMs': ms,
|
|
497
|
-
'atime': date,
|
|
498
|
-
'mtime': mdate,
|
|
499
|
-
'ctime': mdate,
|
|
500
|
-
'birthtime': date
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
catch (_a) {
|
|
504
|
-
return null;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
function stats(path, taskId) {
|
|
510
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
var _a, _b;
|
|
512
|
-
path = tool.urlResolve('/', path);
|
|
513
|
-
if (path.endsWith('/')) {
|
|
514
|
-
path = path.slice(0, -1);
|
|
515
|
-
}
|
|
516
|
-
if (['', '/clickgo', '/storage', '/mounted', '/package'].includes(path)) {
|
|
517
|
-
const date = new Date();
|
|
518
|
-
const ms = date.getTime();
|
|
519
|
-
return {
|
|
520
|
-
isFile: function () {
|
|
521
|
-
return false;
|
|
522
|
-
},
|
|
523
|
-
isDirectory: function () {
|
|
524
|
-
return true;
|
|
525
|
-
},
|
|
526
|
-
isSymbolicLink: function () {
|
|
527
|
-
return false;
|
|
528
|
-
},
|
|
529
|
-
'size': 0,
|
|
530
|
-
'blksize': 0,
|
|
531
|
-
'atimeMs': ms,
|
|
532
|
-
'mtimeMs': ms,
|
|
533
|
-
'ctimeMs': ms,
|
|
534
|
-
'birthtimeMs': ms,
|
|
535
|
-
'atime': date,
|
|
536
|
-
'mtime': date,
|
|
537
|
-
'ctime': date,
|
|
538
|
-
'birthtime': date
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
if (path === '/current') {
|
|
542
|
-
const date = new Date();
|
|
543
|
-
const ms = date.getTime();
|
|
544
|
-
return {
|
|
545
|
-
isFile: function () {
|
|
546
|
-
return false;
|
|
547
|
-
},
|
|
548
|
-
isDirectory: function () {
|
|
549
|
-
return false;
|
|
550
|
-
},
|
|
551
|
-
isSymbolicLink: function () {
|
|
552
|
-
return true;
|
|
553
|
-
},
|
|
554
|
-
'size': 0,
|
|
555
|
-
'blksize': 0,
|
|
556
|
-
'atimeMs': ms,
|
|
557
|
-
'mtimeMs': ms,
|
|
558
|
-
'ctimeMs': ms,
|
|
559
|
-
'birthtimeMs': ms,
|
|
560
|
-
'atime': date,
|
|
561
|
-
'mtime': date,
|
|
562
|
-
'ctime': date,
|
|
563
|
-
'birthtime': date
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
let fpath = path.slice(8);
|
|
567
|
-
if (path.startsWith('/clickgo/')) {
|
|
568
|
-
if (!clickgoFiles.includes(fpath)) {
|
|
569
|
-
if (!clickgoFiles.includes(fpath + '/')) {
|
|
570
|
-
return null;
|
|
571
|
-
}
|
|
572
|
-
fpath += '/';
|
|
573
|
-
}
|
|
574
|
-
return getClickGoStats(fpath);
|
|
575
|
-
}
|
|
576
|
-
else if (path.startsWith('/storage/')) {
|
|
577
|
-
const r = yield task.checkPermission('fs.' + path + 'r', false, undefined, taskId);
|
|
578
|
-
if (!r[0]) {
|
|
579
|
-
return null;
|
|
580
|
-
}
|
|
581
|
-
const item = yield native.invoke('cg-fs-stats', native.getToken(), fpath);
|
|
582
|
-
if (!item) {
|
|
583
|
-
return null;
|
|
584
|
-
}
|
|
585
|
-
return {
|
|
586
|
-
isFile: function () {
|
|
587
|
-
return item.isFile;
|
|
588
|
-
},
|
|
589
|
-
isDirectory: function () {
|
|
590
|
-
return item.isDirectory;
|
|
591
|
-
},
|
|
592
|
-
isSymbolicLink: function () {
|
|
593
|
-
return item.isSymbolicLink;
|
|
594
|
-
},
|
|
595
|
-
'size': item.size,
|
|
596
|
-
'blksize': item.blksize,
|
|
597
|
-
'atimeMs': item.atimeMs,
|
|
598
|
-
'mtimeMs': item.mtimeMs,
|
|
599
|
-
'ctimeMs': item.ctimeMs,
|
|
600
|
-
'birthtimeMs': item.birthtimeMs,
|
|
601
|
-
'atime': item.atime,
|
|
602
|
-
'mtime': item.mtime,
|
|
603
|
-
'ctime': item.ctime,
|
|
604
|
-
'birthtime': item.birthtime
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
else if (path.startsWith('/mounted/')) {
|
|
608
|
-
const name = getMountName(path);
|
|
609
|
-
const hanlder = mounts[name];
|
|
610
|
-
if (!hanlder) {
|
|
611
|
-
return null;
|
|
612
|
-
}
|
|
613
|
-
if (path === '/mounted/' + name) {
|
|
614
|
-
const ms = hanlder.date.getTime();
|
|
615
|
-
return {
|
|
616
|
-
isFile: function () {
|
|
617
|
-
return false;
|
|
618
|
-
},
|
|
619
|
-
isDirectory: function () {
|
|
620
|
-
return true;
|
|
621
|
-
},
|
|
622
|
-
isSymbolicLink: function () {
|
|
623
|
-
return false;
|
|
624
|
-
},
|
|
625
|
-
'size': 0,
|
|
626
|
-
'blksize': 0,
|
|
627
|
-
'atimeMs': ms,
|
|
628
|
-
'mtimeMs': ms,
|
|
629
|
-
'ctimeMs': ms,
|
|
630
|
-
'birthtimeMs': ms,
|
|
631
|
-
'atime': hanlder.date,
|
|
632
|
-
'mtime': hanlder.date,
|
|
633
|
-
'ctime': hanlder.date,
|
|
634
|
-
'birthtime': hanlder.date
|
|
635
|
-
};
|
|
636
|
-
}
|
|
637
|
-
const r = yield task.checkPermission('fs.' + path + 'r', false, undefined, taskId);
|
|
638
|
-
if (!r[0]) {
|
|
639
|
-
return null;
|
|
640
|
-
}
|
|
641
|
-
return (_b = (_a = hanlder.stats) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length))) !== null && _b !== void 0 ? _b : null;
|
|
642
|
-
}
|
|
643
|
-
else if (path.startsWith('/package/') || path.startsWith('/current/')) {
|
|
644
|
-
if (!taskId) {
|
|
645
|
-
return null;
|
|
646
|
-
}
|
|
647
|
-
if (path.startsWith('/current/')) {
|
|
648
|
-
return stats(task.list[taskId].current + fpath, taskId);
|
|
649
|
-
}
|
|
650
|
-
if (task.list[taskId].app.files[fpath]) {
|
|
651
|
-
const file = task.list[taskId].app.files[fpath];
|
|
652
|
-
const date = new Date();
|
|
653
|
-
const ms = date.getTime();
|
|
654
|
-
let size = 0;
|
|
655
|
-
if (typeof file !== 'string') {
|
|
656
|
-
size = file.size;
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
size = new Blob([file]).size;
|
|
660
|
-
}
|
|
661
|
-
return {
|
|
662
|
-
isFile: function () {
|
|
663
|
-
return true;
|
|
664
|
-
},
|
|
665
|
-
isDirectory: function () {
|
|
666
|
-
return false;
|
|
667
|
-
},
|
|
668
|
-
isSymbolicLink: function () {
|
|
669
|
-
return false;
|
|
670
|
-
},
|
|
671
|
-
'size': size,
|
|
672
|
-
'blksize': size,
|
|
673
|
-
'atimeMs': ms,
|
|
674
|
-
'mtimeMs': ms,
|
|
675
|
-
'ctimeMs': ms,
|
|
676
|
-
'birthtimeMs': ms,
|
|
677
|
-
'atime': date,
|
|
678
|
-
'mtime': date,
|
|
679
|
-
'ctime': date,
|
|
680
|
-
'birthtime': date
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
if (!fpath.endsWith('/')) {
|
|
684
|
-
fpath += '/';
|
|
685
|
-
}
|
|
686
|
-
for (const p in task.list[taskId].app.files) {
|
|
687
|
-
if (!p.startsWith(fpath)) {
|
|
688
|
-
continue;
|
|
689
|
-
}
|
|
690
|
-
const date = new Date();
|
|
691
|
-
const ms = date.getTime();
|
|
692
|
-
return {
|
|
693
|
-
isFile: function () {
|
|
694
|
-
return false;
|
|
695
|
-
},
|
|
696
|
-
isDirectory: function () {
|
|
697
|
-
return true;
|
|
698
|
-
},
|
|
699
|
-
isSymbolicLink: function () {
|
|
700
|
-
return false;
|
|
701
|
-
},
|
|
702
|
-
'size': 0,
|
|
703
|
-
'blksize': 0,
|
|
704
|
-
'atimeMs': ms,
|
|
705
|
-
'mtimeMs': ms,
|
|
706
|
-
'ctimeMs': ms,
|
|
707
|
-
'birthtimeMs': ms,
|
|
708
|
-
'atime': date,
|
|
709
|
-
'mtime': date,
|
|
710
|
-
'ctime': date,
|
|
711
|
-
'birthtime': date
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
return null;
|
|
715
|
-
}
|
|
716
|
-
else {
|
|
717
|
-
return null;
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
function isDir(path, taskId) {
|
|
722
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
723
|
-
const pstats = yield stats(path, taskId);
|
|
724
|
-
if (!(pstats === null || pstats === void 0 ? void 0 : pstats.isDirectory())) {
|
|
725
|
-
return false;
|
|
726
|
-
}
|
|
727
|
-
return pstats;
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
function isFile(path, taskId) {
|
|
731
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
-
const pstats = yield stats(path, taskId);
|
|
733
|
-
if (!(pstats === null || pstats === void 0 ? void 0 : pstats.isFile())) {
|
|
734
|
-
return false;
|
|
735
|
-
}
|
|
736
|
-
return pstats;
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
function mkdir(path_1) {
|
|
740
|
-
return __awaiter(this, arguments, void 0, function* (path, mode = 0o755, taskId) {
|
|
741
|
-
var _a, _b;
|
|
742
|
-
path = tool.urlResolve('/', path);
|
|
743
|
-
if (yield isDir(path, taskId)) {
|
|
744
|
-
return true;
|
|
745
|
-
}
|
|
746
|
-
const fpath = path.slice(8);
|
|
747
|
-
if (path.startsWith('/clickgo/')) {
|
|
748
|
-
return false;
|
|
749
|
-
}
|
|
750
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
751
|
-
const r = yield task.checkPermission('fs.' + path + 'w', false, undefined, taskId);
|
|
752
|
-
if (!r[0]) {
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
if (path.startsWith('/mounted/')) {
|
|
756
|
-
const name = getMountName(path);
|
|
757
|
-
const hanlder = mounts[name];
|
|
758
|
-
if (!hanlder) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
return (_b = (_a = hanlder.mkdir) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length), mode)) !== null && _b !== void 0 ? _b : false;
|
|
762
|
-
}
|
|
763
|
-
return native.invoke('cg-fs-mkdir', native.getToken(), fpath, mode);
|
|
764
|
-
}
|
|
765
|
-
else if (path.startsWith('/package/')) {
|
|
766
|
-
return false;
|
|
767
|
-
}
|
|
768
|
-
else if (path.startsWith('/current/')) {
|
|
769
|
-
if (!taskId) {
|
|
770
|
-
return false;
|
|
771
|
-
}
|
|
772
|
-
return mkdir(task.list[taskId].current + fpath, mode, taskId);
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
function rmdir(path, taskId) {
|
|
780
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
781
|
-
var _a, _b;
|
|
782
|
-
path = tool.urlResolve('/', path);
|
|
783
|
-
const fpath = path.slice(8);
|
|
784
|
-
if (path.startsWith('/clickgo/')) {
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
788
|
-
const r = yield task.checkPermission('fs.' + path + 'w', false, undefined, taskId);
|
|
789
|
-
if (!r[0]) {
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
if (path.startsWith('/mounted/')) {
|
|
793
|
-
const name = getMountName(path);
|
|
794
|
-
const hanlder = mounts[name];
|
|
795
|
-
if (!hanlder) {
|
|
796
|
-
return false;
|
|
797
|
-
}
|
|
798
|
-
return (_b = (_a = hanlder.rmdir) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length))) !== null && _b !== void 0 ? _b : false;
|
|
799
|
-
}
|
|
800
|
-
return native.invoke('cg-fs-rmdir', native.getToken(), fpath);
|
|
801
|
-
}
|
|
802
|
-
else if (path.startsWith('/package/')) {
|
|
803
|
-
return false;
|
|
804
|
-
}
|
|
805
|
-
else if (path.startsWith('/current/')) {
|
|
806
|
-
if (!taskId) {
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
return rmdir(task.list[taskId].current + fpath, taskId);
|
|
810
|
-
}
|
|
811
|
-
else {
|
|
812
|
-
return false;
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
function rmdirDeep(path, taskId) {
|
|
817
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
818
|
-
path = tool.urlResolve('/', path);
|
|
819
|
-
if (!path.endsWith('/')) {
|
|
820
|
-
path += '/';
|
|
821
|
-
}
|
|
822
|
-
const list = yield readDir(path, undefined, taskId);
|
|
823
|
-
for (const item of list) {
|
|
824
|
-
const stat = yield stats(path + item.name, taskId);
|
|
825
|
-
if (!stat) {
|
|
826
|
-
return false;
|
|
827
|
-
}
|
|
828
|
-
if (stat.isDirectory()) {
|
|
829
|
-
const rtn = yield rmdirDeep(path + item.name, taskId);
|
|
830
|
-
if (!rtn) {
|
|
831
|
-
return false;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
else {
|
|
835
|
-
const rtn = yield unlink(path + item.name, taskId);
|
|
836
|
-
if (!rtn) {
|
|
837
|
-
return false;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return rmdir(path, taskId);
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
function chmod(path, mod, taskId) {
|
|
845
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
846
|
-
var _a, _b;
|
|
847
|
-
path = tool.urlResolve('/', path);
|
|
848
|
-
const fpath = path.slice(8);
|
|
849
|
-
if (path.startsWith('/clickgo/')) {
|
|
850
|
-
return false;
|
|
851
|
-
}
|
|
852
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
853
|
-
const r = yield task.checkPermission('fs.' + path + 'w', false, undefined, taskId);
|
|
854
|
-
if (!r[0]) {
|
|
855
|
-
return false;
|
|
856
|
-
}
|
|
857
|
-
if (path.startsWith('/mounted/')) {
|
|
858
|
-
const name = getMountName(path);
|
|
859
|
-
const hanlder = mounts[name];
|
|
860
|
-
if (!hanlder) {
|
|
861
|
-
return false;
|
|
862
|
-
}
|
|
863
|
-
return (_b = (_a = hanlder.chmod) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length), mod)) !== null && _b !== void 0 ? _b : false;
|
|
864
|
-
}
|
|
865
|
-
return native.invoke('cg-fs-chmod', native.getToken(), fpath, mod);
|
|
866
|
-
}
|
|
867
|
-
else if (path.startsWith('/package/')) {
|
|
868
|
-
return false;
|
|
869
|
-
}
|
|
870
|
-
else if (path.startsWith('/current/')) {
|
|
871
|
-
if (!taskId) {
|
|
872
|
-
return false;
|
|
873
|
-
}
|
|
874
|
-
return chmod(task.list[taskId].current + fpath, mod, taskId);
|
|
875
|
-
}
|
|
876
|
-
else {
|
|
877
|
-
return false;
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
function rename(oldPath, newPath, taskId) {
|
|
882
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
883
|
-
var _a, _b;
|
|
884
|
-
oldPath = tool.urlResolve('/', oldPath);
|
|
885
|
-
newPath = tool.urlResolve('/', newPath);
|
|
886
|
-
if (!oldPath.startsWith(newPath.slice(0, 9))) {
|
|
887
|
-
return false;
|
|
888
|
-
}
|
|
889
|
-
const ofpath = oldPath.slice(8);
|
|
890
|
-
const nfpath = newPath.slice(8);
|
|
891
|
-
if (oldPath.startsWith('/clickgo/')) {
|
|
892
|
-
return false;
|
|
893
|
-
}
|
|
894
|
-
else if (oldPath.startsWith('/storage/') || oldPath.startsWith('/mounted/')) {
|
|
895
|
-
let r = yield task.checkPermission('fs.' + oldPath + 'w', false, undefined, taskId);
|
|
896
|
-
if (!r[0]) {
|
|
897
|
-
return false;
|
|
898
|
-
}
|
|
899
|
-
r = yield task.checkPermission('fs.' + newPath + 'w', false, undefined, taskId);
|
|
900
|
-
if (!r[0]) {
|
|
901
|
-
return false;
|
|
902
|
-
}
|
|
903
|
-
if (oldPath.startsWith('/mounted/')) {
|
|
904
|
-
const fname = getMountName(oldPath);
|
|
905
|
-
const lname = getMountName(newPath);
|
|
906
|
-
if (fname !== lname) {
|
|
907
|
-
return false;
|
|
908
|
-
}
|
|
909
|
-
const hanlder = mounts[fname];
|
|
910
|
-
if (!hanlder) {
|
|
911
|
-
return false;
|
|
912
|
-
}
|
|
913
|
-
return (_b = (_a = hanlder.rename) === null || _a === void 0 ? void 0 : _a.call(hanlder, oldPath.slice(9 + fname.length), newPath.slice(9 + fname.length))) !== null && _b !== void 0 ? _b : false;
|
|
914
|
-
}
|
|
915
|
-
return native.invoke('cg-fs-rename', native.getToken(), ofpath, nfpath);
|
|
916
|
-
}
|
|
917
|
-
else if (oldPath.startsWith('/package/')) {
|
|
918
|
-
return false;
|
|
919
|
-
}
|
|
920
|
-
else if (oldPath.startsWith('/current/')) {
|
|
921
|
-
if (!taskId) {
|
|
922
|
-
return false;
|
|
923
|
-
}
|
|
924
|
-
return rename(task.list[taskId].current + ofpath, task.list[taskId].current + nfpath, taskId);
|
|
925
|
-
}
|
|
926
|
-
else {
|
|
927
|
-
return false;
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
function readDir(path, encoding, taskId) {
|
|
932
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
933
|
-
var _a, _b;
|
|
934
|
-
path = tool.urlResolve('/', path);
|
|
935
|
-
if (path === '/') {
|
|
936
|
-
const list = [
|
|
937
|
-
{
|
|
938
|
-
isFile: function () {
|
|
939
|
-
return false;
|
|
940
|
-
},
|
|
941
|
-
isDirectory: function () {
|
|
942
|
-
return true;
|
|
943
|
-
},
|
|
944
|
-
isSymbolicLink: function () {
|
|
945
|
-
return false;
|
|
946
|
-
},
|
|
947
|
-
'name': 'clickgo'
|
|
948
|
-
},
|
|
949
|
-
{
|
|
950
|
-
isFile: function () {
|
|
951
|
-
return false;
|
|
952
|
-
},
|
|
953
|
-
isDirectory: function () {
|
|
954
|
-
return true;
|
|
955
|
-
},
|
|
956
|
-
isSymbolicLink: function () {
|
|
957
|
-
return false;
|
|
958
|
-
},
|
|
959
|
-
'name': 'storage'
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
isFile: function () {
|
|
963
|
-
return false;
|
|
964
|
-
},
|
|
965
|
-
isDirectory: function () {
|
|
966
|
-
return true;
|
|
967
|
-
},
|
|
968
|
-
isSymbolicLink: function () {
|
|
969
|
-
return false;
|
|
970
|
-
},
|
|
971
|
-
'name': 'mounted'
|
|
972
|
-
}
|
|
973
|
-
];
|
|
974
|
-
if (taskId) {
|
|
975
|
-
list.push({
|
|
976
|
-
isFile: function () {
|
|
977
|
-
return false;
|
|
978
|
-
},
|
|
979
|
-
isDirectory: function () {
|
|
980
|
-
return true;
|
|
981
|
-
},
|
|
982
|
-
isSymbolicLink: function () {
|
|
983
|
-
return false;
|
|
984
|
-
},
|
|
985
|
-
'name': 'package'
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
if (taskId) {
|
|
989
|
-
list.push({
|
|
990
|
-
isFile: function () {
|
|
991
|
-
return false;
|
|
992
|
-
},
|
|
993
|
-
isDirectory: function () {
|
|
994
|
-
return false;
|
|
995
|
-
},
|
|
996
|
-
isSymbolicLink: function () {
|
|
997
|
-
return true;
|
|
998
|
-
},
|
|
999
|
-
'name': 'current'
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
return list;
|
|
1003
|
-
}
|
|
1004
|
-
if (!path.endsWith('/')) {
|
|
1005
|
-
path += '/';
|
|
1006
|
-
}
|
|
1007
|
-
const fpath = path.slice(8);
|
|
1008
|
-
if (path.startsWith('/clickgo/')) {
|
|
1009
|
-
const list = [];
|
|
1010
|
-
for (const item of clickgoFiles) {
|
|
1011
|
-
if (!item.startsWith(fpath)) {
|
|
1012
|
-
continue;
|
|
1013
|
-
}
|
|
1014
|
-
if (fpath === item) {
|
|
1015
|
-
continue;
|
|
1016
|
-
}
|
|
1017
|
-
const rpath = item.slice(fpath.length);
|
|
1018
|
-
if (rpath.includes('/')) {
|
|
1019
|
-
if (rpath.endsWith('/')) {
|
|
1020
|
-
if (rpath.slice(0, -1).includes('/')) {
|
|
1021
|
-
continue;
|
|
1022
|
-
}
|
|
1023
|
-
list.push({
|
|
1024
|
-
isFile: function () {
|
|
1025
|
-
return false;
|
|
1026
|
-
},
|
|
1027
|
-
isDirectory: function () {
|
|
1028
|
-
return true;
|
|
1029
|
-
},
|
|
1030
|
-
isSymbolicLink: function () {
|
|
1031
|
-
return false;
|
|
1032
|
-
},
|
|
1033
|
-
'name': rpath.slice(0, -1)
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
continue;
|
|
1037
|
-
}
|
|
1038
|
-
list.push({
|
|
1039
|
-
isFile: function () {
|
|
1040
|
-
return true;
|
|
1041
|
-
},
|
|
1042
|
-
isDirectory: function () {
|
|
1043
|
-
return false;
|
|
1044
|
-
},
|
|
1045
|
-
isSymbolicLink: function () {
|
|
1046
|
-
return false;
|
|
1047
|
-
},
|
|
1048
|
-
'name': rpath
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
return list;
|
|
1052
|
-
}
|
|
1053
|
-
else if (path.startsWith('/storage/') || path.startsWith('/mounted/')) {
|
|
1054
|
-
const list = [];
|
|
1055
|
-
if (path === '/mounted/') {
|
|
1056
|
-
for (const name in mounts) {
|
|
1057
|
-
list.push({
|
|
1058
|
-
isFile: function () {
|
|
1059
|
-
return false;
|
|
1060
|
-
},
|
|
1061
|
-
isDirectory: function () {
|
|
1062
|
-
return true;
|
|
1063
|
-
},
|
|
1064
|
-
isSymbolicLink: function () {
|
|
1065
|
-
return false;
|
|
1066
|
-
},
|
|
1067
|
-
'name': name
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
return list;
|
|
1071
|
-
}
|
|
1072
|
-
const r = yield task.checkPermission('fs.' + path + 'r', false, undefined, taskId);
|
|
1073
|
-
if (!r[0]) {
|
|
1074
|
-
return [];
|
|
1075
|
-
}
|
|
1076
|
-
if (path.startsWith('/mounted/')) {
|
|
1077
|
-
const name = getMountName(path);
|
|
1078
|
-
const hanlder = mounts[name];
|
|
1079
|
-
if (!hanlder) {
|
|
1080
|
-
return [];
|
|
1081
|
-
}
|
|
1082
|
-
return (_b = (_a = hanlder.readDir) === null || _a === void 0 ? void 0 : _a.call(hanlder, path.slice(9 + name.length), encoding)) !== null && _b !== void 0 ? _b : [];
|
|
1083
|
-
}
|
|
1084
|
-
const ls = yield native.invoke('cg-fs-readDir', native.getToken(), fpath, encoding);
|
|
1085
|
-
for (const item of ls) {
|
|
1086
|
-
list.push({
|
|
1087
|
-
isFile: function () {
|
|
1088
|
-
return item.isFile;
|
|
1089
|
-
},
|
|
1090
|
-
isDirectory: function () {
|
|
1091
|
-
return item.isDirectory;
|
|
1092
|
-
},
|
|
1093
|
-
isSymbolicLink: function () {
|
|
1094
|
-
return item.isSymbolicLink;
|
|
1095
|
-
},
|
|
1096
|
-
'name': item.name
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
return list;
|
|
1100
|
-
}
|
|
1101
|
-
else if (path.startsWith('/package/') || path.startsWith('/current/')) {
|
|
1102
|
-
if (!taskId) {
|
|
1103
|
-
return [];
|
|
1104
|
-
}
|
|
1105
|
-
if (path.startsWith('/current/')) {
|
|
1106
|
-
return readDir(task.list[taskId].current + fpath, encoding, taskId);
|
|
1107
|
-
}
|
|
1108
|
-
const list = [];
|
|
1109
|
-
const dirs = [];
|
|
1110
|
-
for (const p in task.list[taskId].app.files) {
|
|
1111
|
-
if (!p.startsWith(fpath)) {
|
|
1112
|
-
continue;
|
|
1113
|
-
}
|
|
1114
|
-
const rpath = p.slice(fpath.length);
|
|
1115
|
-
const sio = rpath.indexOf('/');
|
|
1116
|
-
if (sio !== -1) {
|
|
1117
|
-
const name = rpath.slice(0, sio);
|
|
1118
|
-
if (!dirs.includes(name)) {
|
|
1119
|
-
dirs.push(name);
|
|
1120
|
-
list.push({
|
|
1121
|
-
isFile: function () {
|
|
1122
|
-
return false;
|
|
1123
|
-
},
|
|
1124
|
-
isDirectory: function () {
|
|
1125
|
-
return true;
|
|
1126
|
-
},
|
|
1127
|
-
isSymbolicLink: function () {
|
|
1128
|
-
return false;
|
|
1129
|
-
},
|
|
1130
|
-
'name': name
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
continue;
|
|
1134
|
-
}
|
|
1135
|
-
list.push({
|
|
1136
|
-
isFile: function () {
|
|
1137
|
-
return true;
|
|
1138
|
-
},
|
|
1139
|
-
isDirectory: function () {
|
|
1140
|
-
return false;
|
|
1141
|
-
},
|
|
1142
|
-
isSymbolicLink: function () {
|
|
1143
|
-
return false;
|
|
1144
|
-
},
|
|
1145
|
-
'name': rpath
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
return list;
|
|
1149
|
-
}
|
|
1150
|
-
else {
|
|
1151
|
-
return [];
|
|
1152
|
-
}
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
function copyFolder(from_1, to_1) {
|
|
1156
|
-
return __awaiter(this, arguments, void 0, function* (from, to, ignore = [], taskId) {
|
|
1157
|
-
let num = 0;
|
|
1158
|
-
if (!(yield isDir(from, taskId))) {
|
|
1159
|
-
return 0;
|
|
1160
|
-
}
|
|
1161
|
-
const flist = yield readDir(from, undefined, taskId);
|
|
1162
|
-
let checkTo = false;
|
|
1163
|
-
for (const item of flist) {
|
|
1164
|
-
if (item.isDirectory()) {
|
|
1165
|
-
const r = yield copyFolder(from + item.name + '/', to + item.name + '/', ignore, taskId);
|
|
1166
|
-
if (r === -1) {
|
|
1167
|
-
return r;
|
|
1168
|
-
}
|
|
1169
|
-
else {
|
|
1170
|
-
num += r;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
else if (item.isFile()) {
|
|
1174
|
-
if (ignore.length > 0 && tool.match(item.name, ignore)) {
|
|
1175
|
-
continue;
|
|
1176
|
-
}
|
|
1177
|
-
if (!checkTo) {
|
|
1178
|
-
if (!(yield mkdir(to, undefined, taskId))) {
|
|
1179
|
-
return -1;
|
|
1180
|
-
}
|
|
1181
|
-
checkTo = true;
|
|
1182
|
-
}
|
|
1183
|
-
if (!(yield copyFile(from + item.name, to + item.name, taskId))) {
|
|
1184
|
-
continue;
|
|
1185
|
-
}
|
|
1186
|
-
++num;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
return num;
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
function copyFile(src, dest, taskId) {
|
|
1193
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1194
|
-
var _a, _b;
|
|
1195
|
-
src = tool.urlResolve('/', src);
|
|
1196
|
-
dest = tool.urlResolve('/', dest);
|
|
1197
|
-
if (!src.startsWith(dest.slice(0, 9))) {
|
|
1198
|
-
return false;
|
|
1199
|
-
}
|
|
1200
|
-
const sfpath = src.slice(8);
|
|
1201
|
-
const dfpath = dest.slice(8);
|
|
1202
|
-
if (src.startsWith('/clickgo/')) {
|
|
1203
|
-
return false;
|
|
1204
|
-
}
|
|
1205
|
-
else if (src.startsWith('/storage/') || dest.startsWith('/mounted/')) {
|
|
1206
|
-
let r = yield task.checkPermission('fs.' + src + 'r', false, undefined, taskId);
|
|
1207
|
-
if (!r[0]) {
|
|
1208
|
-
return false;
|
|
1209
|
-
}
|
|
1210
|
-
r = yield task.checkPermission('fs.' + dest + 'w', false, undefined, taskId);
|
|
1211
|
-
if (!r[0]) {
|
|
1212
|
-
return false;
|
|
1213
|
-
}
|
|
1214
|
-
if (src.startsWith('/mounted/')) {
|
|
1215
|
-
const fname = getMountName(src);
|
|
1216
|
-
const lname = getMountName(dest);
|
|
1217
|
-
if (fname !== lname) {
|
|
1218
|
-
return false;
|
|
1219
|
-
}
|
|
1220
|
-
const hanlder = mounts[fname];
|
|
1221
|
-
if (!hanlder) {
|
|
1222
|
-
return false;
|
|
1223
|
-
}
|
|
1224
|
-
return (_b = (_a = hanlder.copyFile) === null || _a === void 0 ? void 0 : _a.call(hanlder, src.slice(9 + fname.length), dest.slice(9 + fname.length))) !== null && _b !== void 0 ? _b : false;
|
|
1225
|
-
}
|
|
1226
|
-
return native.invoke('cg-fs-copyFile', native.getToken(), sfpath, dfpath);
|
|
1227
|
-
}
|
|
1228
|
-
else if (src.startsWith('/package/')) {
|
|
1229
|
-
return false;
|
|
1230
|
-
}
|
|
1231
|
-
else if (src.startsWith('/current/')) {
|
|
1232
|
-
if (!taskId) {
|
|
1233
|
-
return false;
|
|
1234
|
-
}
|
|
1235
|
-
return copyFile(task.list[taskId].current + sfpath, task.list[taskId].current + dfpath, taskId);
|
|
1236
|
-
}
|
|
1237
|
-
else {
|
|
1238
|
-
return false;
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
}
|