summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-11 20:15:26 +0200
committerJoas Schilling <coding@schilljs.com>2022-10-11 20:15:26 +0200
commitcfbbace45060c70d80cc01c79595c983747c63c4 (patch)
treee3f43162f644f5a8c6522dd8c652117cf6925c3c /apps/files/js
parent8d05e180bc29dbe0d546fd46d16339ced60c4228 (diff)
downloadnextcloud-server-cfbbace45060c70d80cc01c79595c983747c63c4.tar.gz
nextcloud-server-cfbbace45060c70d80cc01c79595c983747c63c4.zip
Require a token for "Edit locally"
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 2761c3a62b2..7caed29baa3 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -2808,12 +2808,23 @@
},
openLocalClient: function(path) {
- var scheme = 'nc://';
- var command = 'open';
- var uid = OC.getCurrentUser().uid;
- var url = scheme + command + '/' + uid + '@' + window.location.host + OC.encodePath(path);
+ var link = OC.linkToOCS('apps/files/api/v1', 2) + 'openlocaleditor?format=json';
- window.location.href = url;
+ $.post(link, {
+ path
+ })
+ .success(function(result) {
+ var scheme = 'nc://';
+ var command = 'open';
+ var uid = OC.getCurrentUser().uid;
+ var url = scheme + command + '/' + uid + '@' + window.location.host + OC.encodePath(path);
+ url += '?token=' + result.ocs.data.token;
+
+ window.location.href = url;
+ })
+ .fail(function() {
+ OC.Notification.show(t('files', 'Failed to redirect to client'))
+ })
},
/**