From 552d44bbd28eb66c05b450f112ce20bff463fe6f Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 17 May 2018 15:49:40 +0200 Subject: Make folder listing a global setting --- frontend/404.html | 19 +++++++++++++++++++ frontend/js/app.js | 10 +++++++++- frontend/welcome.html | 5 +++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 frontend/404.html (limited to 'frontend') diff --git a/frontend/404.html b/frontend/404.html new file mode 100644 index 0000000..21fd6b4 --- /dev/null +++ b/frontend/404.html @@ -0,0 +1,19 @@ + + + Surfer - File not found + + + + + + + +
+
+

Surfer

+

File not found

+
+
+ + + diff --git a/frontend/js/app.js b/frontend/js/app.js index 57b831e..e9d469b 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -211,7 +211,9 @@ var app = new Vue({ }, onOptionsMenu: function (command) { if (command === 'folderListing') { - console.log('Not implemented'); + superagent.put('/api/settings').send({ folderListingEnabled: this.folderListingEnabled }).query({ access_token: localStorage.accessToken }).end(function (error) { + if (error) console.error(error); + }); } else if (command === 'about') { this.$msgbox({ title: 'About Surfer', @@ -337,6 +339,12 @@ getProfile(localStorage.accessToken, function (error) { if (error) return console.error(error); loadDirectory(window.location.hash.slice(1)); + + superagent.get('/api/settings').query({ access_token: localStorage.accessToken }).end(function (error, result) { + if (error) console.error(error); + + app.folderListingEnabled = !!result.body.folderListingEnabled; + }); }); $(window).on('hashchange', function () { diff --git a/frontend/welcome.html b/frontend/welcome.html index d16dcef..ddc9c36 100644 --- a/frontend/welcome.html +++ b/frontend/welcome.html @@ -1,9 +1,10 @@ - Surfer + Surfer - Welcome - + + -- cgit v1.2.3