From f66b47bd92369aa3c289a8f08de98e7e2ba7b2b0 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Fri, 7 Apr 2017 16:49:43 +0200 Subject: Add file download button --- frontend/js/app.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'frontend/js/app.js') diff --git a/frontend/js/app.js b/frontend/js/app.js index befed24..bf9b534 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -135,6 +135,12 @@ function open(entry) { window.open(encode(path)); } +function download(entry) { + if (entry.isDirectory) return; + + window.open(encode('/api/files/' + sanitize(app.path + '/' + entry.filePath)) + '?access_token=' + localStorage.accessToken); +} + function up() { window.location.hash = sanitize(app.path.split('/').slice(0, -1).filter(function (p) { return !!p; }).join('/')); } @@ -329,6 +335,7 @@ var app = new Vue({ logout: logout, loadDirectory: loadDirectory, open: open, + download: download, up: up, upload: upload, delAsk: delAsk, -- cgit v1.2.3