+ initWithToken(result.body.accessToken);
+ });
+ },
+ onOptionsMenu: function (command) {
+ if (command === 'folderListing') {
+ 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',
+ message: 'Surfer is a static file server written by <a href="https://cloudron.io" target="_blank">Cloudron</a>.<br/><br/>The source code is licensed under MIT and available <a href="https://git.cloudron.io/cloudron/surfer" target="_blank">here</a>.',
+ dangerouslyUseHTMLString: true,
+ confirmButtonText: 'OK',
+ showCancelButton: false,
+ type: 'info',
+ center: true
+ }).then(function () {}).catch(function () {});
+ } else if (command === 'logout') {
+ logout();
+ } else if (command === 'apiAccess') {
+ this.accessTokensDialogVisible = true;
+ }
+ },
+ onDownload: function (entry) {
+ if (entry.isDirectory) return;
+ window.location.href = encode('/api/files/' + sanitize(this.path + '/' + entry.filePath)) + '?access_token=' + localStorage.accessToken;
+ },
+ onUpload: function () {
+ var that = this;