@nextcloud/files 2.1.0 → 3.0.0-beta.3
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/LICENSE +68 -81
- package/README.md +1 -1
- package/dist/humanfilesize.d.ts +29 -1
- package/dist/index.d.ts +44 -0
- package/dist/index.esm.js +224 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +235 -14
- package/dist/index.js.map +1 -1
- package/dist/newFileMenu.d.ts +52 -0
- package/dist/utils/logger.d.ts +23 -0
- package/package.json +59 -27
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/dependabot-approve-merge.yml +0 -29
- package/.travis.yml +0 -19
- package/CHANGELOG.md +0 -23
- package/babel.config.js +0 -15
- package/dist/doc/.nojekyll +0 -0
- package/dist/doc/assets/css/main.css +0 -2328
- package/dist/doc/assets/images/icons.png +0 -0
- package/dist/doc/assets/images/icons@2x.png +0 -0
- package/dist/doc/assets/images/widgets.png +0 -0
- package/dist/doc/assets/images/widgets@2x.png +0 -0
- package/dist/doc/assets/js/main.js +0 -1
- package/dist/doc/assets/js/search.js +0 -3
- package/dist/doc/globals.html +0 -169
- package/dist/doc/index.html +0 -161
- package/dist/doc/modules/_humanfilesize_.html +0 -239
- package/dist/doc/modules/_index_.html +0 -158
- package/dist/filepicker.d.ts +0 -33
- package/dist/filepicker.js +0 -70
- package/dist/filepicker.js.map +0 -1
- package/dist/humanfilesize.js +0 -41
- package/dist/humanfilesize.js.map +0 -1
- package/lib/humanfilesize.ts +0 -28
- package/lib/index.ts +0 -1
- package/test/humanFileSize.test.js +0 -65
- package/tsconfig.json +0 -14
package/LICENSE
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
GNU GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 3,
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
3
|
|
|
4
4
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
5
|
Everyone is permitted to copy and distribute verbatim copies
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
Preamble
|
|
9
9
|
|
|
10
|
-
The GNU General Public License is a free, copyleft license for
|
|
11
|
-
software and other kinds of works
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
12
13
|
|
|
13
14
|
The licenses for most software and other practical works are designed
|
|
14
15
|
to take away your freedom to share and change the works. By contrast,
|
|
15
|
-
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
16
17
|
share and change all versions of a program--to make sure it remains free
|
|
17
|
-
software for all its users.
|
|
18
|
-
GNU General Public License for most of our software; it applies also to
|
|
19
|
-
any other work released this way by its authors. You can apply it to
|
|
20
|
-
your programs, too.
|
|
18
|
+
software for all its users.
|
|
21
19
|
|
|
22
20
|
When we speak of free software, we are referring to freedom, not
|
|
23
21
|
price. Our General Public Licenses are designed to make sure that you
|
|
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
|
|
26
24
|
want it, that you can change the software or use pieces of it in new
|
|
27
25
|
free programs, and that you know you can do these things.
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
that
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
products. If such problems arise substantially in other domains, we
|
|
58
|
-
stand ready to extend this provision to those domains in future versions
|
|
59
|
-
of the GPL, as needed to protect the freedom of users.
|
|
60
|
-
|
|
61
|
-
Finally, every program is threatened constantly by software patents.
|
|
62
|
-
States should not allow patents to restrict development and use of
|
|
63
|
-
software on general-purpose computers, but in those that do, we wish to
|
|
64
|
-
avoid the special danger that patents applied to a free program could
|
|
65
|
-
make it effectively proprietary. To prevent this, the GPL assures that
|
|
66
|
-
patents cannot be used to render the program non-free.
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
67
55
|
|
|
68
56
|
The precise terms and conditions for copying, distribution and
|
|
69
57
|
modification follow.
|
|
@@ -72,7 +60,7 @@ modification follow.
|
|
|
72
60
|
|
|
73
61
|
0. Definitions.
|
|
74
62
|
|
|
75
|
-
"This License" refers to version 3 of the GNU General Public License.
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
76
64
|
|
|
77
65
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
78
66
|
works, such as semiconductor masks.
|
|
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
|
|
549
537
|
the Program, the only way you could satisfy both those terms and this
|
|
550
538
|
License would be to refrain entirely from conveying the Program.
|
|
551
539
|
|
|
552
|
-
13. Use with the GNU
|
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
541
|
+
|
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
|
543
|
+
Program, your modified version must prominently offer all users
|
|
544
|
+
interacting with it remotely through a computer network (if your version
|
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
|
547
|
+
from a network server at no charge, through some standard or customary
|
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
|
551
|
+
following paragraph.
|
|
553
552
|
|
|
554
553
|
Notwithstanding any other provision of this License, you have
|
|
555
554
|
permission to link or combine any covered work with a work licensed
|
|
556
|
-
under version 3 of the GNU
|
|
555
|
+
under version 3 of the GNU General Public License into a single
|
|
557
556
|
combined work, and to convey the resulting work. The terms of this
|
|
558
557
|
License will continue to apply to the part which is the covered work,
|
|
559
|
-
but the
|
|
560
|
-
|
|
561
|
-
combination as such.
|
|
558
|
+
but the work with which it is combined will remain governed by version
|
|
559
|
+
3 of the GNU General Public License.
|
|
562
560
|
|
|
563
561
|
14. Revised Versions of this License.
|
|
564
562
|
|
|
565
563
|
The Free Software Foundation may publish revised and/or new versions of
|
|
566
|
-
the GNU General Public License from time to time. Such new versions
|
|
567
|
-
be similar in spirit to the present version, but may differ in detail to
|
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
|
568
566
|
address new problems or concerns.
|
|
569
567
|
|
|
570
568
|
Each version is given a distinguishing version number. If the
|
|
571
|
-
Program specifies that a certain numbered version of the GNU General
|
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
|
572
570
|
Public License "or any later version" applies to it, you have the
|
|
573
571
|
option of following the terms and conditions either of that numbered
|
|
574
572
|
version or of any later version published by the Free Software
|
|
575
573
|
Foundation. If the Program does not specify a version number of the
|
|
576
|
-
GNU General Public License, you may choose any version ever published
|
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
|
577
575
|
by the Free Software Foundation.
|
|
578
576
|
|
|
579
577
|
If the Program specifies that a proxy can decide which future
|
|
580
|
-
versions of the GNU General Public License can be used, that proxy's
|
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
|
581
579
|
public statement of acceptance of a version permanently authorizes you
|
|
582
580
|
to choose that version for the Program.
|
|
583
581
|
|
|
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
|
|
635
633
|
Copyright (C) <year> <name of author>
|
|
636
634
|
|
|
637
635
|
This program is free software: you can redistribute it and/or modify
|
|
638
|
-
it under the terms of the GNU General Public License as published
|
|
639
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
636
|
+
it under the terms of the GNU Affero General Public License as published
|
|
637
|
+
by the Free Software Foundation, either version 3 of the License, or
|
|
640
638
|
(at your option) any later version.
|
|
641
639
|
|
|
642
640
|
This program is distributed in the hope that it will be useful,
|
|
643
641
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
644
642
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
645
|
-
GNU General Public License for more details.
|
|
643
|
+
GNU Affero General Public License for more details.
|
|
646
644
|
|
|
647
|
-
You should have received a copy of the GNU General Public License
|
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
|
648
646
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
649
647
|
|
|
650
648
|
Also add information on how to contact you by electronic and paper mail.
|
|
651
649
|
|
|
652
|
-
If
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
661
|
-
parts of the General Public License. Of course, your program's commands
|
|
662
|
-
might be different; for a GUI interface, you would use an "about box".
|
|
650
|
+
If your software can interact with users remotely through a computer
|
|
651
|
+
network, you should also make sure that it provides a way for users to
|
|
652
|
+
get its source. For example, if your program is a web application, its
|
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
|
654
|
+
of the code. There are many ways you could offer source, and different
|
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
|
656
|
+
specific requirements.
|
|
663
657
|
|
|
664
658
|
You should also get your employer (if you work as a programmer) or school,
|
|
665
659
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
666
|
-
For more information on this, and how to apply and follow the GNU
|
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
667
661
|
<https://www.gnu.org/licenses/>.
|
|
668
|
-
|
|
669
|
-
The GNU General Public License does not permit incorporating your program
|
|
670
|
-
into proprietary programs. If your program is a subroutine library, you
|
|
671
|
-
may consider it more useful to permit linking proprietary applications with
|
|
672
|
-
the library. If this is what you want to do, use the GNU Lesser General
|
|
673
|
-
Public License instead of this License. But first, please read
|
|
674
|
-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @nextcloud/files
|
|
1
|
+
# @nextcloud/files [](https://www.npmjs.com/package/@nextcloud/files) 
|
|
2
2
|
|
|
3
3
|
Nextcloud Files helpers for Nextcloud apps and libraries
|
package/dist/humanfilesize.d.ts
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
3
|
+
*
|
|
4
|
+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
5
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
6
|
+
*
|
|
7
|
+
* @license AGPL-3.0-or-later
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU Affero General Public License as
|
|
11
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
12
|
+
* License, or (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU Affero General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Format a file size in a human-like format. e.g. 42GB
|
|
25
|
+
*
|
|
26
|
+
* @param size in bytes
|
|
27
|
+
* @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatFileSize(size: number | string, skipSmallSizes?: boolean): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
3
|
+
*
|
|
4
|
+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
5
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
6
|
+
*
|
|
7
|
+
* @license AGPL-3.0-or-later
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU Affero General Public License as
|
|
11
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
12
|
+
* License, or (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU Affero General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
1
23
|
export { formatFileSize } from './humanfilesize';
|
|
24
|
+
export { type Entry } from './newFileMenu';
|
|
25
|
+
import { type Entry, NewFileMenu } from './newFileMenu';
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
OC: any;
|
|
29
|
+
_nc_newfilemenu: NewFileMenu;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Add a new menu entry to the upload manager menu
|
|
34
|
+
*/
|
|
35
|
+
export declare const addNewFileMenuEntry: (entry: Entry) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove a previously registered entry from the upload menu
|
|
38
|
+
*/
|
|
39
|
+
export declare const removeNewFileMenuEntry: (entry: Entry | string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Get the list of registered entries from the upload menu
|
|
42
|
+
*
|
|
43
|
+
* @param {FileInfo} context the creation context. Usually the current folder FileInfo
|
|
44
|
+
*/
|
|
45
|
+
export declare const getNewFileMenuEntries: (context?: Object) => Entry[];
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { getCanonicalLocale } from '@nextcloud/l10n';
|
|
2
|
+
import { getCurrentUser } from '@nextcloud/auth';
|
|
3
|
+
import { getLoggerBuilder } from '@nextcloud/logger';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
7
|
+
*
|
|
8
|
+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
9
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
10
|
+
*
|
|
11
|
+
* @license AGPL-3.0-or-later
|
|
12
|
+
*
|
|
13
|
+
* This program is free software: you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU Affero General Public License as
|
|
15
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
16
|
+
* License, or (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU Affero General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
24
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
const humanList = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
28
|
+
/**
|
|
29
|
+
* Format a file size in a human-like format. e.g. 42GB
|
|
30
|
+
*
|
|
31
|
+
* @param size in bytes
|
|
32
|
+
* @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead
|
|
33
|
+
*/
|
|
34
|
+
function formatFileSize(size, skipSmallSizes = false) {
|
|
35
|
+
if (typeof size === 'string') {
|
|
36
|
+
size = Number(size);
|
|
37
|
+
}
|
|
38
|
+
// Calculate Log with base 1024: size = 1024 ** order
|
|
39
|
+
let order = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;
|
|
40
|
+
// Stay in range of the byte sizes that are defined
|
|
41
|
+
order = Math.min(humanList.length - 1, order);
|
|
42
|
+
const readableFormat = humanList[order];
|
|
43
|
+
let relativeSize = (size / Math.pow(1024, order)).toFixed(1);
|
|
44
|
+
if (skipSmallSizes === true && order === 0) {
|
|
45
|
+
if (relativeSize !== '0.0') {
|
|
46
|
+
return '< 1 KB';
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return '0 KB';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (order < 2) {
|
|
53
|
+
relativeSize = parseFloat(relativeSize).toFixed(0);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
relativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());
|
|
57
|
+
}
|
|
58
|
+
return relativeSize + ' ' + readableFormat;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
63
|
+
*
|
|
64
|
+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
65
|
+
*
|
|
66
|
+
* @license AGPL-3.0-or-later
|
|
67
|
+
*
|
|
68
|
+
* This program is free software: you can redistribute it and/or modify
|
|
69
|
+
* it under the terms of the GNU Affero General Public License as
|
|
70
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
71
|
+
* License, or (at your option) any later version.
|
|
72
|
+
*
|
|
73
|
+
* This program is distributed in the hope that it will be useful,
|
|
74
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
75
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
76
|
+
* GNU Affero General Public License for more details.
|
|
77
|
+
*
|
|
78
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
79
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
const getLogger = user => {
|
|
83
|
+
if (user === null) {
|
|
84
|
+
return getLoggerBuilder()
|
|
85
|
+
.setApp('files')
|
|
86
|
+
.build();
|
|
87
|
+
}
|
|
88
|
+
return getLoggerBuilder()
|
|
89
|
+
.setApp('files')
|
|
90
|
+
.setUid(user.uid)
|
|
91
|
+
.build();
|
|
92
|
+
};
|
|
93
|
+
var logger = getLogger(getCurrentUser());
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
97
|
+
*
|
|
98
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
99
|
+
*
|
|
100
|
+
* @license AGPL-3.0-or-later
|
|
101
|
+
*
|
|
102
|
+
* This program is free software: you can redistribute it and/or modify
|
|
103
|
+
* it under the terms of the GNU Affero General Public License as
|
|
104
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
105
|
+
* License, or (at your option) any later version.
|
|
106
|
+
*
|
|
107
|
+
* This program is distributed in the hope that it will be useful,
|
|
108
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
109
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
110
|
+
* GNU Affero General Public License for more details.
|
|
111
|
+
*
|
|
112
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
113
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
class NewFileMenu {
|
|
117
|
+
_entries = [];
|
|
118
|
+
registerEntry(entry) {
|
|
119
|
+
this.validateEntry(entry);
|
|
120
|
+
this._entries.push(entry);
|
|
121
|
+
}
|
|
122
|
+
unregisterEntry(entry) {
|
|
123
|
+
const entryIndex = typeof entry === 'string'
|
|
124
|
+
? this.getEntryIndex(entry)
|
|
125
|
+
: this.getEntryIndex(entry.id);
|
|
126
|
+
if (entryIndex === -1) {
|
|
127
|
+
logger.warn('Entry not found, nothing removed', { entry, entries: this.getEntries() });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this._entries.splice(entryIndex, 1);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get the list of registered entries
|
|
134
|
+
*
|
|
135
|
+
* @param {FileInfo} context the creation context. Usually the current folder FileInfo
|
|
136
|
+
*/
|
|
137
|
+
getEntries(context) {
|
|
138
|
+
if (context) {
|
|
139
|
+
return this._entries
|
|
140
|
+
.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true);
|
|
141
|
+
}
|
|
142
|
+
return this._entries;
|
|
143
|
+
}
|
|
144
|
+
getEntryIndex(id) {
|
|
145
|
+
return this._entries.findIndex(entry => entry.id === id);
|
|
146
|
+
}
|
|
147
|
+
validateEntry(entry) {
|
|
148
|
+
if (!entry.id || !entry.displayName || !entry.templateName || !(entry.iconSvgInline || entry.iconClass) || !entry.handler) {
|
|
149
|
+
throw new Error('Invalid entry');
|
|
150
|
+
}
|
|
151
|
+
if (typeof entry.id !== 'string'
|
|
152
|
+
|| typeof entry.displayName !== 'string'
|
|
153
|
+
|| typeof entry.templateName !== 'string'
|
|
154
|
+
|| (entry.iconClass && typeof entry.iconClass !== 'string')
|
|
155
|
+
|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {
|
|
156
|
+
throw new Error('Invalid entry property');
|
|
157
|
+
}
|
|
158
|
+
if (entry.if !== undefined && typeof entry.if !== 'function') {
|
|
159
|
+
throw new Error('Invalid entry, if must be a valid function');
|
|
160
|
+
}
|
|
161
|
+
if (typeof entry.handler !== 'function') {
|
|
162
|
+
throw new Error('Invalid entry handler');
|
|
163
|
+
}
|
|
164
|
+
if (this.getEntryIndex(entry.id) !== -1) {
|
|
165
|
+
throw new Error('Duplicate entry');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const getNewFileMenu = function () {
|
|
170
|
+
if (typeof window._nc_newfilemenu === 'undefined') {
|
|
171
|
+
window._nc_newfilemenu = new NewFileMenu();
|
|
172
|
+
logger.debug('NewFileMenu initialized');
|
|
173
|
+
}
|
|
174
|
+
return window._nc_newfilemenu;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
179
|
+
*
|
|
180
|
+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
181
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
182
|
+
*
|
|
183
|
+
* @license AGPL-3.0-or-later
|
|
184
|
+
*
|
|
185
|
+
* This program is free software: you can redistribute it and/or modify
|
|
186
|
+
* it under the terms of the GNU Affero General Public License as
|
|
187
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
188
|
+
* License, or (at your option) any later version.
|
|
189
|
+
*
|
|
190
|
+
* This program is distributed in the hope that it will be useful,
|
|
191
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
192
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
193
|
+
* GNU Affero General Public License for more details.
|
|
194
|
+
*
|
|
195
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
196
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
197
|
+
*
|
|
198
|
+
*/
|
|
199
|
+
/**
|
|
200
|
+
* Add a new menu entry to the upload manager menu
|
|
201
|
+
*/
|
|
202
|
+
const addNewFileMenuEntry = function (entry) {
|
|
203
|
+
const newFileMenu = getNewFileMenu();
|
|
204
|
+
return newFileMenu.registerEntry(entry);
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Remove a previously registered entry from the upload menu
|
|
208
|
+
*/
|
|
209
|
+
const removeNewFileMenuEntry = function (entry) {
|
|
210
|
+
const newFileMenu = getNewFileMenu();
|
|
211
|
+
return newFileMenu.unregisterEntry(entry);
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Get the list of registered entries from the upload menu
|
|
215
|
+
*
|
|
216
|
+
* @param {FileInfo} context the creation context. Usually the current folder FileInfo
|
|
217
|
+
*/
|
|
218
|
+
const getNewFileMenuEntries = function (context) {
|
|
219
|
+
const newFileMenu = getNewFileMenu();
|
|
220
|
+
return newFileMenu.getEntries(context);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export { addNewFileMenuEntry, formatFileSize, getNewFileMenuEntries, removeNewFileMenuEntry };
|
|
224
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.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'];\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): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t// Calculate Log with base 1024: size = 1024 ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min(humanList.length - 1, order);\n\tconst readableFormat = humanList[order];\n\tlet relativeSize = (size / Math.pow(1024, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\tif (relativeSize !== '0.0') {\n\t\t\treturn '< 1 KB';\n\t\t} else {\n\t\t\treturn '0 KB';\n\t\t}\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.templateName || !(entry.iconSvgInline || entry.iconClass) ||!entry.handler) {\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\t|| typeof entry.templateName !== 'string'\n\t\t\t|| (entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid entry property')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid entry, if must be a valid function')\n\t\t}\n\n\t\tif (typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid entry handler')\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 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\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":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEhD;;;;;AAKG;SACa,cAAc,CAAC,IAAmB,EAAE,iBAA0B,KAAK,EAAA;AAElF,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACnB,KAAA;;AAGD,IAAA,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;;AAEvE,IAAA,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9C,IAAA,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACxC,IAAA,IAAI,YAAY,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D,IAAA,IAAI,cAAc,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC,EAAE;QAC3C,IAAI,YAAY,KAAK,KAAK,EAAE;AAC3B,YAAA,OAAO,QAAQ,CAAC;AAChB,SAAA;AAAM,aAAA;AACN,YAAA,OAAO,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