@nextcloud/files 3.4.1 → 3.5.1
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/dav/dav.d.ts +11 -0
- 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 +4 -0
- package/dist/index.cjs +157 -565
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +157 -565
- 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 +0 -21
- package/package.json +9 -7
package/dist/index.mjs
CHANGED
|
@@ -1,60 +1,14 @@
|
|
|
1
|
-
import { getCurrentUser, onRequestTokenUpdate, getRequestToken } from "@nextcloud/auth";
|
|
2
1
|
import { getLoggerBuilder } from "@nextcloud/logger";
|
|
2
|
+
import { getCurrentUser, onRequestTokenUpdate, getRequestToken } from "@nextcloud/auth";
|
|
3
3
|
import { join, basename, extname, dirname } from "path";
|
|
4
4
|
import { encodePath } from "@nextcloud/paths";
|
|
5
5
|
import { generateRemoteUrl } from "@nextcloud/router";
|
|
6
|
-
import { createClient, getPatcher } from "webdav";
|
|
7
6
|
import { CancelablePromise } from "cancelable-promise";
|
|
7
|
+
import { createClient, getPatcher } from "webdav";
|
|
8
|
+
import { isPublicShare, getSharingToken } from "@nextcloud/sharing/public";
|
|
8
9
|
import { getCanonicalLocale, getLanguage } from "@nextcloud/l10n";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
13
|
-
*
|
|
14
|
-
* @license AGPL-3.0-or-later
|
|
15
|
-
*
|
|
16
|
-
* This program is free software: you can redistribute it and/or modify
|
|
17
|
-
* it under the terms of the GNU Affero General Public License as
|
|
18
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
19
|
-
* License, or (at your option) any later version.
|
|
20
|
-
*
|
|
21
|
-
* This program is distributed in the hope that it will be useful,
|
|
22
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24
|
-
* GNU Affero General Public License for more details.
|
|
25
|
-
*
|
|
26
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
27
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
const getLogger = (user) => {
|
|
31
|
-
if (user === null) {
|
|
32
|
-
return getLoggerBuilder().setApp("files").build();
|
|
33
|
-
}
|
|
34
|
-
return getLoggerBuilder().setApp("files").setUid(user.uid).build();
|
|
35
|
-
};
|
|
36
|
-
const logger = getLogger(getCurrentUser());
|
|
37
|
-
/**
|
|
38
|
-
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
39
|
-
*
|
|
40
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
41
|
-
*
|
|
42
|
-
* @license AGPL-3.0-or-later
|
|
43
|
-
*
|
|
44
|
-
* This program is free software: you can redistribute it and/or modify
|
|
45
|
-
* it under the terms of the GNU Affero General Public License as
|
|
46
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
47
|
-
* License, or (at your option) any later version.
|
|
48
|
-
*
|
|
49
|
-
* This program is distributed in the hope that it will be useful,
|
|
50
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
51
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
52
|
-
* GNU Affero General Public License for more details.
|
|
53
|
-
*
|
|
54
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
55
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
10
|
+
import { TypedEventTarget } from "typescript-event-target";
|
|
11
|
+
const logger = getLoggerBuilder().setApp("@nextcloud/files").detectUser().build();
|
|
58
12
|
var NewMenuEntryCategory = /* @__PURE__ */ ((NewMenuEntryCategory2) => {
|
|
59
13
|
NewMenuEntryCategory2[NewMenuEntryCategory2["UploadFromDevice"] = 0] = "UploadFromDevice";
|
|
60
14
|
NewMenuEntryCategory2[NewMenuEntryCategory2["CreateNew"] = 1] = "CreateNew";
|
|
@@ -121,27 +75,6 @@ const getNewFileMenu = function() {
|
|
|
121
75
|
}
|
|
122
76
|
return window._nc_newfilemenu;
|
|
123
77
|
};
|
|
124
|
-
/**
|
|
125
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
126
|
-
*
|
|
127
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
128
|
-
*
|
|
129
|
-
* @license AGPL-3.0-or-later
|
|
130
|
-
*
|
|
131
|
-
* This program is free software: you can redistribute it and/or modify
|
|
132
|
-
* it under the terms of the GNU Affero General Public License as
|
|
133
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
134
|
-
* License, or (at your option) any later version.
|
|
135
|
-
*
|
|
136
|
-
* This program is distributed in the hope that it will be useful,
|
|
137
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
138
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
139
|
-
* GNU Affero General Public License for more details.
|
|
140
|
-
*
|
|
141
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
142
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
78
|
var DefaultType = /* @__PURE__ */ ((DefaultType2) => {
|
|
146
79
|
DefaultType2["DEFAULT"] = "default";
|
|
147
80
|
DefaultType2["HIDDEN"] = "hidden";
|
|
@@ -246,27 +179,6 @@ const getFileActions = function() {
|
|
|
246
179
|
}
|
|
247
180
|
return window._nc_fileactions;
|
|
248
181
|
};
|
|
249
|
-
/**
|
|
250
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
251
|
-
*
|
|
252
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
253
|
-
*
|
|
254
|
-
* @license AGPL-3.0-or-later
|
|
255
|
-
*
|
|
256
|
-
* This program is free software: you can redistribute it and/or modify
|
|
257
|
-
* it under the terms of the GNU Affero General Public License as
|
|
258
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
259
|
-
* License, or (at your option) any later version.
|
|
260
|
-
*
|
|
261
|
-
* This program is distributed in the hope that it will be useful,
|
|
262
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
263
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
264
|
-
* GNU Affero General Public License for more details.
|
|
265
|
-
*
|
|
266
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
267
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
268
|
-
*
|
|
269
|
-
*/
|
|
270
182
|
class Header {
|
|
271
183
|
_header;
|
|
272
184
|
constructor(header) {
|
|
@@ -324,27 +236,6 @@ const getFileListHeaders = function() {
|
|
|
324
236
|
}
|
|
325
237
|
return window._nc_filelistheader;
|
|
326
238
|
};
|
|
327
|
-
/**
|
|
328
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
329
|
-
*
|
|
330
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
331
|
-
*
|
|
332
|
-
* @license AGPL-3.0-or-later
|
|
333
|
-
*
|
|
334
|
-
* This program is free software: you can redistribute it and/or modify
|
|
335
|
-
* it under the terms of the GNU Affero General Public License as
|
|
336
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
337
|
-
* License, or (at your option) any later version.
|
|
338
|
-
*
|
|
339
|
-
* This program is distributed in the hope that it will be useful,
|
|
340
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
341
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
342
|
-
* GNU Affero General Public License for more details.
|
|
343
|
-
*
|
|
344
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
345
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
346
|
-
*
|
|
347
|
-
*/
|
|
348
239
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
349
240
|
Permission2[Permission2["NONE"] = 0] = "NONE";
|
|
350
241
|
Permission2[Permission2["CREATE"] = 4] = "CREATE";
|
|
@@ -355,33 +246,13 @@ var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
|
355
246
|
Permission2[Permission2["ALL"] = 31] = "ALL";
|
|
356
247
|
return Permission2;
|
|
357
248
|
})(Permission || {});
|
|
358
|
-
/**
|
|
359
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
360
|
-
*
|
|
361
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
362
|
-
* @author Ferdinand Thiessen <opensource@fthiessen.de>
|
|
363
|
-
*
|
|
364
|
-
* @license AGPL-3.0-or-later
|
|
365
|
-
*
|
|
366
|
-
* This program is free software: you can redistribute it and/or modify
|
|
367
|
-
* it under the terms of the GNU Affero General Public License as
|
|
368
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
369
|
-
* License, or (at your option) any later version.
|
|
370
|
-
*
|
|
371
|
-
* This program is distributed in the hope that it will be useful,
|
|
372
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
373
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
374
|
-
* GNU Affero General Public License for more details.
|
|
375
|
-
*
|
|
376
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
377
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
378
|
-
*
|
|
379
|
-
*/
|
|
380
249
|
const defaultDavProperties = [
|
|
381
250
|
"d:getcontentlength",
|
|
382
251
|
"d:getcontenttype",
|
|
383
252
|
"d:getetag",
|
|
384
253
|
"d:getlastmodified",
|
|
254
|
+
"d:creationdate",
|
|
255
|
+
"d:displayname",
|
|
385
256
|
"d:quota-available-bytes",
|
|
386
257
|
"d:resourcetype",
|
|
387
258
|
"nc:has-preview",
|
|
@@ -512,28 +383,6 @@ const davGetRecentSearch = function(lastModified) {
|
|
|
512
383
|
</d:basicsearch>
|
|
513
384
|
</d:searchrequest>`;
|
|
514
385
|
};
|
|
515
|
-
/**
|
|
516
|
-
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
|
|
517
|
-
*
|
|
518
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
519
|
-
* @author Ferdinand Thiessen <opensource@fthiessen.de>
|
|
520
|
-
*
|
|
521
|
-
* @license AGPL-3.0-or-later
|
|
522
|
-
*
|
|
523
|
-
* This program is free software: you can redistribute it and/or modify
|
|
524
|
-
* it under the terms of the GNU Affero General Public License as
|
|
525
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
526
|
-
* License, or (at your option) any later version.
|
|
527
|
-
*
|
|
528
|
-
* This program is distributed in the hope that it will be useful,
|
|
529
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
530
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
531
|
-
* GNU Affero General Public License for more details.
|
|
532
|
-
*
|
|
533
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
534
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
535
|
-
*
|
|
536
|
-
*/
|
|
537
386
|
const davParsePermissions = function(permString = "") {
|
|
538
387
|
let permissions = Permission.NONE;
|
|
539
388
|
if (!permString) {
|
|
@@ -556,53 +405,11 @@ const davParsePermissions = function(permString = "") {
|
|
|
556
405
|
}
|
|
557
406
|
return permissions;
|
|
558
407
|
};
|
|
559
|
-
/**
|
|
560
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
561
|
-
*
|
|
562
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
563
|
-
*
|
|
564
|
-
* @license AGPL-3.0-or-later
|
|
565
|
-
*
|
|
566
|
-
* This program is free software: you can redistribute it and/or modify
|
|
567
|
-
* it under the terms of the GNU Affero General Public License as
|
|
568
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
569
|
-
* License, or (at your option) any later version.
|
|
570
|
-
*
|
|
571
|
-
* This program is distributed in the hope that it will be useful,
|
|
572
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
573
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
574
|
-
* GNU Affero General Public License for more details.
|
|
575
|
-
*
|
|
576
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
577
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
578
|
-
*
|
|
579
|
-
*/
|
|
580
408
|
var FileType = /* @__PURE__ */ ((FileType2) => {
|
|
581
409
|
FileType2["Folder"] = "folder";
|
|
582
410
|
FileType2["File"] = "file";
|
|
583
411
|
return FileType2;
|
|
584
412
|
})(FileType || {});
|
|
585
|
-
/**
|
|
586
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
587
|
-
*
|
|
588
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
589
|
-
*
|
|
590
|
-
* @license AGPL-3.0-or-later
|
|
591
|
-
*
|
|
592
|
-
* This program is free software: you can redistribute it and/or modify
|
|
593
|
-
* it under the terms of the GNU Affero General Public License as
|
|
594
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
595
|
-
* License, or (at your option) any later version.
|
|
596
|
-
*
|
|
597
|
-
* This program is distributed in the hope that it will be useful,
|
|
598
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
599
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
600
|
-
* GNU Affero General Public License for more details.
|
|
601
|
-
*
|
|
602
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
603
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
604
|
-
*
|
|
605
|
-
*/
|
|
606
413
|
const isDavRessource = function(source, davService) {
|
|
607
414
|
return source.match(davService) !== null;
|
|
608
415
|
};
|
|
@@ -661,27 +468,6 @@ const validateData = (data, davService) => {
|
|
|
661
468
|
throw new Error("Status must be a valid NodeStatus");
|
|
662
469
|
}
|
|
663
470
|
};
|
|
664
|
-
/**
|
|
665
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
666
|
-
*
|
|
667
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
668
|
-
*
|
|
669
|
-
* @license AGPL-3.0-or-later
|
|
670
|
-
*
|
|
671
|
-
* This program is free software: you can redistribute it and/or modify
|
|
672
|
-
* it under the terms of the GNU Affero General Public License as
|
|
673
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
674
|
-
* License, or (at your option) any later version.
|
|
675
|
-
*
|
|
676
|
-
* This program is distributed in the hope that it will be useful,
|
|
677
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
678
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
679
|
-
* GNU Affero General Public License for more details.
|
|
680
|
-
*
|
|
681
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
682
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
683
|
-
*
|
|
684
|
-
*/
|
|
685
471
|
var NodeStatus = /* @__PURE__ */ ((NodeStatus2) => {
|
|
686
472
|
NodeStatus2["NEW"] = "new";
|
|
687
473
|
NodeStatus2["FAILED"] = "failed";
|
|
@@ -956,53 +742,11 @@ class Node {
|
|
|
956
742
|
}
|
|
957
743
|
}
|
|
958
744
|
}
|
|
959
|
-
/**
|
|
960
|
-
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
961
|
-
*
|
|
962
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
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
|
-
*/
|
|
980
745
|
class File extends Node {
|
|
981
746
|
get type() {
|
|
982
747
|
return FileType.File;
|
|
983
748
|
}
|
|
984
749
|
}
|
|
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
750
|
class Folder extends Node {
|
|
1007
751
|
constructor(data) {
|
|
1008
752
|
super({
|
|
@@ -1020,30 +764,21 @@ class Folder extends Node {
|
|
|
1020
764
|
return "httpd/unix-directory";
|
|
1021
765
|
}
|
|
1022
766
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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
|
-
const davRootPath = `/files/${getCurrentUser()?.uid}`;
|
|
1046
|
-
const davRemoteURL = generateRemoteUrl("dav");
|
|
767
|
+
function davGetRootPath() {
|
|
768
|
+
if (isPublicShare()) {
|
|
769
|
+
return `/files/${getSharingToken()}`;
|
|
770
|
+
}
|
|
771
|
+
return `/files/${getCurrentUser()?.uid}`;
|
|
772
|
+
}
|
|
773
|
+
const davRootPath = davGetRootPath();
|
|
774
|
+
function davGetRemoteURL() {
|
|
775
|
+
const url = generateRemoteUrl("dav");
|
|
776
|
+
if (isPublicShare()) {
|
|
777
|
+
return url.replace("remote.php", "public.php");
|
|
778
|
+
}
|
|
779
|
+
return url;
|
|
780
|
+
}
|
|
781
|
+
const davRemoteURL = davGetRemoteURL();
|
|
1047
782
|
const davGetClient = function(remoteURL = davRemoteURL, headers = {}) {
|
|
1048
783
|
const client = createClient(remoteURL, { headers });
|
|
1049
784
|
function setHeaders(token) {
|
|
@@ -1092,9 +827,7 @@ const getFavoriteNodes = (davClient, path = "/", davRoot = davRootPath) => {
|
|
|
1092
827
|
};
|
|
1093
828
|
const davResultToNode = function(node, filesRoot = davRootPath, remoteURL = davRemoteURL) {
|
|
1094
829
|
let userId = getCurrentUser()?.uid;
|
|
1095
|
-
|
|
1096
|
-
if (isPublic) {
|
|
1097
|
-
userId = userId ?? document.querySelector("input#sharingUserId")?.value;
|
|
830
|
+
if (isPublicShare()) {
|
|
1098
831
|
userId = userId ?? "anonymous";
|
|
1099
832
|
} else if (!userId) {
|
|
1100
833
|
throw new Error("No user id found");
|
|
@@ -1102,12 +835,15 @@ const davResultToNode = function(node, filesRoot = davRootPath, remoteURL = davR
|
|
|
1102
835
|
const props = node.props;
|
|
1103
836
|
const permissions = davParsePermissions(props?.permissions);
|
|
1104
837
|
const owner = String(props?.["owner-id"] || userId);
|
|
838
|
+
const id = props.fileid || 0;
|
|
1105
839
|
const nodeData = {
|
|
1106
|
-
id
|
|
840
|
+
id,
|
|
1107
841
|
source: `${remoteURL}${node.filename}`,
|
|
1108
842
|
mtime: new Date(Date.parse(node.lastmod)),
|
|
1109
843
|
mime: node.mime || "application/octet-stream",
|
|
1110
844
|
size: props?.size || Number.parseInt(props.getcontentlength || "0"),
|
|
845
|
+
// The fileid is set to -1 for failed requests
|
|
846
|
+
status: id < 0 ? NodeStatus.FAILED : void 0,
|
|
1111
847
|
permissions,
|
|
1112
848
|
owner,
|
|
1113
849
|
root: filesRoot,
|
|
@@ -1131,28 +867,21 @@ function isFilenameValid(filename) {
|
|
|
1131
867
|
}
|
|
1132
868
|
return true;
|
|
1133
869
|
}
|
|
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
|
-
*/
|
|
870
|
+
function getUniqueName(name, otherNames, options) {
|
|
871
|
+
const opts = {
|
|
872
|
+
suffix: (n) => `(${n})`,
|
|
873
|
+
ignoreFileExtension: false,
|
|
874
|
+
...options
|
|
875
|
+
};
|
|
876
|
+
let newName = name;
|
|
877
|
+
let i = 1;
|
|
878
|
+
while (otherNames.includes(newName)) {
|
|
879
|
+
const ext = opts.ignoreFileExtension ? "" : extname(name);
|
|
880
|
+
const base = basename(name, ext);
|
|
881
|
+
newName = `${base} ${opts.suffix(i++)}${ext}`;
|
|
882
|
+
}
|
|
883
|
+
return newName;
|
|
884
|
+
}
|
|
1156
885
|
const humanList = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
1157
886
|
const humanListBinary = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
1158
887
|
function formatFileSize(size, skipSmallSizes = false, binaryPrefixes = false, base1000 = false) {
|
|
@@ -1239,15 +968,16 @@ function sortNodes(nodes, options = {}) {
|
|
|
1239
968
|
sortingOrder: "asc",
|
|
1240
969
|
...options
|
|
1241
970
|
};
|
|
971
|
+
const basename2 = (name) => name.lastIndexOf(".") > 0 ? name.slice(0, name.lastIndexOf(".")) : name;
|
|
1242
972
|
const identifiers = [
|
|
1243
973
|
// 1: Sort favorites first if enabled
|
|
1244
974
|
...sortingOptions.sortFavoritesFirst ? [(v) => v.attributes?.favorite !== 1] : [],
|
|
1245
975
|
// 2: Sort folders first if sorting by name
|
|
1246
976
|
...sortingOptions.sortFoldersFirst ? [(v) => v.type !== "folder"] : [],
|
|
1247
|
-
// 3: Use sorting mode if NOT basename (to be able to use
|
|
977
|
+
// 3: Use sorting mode if NOT basename (to be able to use displayname too)
|
|
1248
978
|
...sortingOptions.sortingMode !== "basename" ? [(v) => v[sortingOptions.sortingMode]] : [],
|
|
1249
|
-
// 4: Use
|
|
1250
|
-
(v) => v.attributes?.
|
|
979
|
+
// 4: Use displayname if available, fallback to name
|
|
980
|
+
(v) => basename2(v.attributes?.displayname || v.basename),
|
|
1251
981
|
// 5: Finally, use basename if all previous sorting methods failed
|
|
1252
982
|
(v) => v.basename
|
|
1253
983
|
];
|
|
@@ -1267,51 +997,54 @@ function sortNodes(nodes, options = {}) {
|
|
|
1267
997
|
];
|
|
1268
998
|
return orderBy(nodes, identifiers, orders);
|
|
1269
999
|
}
|
|
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 {
|
|
1000
|
+
class Navigation extends TypedEventTarget {
|
|
1292
1001
|
_views = [];
|
|
1293
1002
|
_currentView = null;
|
|
1003
|
+
/**
|
|
1004
|
+
* Register a new view on the navigation
|
|
1005
|
+
* @param view The view to register
|
|
1006
|
+
* @throws `Error` is thrown if a view with the same id is already registered
|
|
1007
|
+
*/
|
|
1294
1008
|
register(view) {
|
|
1295
1009
|
if (this._views.find((search) => search.id === view.id)) {
|
|
1296
1010
|
throw new Error(`View id ${view.id} is already registered`);
|
|
1297
1011
|
}
|
|
1298
1012
|
this._views.push(view);
|
|
1013
|
+
this.dispatchTypedEvent("update", new CustomEvent("update"));
|
|
1299
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Remove a registered view
|
|
1017
|
+
* @param id The id of the view to remove
|
|
1018
|
+
*/
|
|
1300
1019
|
remove(id) {
|
|
1301
1020
|
const index = this._views.findIndex((view) => view.id === id);
|
|
1302
1021
|
if (index !== -1) {
|
|
1303
1022
|
this._views.splice(index, 1);
|
|
1023
|
+
this.dispatchTypedEvent("update", new CustomEvent("update"));
|
|
1304
1024
|
}
|
|
1305
1025
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1026
|
+
/**
|
|
1027
|
+
* Set the currently active view
|
|
1028
|
+
* @fires UpdateActiveViewEvent
|
|
1029
|
+
* @param view New active view
|
|
1030
|
+
*/
|
|
1309
1031
|
setActive(view) {
|
|
1310
1032
|
this._currentView = view;
|
|
1033
|
+
const event = new CustomEvent("updateActive", { detail: view });
|
|
1034
|
+
this.dispatchTypedEvent("updateActive", event);
|
|
1311
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* The currently active files view
|
|
1038
|
+
*/
|
|
1312
1039
|
get active() {
|
|
1313
1040
|
return this._currentView;
|
|
1314
1041
|
}
|
|
1042
|
+
/**
|
|
1043
|
+
* All registered views
|
|
1044
|
+
*/
|
|
1045
|
+
get views() {
|
|
1046
|
+
return this._views;
|
|
1047
|
+
}
|
|
1315
1048
|
}
|
|
1316
1049
|
const getNavigation = function() {
|
|
1317
1050
|
if (typeof window._nc_navigation === "undefined") {
|
|
@@ -1320,27 +1053,6 @@ const getNavigation = function() {
|
|
|
1320
1053
|
}
|
|
1321
1054
|
return window._nc_navigation;
|
|
1322
1055
|
};
|
|
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
1056
|
class Column {
|
|
1345
1057
|
_column;
|
|
1346
1058
|
constructor(column) {
|
|
@@ -1455,8 +1167,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1455
1167
|
if (xmlData[i] === "<" && xmlData[i + 1] === "?") {
|
|
1456
1168
|
i += 2;
|
|
1457
1169
|
i = readPI(xmlData, i);
|
|
1458
|
-
if (i.err)
|
|
1459
|
-
return i;
|
|
1170
|
+
if (i.err) return i;
|
|
1460
1171
|
} else if (xmlData[i] === "<") {
|
|
1461
1172
|
let tagStartPos = i;
|
|
1462
1173
|
i++;
|
|
@@ -1530,8 +1241,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1530
1241
|
}
|
|
1531
1242
|
if (reachedRoot === true) {
|
|
1532
1243
|
return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
|
|
1533
|
-
} else if (options.unpairedTags.indexOf(tagName) !== -1)
|
|
1534
|
-
;
|
|
1244
|
+
} else if (options.unpairedTags.indexOf(tagName) !== -1) ;
|
|
1535
1245
|
else {
|
|
1536
1246
|
tags.push({ tagName, tagStartPos });
|
|
1537
1247
|
}
|
|
@@ -1545,8 +1255,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1545
1255
|
continue;
|
|
1546
1256
|
} else if (xmlData[i + 1] === "?") {
|
|
1547
1257
|
i = readPI(xmlData, ++i);
|
|
1548
|
-
if (i.err)
|
|
1549
|
-
return i;
|
|
1258
|
+
if (i.err) return i;
|
|
1550
1259
|
} else {
|
|
1551
1260
|
break;
|
|
1552
1261
|
}
|
|
@@ -1641,8 +1350,7 @@ function readAttributeStr(xmlData, i) {
|
|
|
1641
1350
|
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
1642
1351
|
if (startChar === "") {
|
|
1643
1352
|
startChar = xmlData[i];
|
|
1644
|
-
} else if (startChar !== xmlData[i])
|
|
1645
|
-
;
|
|
1353
|
+
} else if (startChar !== xmlData[i]) ;
|
|
1646
1354
|
else {
|
|
1647
1355
|
startChar = "";
|
|
1648
1356
|
}
|
|
@@ -1803,13 +1511,11 @@ class XmlNode {
|
|
|
1803
1511
|
this[":@"] = {};
|
|
1804
1512
|
}
|
|
1805
1513
|
add(key, val2) {
|
|
1806
|
-
if (key === "__proto__")
|
|
1807
|
-
key = "#__proto__";
|
|
1514
|
+
if (key === "__proto__") key = "#__proto__";
|
|
1808
1515
|
this.child.push({ [key]: val2 });
|
|
1809
1516
|
}
|
|
1810
1517
|
addChild(node) {
|
|
1811
|
-
if (node.tagname === "__proto__")
|
|
1812
|
-
node.tagname = "#__proto__";
|
|
1518
|
+
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
1813
1519
|
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
|
|
1814
1520
|
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
1815
1521
|
} else {
|
|
@@ -1836,16 +1542,11 @@ function readDocType$1(xmlData, i) {
|
|
|
1836
1542
|
regx: RegExp(`&${entityName};`, "g"),
|
|
1837
1543
|
val
|
|
1838
1544
|
};
|
|
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");
|
|
1545
|
+
} else if (hasBody && isElement(xmlData, i)) i += 8;
|
|
1546
|
+
else if (hasBody && isAttlist(xmlData, i)) i += 8;
|
|
1547
|
+
else if (hasBody && isNotation(xmlData, i)) i += 9;
|
|
1548
|
+
else if (isComment) comment = true;
|
|
1549
|
+
else throw new Error("Invalid DOCTYPE");
|
|
1849
1550
|
angleBracketsCount++;
|
|
1850
1551
|
exp = "";
|
|
1851
1552
|
} else if (xmlData[i] === ">") {
|
|
@@ -1880,8 +1581,7 @@ function readEntityExp(xmlData, i) {
|
|
|
1880
1581
|
entityName2 += xmlData[i];
|
|
1881
1582
|
}
|
|
1882
1583
|
entityName2 = entityName2.trim();
|
|
1883
|
-
if (entityName2.indexOf(" ") !== -1)
|
|
1884
|
-
throw new Error("External entites are not supported");
|
|
1584
|
+
if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
1885
1585
|
const startChar = xmlData[i++];
|
|
1886
1586
|
let val2 = "";
|
|
1887
1587
|
for (; i < xmlData.length && xmlData[i] !== startChar; i++) {
|
|
@@ -1890,28 +1590,23 @@ function readEntityExp(xmlData, i) {
|
|
|
1890
1590
|
return [entityName2, val2, i];
|
|
1891
1591
|
}
|
|
1892
1592
|
function isComment(xmlData, i) {
|
|
1893
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-")
|
|
1894
|
-
return true;
|
|
1593
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true;
|
|
1895
1594
|
return false;
|
|
1896
1595
|
}
|
|
1897
1596
|
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;
|
|
1597
|
+
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
1598
|
return false;
|
|
1901
1599
|
}
|
|
1902
1600
|
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;
|
|
1601
|
+
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
1602
|
return false;
|
|
1906
1603
|
}
|
|
1907
1604
|
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;
|
|
1605
|
+
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
1606
|
return false;
|
|
1911
1607
|
}
|
|
1912
1608
|
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;
|
|
1609
|
+
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
1610
|
return false;
|
|
1916
1611
|
}
|
|
1917
1612
|
function validateEntityName(name) {
|
|
@@ -1938,11 +1633,9 @@ const consider = {
|
|
|
1938
1633
|
};
|
|
1939
1634
|
function toNumber$1(str, options = {}) {
|
|
1940
1635
|
options = Object.assign({}, consider, options);
|
|
1941
|
-
if (!str || typeof str !== "string")
|
|
1942
|
-
return str;
|
|
1636
|
+
if (!str || typeof str !== "string") return str;
|
|
1943
1637
|
let trimmedStr = str.trim();
|
|
1944
|
-
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr))
|
|
1945
|
-
return str;
|
|
1638
|
+
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
|
|
1946
1639
|
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
1947
1640
|
return Number.parseInt(trimmedStr, 16);
|
|
1948
1641
|
} else {
|
|
@@ -1952,45 +1645,30 @@ function toNumber$1(str, options = {}) {
|
|
|
1952
1645
|
const leadingZeros = match[2];
|
|
1953
1646
|
let numTrimmedByZeros = trimZeros(match[3]);
|
|
1954
1647
|
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;
|
|
1648
|
+
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str;
|
|
1649
|
+
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str;
|
|
1959
1650
|
else {
|
|
1960
1651
|
const num = Number(trimmedStr);
|
|
1961
1652
|
const numStr = "" + num;
|
|
1962
1653
|
if (numStr.search(/[eE]/) !== -1) {
|
|
1963
|
-
if (options.eNotation)
|
|
1964
|
-
|
|
1965
|
-
else
|
|
1966
|
-
return str;
|
|
1654
|
+
if (options.eNotation) return num;
|
|
1655
|
+
else return str;
|
|
1967
1656
|
} else if (eNotation) {
|
|
1968
|
-
if (options.eNotation)
|
|
1969
|
-
|
|
1970
|
-
else
|
|
1971
|
-
return str;
|
|
1657
|
+
if (options.eNotation) return num;
|
|
1658
|
+
else return str;
|
|
1972
1659
|
} 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;
|
|
1660
|
+
if (numStr === "0" && numTrimmedByZeros === "") return num;
|
|
1661
|
+
else if (numStr === numTrimmedByZeros) return num;
|
|
1662
|
+
else if (sign && numStr === "-" + numTrimmedByZeros) return num;
|
|
1663
|
+
else return str;
|
|
1981
1664
|
}
|
|
1982
1665
|
if (leadingZeros) {
|
|
1983
|
-
if (numTrimmedByZeros === numStr)
|
|
1984
|
-
|
|
1985
|
-
else
|
|
1986
|
-
return num;
|
|
1987
|
-
else
|
|
1988
|
-
return str;
|
|
1666
|
+
if (numTrimmedByZeros === numStr) return num;
|
|
1667
|
+
else if (sign + numTrimmedByZeros === numStr) return num;
|
|
1668
|
+
else return str;
|
|
1989
1669
|
}
|
|
1990
|
-
if (trimmedStr === numStr)
|
|
1991
|
-
|
|
1992
|
-
else if (trimmedStr === sign + numStr)
|
|
1993
|
-
return num;
|
|
1670
|
+
if (trimmedStr === numStr) return num;
|
|
1671
|
+
else if (trimmedStr === sign + numStr) return num;
|
|
1994
1672
|
return str;
|
|
1995
1673
|
}
|
|
1996
1674
|
} else {
|
|
@@ -2001,12 +1679,9 @@ function toNumber$1(str, options = {}) {
|
|
|
2001
1679
|
function trimZeros(numStr) {
|
|
2002
1680
|
if (numStr && numStr.indexOf(".") !== -1) {
|
|
2003
1681
|
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);
|
|
1682
|
+
if (numStr === ".") numStr = "0";
|
|
1683
|
+
else if (numStr[0] === ".") numStr = "0" + numStr;
|
|
1684
|
+
else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1);
|
|
2010
1685
|
return numStr;
|
|
2011
1686
|
}
|
|
2012
1687
|
return numStr;
|
|
@@ -2074,8 +1749,7 @@ function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode
|
|
|
2074
1749
|
val2 = val2.trim();
|
|
2075
1750
|
}
|
|
2076
1751
|
if (val2.length > 0) {
|
|
2077
|
-
if (!escapeEntities)
|
|
2078
|
-
val2 = this.replaceEntitiesValue(val2);
|
|
1752
|
+
if (!escapeEntities) val2 = this.replaceEntitiesValue(val2);
|
|
2079
1753
|
const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode);
|
|
2080
1754
|
if (newval === null || newval === void 0) {
|
|
2081
1755
|
return val2;
|
|
@@ -2121,8 +1795,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
2121
1795
|
if (this.options.transformAttributeName) {
|
|
2122
1796
|
aName = this.options.transformAttributeName(aName);
|
|
2123
1797
|
}
|
|
2124
|
-
if (aName === "__proto__")
|
|
2125
|
-
aName = "#__proto__";
|
|
1798
|
+
if (aName === "__proto__") aName = "#__proto__";
|
|
2126
1799
|
if (oldVal !== void 0) {
|
|
2127
1800
|
if (this.options.trimValues) {
|
|
2128
1801
|
oldVal = oldVal.trim();
|
|
@@ -2197,11 +1870,9 @@ const parseXml = function(xmlData) {
|
|
|
2197
1870
|
i = closeIndex;
|
|
2198
1871
|
} else if (xmlData[i + 1] === "?") {
|
|
2199
1872
|
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
2200
|
-
if (!tagData)
|
|
2201
|
-
throw new Error("Pi Tag is not closed.");
|
|
1873
|
+
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
2202
1874
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
2203
|
-
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags)
|
|
2204
|
-
;
|
|
1875
|
+
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) ;
|
|
2205
1876
|
else {
|
|
2206
1877
|
const childNode = new xmlNode(tagData.tagName);
|
|
2207
1878
|
childNode.add(this.options.textNodeName, "");
|
|
@@ -2228,8 +1899,7 @@ const parseXml = function(xmlData) {
|
|
|
2228
1899
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
2229
1900
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
2230
1901
|
let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
2231
|
-
if (val2 == void 0)
|
|
2232
|
-
val2 = "";
|
|
1902
|
+
if (val2 == void 0) val2 = "";
|
|
2233
1903
|
if (this.options.cdataPropName) {
|
|
2234
1904
|
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
2235
1905
|
} else {
|
|
@@ -2274,8 +1944,7 @@ const parseXml = function(xmlData) {
|
|
|
2274
1944
|
i = result.closeIndex;
|
|
2275
1945
|
} else {
|
|
2276
1946
|
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
2277
|
-
if (!result2)
|
|
2278
|
-
throw new Error(`Unexpected end of ${rawTagName}`);
|
|
1947
|
+
if (!result2) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
2279
1948
|
i = result2.i;
|
|
2280
1949
|
tagContent = result2.tagContent;
|
|
2281
1950
|
}
|
|
@@ -2328,8 +1997,7 @@ const parseXml = function(xmlData) {
|
|
|
2328
1997
|
};
|
|
2329
1998
|
function addChild(currentNode, childNode, jPath) {
|
|
2330
1999
|
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
2331
|
-
if (result === false)
|
|
2332
|
-
;
|
|
2000
|
+
if (result === false) ;
|
|
2333
2001
|
else if (typeof result === "string") {
|
|
2334
2002
|
childNode.tagname = result;
|
|
2335
2003
|
currentNode.addChild(childNode);
|
|
@@ -2359,8 +2027,7 @@ const replaceEntitiesValue$1 = function(val2) {
|
|
|
2359
2027
|
};
|
|
2360
2028
|
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
2361
2029
|
if (textData) {
|
|
2362
|
-
if (isLeafNode === void 0)
|
|
2363
|
-
isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
2030
|
+
if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
2364
2031
|
textData = this.parseTextData(
|
|
2365
2032
|
textData,
|
|
2366
2033
|
currentNode.tagname,
|
|
@@ -2379,8 +2046,7 @@ function isItStopNode(stopNodes, jPath, currentTagName) {
|
|
|
2379
2046
|
const allNodesExp = "*." + currentTagName;
|
|
2380
2047
|
for (const stopNodePath in stopNodes) {
|
|
2381
2048
|
const stopNodeExp = stopNodes[stopNodePath];
|
|
2382
|
-
if (allNodesExp === stopNodeExp || jPath === stopNodeExp)
|
|
2383
|
-
return true;
|
|
2049
|
+
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
2384
2050
|
}
|
|
2385
2051
|
return false;
|
|
2386
2052
|
}
|
|
@@ -2390,8 +2056,7 @@ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
|
2390
2056
|
for (let index = i; index < xmlData.length; index++) {
|
|
2391
2057
|
let ch = xmlData[index];
|
|
2392
2058
|
if (attrBoundary) {
|
|
2393
|
-
if (ch === attrBoundary)
|
|
2394
|
-
attrBoundary = "";
|
|
2059
|
+
if (ch === attrBoundary) attrBoundary = "";
|
|
2395
2060
|
} else if (ch === '"' || ch === "'") {
|
|
2396
2061
|
attrBoundary = ch;
|
|
2397
2062
|
} else if (ch === closingChar[0]) {
|
|
@@ -2424,8 +2089,7 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
2424
2089
|
}
|
|
2425
2090
|
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
2426
2091
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
2427
|
-
if (!result)
|
|
2428
|
-
return;
|
|
2092
|
+
if (!result) return;
|
|
2429
2093
|
let tagExp = result.data;
|
|
2430
2094
|
const closeIndex = result.index;
|
|
2431
2095
|
const separatorIndex = tagExp.search(/\s/);
|
|
@@ -2494,12 +2158,9 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
2494
2158
|
function parseValue(val2, shouldParse, options) {
|
|
2495
2159
|
if (shouldParse && typeof val2 === "string") {
|
|
2496
2160
|
const newval = val2.trim();
|
|
2497
|
-
if (newval === "true")
|
|
2498
|
-
|
|
2499
|
-
else
|
|
2500
|
-
return false;
|
|
2501
|
-
else
|
|
2502
|
-
return toNumber(val2, options);
|
|
2161
|
+
if (newval === "true") return true;
|
|
2162
|
+
else if (newval === "false") return false;
|
|
2163
|
+
else return toNumber(val2, options);
|
|
2503
2164
|
} else {
|
|
2504
2165
|
if (util.isExist(val2)) {
|
|
2505
2166
|
return val2;
|
|
@@ -2520,15 +2181,11 @@ function compress(arr, options, jPath) {
|
|
|
2520
2181
|
const tagObj = arr[i];
|
|
2521
2182
|
const property = propName$1(tagObj);
|
|
2522
2183
|
let newJpath = "";
|
|
2523
|
-
if (jPath === void 0)
|
|
2524
|
-
|
|
2525
|
-
else
|
|
2526
|
-
newJpath = jPath + "." + property;
|
|
2184
|
+
if (jPath === void 0) newJpath = property;
|
|
2185
|
+
else newJpath = jPath + "." + property;
|
|
2527
2186
|
if (property === options.textNodeName) {
|
|
2528
|
-
if (text === void 0)
|
|
2529
|
-
|
|
2530
|
-
else
|
|
2531
|
-
text += "" + tagObj[property];
|
|
2187
|
+
if (text === void 0) text = tagObj[property];
|
|
2188
|
+
else text += "" + tagObj[property];
|
|
2532
2189
|
} else if (property === void 0) {
|
|
2533
2190
|
continue;
|
|
2534
2191
|
} else if (tagObj[property]) {
|
|
@@ -2539,10 +2196,8 @@ function compress(arr, options, jPath) {
|
|
|
2539
2196
|
} else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
2540
2197
|
val2 = val2[options.textNodeName];
|
|
2541
2198
|
} else if (Object.keys(val2).length === 0) {
|
|
2542
|
-
if (options.alwaysCreateTextNode)
|
|
2543
|
-
|
|
2544
|
-
else
|
|
2545
|
-
val2 = "";
|
|
2199
|
+
if (options.alwaysCreateTextNode) val2[options.textNodeName] = "";
|
|
2200
|
+
else val2 = "";
|
|
2546
2201
|
}
|
|
2547
2202
|
if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) {
|
|
2548
2203
|
if (!Array.isArray(compressedObj[property])) {
|
|
@@ -2559,18 +2214,15 @@ function compress(arr, options, jPath) {
|
|
|
2559
2214
|
}
|
|
2560
2215
|
}
|
|
2561
2216
|
if (typeof text === "string") {
|
|
2562
|
-
if (text.length > 0)
|
|
2563
|
-
|
|
2564
|
-
} else if (text !== void 0)
|
|
2565
|
-
compressedObj[options.textNodeName] = text;
|
|
2217
|
+
if (text.length > 0) compressedObj[options.textNodeName] = text;
|
|
2218
|
+
} else if (text !== void 0) compressedObj[options.textNodeName] = text;
|
|
2566
2219
|
return compressedObj;
|
|
2567
2220
|
}
|
|
2568
2221
|
function propName$1(obj) {
|
|
2569
2222
|
const keys = Object.keys(obj);
|
|
2570
2223
|
for (let i = 0; i < keys.length; i++) {
|
|
2571
2224
|
const key = keys[i];
|
|
2572
|
-
if (key !== ":@")
|
|
2573
|
-
return key;
|
|
2225
|
+
if (key !== ":@") return key;
|
|
2574
2226
|
}
|
|
2575
2227
|
}
|
|
2576
2228
|
function assignAttributes(obj, attrMap, jpath, options) {
|
|
@@ -2614,16 +2266,14 @@ let XMLParser$1 = class XMLParser {
|
|
|
2614
2266
|
* @param {boolean|Object} validationOption
|
|
2615
2267
|
*/
|
|
2616
2268
|
parse(xmlData, validationOption) {
|
|
2617
|
-
if (typeof xmlData === "string")
|
|
2618
|
-
;
|
|
2269
|
+
if (typeof xmlData === "string") ;
|
|
2619
2270
|
else if (xmlData.toString) {
|
|
2620
2271
|
xmlData = xmlData.toString();
|
|
2621
2272
|
} else {
|
|
2622
2273
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
2623
2274
|
}
|
|
2624
2275
|
if (validationOption) {
|
|
2625
|
-
if (validationOption === true)
|
|
2626
|
-
validationOption = {};
|
|
2276
|
+
if (validationOption === true) validationOption = {};
|
|
2627
2277
|
const result = validator$1.validate(xmlData, validationOption);
|
|
2628
2278
|
if (result !== true) {
|
|
2629
2279
|
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
@@ -2632,10 +2282,8 @@ let XMLParser$1 = class XMLParser {
|
|
|
2632
2282
|
const orderedObjParser = new OrderedObjParser2(this.options);
|
|
2633
2283
|
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
2634
2284
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
2635
|
-
if (this.options.preserveOrder || orderedResult === void 0)
|
|
2636
|
-
|
|
2637
|
-
else
|
|
2638
|
-
return prettify(orderedResult, this.options);
|
|
2285
|
+
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
2286
|
+
else return prettify(orderedResult, this.options);
|
|
2639
2287
|
}
|
|
2640
2288
|
/**
|
|
2641
2289
|
* Add Entity which is not by default supported by this library
|
|
@@ -2669,13 +2317,10 @@ function arrToStr(arr, options, jPath, indentation) {
|
|
|
2669
2317
|
for (let i = 0; i < arr.length; i++) {
|
|
2670
2318
|
const tagObj = arr[i];
|
|
2671
2319
|
const tagName = propName(tagObj);
|
|
2672
|
-
if (tagName === void 0)
|
|
2673
|
-
continue;
|
|
2320
|
+
if (tagName === void 0) continue;
|
|
2674
2321
|
let newJPath = "";
|
|
2675
|
-
if (jPath.length === 0)
|
|
2676
|
-
|
|
2677
|
-
else
|
|
2678
|
-
newJPath = `${jPath}.${tagName}`;
|
|
2322
|
+
if (jPath.length === 0) newJPath = tagName;
|
|
2323
|
+
else newJPath = `${jPath}.${tagName}`;
|
|
2679
2324
|
if (tagName === options.textNodeName) {
|
|
2680
2325
|
let tagText = tagObj[tagName];
|
|
2681
2326
|
if (!isStopNode(newJPath, options)) {
|
|
@@ -2716,10 +2361,8 @@ function arrToStr(arr, options, jPath, indentation) {
|
|
|
2716
2361
|
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
2717
2362
|
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
2718
2363
|
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
2719
|
-
if (options.suppressUnpairedNode)
|
|
2720
|
-
|
|
2721
|
-
else
|
|
2722
|
-
xmlStr += tagStart + "/>";
|
|
2364
|
+
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
2365
|
+
else xmlStr += tagStart + "/>";
|
|
2723
2366
|
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
2724
2367
|
xmlStr += tagStart + "/>";
|
|
2725
2368
|
} else if (tagValue && tagValue.endsWith(">")) {
|
|
@@ -2741,18 +2384,15 @@ function propName(obj) {
|
|
|
2741
2384
|
const keys = Object.keys(obj);
|
|
2742
2385
|
for (let i = 0; i < keys.length; i++) {
|
|
2743
2386
|
const key = keys[i];
|
|
2744
|
-
if (!obj.hasOwnProperty(key))
|
|
2745
|
-
|
|
2746
|
-
if (key !== ":@")
|
|
2747
|
-
return key;
|
|
2387
|
+
if (!obj.hasOwnProperty(key)) continue;
|
|
2388
|
+
if (key !== ":@") return key;
|
|
2748
2389
|
}
|
|
2749
2390
|
}
|
|
2750
2391
|
function attr_to_str(attrMap, options) {
|
|
2751
2392
|
let attrStr = "";
|
|
2752
2393
|
if (attrMap && !options.ignoreAttributes) {
|
|
2753
2394
|
for (let attr in attrMap) {
|
|
2754
|
-
if (!attrMap.hasOwnProperty(attr))
|
|
2755
|
-
continue;
|
|
2395
|
+
if (!attrMap.hasOwnProperty(attr)) continue;
|
|
2756
2396
|
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
2757
2397
|
attrVal = replaceEntitiesValue(attrVal, options);
|
|
2758
2398
|
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
@@ -2768,8 +2408,7 @@ function isStopNode(jPath, options) {
|
|
|
2768
2408
|
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
2769
2409
|
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
2770
2410
|
for (let index in options.stopNodes) {
|
|
2771
|
-
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName)
|
|
2772
|
-
return true;
|
|
2411
|
+
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
2773
2412
|
}
|
|
2774
2413
|
return false;
|
|
2775
2414
|
}
|
|
@@ -2857,8 +2496,7 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
2857
2496
|
let attrStr = "";
|
|
2858
2497
|
let val2 = "";
|
|
2859
2498
|
for (let key in jObj) {
|
|
2860
|
-
if (!Object.prototype.hasOwnProperty.call(jObj, key))
|
|
2861
|
-
continue;
|
|
2499
|
+
if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
2862
2500
|
if (typeof jObj[key] === "undefined") {
|
|
2863
2501
|
if (this.isAttribute(key)) {
|
|
2864
2502
|
val2 += "";
|
|
@@ -2890,13 +2528,10 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
2890
2528
|
let listTagVal = "";
|
|
2891
2529
|
for (let j = 0; j < arrLen; j++) {
|
|
2892
2530
|
const item = jObj[key][j];
|
|
2893
|
-
if (typeof item === "undefined")
|
|
2894
|
-
;
|
|
2531
|
+
if (typeof item === "undefined") ;
|
|
2895
2532
|
else if (item === null) {
|
|
2896
|
-
if (key[0] === "?")
|
|
2897
|
-
|
|
2898
|
-
else
|
|
2899
|
-
val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2533
|
+
if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
2534
|
+
else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2900
2535
|
} else if (typeof item === "object") {
|
|
2901
2536
|
if (this.options.oneListGroup) {
|
|
2902
2537
|
listTagVal += this.j2x(item, level + 1).val;
|
|
@@ -2930,8 +2565,7 @@ Builder.prototype.buildAttrPairStr = function(attrName, val2) {
|
|
|
2930
2565
|
val2 = this.replaceEntitiesValue(val2);
|
|
2931
2566
|
if (this.options.suppressBooleanAttributes && val2 === "true") {
|
|
2932
2567
|
return " " + attrName;
|
|
2933
|
-
} else
|
|
2934
|
-
return " " + attrName + '="' + val2 + '"';
|
|
2568
|
+
} else return " " + attrName + '="' + val2 + '"';
|
|
2935
2569
|
};
|
|
2936
2570
|
function processTextOrObjNode(object, key, level) {
|
|
2937
2571
|
const result = this.j2x(object, level + 1);
|
|
@@ -2943,8 +2577,7 @@ function processTextOrObjNode(object, key, level) {
|
|
|
2943
2577
|
}
|
|
2944
2578
|
Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
|
|
2945
2579
|
if (val2 === "") {
|
|
2946
|
-
if (key[0] === "?")
|
|
2947
|
-
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2580
|
+
if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2948
2581
|
else {
|
|
2949
2582
|
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2950
2583
|
}
|
|
@@ -2967,8 +2600,7 @@ Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
|
|
|
2967
2600
|
Builder.prototype.closeTag = function(key) {
|
|
2968
2601
|
let closeTag = "";
|
|
2969
2602
|
if (this.options.unpairedTags.indexOf(key) !== -1) {
|
|
2970
|
-
if (!this.options.suppressUnpairedNode)
|
|
2971
|
-
closeTag = "/";
|
|
2603
|
+
if (!this.options.suppressUnpairedNode) closeTag = "/";
|
|
2972
2604
|
} else if (this.options.suppressEmptyNode) {
|
|
2973
2605
|
closeTag = "/";
|
|
2974
2606
|
} else {
|
|
@@ -3047,27 +2679,6 @@ function isSvg(string) {
|
|
|
3047
2679
|
}
|
|
3048
2680
|
return true;
|
|
3049
2681
|
}
|
|
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
2682
|
class View {
|
|
3072
2683
|
_view;
|
|
3073
2684
|
constructor(view) {
|
|
@@ -3175,28 +2786,6 @@ const isValidView = function(view) {
|
|
|
3175
2786
|
}
|
|
3176
2787
|
return true;
|
|
3177
2788
|
};
|
|
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
2789
|
const addNewFileMenuEntry = function(entry) {
|
|
3201
2790
|
const newFileMenu = getNewFileMenu();
|
|
3202
2791
|
return newFileMenu.registerEntry(entry);
|
|
@@ -3234,6 +2823,8 @@ export {
|
|
|
3234
2823
|
davGetDefaultPropfind,
|
|
3235
2824
|
davGetFavoritesReport,
|
|
3236
2825
|
davGetRecentSearch,
|
|
2826
|
+
davGetRemoteURL,
|
|
2827
|
+
davGetRootPath,
|
|
3237
2828
|
davParsePermissions,
|
|
3238
2829
|
davRemoteURL,
|
|
3239
2830
|
davResultToNode,
|
|
@@ -3248,6 +2839,7 @@ export {
|
|
|
3248
2839
|
getFileListHeaders,
|
|
3249
2840
|
getNavigation,
|
|
3250
2841
|
getNewFileMenuEntries,
|
|
2842
|
+
getUniqueName,
|
|
3251
2843
|
isFilenameValid,
|
|
3252
2844
|
orderBy,
|
|
3253
2845
|
parseFileSize,
|