Skip to content

Commit b1eaea9

Browse files
committed
Change do not check file is shared #14
1 parent 76fff24 commit b1eaea9

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<description>
88
<![CDATA[Files sharing use file stored path. Now you cau use nextcloud as your CDN origin.
99
What you need to do is just share your files, then click Open Sharing Path to access from files dropdown actions menu. ]]></description>
10-
<version>0.2.1</version>
10+
<version>0.2.2</version>
1111
<licence>agpl</licence>
1212
<author mail="[email protected]">Rookie0</author>
1313
<namespace>SharingPath</namespace>

js/script.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
$(document).ready(function () {
22
OCA.Files.fileActions.registerAction({
33
name: 'copy-sharing-path',
4-
displayName: ['zh-CN', 'zh-HK', 'zh-TW', 'ja', 'ko'].includes(OC.getLanguage()) ? (t('files', 'Copy') + t('files_sharing', 'Sharing') + t('files', 'Path')) : (t('files', 'Copy') + ' ' + t('files_sharing', 'Sharing') + ' ' + t('files', 'Path')),
4+
displayName: ['zh-CN', 'zh-HK', 'zh-TW', 'ja', 'ko'].includes(OC.getLanguage()) ?
5+
(t('files', 'Copy') + t('files_sharing', 'Sharing') + t('files', 'Path')) :
6+
(t('files', 'Copy') + ' ' + t('files_sharing', 'Sharing') + ' ' + t('files', 'Path')),
57
mime: 'file',
68
permissions: OC.PERMISSION_READ,
79
iconClass: 'icon-public',
810
actionHandler: function (filename, context) {
9-
if (context.$file.data('shareTypes') !== OC.Share.SHARE_TYPE_LINK) {
10-
OC.dialogs.info(t('files_sharing', 'No shared links'), t('gallery', 'Warning'));
11-
return;
12-
}
11+
// Do not check file or parent folder is shared
12+
// if (context.fileInfoModel.attributes.shareTypes.indexOf(OC.Share.SHARE_TYPE_LINK) < 0) {
13+
// OC.dialogs.info(t('files_sharing', 'No shared links'), t('gallery', 'Warning'));
14+
// return;
15+
// }
1316

14-
var path = OC.getProtocol() + '://' + OC.getHost() + OC.generateUrl('/apps/sharingpath/' + OC.getCurrentUser().uid + (context.dir === '/' ? '' : context.dir) + '/' + filename);
17+
let path = OC.getProtocol() + '://' + OC.getHost() + OC.generateUrl('/apps/sharingpath/' +
18+
OC.getCurrentUser().uid + (context.dir === '/' ? '' : context.dir) + '/' + filename);
1519

16-
var dummyPath = document.createElement('textarea');
20+
let dummyPath = document.createElement('textarea');
1721
dummyPath.value = path;
1822
dummyPath.setAttribute('readonly', '');
1923
dummyPath.style.position = 'absolute';
2024
dummyPath.style.left = '-9999px';
2125
document.body.appendChild(dummyPath);
2226
const selected =
23-
document.getSelection().rangeCount > 0 // Check if there is any content selected previously
24-
? document.getSelection().getRangeAt(0) // Store selection if found
25-
: false;
27+
document.getSelection().rangeCount > 0 // Check if there is any content selected previously
28+
? document.getSelection().getRangeAt(0) // Store selection if found
29+
: false;
2630

2731
dummyPath.select();
2832
document.execCommand("copy");
@@ -33,5 +37,4 @@ $(document).ready(function () {
3337
}
3438
}
3539
});
36-
3740
});

0 commit comments

Comments
 (0)