From 5ae14aa7d3fb5246940d18e0c68447a14f743e6d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 22 May 2020 14:48:43 +0000 Subject: [PATCH] --- ayanova/src/api/gzapi.js | 16 ++++++- ayanova/src/components/attachment-control.vue | 2 +- ayanova/src/components/wiki-control.vue | 6 +-- ayanova/src/views/ops-backup.vue | 44 +++++++++++++++++-- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index a9476847..5e0acb68 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -261,9 +261,23 @@ export default { return window.$gz.store.state.apiUrl + apiPath; }, ///////////////////////////// + // backup file download URL + // + backupDownloadUrl(fileName) { + //http://localhost:7575/api/v8/backup/download/100?t=sssss + + let url = + "attachment/download/" + + fileName + + "?t=" + + window.$gz.store.state.downloadToken; + + return this.APIUrl(url); + }, + ///////////////////////////// // attachment download URL // - downloadUrl(fileId, ctype) { + attachmentDownloadUrl(fileId, ctype) { //http://localhost:7575/api/v8/attachment/download/100?t=sssss //Ctype is optional and is the MIME content type, used to detect image urls at client for drag and drop ops //in wiki but ignored by server diff --git a/ayanova/src/components/attachment-control.vue b/ayanova/src/components/attachment-control.vue index 4fd8292e..31725984 100644 --- a/ayanova/src/components/attachment-control.vue +++ b/ayanova/src/components/attachment-control.vue @@ -278,7 +278,7 @@ export default { ret.push({ id: o.id, concurrency: o.concurrency, - url: window.$gz.api.downloadUrl(o.id, o.contentType), + url: window.$gz.api.attachmentDownloadUrl(o.id, o.contentType), name: o.displayFileName, date: window.$gz.locale.utcDateToShortDateAndTimeLocalized( o.lastModified, diff --git a/ayanova/src/components/wiki-control.vue b/ayanova/src/components/wiki-control.vue index 9a9e2d25..91b9d4f7 100644 --- a/ayanova/src/components/wiki-control.vue +++ b/ayanova/src/components/wiki-control.vue @@ -400,7 +400,7 @@ export default { } //replace attachment urls with tokenized local urls let src = this.localVal.replace(/\[ATTACH:(.*)\]/g, function(match, p1) { - return window.$gz.api.downloadUrl(p1); + return window.$gz.api.attachmentDownloadUrl(p1); }); return DOMPurify.sanitize(marked(src, { breaks: true })); @@ -881,7 +881,7 @@ export default { //let them attach any file type to the wiki since it supports it anyway ret.push({ id: o.id, - url: window.$gz.api.downloadUrl(o.id, o.contentType), + url: window.$gz.api.attachmentDownloadUrl(o.id, o.contentType), name: o.displayFileName }); //} @@ -932,7 +932,7 @@ export default { //attachment? if (url.includes("attachment/download/")) { //it's an attachment url so fixup accordingly - //i paramter added by gzapi::downloadUrl function + //i paramter added by gzapi::attachmentDownloadUrl function isImageUrl = url.includes("&i="); let m = url.match(/attachment\/download\/(.*)\?t=/); if (m.length > 1) { diff --git a/ayanova/src/views/ops-backup.vue b/ayanova/src/views/ops-backup.vue index dda33baf..3b8cd755 100644 --- a/ayanova/src/views/ops-backup.vue +++ b/ayanova/src/views/ops-backup.vue @@ -4,9 +4,32 @@ - - {{ obj.lastBackup }} {{ backupFileList }} +
+ +
+
@@ -179,7 +202,22 @@ export default { vm.formState.serverError = res.error; window.$gz.form.setErrorBoxErrors(vm); } else { - vm.backupFileList = res.data; + //process add url dl token and id + if (res.data) { + let ret = []; + for (let i = 0; i < res.data.length; i++) { + let o = res.data[i]; + ret.push({ + id: i, + concurrency: o.concurrency, + url: window.$gz.api.backupDownloadUrl(o), + name: o + }); + } + vm.backupFileList = ret; + } else { + vm.backupFileList = []; + } } }) .catch(function handleGetBackupFileListError(error) {