This commit is contained in:
2020-05-22 14:48:43 +00:00
parent bb9e2cd107
commit 5ae14aa7d3
4 changed files with 60 additions and 8 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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) {

View File

@@ -4,9 +4,32 @@
<v-form ref="form">
<v-row>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-col cols="12" sm="6" lg="4" xl="3">
{{ obj.lastBackup }} {{ backupFileList }}
<div>
<ul>
<li v-for="item in backupFileList" :key="item.id">
<a :href="item.url" target="_blank">{{ item.name }}</a>
</li>
</ul>
</div>
<!-- <div>
<v-list color="grey lighten-5" three-line>
<v-list-item
v-for="item in backupFileList"
:key="item.id"
:href="item.url"
target="_blank"
>
<v-list-item-avatar>
<v-icon v-text="item.icon"></v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="item.name"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</div> -->
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
@@ -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) {