summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-11 20:15:26 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-10-12 17:52:13 +0000
commit1d02efdd8b04f1a821ce824d293b0a2e47b3bf37 (patch)
treefbc8d4c35242f68123ace72721fa5bba86f332ab /apps/files/js
parent8e89c281a57f8d3f011b89d8ebacc188c905dd39 (diff)
downloadnextcloud-server-1d02efdd8b04f1a821ce824d293b0a2e47b3bf37.tar.gz
nextcloud-server-1d02efdd8b04f1a821ce824d293b0a2e47b3bf37.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'))
+ })
},
/**