@nextcloud/files 3.0.0-beta.7 → 3.0.0-beta.9
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/dist/fileAction.d.ts +77 -0
- package/dist/files/node.d.ts +13 -1
- package/dist/files/nodeData.d.ts +2 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +183 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +238 -31
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
3
|
+
*
|
|
4
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
5
|
+
*
|
|
6
|
+
* @license AGPL-3.0-or-later
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Affero General Public License as
|
|
10
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
+
* License, or (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Affero General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
import { Node } from "./files/node";
|
|
23
|
+
interface FileActionData {
|
|
24
|
+
/** Unique ID */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Translatable string displayed in the menu */
|
|
27
|
+
displayName: (files: Node[], view: any) => string;
|
|
28
|
+
/** Svg as inline string. <svg><path fill="..." /></svg> */
|
|
29
|
+
iconSvgInline: (files: Node[], view: any) => string;
|
|
30
|
+
/** Condition wether this action is shown or not */
|
|
31
|
+
enabled?: (files: Node[], view: any) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Function executed on single file action
|
|
34
|
+
* @returns true if the action was executed successfully,
|
|
35
|
+
* false otherwise and null if the action is silent/undefined.
|
|
36
|
+
* @throws Error if the action failed
|
|
37
|
+
*/
|
|
38
|
+
exec: (file: Node, view: any, dir: string) => Promise<boolean | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Function executed on multiple files action
|
|
41
|
+
* @returns true if the action was executed successfully,
|
|
42
|
+
* false otherwise and null if the action is silent/undefined.
|
|
43
|
+
* @throws Error if the action failed
|
|
44
|
+
*/
|
|
45
|
+
execBatch?: (files: Node[], view: any, dir: string) => Promise<(boolean | null)[]>;
|
|
46
|
+
/** This action order in the list */
|
|
47
|
+
order?: number;
|
|
48
|
+
/** Make this action the default */
|
|
49
|
+
default?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* If true, the renderInline function will be called
|
|
52
|
+
*/
|
|
53
|
+
inline?: (file: Node, view: any) => boolean;
|
|
54
|
+
/**
|
|
55
|
+
* If defined, the returned html element will be
|
|
56
|
+
* appended before the actions menu.
|
|
57
|
+
*/
|
|
58
|
+
renderInline?: (file: Node, view: any) => HTMLElement;
|
|
59
|
+
}
|
|
60
|
+
export declare class FileAction {
|
|
61
|
+
private _action;
|
|
62
|
+
constructor(action: FileActionData);
|
|
63
|
+
get id(): string;
|
|
64
|
+
get displayName(): (files: Node[], view: any) => string;
|
|
65
|
+
get iconSvgInline(): (files: Node[], view: any) => string;
|
|
66
|
+
get enabled(): ((files: Node[], view: any) => boolean) | undefined;
|
|
67
|
+
get exec(): (file: Node, view: any, dir: string) => Promise<boolean | null>;
|
|
68
|
+
get execBatch(): ((files: Node[], view: any, dir: string) => Promise<(boolean | null)[]>) | undefined;
|
|
69
|
+
get order(): number | undefined;
|
|
70
|
+
get default(): boolean | undefined;
|
|
71
|
+
get inline(): ((file: Node, view: any) => boolean) | undefined;
|
|
72
|
+
get renderInline(): ((file: Node, view: any) => HTMLElement) | undefined;
|
|
73
|
+
private validateAction;
|
|
74
|
+
}
|
|
75
|
+
export declare const registerFileAction: (action: FileAction) => void;
|
|
76
|
+
export declare const getFileActions: () => FileAction[];
|
|
77
|
+
export {};
|
package/dist/files/node.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export declare abstract class Node {
|
|
|
31
31
|
* Get the file mime
|
|
32
32
|
*/
|
|
33
33
|
get mime(): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get the file modification time
|
|
36
|
+
*/
|
|
37
|
+
get mtime(): Date | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Get the file creation time
|
|
40
|
+
*/
|
|
41
|
+
get crtime(): Date | undefined;
|
|
34
42
|
/**
|
|
35
43
|
* Get the file size
|
|
36
44
|
*/
|
|
@@ -58,7 +66,11 @@ export declare abstract class Node {
|
|
|
58
66
|
/**
|
|
59
67
|
* Get the absolute path of this object relative to the root
|
|
60
68
|
*/
|
|
61
|
-
get path(): string
|
|
69
|
+
get path(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Get the file id if defined in attributes
|
|
72
|
+
*/
|
|
73
|
+
get fileid(): number | undefined;
|
|
62
74
|
/**
|
|
63
75
|
* Move the node to a new destination
|
|
64
76
|
*
|
package/dist/files/nodeData.d.ts
CHANGED
|
@@ -52,7 +52,8 @@ export default interface NodeData {
|
|
|
52
52
|
*/
|
|
53
53
|
root?: string;
|
|
54
54
|
}
|
|
55
|
+
export declare const isDavRessource: (source: string, davService: RegExp) => boolean;
|
|
55
56
|
/**
|
|
56
57
|
* Validate Node construct data
|
|
57
58
|
*/
|
|
58
|
-
export declare const validateData: (data: NodeData) => void;
|
|
59
|
+
export declare const validateData: (data: NodeData, davService: RegExp) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export { formatFileSize } from './humanfilesize';
|
|
24
24
|
export { type Entry } from './newFileMenu';
|
|
25
|
+
import { FileAction } from './fileAction';
|
|
25
26
|
import { type Entry, NewFileMenu } from './newFileMenu';
|
|
26
27
|
export { FileType } from './files/fileType';
|
|
27
28
|
export { File } from './files/file';
|
|
28
29
|
export { Folder } from './files/folder';
|
|
29
30
|
export { Node } from './files/node';
|
|
30
31
|
export { Permission, parseWebdavPermissions } from './permissions';
|
|
32
|
+
export { FileAction, registerFileAction, getFileActions } from './fileAction';
|
|
31
33
|
declare global {
|
|
32
34
|
interface Window {
|
|
33
35
|
OC: any;
|
|
34
|
-
_nc_newfilemenu: NewFileMenu;
|
|
36
|
+
_nc_newfilemenu: NewFileMenu | undefined;
|
|
37
|
+
_nc_fileactions: FileAction[] | undefined;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCanonicalLocale } from '@nextcloud/l10n';
|
|
2
2
|
import { getCurrentUser } from '@nextcloud/auth';
|
|
3
3
|
import { getLoggerBuilder } from '@nextcloud/logger';
|
|
4
|
-
import { basename, extname, dirname } from 'path';
|
|
4
|
+
import { join, basename, extname, dirname } from 'path';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
@@ -284,18 +284,27 @@ const parseWebdavPermissions = function (permString = '') {
|
|
|
284
284
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
285
285
|
*
|
|
286
286
|
*/
|
|
287
|
+
const isDavRessource = function (source, davService) {
|
|
288
|
+
return source.match(davService) !== null;
|
|
289
|
+
};
|
|
287
290
|
/**
|
|
288
291
|
* Validate Node construct data
|
|
289
292
|
*/
|
|
290
|
-
const validateData = (data) => {
|
|
293
|
+
const validateData = (data, davService) => {
|
|
291
294
|
if ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {
|
|
292
295
|
throw new Error('Invalid id type of value');
|
|
293
296
|
}
|
|
294
297
|
if (!data.source) {
|
|
295
298
|
throw new Error('Missing mandatory source');
|
|
296
299
|
}
|
|
300
|
+
try {
|
|
301
|
+
new URL(data.source);
|
|
302
|
+
}
|
|
303
|
+
catch (e) {
|
|
304
|
+
throw new Error('Invalid source format, source must be a valid URL');
|
|
305
|
+
}
|
|
297
306
|
if (!data.source.startsWith('http')) {
|
|
298
|
-
throw new Error('Invalid source format');
|
|
307
|
+
throw new Error('Invalid source format, only http(s) is supported');
|
|
299
308
|
}
|
|
300
309
|
if ('mtime' in data && !(data.mtime instanceof Date)) {
|
|
301
310
|
throw new Error('Invalid mtime type');
|
|
@@ -329,6 +338,15 @@ const validateData = (data) => {
|
|
|
329
338
|
if (data.root && !data.root.startsWith('/')) {
|
|
330
339
|
throw new Error('Root must start with a leading slash');
|
|
331
340
|
}
|
|
341
|
+
if (data.root && !data.source.includes(data.root)) {
|
|
342
|
+
throw new Error('Root must be part of the source');
|
|
343
|
+
}
|
|
344
|
+
if (data.root && isDavRessource(data.source, davService)) {
|
|
345
|
+
const service = data.source.match(davService)[0];
|
|
346
|
+
if (!data.source.includes(join(service, data.root))) {
|
|
347
|
+
throw new Error('The root must be relative to the service. e.g /files/emma');
|
|
348
|
+
}
|
|
349
|
+
}
|
|
332
350
|
};
|
|
333
351
|
|
|
334
352
|
/**
|
|
@@ -358,9 +376,24 @@ class Node {
|
|
|
358
376
|
_knownDavService = /(remote|public)\.php\/(web)?dav/i;
|
|
359
377
|
constructor(data, davService) {
|
|
360
378
|
// Validate data
|
|
361
|
-
validateData(data);
|
|
379
|
+
validateData(data, davService || this._knownDavService);
|
|
362
380
|
this._data = data;
|
|
363
|
-
|
|
381
|
+
const handler = {
|
|
382
|
+
set: (target, prop, value) => {
|
|
383
|
+
// Edit modification time
|
|
384
|
+
this._data['mtime'] = new Date();
|
|
385
|
+
// Apply original changes
|
|
386
|
+
return Reflect.set(target, prop, value);
|
|
387
|
+
},
|
|
388
|
+
deleteProperty: (target, prop) => {
|
|
389
|
+
// Edit modification time
|
|
390
|
+
this._data['mtime'] = new Date();
|
|
391
|
+
// Apply original changes
|
|
392
|
+
return Reflect.deleteProperty(target, prop);
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
// Proxy the attributes to update the mtime on change
|
|
396
|
+
this._attributes = new Proxy(data.attributes || {}, handler);
|
|
364
397
|
delete this._data.attributes;
|
|
365
398
|
if (davService) {
|
|
366
399
|
this._knownDavService = davService;
|
|
@@ -391,9 +424,14 @@ class Node {
|
|
|
391
424
|
*/
|
|
392
425
|
get dirname() {
|
|
393
426
|
if (this.root) {
|
|
394
|
-
|
|
427
|
+
// Using replace would remove all part matching root
|
|
428
|
+
const firstMatch = this.source.indexOf(this.root);
|
|
429
|
+
return dirname(this.source.slice(firstMatch + this.root.length) || '/');
|
|
395
430
|
}
|
|
396
|
-
|
|
431
|
+
// This should always be a valid URL
|
|
432
|
+
// as this is tested in the constructor
|
|
433
|
+
const url = new URL(this.source);
|
|
434
|
+
return dirname(url.pathname);
|
|
397
435
|
}
|
|
398
436
|
/**
|
|
399
437
|
* Get the file mime
|
|
@@ -401,6 +439,18 @@ class Node {
|
|
|
401
439
|
get mime() {
|
|
402
440
|
return this._data.mime;
|
|
403
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Get the file modification time
|
|
444
|
+
*/
|
|
445
|
+
get mtime() {
|
|
446
|
+
return this._data.mtime;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Get the file creation time
|
|
450
|
+
*/
|
|
451
|
+
get crtime() {
|
|
452
|
+
return this._data.crtime;
|
|
453
|
+
}
|
|
404
454
|
/**
|
|
405
455
|
* Get the file size
|
|
406
456
|
*/
|
|
@@ -421,7 +471,10 @@ class Node {
|
|
|
421
471
|
if (this.owner === null && !this.isDavRessource) {
|
|
422
472
|
return Permission.READ;
|
|
423
473
|
}
|
|
424
|
-
|
|
474
|
+
// If the permissions are not defined, we have none
|
|
475
|
+
return this._data.permissions !== undefined
|
|
476
|
+
? this._data.permissions
|
|
477
|
+
: Permission.NONE;
|
|
425
478
|
}
|
|
426
479
|
/**
|
|
427
480
|
* Get the file owner
|
|
@@ -437,7 +490,7 @@ class Node {
|
|
|
437
490
|
* Is this a dav-related ressource ?
|
|
438
491
|
*/
|
|
439
492
|
get isDavRessource() {
|
|
440
|
-
return this.source
|
|
493
|
+
return isDavRessource(this.source, this._knownDavService);
|
|
441
494
|
}
|
|
442
495
|
/**
|
|
443
496
|
* Get the dav root of this object
|
|
@@ -458,8 +511,19 @@ class Node {
|
|
|
458
511
|
* Get the absolute path of this object relative to the root
|
|
459
512
|
*/
|
|
460
513
|
get path() {
|
|
514
|
+
if (this.root) {
|
|
515
|
+
// Using replace would remove all part matching root
|
|
516
|
+
const firstMatch = this.source.indexOf(this.root);
|
|
517
|
+
return this.source.slice(firstMatch + this.root.length) || '/';
|
|
518
|
+
}
|
|
461
519
|
return (this.dirname + '/' + this.basename).replace(/\/\//g, '/');
|
|
462
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Get the file id if defined in attributes
|
|
523
|
+
*/
|
|
524
|
+
get fileid() {
|
|
525
|
+
return this.attributes?.fileid;
|
|
526
|
+
}
|
|
463
527
|
/**
|
|
464
528
|
* Move the node to a new destination
|
|
465
529
|
*
|
|
@@ -467,7 +531,9 @@ class Node {
|
|
|
467
531
|
* e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
|
|
468
532
|
*/
|
|
469
533
|
move(destination) {
|
|
534
|
+
validateData({ ...this._data, source: destination }, this._knownDavService);
|
|
470
535
|
this._data.source = destination;
|
|
536
|
+
this._data.mtime = new Date();
|
|
471
537
|
}
|
|
472
538
|
/**
|
|
473
539
|
* Rename the node
|
|
@@ -548,6 +614,113 @@ class Folder extends Node {
|
|
|
548
614
|
}
|
|
549
615
|
}
|
|
550
616
|
|
|
617
|
+
/**
|
|
618
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
619
|
+
*
|
|
620
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
621
|
+
*
|
|
622
|
+
* @license AGPL-3.0-or-later
|
|
623
|
+
*
|
|
624
|
+
* This program is free software: you can redistribute it and/or modify
|
|
625
|
+
* it under the terms of the GNU Affero General Public License as
|
|
626
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
627
|
+
* License, or (at your option) any later version.
|
|
628
|
+
*
|
|
629
|
+
* This program is distributed in the hope that it will be useful,
|
|
630
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
631
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
632
|
+
* GNU Affero General Public License for more details.
|
|
633
|
+
*
|
|
634
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
635
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
636
|
+
*
|
|
637
|
+
*/
|
|
638
|
+
class FileAction {
|
|
639
|
+
_action;
|
|
640
|
+
constructor(action) {
|
|
641
|
+
this.validateAction(action);
|
|
642
|
+
this._action = action;
|
|
643
|
+
}
|
|
644
|
+
get id() {
|
|
645
|
+
return this._action.id;
|
|
646
|
+
}
|
|
647
|
+
get displayName() {
|
|
648
|
+
return this._action.displayName;
|
|
649
|
+
}
|
|
650
|
+
get iconSvgInline() {
|
|
651
|
+
return this._action.iconSvgInline;
|
|
652
|
+
}
|
|
653
|
+
get enabled() {
|
|
654
|
+
return this._action.enabled;
|
|
655
|
+
}
|
|
656
|
+
get exec() {
|
|
657
|
+
return this._action.exec;
|
|
658
|
+
}
|
|
659
|
+
get execBatch() {
|
|
660
|
+
return this._action.execBatch;
|
|
661
|
+
}
|
|
662
|
+
get order() {
|
|
663
|
+
return this._action.order;
|
|
664
|
+
}
|
|
665
|
+
get default() {
|
|
666
|
+
return this._action.default;
|
|
667
|
+
}
|
|
668
|
+
get inline() {
|
|
669
|
+
return this._action.inline;
|
|
670
|
+
}
|
|
671
|
+
get renderInline() {
|
|
672
|
+
return this._action.renderInline;
|
|
673
|
+
}
|
|
674
|
+
validateAction(action) {
|
|
675
|
+
if (!action.id || typeof action.id !== 'string') {
|
|
676
|
+
throw new Error('Invalid id');
|
|
677
|
+
}
|
|
678
|
+
if (!action.displayName || typeof action.displayName !== 'function') {
|
|
679
|
+
throw new Error('Invalid displayName function');
|
|
680
|
+
}
|
|
681
|
+
if (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {
|
|
682
|
+
throw new Error('Invalid iconSvgInline function');
|
|
683
|
+
}
|
|
684
|
+
if (!action.exec || typeof action.exec !== 'function') {
|
|
685
|
+
throw new Error('Invalid exec function');
|
|
686
|
+
}
|
|
687
|
+
// Optional properties --------------------------------------------
|
|
688
|
+
if ('enabled' in action && typeof action.enabled !== 'function') {
|
|
689
|
+
throw new Error('Invalid enabled function');
|
|
690
|
+
}
|
|
691
|
+
if ('execBatch' in action && typeof action.execBatch !== 'function') {
|
|
692
|
+
throw new Error('Invalid execBatch function');
|
|
693
|
+
}
|
|
694
|
+
if ('order' in action && typeof action.order !== 'number') {
|
|
695
|
+
throw new Error('Invalid order');
|
|
696
|
+
}
|
|
697
|
+
if ('default' in action && typeof action.default !== 'boolean') {
|
|
698
|
+
throw new Error('Invalid default');
|
|
699
|
+
}
|
|
700
|
+
if ('inline' in action && typeof action.inline !== 'function') {
|
|
701
|
+
throw new Error('Invalid inline function');
|
|
702
|
+
}
|
|
703
|
+
if ('renderInline' in action && typeof action.renderInline !== 'function') {
|
|
704
|
+
throw new Error('Invalid renderInline function');
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const registerFileAction = function (action) {
|
|
709
|
+
if (typeof window._nc_fileactions === 'undefined') {
|
|
710
|
+
window._nc_fileactions = [];
|
|
711
|
+
logger.debug('FileActions initialized');
|
|
712
|
+
}
|
|
713
|
+
// Check duplicates
|
|
714
|
+
if (window._nc_fileactions.find(search => search.id === action.id)) {
|
|
715
|
+
logger.error(`FileAction ${action.id} already registered`, { action });
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
window._nc_fileactions.push(action);
|
|
719
|
+
};
|
|
720
|
+
const getFileActions = function () {
|
|
721
|
+
return window._nc_fileactions || [];
|
|
722
|
+
};
|
|
723
|
+
|
|
551
724
|
/**
|
|
552
725
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
553
726
|
*
|
|
@@ -594,5 +767,5 @@ const getNewFileMenuEntries = function (context) {
|
|
|
594
767
|
return newFileMenu.getEntries(context);
|
|
595
768
|
};
|
|
596
769
|
|
|
597
|
-
export { File, FileType, Folder, Node, Permission, addNewFileMenuEntry, formatFileSize, getNewFileMenuEntries, parseWebdavPermissions, removeNewFileMenuEntry };
|
|
770
|
+
export { File, FileAction, FileType, Folder, Node, Permission, addNewFileMenuEntry, formatFileSize, getFileActions, getNewFileMenuEntries, parseWebdavPermissions, registerFileAction, removeNewFileMenuEntry };
|
|
598
771
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, validateData } from './nodeData'\n\nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute[]\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data)\n\n\t\tthis._data = data\n\t\tthis._attributes = data.attributes || {} as any\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\treturn dirname(this.source.split(this.root).pop() || '/')\n\t\t}\n\t\treturn dirname(this.source)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\treturn this._data.permissions || Permission.READ\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.source.match(this._knownDavService) !== null\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string|null {\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tthis._data.source = destination\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":[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,SAAA,CAAC,CAAA;KACF;AAED,IAAA,IAAI,IAAI,GAAA;QACP,OAAO,QAAQ,CAAC,MAAM,CAAA;KACtB;AAED,IAAA,IAAI,SAAS,GAAA;AACZ,QAAA,OAAO,IAAI,CAAA;KACX;AAED,IAAA,IAAI,IAAI,GAAA;AACP,QAAA,OAAO,sBAAsB,CAAA;KAC7B;AACD;;AC7CD;;;;;;;;;;;;;;;;;;;;;AAqBG;AAmBH;;AAEG;AACI,MAAM,mBAAmB,GAAG,UAAS,KAAY,EAAA;AACvD,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACxC,EAAC;AAED;;AAEG;AACI,MAAM,sBAAsB,GAAG,UAAS,KAAqB,EAAA;AACnE,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAC1C,EAAC;AAED;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,UAAS,OAAgB,EAAA;AAC7D,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/fileAction.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { join } from \"path\"\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n\nexport const isDavRessource = function(source: string, davService: RegExp): boolean {\n\treturn source.match(davService) !== null\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData, davService: RegExp) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\ttry {\n\t\tnew URL(data.source)\n\t} catch (e) {\n\t\tthrow new Error('Invalid source format, source must be a valid URL')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format, only http(s) is supported')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n\n\tif (data.root && !data.source.includes(data.root)) {\n\t\tthrow new Error('Root must be part of the source')\n\t}\n\n\tif (data.root && isDavRessource(data.source, davService)) {\n\t\tconst service = data.source.match(davService)![0]\n\t\tif (!data.source.includes(join(service, data.root))) {\n\t\t\tthrow new Error('The root must be relative to the service. e.g /files/emma')\n\t\t}\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, isDavRessource, validateData } from './nodeData'\n\n \nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data, davService || this._knownDavService)\n\n\t\tthis._data = data\n\t\n\t\tconst handler = {\n\t\t\tset: (target: Attribute, prop: string, value: any): any => {\n\t\t\t\t// Edit modification time\n\t\t\t\tthis._data['mtime'] = new Date()\n\t\t\t\t// Apply original changes\n\t\t\t\treturn Reflect.set(target, prop, value)\n\t\t\t},\n\t\t\tdeleteProperty: (target: Attribute, prop: string) => {\n\t\t\t\t// Edit modification time\n\t\t\t\tthis._data['mtime'] = new Date()\n\t\t\t\t// Apply original changes\n\t\t\t\treturn Reflect.deleteProperty(target, prop)\n\t\t\t},\n\t\t} as ProxyHandler<any>\n\n\t\t// Proxy the attributes to update the mtime on change\n\t\tthis._attributes = new Proxy(data.attributes || {} as any, handler)\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\t// Using replace would remove all part matching root\n\t\t\tconst firstMatch = this.source.indexOf(this.root)\n\t\t\treturn dirname(this.source.slice(firstMatch + this.root.length) || '/')\n\t\t}\n\n\t\t// This should always be a valid URL\n\t\t// as this is tested in the constructor\n\t\tconst url = new URL(this.source)\n\t\treturn dirname(url.pathname)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file modification time\n\t */\n\tget mtime(): Date|undefined {\n\t\treturn this._data.mtime\n\t}\n\n\t/**\n\t * Get the file creation time\n\t */\n\tget crtime(): Date|undefined {\n\t\treturn this._data.crtime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\t// If the permissions are not defined, we have none\n\t\treturn this._data.permissions !== undefined\n\t\t\t? this._data.permissions\n\t\t\t: Permission.NONE\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn isDavRessource(this.source, this._knownDavService)\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string {\n\t\tif (this.root) {\n\t\t\t// Using replace would remove all part matching root\n\t\t\tconst firstMatch = this.source.indexOf(this.root)\n\t\t\treturn this.source.slice(firstMatch + this.root.length) || '/'\n\t\t}\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Get the file id if defined in attributes\n\t */\n\tget fileid(): number|undefined {\n\t\treturn this.attributes?.fileid\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tvalidateData({ ...this._data, source: destination }, this._knownDavService)\n\t\tthis._data.source = destination\n\t\tthis._data.mtime = new Date()\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Node } from \"./files/node\"\nimport logger from \"./utils/logger\"\n\ninterface FileActionData {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: (files: Node[], view) => string\n\t/** Svg as inline string. <svg><path fill=\"...\" /></svg> */\n\ticonSvgInline: (files: Node[], view) => string\n\t/** Condition wether this action is shown or not */\n\tenabled?: (files: Node[], view) => boolean\n\t/**\n\t * Function executed on single file action\n\t * @returns true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texec: (file: Node, view, dir: string) => Promise<boolean|null>,\n\t/**\n\t * Function executed on multiple files action\n\t * @returns true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texecBatch?: (files: Node[], view, dir: string) => Promise<(boolean|null)[]>\n\t/** This action order in the list */\n\torder?: number,\n\t/** Make this action the default */\n\tdefault?: boolean,\n\t/**\n\t * If true, the renderInline function will be called\n\t */\n\tinline?: (file: Node, view) => boolean,\n\t/**\n\t * If defined, the returned html element will be\n\t * appended before the actions menu.\n\t */\n\trenderInline?: (file: Node, view) => HTMLElement,\n}\n\nexport class FileAction {\n\tprivate _action: FileActionData\n\t\n\tconstructor(action: FileActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tget execBatch() {\n\t\treturn this._action.execBatch\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget default() {\n\t\treturn this._action.default\n\t}\n\n\tget inline() {\n\t\treturn this._action.inline\n\t}\n\n\tget renderInline() {\n\t\treturn this._action.renderInline\n\t}\n\n\tprivate validateAction(action: FileActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\n\t\t// Optional properties --------------------------------------------\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif ('execBatch' in action && typeof action.execBatch !== 'function') {\n\t\t\tthrow new Error('Invalid execBatch function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif ('default' in action && typeof action.default !== 'boolean') {\n\t\t\tthrow new Error('Invalid default')\n\t\t}\n\n\t\tif ('inline' in action && typeof action.inline !== 'function') {\n\t\t\tthrow new Error('Invalid inline function')\n\t\t}\n\n\t\tif ('renderInline' in action && typeof action.renderInline !== 'function') {\n\t\t\tthrow new Error('Invalid renderInline function')\n\t\t}\n\t}\n}\n\nexport const registerFileAction = function(action: FileAction): void {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_fileactions.find(search => search.id === action.id)) {\n\t\tlogger.error(`FileAction ${action.id} already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_fileactions.push(action)\n}\n\nexport const getFileActions = function(): FileAction[] {\n\treturn window._nc_fileactions || []\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { FileAction } from './fileAction'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\nexport { FileAction, registerFileAction, getFileActions } from './fileAction'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu | undefined;\n\t\t_nc_fileactions: FileAction[] | undefined;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;AAKG;AACG,SAAU,cAAc,CAAC,IAAmB,EAAE,cAA0B,GAAA,KAAK,EAAE,cAAA,GAA0B,KAAK,EAAA;AAEnH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACnB,KAAA;AAED;;;;;AAKE;;AAEF,I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