<th><span v-my-tooltip="foobar" data-toggle="tooltip" title="{{ entry.mtime }}">{{ entry.mtime | prettyDate }}</span></th>
<th style="text-align: right;">
<span class="entry-toolbar">
+ <button class="btn btn-sm btn-default" v-on:click.stop="download(entry)" title="Download" v-show="entry.isFile"><i class="fa fa-download"></i></button>
<button class="btn btn-sm btn-default" v-on:click.stop="renameAsk(entry)" title="Rename"><i class="fa fa-pencil"></i></button>
<button class="btn btn-sm btn-danger" v-on:click.stop="delAsk(entry)" title="Delete"><i class="fa fa-trash"></i></button>
</span>
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('/'));
}
logout: logout,
loadDirectory: loadDirectory,
open: open,
+ download: download,
up: up,
upload: upload,
delAsk: delAsk,
debug('get', absoluteFilePath);
if (!result.isDirectory() && !result.isFile()) return next(new HttpError(500, 'unsupported type'));
- if (result.isFile()) return res.sendFile(absoluteFilePath);
+ if (result.isFile()) return res.download(absoluteFilePath);
async.map(fs.readdirSync(absoluteFilePath), function (filePath, callback) {
fs.stat(path.join(absoluteFilePath, filePath), function (error, result) {