This commit is contained in:
@@ -261,9 +261,23 @@ export default {
|
|||||||
return window.$gz.store.state.apiUrl + apiPath;
|
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
|
// attachment download URL
|
||||||
//
|
//
|
||||||
downloadUrl(fileId, ctype) {
|
attachmentDownloadUrl(fileId, ctype) {
|
||||||
//http://localhost:7575/api/v8/attachment/download/100?t=sssss
|
//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
|
//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
|
//in wiki but ignored by server
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ export default {
|
|||||||
ret.push({
|
ret.push({
|
||||||
id: o.id,
|
id: o.id,
|
||||||
concurrency: o.concurrency,
|
concurrency: o.concurrency,
|
||||||
url: window.$gz.api.downloadUrl(o.id, o.contentType),
|
url: window.$gz.api.attachmentDownloadUrl(o.id, o.contentType),
|
||||||
name: o.displayFileName,
|
name: o.displayFileName,
|
||||||
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||||
o.lastModified,
|
o.lastModified,
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ export default {
|
|||||||
}
|
}
|
||||||
//replace attachment urls with tokenized local urls
|
//replace attachment urls with tokenized local urls
|
||||||
let src = this.localVal.replace(/\[ATTACH:(.*)\]/g, function(match, p1) {
|
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 }));
|
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
|
//let them attach any file type to the wiki since it supports it anyway
|
||||||
ret.push({
|
ret.push({
|
||||||
id: o.id,
|
id: o.id,
|
||||||
url: window.$gz.api.downloadUrl(o.id, o.contentType),
|
url: window.$gz.api.attachmentDownloadUrl(o.id, o.contentType),
|
||||||
name: o.displayFileName
|
name: o.displayFileName
|
||||||
});
|
});
|
||||||
//}
|
//}
|
||||||
@@ -932,7 +932,7 @@ export default {
|
|||||||
//attachment?
|
//attachment?
|
||||||
if (url.includes("attachment/download/")) {
|
if (url.includes("attachment/download/")) {
|
||||||
//it's an attachment url so fixup accordingly
|
//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=");
|
isImageUrl = url.includes("&i=");
|
||||||
let m = url.match(/attachment\/download\/(.*)\?t=/);
|
let m = url.match(/attachment\/download\/(.*)\?t=/);
|
||||||
if (m.length > 1) {
|
if (m.length > 1) {
|
||||||
|
|||||||
@@ -4,9 +4,32 @@
|
|||||||
<v-form ref="form">
|
<v-form ref="form">
|
||||||
<v-row>
|
<v-row>
|
||||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
<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>
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||||
@@ -179,7 +202,22 @@ export default {
|
|||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
} else {
|
} 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) {
|
.catch(function handleGetBackupFileListError(error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user