@nextcloud/files 3.4.0 → 3.5.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 +5 -1
- package/dist/files/file.d.ts +7 -1
- package/dist/files/fileType.d.ts +2 -19
- package/dist/files/folder.d.ts +9 -1
- package/dist/files/node.d.ts +11 -4
- package/dist/index.cjs +144 -560
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +144 -560
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/column.d.ts +1 -1
- package/dist/navigation/navigation.d.ts +64 -2
- package/dist/permissions.d.ts +2 -19
- package/dist/utils/fileSize.d.ts +2 -20
- package/dist/utils/fileSorting.d.ts +2 -2
- package/dist/utils/filename.d.ts +20 -0
- package/dist/utils/logger.d.ts +2 -19
- package/package.json +8 -7
package/dist/index.cjs
CHANGED
|
@@ -8,27 +8,7 @@ const router = require("@nextcloud/router");
|
|
|
8
8
|
const webdav = require("webdav");
|
|
9
9
|
const cancelablePromise = require("cancelable-promise");
|
|
10
10
|
const l10n = require("@nextcloud/l10n");
|
|
11
|
-
|
|
12
|
-
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
13
|
-
*
|
|
14
|
-
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
15
|
-
*
|
|
16
|
-
* @license AGPL-3.0-or-later
|
|
17
|
-
*
|
|
18
|
-
* This program is free software: you can redistribute it and/or modify
|
|
19
|
-
* it under the terms of the GNU Affero General Public License as
|
|
20
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
21
|
-
* License, or (at your option) any later version.
|
|
22
|
-
*
|
|
23
|
-
* This program is distributed in the hope that it will be useful,
|
|
24
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
-
* GNU Affero General Public License for more details.
|
|
27
|
-
*
|
|
28
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
29
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
11
|
+
const typescriptEventTarget = require("typescript-event-target");
|
|
32
12
|
const getLogger = (user) => {
|
|
33
13
|
if (user === null) {
|
|
34
14
|
return logger$1.getLoggerBuilder().setApp("files").build();
|
|
@@ -36,27 +16,6 @@ const getLogger = (user) => {
|
|
|
36
16
|
return logger$1.getLoggerBuilder().setApp("files").setUid(user.uid).build();
|
|
37
17
|
};
|
|
38
18
|
const logger = getLogger(auth.getCurrentUser());
|
|
39
|
-
/**
|
|
40
|
-
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
41
|
-
*
|
|
42
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
43
|
-
*
|
|
44
|
-
* @license AGPL-3.0-or-later
|
|
45
|
-
*
|
|
46
|
-
* This program is free software: you can redistribute it and/or modify
|
|
47
|
-
* it under the terms of the GNU Affero General Public License as
|
|
48
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
49
|
-
* License, or (at your option) any later version.
|
|
50
|
-
*
|
|
51
|
-
* This program is distributed in the hope that it will be useful,
|
|
52
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
53
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
54
|
-
* GNU Affero General Public License for more details.
|
|
55
|
-
*
|
|
56
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
57
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
19
|
var NewMenuEntryCategory = /* @__PURE__ */ ((NewMenuEntryCategory2) => {
|
|
61
20
|
NewMenuEntryCategory2[NewMenuEntryCategory2["UploadFromDevice"] = 0] = "UploadFromDevice";
|
|
62
21
|
NewMenuEntryCategory2[NewMenuEntryCategory2["CreateNew"] = 1] = "CreateNew";
|
|
@@ -123,27 +82,6 @@ const getNewFileMenu = function() {
|
|
|
123
82
|
}
|
|
124
83
|
return window._nc_newfilemenu;
|
|
125
84
|
};
|
|
126
|
-
/**
|
|
127
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
128
|
-
*
|
|
129
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
130
|
-
*
|
|
131
|
-
* @license AGPL-3.0-or-later
|
|
132
|
-
*
|
|
133
|
-
* This program is free software: you can redistribute it and/or modify
|
|
134
|
-
* it under the terms of the GNU Affero General Public License as
|
|
135
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
136
|
-
* License, or (at your option) any later version.
|
|
137
|
-
*
|
|
138
|
-
* This program is distributed in the hope that it will be useful,
|
|
139
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
140
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
141
|
-
* GNU Affero General Public License for more details.
|
|
142
|
-
*
|
|
143
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
144
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
85
|
var DefaultType = /* @__PURE__ */ ((DefaultType2) => {
|
|
148
86
|
DefaultType2["DEFAULT"] = "default";
|
|
149
87
|
DefaultType2["HIDDEN"] = "hidden";
|
|
@@ -248,27 +186,6 @@ const getFileActions = function() {
|
|
|
248
186
|
}
|
|
249
187
|
return window._nc_fileactions;
|
|
250
188
|
};
|
|
251
|
-
/**
|
|
252
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
253
|
-
*
|
|
254
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
255
|
-
*
|
|
256
|
-
* @license AGPL-3.0-or-later
|
|
257
|
-
*
|
|
258
|
-
* This program is free software: you can redistribute it and/or modify
|
|
259
|
-
* it under the terms of the GNU Affero General Public License as
|
|
260
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
261
|
-
* License, or (at your option) any later version.
|
|
262
|
-
*
|
|
263
|
-
* This program is distributed in the hope that it will be useful,
|
|
264
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
265
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
266
|
-
* GNU Affero General Public License for more details.
|
|
267
|
-
*
|
|
268
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
269
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
270
|
-
*
|
|
271
|
-
*/
|
|
272
189
|
class Header {
|
|
273
190
|
_header;
|
|
274
191
|
constructor(header) {
|
|
@@ -326,27 +243,6 @@ const getFileListHeaders = function() {
|
|
|
326
243
|
}
|
|
327
244
|
return window._nc_filelistheader;
|
|
328
245
|
};
|
|
329
|
-
/**
|
|
330
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
331
|
-
*
|
|
332
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
333
|
-
*
|
|
334
|
-
* @license AGPL-3.0-or-later
|
|
335
|
-
*
|
|
336
|
-
* This program is free software: you can redistribute it and/or modify
|
|
337
|
-
* it under the terms of the GNU Affero General Public License as
|
|
338
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
339
|
-
* License, or (at your option) any later version.
|
|
340
|
-
*
|
|
341
|
-
* This program is distributed in the hope that it will be useful,
|
|
342
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
343
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
344
|
-
* GNU Affero General Public License for more details.
|
|
345
|
-
*
|
|
346
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
347
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
348
|
-
*
|
|
349
|
-
*/
|
|
350
246
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
351
247
|
Permission2[Permission2["NONE"] = 0] = "NONE";
|
|
352
248
|
Permission2[Permission2["CREATE"] = 4] = "CREATE";
|
|
@@ -357,28 +253,6 @@ var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
|
357
253
|
Permission2[Permission2["ALL"] = 31] = "ALL";
|
|
358
254
|
return Permission2;
|
|
359
255
|
})(Permission || {});
|
|
360
|
-
/**
|
|
361
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
362
|
-
*
|
|
363
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
364
|
-
* @author Ferdinand Thiessen <opensource@fthiessen.de>
|
|
365
|
-
*
|
|
366
|
-
* @license AGPL-3.0-or-later
|
|
367
|
-
*
|
|
368
|
-
* This program is free software: you can redistribute it and/or modify
|
|
369
|
-
* it under the terms of the GNU Affero General Public License as
|
|
370
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
371
|
-
* License, or (at your option) any later version.
|
|
372
|
-
*
|
|
373
|
-
* This program is distributed in the hope that it will be useful,
|
|
374
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
375
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
376
|
-
* GNU Affero General Public License for more details.
|
|
377
|
-
*
|
|
378
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
379
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
380
|
-
*
|
|
381
|
-
*/
|
|
382
256
|
const defaultDavProperties = [
|
|
383
257
|
"d:getcontentlength",
|
|
384
258
|
"d:getcontenttype",
|
|
@@ -514,28 +388,6 @@ const davGetRecentSearch = function(lastModified) {
|
|
|
514
388
|
</d:basicsearch>
|
|
515
389
|
</d:searchrequest>`;
|
|
516
390
|
};
|
|
517
|
-
/**
|
|
518
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
519
|
-
*
|
|
520
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
521
|
-
* @author Ferdinand Thiessen <opensource@fthiessen.de>
|
|
522
|
-
*
|
|
523
|
-
* @license AGPL-3.0-or-later
|
|
524
|
-
*
|
|
525
|
-
* This program is free software: you can redistribute it and/or modify
|
|
526
|
-
* it under the terms of the GNU Affero General Public License as
|
|
527
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
528
|
-
* License, or (at your option) any later version.
|
|
529
|
-
*
|
|
530
|
-
* This program is distributed in the hope that it will be useful,
|
|
531
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
532
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
533
|
-
* GNU Affero General Public License for more details.
|
|
534
|
-
*
|
|
535
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
536
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
537
|
-
*
|
|
538
|
-
*/
|
|
539
391
|
const davParsePermissions = function(permString = "") {
|
|
540
392
|
let permissions = Permission.NONE;
|
|
541
393
|
if (!permString) {
|
|
@@ -558,53 +410,6 @@ const davParsePermissions = function(permString = "") {
|
|
|
558
410
|
}
|
|
559
411
|
return permissions;
|
|
560
412
|
};
|
|
561
|
-
/**
|
|
562
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
563
|
-
*
|
|
564
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
565
|
-
*
|
|
566
|
-
* @license AGPL-3.0-or-later
|
|
567
|
-
*
|
|
568
|
-
* This program is free software: you can redistribute it and/or modify
|
|
569
|
-
* it under the terms of the GNU Affero General Public License as
|
|
570
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
571
|
-
* License, or (at your option) any later version.
|
|
572
|
-
*
|
|
573
|
-
* This program is distributed in the hope that it will be useful,
|
|
574
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
575
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
576
|
-
* GNU Affero General Public License for more details.
|
|
577
|
-
*
|
|
578
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
579
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
580
|
-
*
|
|
581
|
-
*/
|
|
582
|
-
var FileType = /* @__PURE__ */ ((FileType2) => {
|
|
583
|
-
FileType2["Folder"] = "folder";
|
|
584
|
-
FileType2["File"] = "file";
|
|
585
|
-
return FileType2;
|
|
586
|
-
})(FileType || {});
|
|
587
|
-
/**
|
|
588
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
589
|
-
*
|
|
590
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
591
|
-
*
|
|
592
|
-
* @license AGPL-3.0-or-later
|
|
593
|
-
*
|
|
594
|
-
* This program is free software: you can redistribute it and/or modify
|
|
595
|
-
* it under the terms of the GNU Affero General Public License as
|
|
596
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
597
|
-
* License, or (at your option) any later version.
|
|
598
|
-
*
|
|
599
|
-
* This program is distributed in the hope that it will be useful,
|
|
600
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
601
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
602
|
-
* GNU Affero General Public License for more details.
|
|
603
|
-
*
|
|
604
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
605
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
606
|
-
*
|
|
607
|
-
*/
|
|
608
413
|
const isDavRessource = function(source, davService) {
|
|
609
414
|
return source.match(davService) !== null;
|
|
610
415
|
};
|
|
@@ -663,27 +468,6 @@ const validateData = (data, davService) => {
|
|
|
663
468
|
throw new Error("Status must be a valid NodeStatus");
|
|
664
469
|
}
|
|
665
470
|
};
|
|
666
|
-
/**
|
|
667
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
668
|
-
*
|
|
669
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
670
|
-
*
|
|
671
|
-
* @license AGPL-3.0-or-later
|
|
672
|
-
*
|
|
673
|
-
* This program is free software: you can redistribute it and/or modify
|
|
674
|
-
* it under the terms of the GNU Affero General Public License as
|
|
675
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
676
|
-
* License, or (at your option) any later version.
|
|
677
|
-
*
|
|
678
|
-
* This program is distributed in the hope that it will be useful,
|
|
679
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
680
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
681
|
-
* GNU Affero General Public License for more details.
|
|
682
|
-
*
|
|
683
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
684
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
685
|
-
*
|
|
686
|
-
*/
|
|
687
471
|
var NodeStatus = /* @__PURE__ */ ((NodeStatus2) => {
|
|
688
472
|
NodeStatus2["NEW"] = "new";
|
|
689
473
|
NodeStatus2["FAILED"] = "failed";
|
|
@@ -701,14 +485,12 @@ class Node {
|
|
|
701
485
|
if (this.readonlyAttributes.includes(prop)) {
|
|
702
486
|
return false;
|
|
703
487
|
}
|
|
704
|
-
this.updateMtime();
|
|
705
488
|
return Reflect.set(target, prop, value);
|
|
706
489
|
},
|
|
707
490
|
deleteProperty: (target, prop) => {
|
|
708
491
|
if (this.readonlyAttributes.includes(prop)) {
|
|
709
492
|
return false;
|
|
710
493
|
}
|
|
711
|
-
this.updateMtime();
|
|
712
494
|
return Reflect.deleteProperty(target, prop);
|
|
713
495
|
},
|
|
714
496
|
// TODO: This is deprecated and only needed for files v3
|
|
@@ -725,7 +507,6 @@ class Node {
|
|
|
725
507
|
this._data = { ...data, attributes: {} };
|
|
726
508
|
this._attributes = new Proxy(this._data.attributes, this.handler);
|
|
727
509
|
this.update(data.attributes ?? {});
|
|
728
|
-
this._data.mtime = data.mtime;
|
|
729
510
|
if (davService) {
|
|
730
511
|
this._knownDavService = davService;
|
|
731
512
|
}
|
|
@@ -790,12 +571,16 @@ class Node {
|
|
|
790
571
|
}
|
|
791
572
|
/**
|
|
792
573
|
* Get the file modification time
|
|
793
|
-
* There is no setter as the modification time is not meant to be changed manually.
|
|
794
|
-
* It will be automatically updated when the attributes are changed.
|
|
795
574
|
*/
|
|
796
575
|
get mtime() {
|
|
797
576
|
return this._data.mtime;
|
|
798
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Set the file modification time
|
|
580
|
+
*/
|
|
581
|
+
set mtime(mtime) {
|
|
582
|
+
this._data.mtime = mtime;
|
|
583
|
+
}
|
|
799
584
|
/**
|
|
800
585
|
* Get the file creation time
|
|
801
586
|
* There is no setter as the creation time is not meant to be changed
|
|
@@ -927,7 +712,7 @@ class Node {
|
|
|
927
712
|
this.move(path.dirname(this.source) + "/" + basename2);
|
|
928
713
|
}
|
|
929
714
|
/**
|
|
930
|
-
* Update the mtime if exists
|
|
715
|
+
* Update the mtime if exists
|
|
931
716
|
*/
|
|
932
717
|
updateMtime() {
|
|
933
718
|
if (this._data.mtime) {
|
|
@@ -936,6 +721,7 @@ class Node {
|
|
|
936
721
|
}
|
|
937
722
|
/**
|
|
938
723
|
* Update the attributes of the node
|
|
724
|
+
* Warning, updating attributes will NOT automatically update the mtime.
|
|
939
725
|
*
|
|
940
726
|
* @param attributes The new attributes to update on the Node attributes
|
|
941
727
|
*/
|
|
@@ -956,53 +742,16 @@ class Node {
|
|
|
956
742
|
}
|
|
957
743
|
}
|
|
958
744
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
* @license AGPL-3.0-or-later
|
|
965
|
-
*
|
|
966
|
-
* This program is free software: you can redistribute it and/or modify
|
|
967
|
-
* it under the terms of the GNU Affero General Public License as
|
|
968
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
969
|
-
* License, or (at your option) any later version.
|
|
970
|
-
*
|
|
971
|
-
* This program is distributed in the hope that it will be useful,
|
|
972
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
973
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
974
|
-
* GNU Affero General Public License for more details.
|
|
975
|
-
*
|
|
976
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
977
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
978
|
-
*
|
|
979
|
-
*/
|
|
745
|
+
var FileType = /* @__PURE__ */ ((FileType2) => {
|
|
746
|
+
FileType2["Folder"] = "folder";
|
|
747
|
+
FileType2["File"] = "file";
|
|
748
|
+
return FileType2;
|
|
749
|
+
})(FileType || {});
|
|
980
750
|
class File extends Node {
|
|
981
751
|
get type() {
|
|
982
752
|
return FileType.File;
|
|
983
753
|
}
|
|
984
754
|
}
|
|
985
|
-
/**
|
|
986
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
987
|
-
*
|
|
988
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
989
|
-
*
|
|
990
|
-
* @license AGPL-3.0-or-later
|
|
991
|
-
*
|
|
992
|
-
* This program is free software: you can redistribute it and/or modify
|
|
993
|
-
* it under the terms of the GNU Affero General Public License as
|
|
994
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
995
|
-
* License, or (at your option) any later version.
|
|
996
|
-
*
|
|
997
|
-
* This program is distributed in the hope that it will be useful,
|
|
998
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
999
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1000
|
-
* GNU Affero General Public License for more details.
|
|
1001
|
-
*
|
|
1002
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1003
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1004
|
-
*
|
|
1005
|
-
*/
|
|
1006
755
|
class Folder extends Node {
|
|
1007
756
|
constructor(data) {
|
|
1008
757
|
super({
|
|
@@ -1020,28 +769,6 @@ class Folder extends Node {
|
|
|
1020
769
|
return "httpd/unix-directory";
|
|
1021
770
|
}
|
|
1022
771
|
}
|
|
1023
|
-
/**
|
|
1024
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
1025
|
-
*
|
|
1026
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
1027
|
-
* @author Ferdinand Thiessen <opensource@fthiessen.de>
|
|
1028
|
-
*
|
|
1029
|
-
* @license AGPL-3.0-or-later
|
|
1030
|
-
*
|
|
1031
|
-
* This program is free software: you can redistribute it and/or modify
|
|
1032
|
-
* it under the terms of the GNU Affero General Public License as
|
|
1033
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
1034
|
-
* License, or (at your option) any later version.
|
|
1035
|
-
*
|
|
1036
|
-
* This program is distributed in the hope that it will be useful,
|
|
1037
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1038
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1039
|
-
* GNU Affero General Public License for more details.
|
|
1040
|
-
*
|
|
1041
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1042
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1043
|
-
*
|
|
1044
|
-
*/
|
|
1045
772
|
const davRootPath = `/files/${auth.getCurrentUser()?.uid}`;
|
|
1046
773
|
const davRemoteURL = router.generateRemoteUrl("dav");
|
|
1047
774
|
const davGetClient = function(remoteURL = davRemoteURL, headers = {}) {
|
|
@@ -1102,12 +829,15 @@ const davResultToNode = function(node, filesRoot = davRootPath, remoteURL = davR
|
|
|
1102
829
|
const props = node.props;
|
|
1103
830
|
const permissions = davParsePermissions(props?.permissions);
|
|
1104
831
|
const owner = String(props?.["owner-id"] || userId);
|
|
832
|
+
const id = props.fileid || 0;
|
|
1105
833
|
const nodeData = {
|
|
1106
|
-
id
|
|
834
|
+
id,
|
|
1107
835
|
source: `${remoteURL}${node.filename}`,
|
|
1108
836
|
mtime: new Date(Date.parse(node.lastmod)),
|
|
1109
837
|
mime: node.mime || "application/octet-stream",
|
|
1110
838
|
size: props?.size || Number.parseInt(props.getcontentlength || "0"),
|
|
839
|
+
// The fileid is set to -1 for failed requests
|
|
840
|
+
status: id < 0 ? NodeStatus.FAILED : void 0,
|
|
1111
841
|
permissions,
|
|
1112
842
|
owner,
|
|
1113
843
|
root: filesRoot,
|
|
@@ -1131,28 +861,21 @@ function isFilenameValid(filename) {
|
|
|
1131
861
|
}
|
|
1132
862
|
return true;
|
|
1133
863
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1150
|
-
* GNU Affero General Public License for more details.
|
|
1151
|
-
*
|
|
1152
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1153
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1154
|
-
*
|
|
1155
|
-
*/
|
|
864
|
+
function getUniqueName(name, otherNames, options) {
|
|
865
|
+
const opts = {
|
|
866
|
+
suffix: (n) => `(${n})`,
|
|
867
|
+
ignoreFileExtension: false,
|
|
868
|
+
...options
|
|
869
|
+
};
|
|
870
|
+
let newName = name;
|
|
871
|
+
let i = 1;
|
|
872
|
+
while (otherNames.includes(newName)) {
|
|
873
|
+
const ext = opts.ignoreFileExtension ? "" : path.extname(name);
|
|
874
|
+
const base = path.basename(name, ext);
|
|
875
|
+
newName = `${base} ${opts.suffix(i++)}${ext}`;
|
|
876
|
+
}
|
|
877
|
+
return newName;
|
|
878
|
+
}
|
|
1156
879
|
const humanList = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
1157
880
|
const humanListBinary = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
1158
881
|
function formatFileSize(size, skipSmallSizes = false, binaryPrefixes = false, base1000 = false) {
|
|
@@ -1239,6 +962,7 @@ function sortNodes(nodes, options = {}) {
|
|
|
1239
962
|
sortingOrder: "asc",
|
|
1240
963
|
...options
|
|
1241
964
|
};
|
|
965
|
+
const basename = (name) => name.lastIndexOf(".") > 0 ? name.slice(0, name.lastIndexOf(".")) : name;
|
|
1242
966
|
const identifiers = [
|
|
1243
967
|
// 1: Sort favorites first if enabled
|
|
1244
968
|
...sortingOptions.sortFavoritesFirst ? [(v) => v.attributes?.favorite !== 1] : [],
|
|
@@ -1247,7 +971,7 @@ function sortNodes(nodes, options = {}) {
|
|
|
1247
971
|
// 3: Use sorting mode if NOT basename (to be able to use displayName too)
|
|
1248
972
|
...sortingOptions.sortingMode !== "basename" ? [(v) => v[sortingOptions.sortingMode]] : [],
|
|
1249
973
|
// 4: Use displayName if available, fallback to name
|
|
1250
|
-
(v) => v.attributes?.displayName || v.basename,
|
|
974
|
+
(v) => basename(v.attributes?.displayName || v.basename),
|
|
1251
975
|
// 5: Finally, use basename if all previous sorting methods failed
|
|
1252
976
|
(v) => v.basename
|
|
1253
977
|
];
|
|
@@ -1267,51 +991,54 @@ function sortNodes(nodes, options = {}) {
|
|
|
1267
991
|
];
|
|
1268
992
|
return orderBy(nodes, identifiers, orders);
|
|
1269
993
|
}
|
|
1270
|
-
|
|
1271
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
1272
|
-
*
|
|
1273
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
1274
|
-
*
|
|
1275
|
-
* @license AGPL-3.0-or-later
|
|
1276
|
-
*
|
|
1277
|
-
* This program is free software: you can redistribute it and/or modify
|
|
1278
|
-
* it under the terms of the GNU Affero General Public License as
|
|
1279
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
1280
|
-
* License, or (at your option) any later version.
|
|
1281
|
-
*
|
|
1282
|
-
* This program is distributed in the hope that it will be useful,
|
|
1283
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1284
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1285
|
-
* GNU Affero General Public License for more details.
|
|
1286
|
-
*
|
|
1287
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1288
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1289
|
-
*
|
|
1290
|
-
*/
|
|
1291
|
-
class Navigation {
|
|
994
|
+
class Navigation extends typescriptEventTarget.TypedEventTarget {
|
|
1292
995
|
_views = [];
|
|
1293
996
|
_currentView = null;
|
|
997
|
+
/**
|
|
998
|
+
* Register a new view on the navigation
|
|
999
|
+
* @param view The view to register
|
|
1000
|
+
* @throws `Error` is thrown if a view with the same id is already registered
|
|
1001
|
+
*/
|
|
1294
1002
|
register(view) {
|
|
1295
1003
|
if (this._views.find((search) => search.id === view.id)) {
|
|
1296
1004
|
throw new Error(`View id ${view.id} is already registered`);
|
|
1297
1005
|
}
|
|
1298
1006
|
this._views.push(view);
|
|
1007
|
+
this.dispatchTypedEvent("update", new CustomEvent("update"));
|
|
1299
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Remove a registered view
|
|
1011
|
+
* @param id The id of the view to remove
|
|
1012
|
+
*/
|
|
1300
1013
|
remove(id) {
|
|
1301
1014
|
const index = this._views.findIndex((view) => view.id === id);
|
|
1302
1015
|
if (index !== -1) {
|
|
1303
1016
|
this._views.splice(index, 1);
|
|
1017
|
+
this.dispatchTypedEvent("update", new CustomEvent("update"));
|
|
1304
1018
|
}
|
|
1305
1019
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* Set the currently active view
|
|
1022
|
+
* @fires UpdateActiveViewEvent
|
|
1023
|
+
* @param view New active view
|
|
1024
|
+
*/
|
|
1309
1025
|
setActive(view) {
|
|
1310
1026
|
this._currentView = view;
|
|
1027
|
+
const event = new CustomEvent("updateActive", { detail: view });
|
|
1028
|
+
this.dispatchTypedEvent("updateActive", event);
|
|
1311
1029
|
}
|
|
1030
|
+
/**
|
|
1031
|
+
* The currently active files view
|
|
1032
|
+
*/
|
|
1312
1033
|
get active() {
|
|
1313
1034
|
return this._currentView;
|
|
1314
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* All registered views
|
|
1038
|
+
*/
|
|
1039
|
+
get views() {
|
|
1040
|
+
return this._views;
|
|
1041
|
+
}
|
|
1315
1042
|
}
|
|
1316
1043
|
const getNavigation = function() {
|
|
1317
1044
|
if (typeof window._nc_navigation === "undefined") {
|
|
@@ -1320,27 +1047,6 @@ const getNavigation = function() {
|
|
|
1320
1047
|
}
|
|
1321
1048
|
return window._nc_navigation;
|
|
1322
1049
|
};
|
|
1323
|
-
/**
|
|
1324
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
1325
|
-
*
|
|
1326
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
1327
|
-
*
|
|
1328
|
-
* @license AGPL-3.0-or-later
|
|
1329
|
-
*
|
|
1330
|
-
* This program is free software: you can redistribute it and/or modify
|
|
1331
|
-
* it under the terms of the GNU Affero General Public License as
|
|
1332
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
1333
|
-
* License, or (at your option) any later version.
|
|
1334
|
-
*
|
|
1335
|
-
* This program is distributed in the hope that it will be useful,
|
|
1336
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1337
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1338
|
-
* GNU Affero General Public License for more details.
|
|
1339
|
-
*
|
|
1340
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1341
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1342
|
-
*
|
|
1343
|
-
*/
|
|
1344
1050
|
class Column {
|
|
1345
1051
|
_column;
|
|
1346
1052
|
constructor(column) {
|
|
@@ -1455,8 +1161,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1455
1161
|
if (xmlData[i] === "<" && xmlData[i + 1] === "?") {
|
|
1456
1162
|
i += 2;
|
|
1457
1163
|
i = readPI(xmlData, i);
|
|
1458
|
-
if (i.err)
|
|
1459
|
-
return i;
|
|
1164
|
+
if (i.err) return i;
|
|
1460
1165
|
} else if (xmlData[i] === "<") {
|
|
1461
1166
|
let tagStartPos = i;
|
|
1462
1167
|
i++;
|
|
@@ -1530,8 +1235,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1530
1235
|
}
|
|
1531
1236
|
if (reachedRoot === true) {
|
|
1532
1237
|
return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
|
|
1533
|
-
} else if (options.unpairedTags.indexOf(tagName) !== -1)
|
|
1534
|
-
;
|
|
1238
|
+
} else if (options.unpairedTags.indexOf(tagName) !== -1) ;
|
|
1535
1239
|
else {
|
|
1536
1240
|
tags.push({ tagName, tagStartPos });
|
|
1537
1241
|
}
|
|
@@ -1545,8 +1249,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1545
1249
|
continue;
|
|
1546
1250
|
} else if (xmlData[i + 1] === "?") {
|
|
1547
1251
|
i = readPI(xmlData, ++i);
|
|
1548
|
-
if (i.err)
|
|
1549
|
-
return i;
|
|
1252
|
+
if (i.err) return i;
|
|
1550
1253
|
} else {
|
|
1551
1254
|
break;
|
|
1552
1255
|
}
|
|
@@ -1641,8 +1344,7 @@ function readAttributeStr(xmlData, i) {
|
|
|
1641
1344
|
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
1642
1345
|
if (startChar === "") {
|
|
1643
1346
|
startChar = xmlData[i];
|
|
1644
|
-
} else if (startChar !== xmlData[i])
|
|
1645
|
-
;
|
|
1347
|
+
} else if (startChar !== xmlData[i]) ;
|
|
1646
1348
|
else {
|
|
1647
1349
|
startChar = "";
|
|
1648
1350
|
}
|
|
@@ -1803,13 +1505,11 @@ class XmlNode {
|
|
|
1803
1505
|
this[":@"] = {};
|
|
1804
1506
|
}
|
|
1805
1507
|
add(key, val2) {
|
|
1806
|
-
if (key === "__proto__")
|
|
1807
|
-
key = "#__proto__";
|
|
1508
|
+
if (key === "__proto__") key = "#__proto__";
|
|
1808
1509
|
this.child.push({ [key]: val2 });
|
|
1809
1510
|
}
|
|
1810
1511
|
addChild(node) {
|
|
1811
|
-
if (node.tagname === "__proto__")
|
|
1812
|
-
node.tagname = "#__proto__";
|
|
1512
|
+
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
1813
1513
|
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
|
|
1814
1514
|
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
1815
1515
|
} else {
|
|
@@ -1836,16 +1536,11 @@ function readDocType$1(xmlData, i) {
|
|
|
1836
1536
|
regx: RegExp(`&${entityName};`, "g"),
|
|
1837
1537
|
val
|
|
1838
1538
|
};
|
|
1839
|
-
} else if (hasBody && isElement(xmlData, i))
|
|
1840
|
-
|
|
1841
|
-
else if (hasBody &&
|
|
1842
|
-
|
|
1843
|
-
else
|
|
1844
|
-
i += 9;
|
|
1845
|
-
else if (isComment)
|
|
1846
|
-
comment = true;
|
|
1847
|
-
else
|
|
1848
|
-
throw new Error("Invalid DOCTYPE");
|
|
1539
|
+
} else if (hasBody && isElement(xmlData, i)) i += 8;
|
|
1540
|
+
else if (hasBody && isAttlist(xmlData, i)) i += 8;
|
|
1541
|
+
else if (hasBody && isNotation(xmlData, i)) i += 9;
|
|
1542
|
+
else if (isComment) comment = true;
|
|
1543
|
+
else throw new Error("Invalid DOCTYPE");
|
|
1849
1544
|
angleBracketsCount++;
|
|
1850
1545
|
exp = "";
|
|
1851
1546
|
} else if (xmlData[i] === ">") {
|
|
@@ -1880,8 +1575,7 @@ function readEntityExp(xmlData, i) {
|
|
|
1880
1575
|
entityName2 += xmlData[i];
|
|
1881
1576
|
}
|
|
1882
1577
|
entityName2 = entityName2.trim();
|
|
1883
|
-
if (entityName2.indexOf(" ") !== -1)
|
|
1884
|
-
throw new Error("External entites are not supported");
|
|
1578
|
+
if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
1885
1579
|
const startChar = xmlData[i++];
|
|
1886
1580
|
let val2 = "";
|
|
1887
1581
|
for (; i < xmlData.length && xmlData[i] !== startChar; i++) {
|
|
@@ -1890,28 +1584,23 @@ function readEntityExp(xmlData, i) {
|
|
|
1890
1584
|
return [entityName2, val2, i];
|
|
1891
1585
|
}
|
|
1892
1586
|
function isComment(xmlData, i) {
|
|
1893
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-")
|
|
1894
|
-
return true;
|
|
1587
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true;
|
|
1895
1588
|
return false;
|
|
1896
1589
|
}
|
|
1897
1590
|
function isEntity(xmlData, i) {
|
|
1898
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y")
|
|
1899
|
-
return true;
|
|
1591
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true;
|
|
1900
1592
|
return false;
|
|
1901
1593
|
}
|
|
1902
1594
|
function isElement(xmlData, i) {
|
|
1903
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T")
|
|
1904
|
-
return true;
|
|
1595
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true;
|
|
1905
1596
|
return false;
|
|
1906
1597
|
}
|
|
1907
1598
|
function isAttlist(xmlData, i) {
|
|
1908
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T")
|
|
1909
|
-
return true;
|
|
1599
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true;
|
|
1910
1600
|
return false;
|
|
1911
1601
|
}
|
|
1912
1602
|
function isNotation(xmlData, i) {
|
|
1913
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N")
|
|
1914
|
-
return true;
|
|
1603
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true;
|
|
1915
1604
|
return false;
|
|
1916
1605
|
}
|
|
1917
1606
|
function validateEntityName(name) {
|
|
@@ -1938,11 +1627,9 @@ const consider = {
|
|
|
1938
1627
|
};
|
|
1939
1628
|
function toNumber$1(str, options = {}) {
|
|
1940
1629
|
options = Object.assign({}, consider, options);
|
|
1941
|
-
if (!str || typeof str !== "string")
|
|
1942
|
-
return str;
|
|
1630
|
+
if (!str || typeof str !== "string") return str;
|
|
1943
1631
|
let trimmedStr = str.trim();
|
|
1944
|
-
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr))
|
|
1945
|
-
return str;
|
|
1632
|
+
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
|
|
1946
1633
|
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
1947
1634
|
return Number.parseInt(trimmedStr, 16);
|
|
1948
1635
|
} else {
|
|
@@ -1952,45 +1639,30 @@ function toNumber$1(str, options = {}) {
|
|
|
1952
1639
|
const leadingZeros = match[2];
|
|
1953
1640
|
let numTrimmedByZeros = trimZeros(match[3]);
|
|
1954
1641
|
const eNotation = match[4] || match[6];
|
|
1955
|
-
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".")
|
|
1956
|
-
|
|
1957
|
-
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".")
|
|
1958
|
-
return str;
|
|
1642
|
+
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str;
|
|
1643
|
+
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str;
|
|
1959
1644
|
else {
|
|
1960
1645
|
const num = Number(trimmedStr);
|
|
1961
1646
|
const numStr = "" + num;
|
|
1962
1647
|
if (numStr.search(/[eE]/) !== -1) {
|
|
1963
|
-
if (options.eNotation)
|
|
1964
|
-
|
|
1965
|
-
else
|
|
1966
|
-
return str;
|
|
1648
|
+
if (options.eNotation) return num;
|
|
1649
|
+
else return str;
|
|
1967
1650
|
} else if (eNotation) {
|
|
1968
|
-
if (options.eNotation)
|
|
1969
|
-
|
|
1970
|
-
else
|
|
1971
|
-
return str;
|
|
1651
|
+
if (options.eNotation) return num;
|
|
1652
|
+
else return str;
|
|
1972
1653
|
} else if (trimmedStr.indexOf(".") !== -1) {
|
|
1973
|
-
if (numStr === "0" && numTrimmedByZeros === "")
|
|
1974
|
-
|
|
1975
|
-
else if (numStr === numTrimmedByZeros)
|
|
1976
|
-
|
|
1977
|
-
else if (sign && numStr === "-" + numTrimmedByZeros)
|
|
1978
|
-
return num;
|
|
1979
|
-
else
|
|
1980
|
-
return str;
|
|
1654
|
+
if (numStr === "0" && numTrimmedByZeros === "") return num;
|
|
1655
|
+
else if (numStr === numTrimmedByZeros) return num;
|
|
1656
|
+
else if (sign && numStr === "-" + numTrimmedByZeros) return num;
|
|
1657
|
+
else return str;
|
|
1981
1658
|
}
|
|
1982
1659
|
if (leadingZeros) {
|
|
1983
|
-
if (numTrimmedByZeros === numStr)
|
|
1984
|
-
|
|
1985
|
-
else
|
|
1986
|
-
return num;
|
|
1987
|
-
else
|
|
1988
|
-
return str;
|
|
1660
|
+
if (numTrimmedByZeros === numStr) return num;
|
|
1661
|
+
else if (sign + numTrimmedByZeros === numStr) return num;
|
|
1662
|
+
else return str;
|
|
1989
1663
|
}
|
|
1990
|
-
if (trimmedStr === numStr)
|
|
1991
|
-
|
|
1992
|
-
else if (trimmedStr === sign + numStr)
|
|
1993
|
-
return num;
|
|
1664
|
+
if (trimmedStr === numStr) return num;
|
|
1665
|
+
else if (trimmedStr === sign + numStr) return num;
|
|
1994
1666
|
return str;
|
|
1995
1667
|
}
|
|
1996
1668
|
} else {
|
|
@@ -2001,12 +1673,9 @@ function toNumber$1(str, options = {}) {
|
|
|
2001
1673
|
function trimZeros(numStr) {
|
|
2002
1674
|
if (numStr && numStr.indexOf(".") !== -1) {
|
|
2003
1675
|
numStr = numStr.replace(/0+$/, "");
|
|
2004
|
-
if (numStr === ".")
|
|
2005
|
-
|
|
2006
|
-
else if (numStr[
|
|
2007
|
-
numStr = "0" + numStr;
|
|
2008
|
-
else if (numStr[numStr.length - 1] === ".")
|
|
2009
|
-
numStr = numStr.substr(0, numStr.length - 1);
|
|
1676
|
+
if (numStr === ".") numStr = "0";
|
|
1677
|
+
else if (numStr[0] === ".") numStr = "0" + numStr;
|
|
1678
|
+
else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1);
|
|
2010
1679
|
return numStr;
|
|
2011
1680
|
}
|
|
2012
1681
|
return numStr;
|
|
@@ -2074,8 +1743,7 @@ function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode
|
|
|
2074
1743
|
val2 = val2.trim();
|
|
2075
1744
|
}
|
|
2076
1745
|
if (val2.length > 0) {
|
|
2077
|
-
if (!escapeEntities)
|
|
2078
|
-
val2 = this.replaceEntitiesValue(val2);
|
|
1746
|
+
if (!escapeEntities) val2 = this.replaceEntitiesValue(val2);
|
|
2079
1747
|
const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode);
|
|
2080
1748
|
if (newval === null || newval === void 0) {
|
|
2081
1749
|
return val2;
|
|
@@ -2121,8 +1789,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
2121
1789
|
if (this.options.transformAttributeName) {
|
|
2122
1790
|
aName = this.options.transformAttributeName(aName);
|
|
2123
1791
|
}
|
|
2124
|
-
if (aName === "__proto__")
|
|
2125
|
-
aName = "#__proto__";
|
|
1792
|
+
if (aName === "__proto__") aName = "#__proto__";
|
|
2126
1793
|
if (oldVal !== void 0) {
|
|
2127
1794
|
if (this.options.trimValues) {
|
|
2128
1795
|
oldVal = oldVal.trim();
|
|
@@ -2197,11 +1864,9 @@ const parseXml = function(xmlData) {
|
|
|
2197
1864
|
i = closeIndex;
|
|
2198
1865
|
} else if (xmlData[i + 1] === "?") {
|
|
2199
1866
|
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
2200
|
-
if (!tagData)
|
|
2201
|
-
throw new Error("Pi Tag is not closed.");
|
|
1867
|
+
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
2202
1868
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
2203
|
-
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags)
|
|
2204
|
-
;
|
|
1869
|
+
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) ;
|
|
2205
1870
|
else {
|
|
2206
1871
|
const childNode = new xmlNode(tagData.tagName);
|
|
2207
1872
|
childNode.add(this.options.textNodeName, "");
|
|
@@ -2228,8 +1893,7 @@ const parseXml = function(xmlData) {
|
|
|
2228
1893
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
2229
1894
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
2230
1895
|
let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
2231
|
-
if (val2 == void 0)
|
|
2232
|
-
val2 = "";
|
|
1896
|
+
if (val2 == void 0) val2 = "";
|
|
2233
1897
|
if (this.options.cdataPropName) {
|
|
2234
1898
|
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
2235
1899
|
} else {
|
|
@@ -2274,8 +1938,7 @@ const parseXml = function(xmlData) {
|
|
|
2274
1938
|
i = result.closeIndex;
|
|
2275
1939
|
} else {
|
|
2276
1940
|
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
2277
|
-
if (!result2)
|
|
2278
|
-
throw new Error(`Unexpected end of ${rawTagName}`);
|
|
1941
|
+
if (!result2) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
2279
1942
|
i = result2.i;
|
|
2280
1943
|
tagContent = result2.tagContent;
|
|
2281
1944
|
}
|
|
@@ -2328,8 +1991,7 @@ const parseXml = function(xmlData) {
|
|
|
2328
1991
|
};
|
|
2329
1992
|
function addChild(currentNode, childNode, jPath) {
|
|
2330
1993
|
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
2331
|
-
if (result === false)
|
|
2332
|
-
;
|
|
1994
|
+
if (result === false) ;
|
|
2333
1995
|
else if (typeof result === "string") {
|
|
2334
1996
|
childNode.tagname = result;
|
|
2335
1997
|
currentNode.addChild(childNode);
|
|
@@ -2359,8 +2021,7 @@ const replaceEntitiesValue$1 = function(val2) {
|
|
|
2359
2021
|
};
|
|
2360
2022
|
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
2361
2023
|
if (textData) {
|
|
2362
|
-
if (isLeafNode === void 0)
|
|
2363
|
-
isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
2024
|
+
if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
2364
2025
|
textData = this.parseTextData(
|
|
2365
2026
|
textData,
|
|
2366
2027
|
currentNode.tagname,
|
|
@@ -2379,8 +2040,7 @@ function isItStopNode(stopNodes, jPath, currentTagName) {
|
|
|
2379
2040
|
const allNodesExp = "*." + currentTagName;
|
|
2380
2041
|
for (const stopNodePath in stopNodes) {
|
|
2381
2042
|
const stopNodeExp = stopNodes[stopNodePath];
|
|
2382
|
-
if (allNodesExp === stopNodeExp || jPath === stopNodeExp)
|
|
2383
|
-
return true;
|
|
2043
|
+
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
2384
2044
|
}
|
|
2385
2045
|
return false;
|
|
2386
2046
|
}
|
|
@@ -2390,8 +2050,7 @@ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
|
2390
2050
|
for (let index = i; index < xmlData.length; index++) {
|
|
2391
2051
|
let ch = xmlData[index];
|
|
2392
2052
|
if (attrBoundary) {
|
|
2393
|
-
if (ch === attrBoundary)
|
|
2394
|
-
attrBoundary = "";
|
|
2053
|
+
if (ch === attrBoundary) attrBoundary = "";
|
|
2395
2054
|
} else if (ch === '"' || ch === "'") {
|
|
2396
2055
|
attrBoundary = ch;
|
|
2397
2056
|
} else if (ch === closingChar[0]) {
|
|
@@ -2424,8 +2083,7 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
2424
2083
|
}
|
|
2425
2084
|
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
2426
2085
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
2427
|
-
if (!result)
|
|
2428
|
-
return;
|
|
2086
|
+
if (!result) return;
|
|
2429
2087
|
let tagExp = result.data;
|
|
2430
2088
|
const closeIndex = result.index;
|
|
2431
2089
|
const separatorIndex = tagExp.search(/\s/);
|
|
@@ -2494,12 +2152,9 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
2494
2152
|
function parseValue(val2, shouldParse, options) {
|
|
2495
2153
|
if (shouldParse && typeof val2 === "string") {
|
|
2496
2154
|
const newval = val2.trim();
|
|
2497
|
-
if (newval === "true")
|
|
2498
|
-
|
|
2499
|
-
else
|
|
2500
|
-
return false;
|
|
2501
|
-
else
|
|
2502
|
-
return toNumber(val2, options);
|
|
2155
|
+
if (newval === "true") return true;
|
|
2156
|
+
else if (newval === "false") return false;
|
|
2157
|
+
else return toNumber(val2, options);
|
|
2503
2158
|
} else {
|
|
2504
2159
|
if (util.isExist(val2)) {
|
|
2505
2160
|
return val2;
|
|
@@ -2520,15 +2175,11 @@ function compress(arr, options, jPath) {
|
|
|
2520
2175
|
const tagObj = arr[i];
|
|
2521
2176
|
const property = propName$1(tagObj);
|
|
2522
2177
|
let newJpath = "";
|
|
2523
|
-
if (jPath === void 0)
|
|
2524
|
-
|
|
2525
|
-
else
|
|
2526
|
-
newJpath = jPath + "." + property;
|
|
2178
|
+
if (jPath === void 0) newJpath = property;
|
|
2179
|
+
else newJpath = jPath + "." + property;
|
|
2527
2180
|
if (property === options.textNodeName) {
|
|
2528
|
-
if (text === void 0)
|
|
2529
|
-
|
|
2530
|
-
else
|
|
2531
|
-
text += "" + tagObj[property];
|
|
2181
|
+
if (text === void 0) text = tagObj[property];
|
|
2182
|
+
else text += "" + tagObj[property];
|
|
2532
2183
|
} else if (property === void 0) {
|
|
2533
2184
|
continue;
|
|
2534
2185
|
} else if (tagObj[property]) {
|
|
@@ -2539,10 +2190,8 @@ function compress(arr, options, jPath) {
|
|
|
2539
2190
|
} else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
2540
2191
|
val2 = val2[options.textNodeName];
|
|
2541
2192
|
} else if (Object.keys(val2).length === 0) {
|
|
2542
|
-
if (options.alwaysCreateTextNode)
|
|
2543
|
-
|
|
2544
|
-
else
|
|
2545
|
-
val2 = "";
|
|
2193
|
+
if (options.alwaysCreateTextNode) val2[options.textNodeName] = "";
|
|
2194
|
+
else val2 = "";
|
|
2546
2195
|
}
|
|
2547
2196
|
if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) {
|
|
2548
2197
|
if (!Array.isArray(compressedObj[property])) {
|
|
@@ -2559,18 +2208,15 @@ function compress(arr, options, jPath) {
|
|
|
2559
2208
|
}
|
|
2560
2209
|
}
|
|
2561
2210
|
if (typeof text === "string") {
|
|
2562
|
-
if (text.length > 0)
|
|
2563
|
-
|
|
2564
|
-
} else if (text !== void 0)
|
|
2565
|
-
compressedObj[options.textNodeName] = text;
|
|
2211
|
+
if (text.length > 0) compressedObj[options.textNodeName] = text;
|
|
2212
|
+
} else if (text !== void 0) compressedObj[options.textNodeName] = text;
|
|
2566
2213
|
return compressedObj;
|
|
2567
2214
|
}
|
|
2568
2215
|
function propName$1(obj) {
|
|
2569
2216
|
const keys = Object.keys(obj);
|
|
2570
2217
|
for (let i = 0; i < keys.length; i++) {
|
|
2571
2218
|
const key = keys[i];
|
|
2572
|
-
if (key !== ":@")
|
|
2573
|
-
return key;
|
|
2219
|
+
if (key !== ":@") return key;
|
|
2574
2220
|
}
|
|
2575
2221
|
}
|
|
2576
2222
|
function assignAttributes(obj, attrMap, jpath, options) {
|
|
@@ -2614,16 +2260,14 @@ let XMLParser$1 = class XMLParser {
|
|
|
2614
2260
|
* @param {boolean|Object} validationOption
|
|
2615
2261
|
*/
|
|
2616
2262
|
parse(xmlData, validationOption) {
|
|
2617
|
-
if (typeof xmlData === "string")
|
|
2618
|
-
;
|
|
2263
|
+
if (typeof xmlData === "string") ;
|
|
2619
2264
|
else if (xmlData.toString) {
|
|
2620
2265
|
xmlData = xmlData.toString();
|
|
2621
2266
|
} else {
|
|
2622
2267
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
2623
2268
|
}
|
|
2624
2269
|
if (validationOption) {
|
|
2625
|
-
if (validationOption === true)
|
|
2626
|
-
validationOption = {};
|
|
2270
|
+
if (validationOption === true) validationOption = {};
|
|
2627
2271
|
const result = validator$1.validate(xmlData, validationOption);
|
|
2628
2272
|
if (result !== true) {
|
|
2629
2273
|
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
@@ -2632,10 +2276,8 @@ let XMLParser$1 = class XMLParser {
|
|
|
2632
2276
|
const orderedObjParser = new OrderedObjParser2(this.options);
|
|
2633
2277
|
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
2634
2278
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
2635
|
-
if (this.options.preserveOrder || orderedResult === void 0)
|
|
2636
|
-
|
|
2637
|
-
else
|
|
2638
|
-
return prettify(orderedResult, this.options);
|
|
2279
|
+
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
2280
|
+
else return prettify(orderedResult, this.options);
|
|
2639
2281
|
}
|
|
2640
2282
|
/**
|
|
2641
2283
|
* Add Entity which is not by default supported by this library
|
|
@@ -2669,13 +2311,10 @@ function arrToStr(arr, options, jPath, indentation) {
|
|
|
2669
2311
|
for (let i = 0; i < arr.length; i++) {
|
|
2670
2312
|
const tagObj = arr[i];
|
|
2671
2313
|
const tagName = propName(tagObj);
|
|
2672
|
-
if (tagName === void 0)
|
|
2673
|
-
continue;
|
|
2314
|
+
if (tagName === void 0) continue;
|
|
2674
2315
|
let newJPath = "";
|
|
2675
|
-
if (jPath.length === 0)
|
|
2676
|
-
|
|
2677
|
-
else
|
|
2678
|
-
newJPath = `${jPath}.${tagName}`;
|
|
2316
|
+
if (jPath.length === 0) newJPath = tagName;
|
|
2317
|
+
else newJPath = `${jPath}.${tagName}`;
|
|
2679
2318
|
if (tagName === options.textNodeName) {
|
|
2680
2319
|
let tagText = tagObj[tagName];
|
|
2681
2320
|
if (!isStopNode(newJPath, options)) {
|
|
@@ -2716,10 +2355,8 @@ function arrToStr(arr, options, jPath, indentation) {
|
|
|
2716
2355
|
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
2717
2356
|
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
2718
2357
|
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
2719
|
-
if (options.suppressUnpairedNode)
|
|
2720
|
-
|
|
2721
|
-
else
|
|
2722
|
-
xmlStr += tagStart + "/>";
|
|
2358
|
+
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
2359
|
+
else xmlStr += tagStart + "/>";
|
|
2723
2360
|
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
2724
2361
|
xmlStr += tagStart + "/>";
|
|
2725
2362
|
} else if (tagValue && tagValue.endsWith(">")) {
|
|
@@ -2741,18 +2378,15 @@ function propName(obj) {
|
|
|
2741
2378
|
const keys = Object.keys(obj);
|
|
2742
2379
|
for (let i = 0; i < keys.length; i++) {
|
|
2743
2380
|
const key = keys[i];
|
|
2744
|
-
if (!obj.hasOwnProperty(key))
|
|
2745
|
-
|
|
2746
|
-
if (key !== ":@")
|
|
2747
|
-
return key;
|
|
2381
|
+
if (!obj.hasOwnProperty(key)) continue;
|
|
2382
|
+
if (key !== ":@") return key;
|
|
2748
2383
|
}
|
|
2749
2384
|
}
|
|
2750
2385
|
function attr_to_str(attrMap, options) {
|
|
2751
2386
|
let attrStr = "";
|
|
2752
2387
|
if (attrMap && !options.ignoreAttributes) {
|
|
2753
2388
|
for (let attr in attrMap) {
|
|
2754
|
-
if (!attrMap.hasOwnProperty(attr))
|
|
2755
|
-
continue;
|
|
2389
|
+
if (!attrMap.hasOwnProperty(attr)) continue;
|
|
2756
2390
|
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
2757
2391
|
attrVal = replaceEntitiesValue(attrVal, options);
|
|
2758
2392
|
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
@@ -2768,8 +2402,7 @@ function isStopNode(jPath, options) {
|
|
|
2768
2402
|
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
2769
2403
|
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
2770
2404
|
for (let index in options.stopNodes) {
|
|
2771
|
-
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName)
|
|
2772
|
-
return true;
|
|
2405
|
+
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
2773
2406
|
}
|
|
2774
2407
|
return false;
|
|
2775
2408
|
}
|
|
@@ -2857,8 +2490,7 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
2857
2490
|
let attrStr = "";
|
|
2858
2491
|
let val2 = "";
|
|
2859
2492
|
for (let key in jObj) {
|
|
2860
|
-
if (!Object.prototype.hasOwnProperty.call(jObj, key))
|
|
2861
|
-
continue;
|
|
2493
|
+
if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
2862
2494
|
if (typeof jObj[key] === "undefined") {
|
|
2863
2495
|
if (this.isAttribute(key)) {
|
|
2864
2496
|
val2 += "";
|
|
@@ -2890,13 +2522,10 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
2890
2522
|
let listTagVal = "";
|
|
2891
2523
|
for (let j = 0; j < arrLen; j++) {
|
|
2892
2524
|
const item = jObj[key][j];
|
|
2893
|
-
if (typeof item === "undefined")
|
|
2894
|
-
;
|
|
2525
|
+
if (typeof item === "undefined") ;
|
|
2895
2526
|
else if (item === null) {
|
|
2896
|
-
if (key[0] === "?")
|
|
2897
|
-
|
|
2898
|
-
else
|
|
2899
|
-
val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2527
|
+
if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
2528
|
+
else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2900
2529
|
} else if (typeof item === "object") {
|
|
2901
2530
|
if (this.options.oneListGroup) {
|
|
2902
2531
|
listTagVal += this.j2x(item, level + 1).val;
|
|
@@ -2930,8 +2559,7 @@ Builder.prototype.buildAttrPairStr = function(attrName, val2) {
|
|
|
2930
2559
|
val2 = this.replaceEntitiesValue(val2);
|
|
2931
2560
|
if (this.options.suppressBooleanAttributes && val2 === "true") {
|
|
2932
2561
|
return " " + attrName;
|
|
2933
|
-
} else
|
|
2934
|
-
return " " + attrName + '="' + val2 + '"';
|
|
2562
|
+
} else return " " + attrName + '="' + val2 + '"';
|
|
2935
2563
|
};
|
|
2936
2564
|
function processTextOrObjNode(object, key, level) {
|
|
2937
2565
|
const result = this.j2x(object, level + 1);
|
|
@@ -2943,8 +2571,7 @@ function processTextOrObjNode(object, key, level) {
|
|
|
2943
2571
|
}
|
|
2944
2572
|
Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
|
|
2945
2573
|
if (val2 === "") {
|
|
2946
|
-
if (key[0] === "?")
|
|
2947
|
-
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2574
|
+
if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2948
2575
|
else {
|
|
2949
2576
|
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2950
2577
|
}
|
|
@@ -2967,8 +2594,7 @@ Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
|
|
|
2967
2594
|
Builder.prototype.closeTag = function(key) {
|
|
2968
2595
|
let closeTag = "";
|
|
2969
2596
|
if (this.options.unpairedTags.indexOf(key) !== -1) {
|
|
2970
|
-
if (!this.options.suppressUnpairedNode)
|
|
2971
|
-
closeTag = "/";
|
|
2597
|
+
if (!this.options.suppressUnpairedNode) closeTag = "/";
|
|
2972
2598
|
} else if (this.options.suppressEmptyNode) {
|
|
2973
2599
|
closeTag = "/";
|
|
2974
2600
|
} else {
|
|
@@ -3047,27 +2673,6 @@ function isSvg(string) {
|
|
|
3047
2673
|
}
|
|
3048
2674
|
return true;
|
|
3049
2675
|
}
|
|
3050
|
-
/**
|
|
3051
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
3052
|
-
*
|
|
3053
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
3054
|
-
*
|
|
3055
|
-
* @license AGPL-3.0-or-later
|
|
3056
|
-
*
|
|
3057
|
-
* This program is free software: you can redistribute it and/or modify
|
|
3058
|
-
* it under the terms of the GNU Affero General Public License as
|
|
3059
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
3060
|
-
* License, or (at your option) any later version.
|
|
3061
|
-
*
|
|
3062
|
-
* This program is distributed in the hope that it will be useful,
|
|
3063
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
3064
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
3065
|
-
* GNU Affero General Public License for more details.
|
|
3066
|
-
*
|
|
3067
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
3068
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
3069
|
-
*
|
|
3070
|
-
*/
|
|
3071
2676
|
class View {
|
|
3072
2677
|
_view;
|
|
3073
2678
|
constructor(view) {
|
|
@@ -3175,28 +2780,6 @@ const isValidView = function(view) {
|
|
|
3175
2780
|
}
|
|
3176
2781
|
return true;
|
|
3177
2782
|
};
|
|
3178
|
-
/**
|
|
3179
|
-
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
3180
|
-
*
|
|
3181
|
-
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
3182
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
3183
|
-
*
|
|
3184
|
-
* @license AGPL-3.0-or-later
|
|
3185
|
-
*
|
|
3186
|
-
* This program is free software: you can redistribute it and/or modify
|
|
3187
|
-
* it under the terms of the GNU Affero General Public License as
|
|
3188
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
3189
|
-
* License, or (at your option) any later version.
|
|
3190
|
-
*
|
|
3191
|
-
* This program is distributed in the hope that it will be useful,
|
|
3192
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
3193
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
3194
|
-
* GNU Affero General Public License for more details.
|
|
3195
|
-
*
|
|
3196
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
3197
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
3198
|
-
*
|
|
3199
|
-
*/
|
|
3200
2783
|
const addNewFileMenuEntry = function(entry) {
|
|
3201
2784
|
const newFileMenu = getNewFileMenu();
|
|
3202
2785
|
return newFileMenu.registerEntry(entry);
|
|
@@ -3247,6 +2830,7 @@ exports.getFileActions = getFileActions;
|
|
|
3247
2830
|
exports.getFileListHeaders = getFileListHeaders;
|
|
3248
2831
|
exports.getNavigation = getNavigation;
|
|
3249
2832
|
exports.getNewFileMenuEntries = getNewFileMenuEntries;
|
|
2833
|
+
exports.getUniqueName = getUniqueName;
|
|
3250
2834
|
exports.isFilenameValid = isFilenameValid;
|
|
3251
2835
|
exports.orderBy = orderBy;
|
|
3252
2836
|
exports.parseFileSize = parseFileSize;
|