build(release): 加固 v0.1.0 桌面发布链路

This commit is contained in:
Cheng Zhou
2026-07-17 09:23:23 +08:00
parent 1837ceff58
commit 9fd80cab50
16 changed files with 895 additions and 323 deletions
@@ -381,7 +381,7 @@ import StateLoading from "../../components/StateLoading.vue";
import { onDesktopRefreshCurrentView } from "../../composables/useDesktopRefresh";
import { openFileWithFeedback, pickFilesWithFeedback, saveFileWithFeedback } from "../../utils/fileTaskFeedback";
import { getApiErrorMessage } from "../../utils/apiErrorMessage";
import { getContentDispositionFilename } from "../../utils/contentDisposition";
import { getContentDispositionFilename, getHttpHeaderString } from "../../utils/contentDisposition";
import { prepareSaveFile } from "../../runtime";
import { detectFilePreviewKind, ONLYOFFICE_FILE_EXTENSIONS } from "../../utils/officePreview";
@@ -803,7 +803,8 @@ const previewVersion = async (version: DocumentVersion) => {
previewLoading.value = true;
try {
const response = await downloadDocumentVersion(version.id);
const contentType = response.headers?.["content-type"] || version.mime_type || "application/octet-stream";
const contentType =
getHttpHeaderString(response.headers?.["content-type"]) || version.mime_type || "application/octet-stream";
const blob = new Blob([response.data], { type: contentType });
previewObjectUrl.value = URL.createObjectURL(blob);
previewUrl.value = previewObjectUrl.value;
@@ -823,8 +824,9 @@ const downloadVersion = async (version: DocumentVersion) => {
return;
}
const response = await downloadDocumentVersion(version.id);
const contentType = response.headers?.["content-type"] || "application/octet-stream";
const filename = getContentDispositionFilename(response.headers?.["content-disposition"]) || suggestedName;
const contentType = getHttpHeaderString(response.headers?.["content-type"]) || "application/octet-stream";
const filename =
getContentDispositionFilename(getHttpHeaderString(response.headers?.["content-disposition"])) || suggestedName;
const blob = new Blob([response.data], { type: contentType });
await saveFileWithFeedback({ suggestedName: filename, mimeType: contentType, data: blob }, {}, destination);
} catch (e: any) { ElMessage.error(await getApiErrorMessage(e, TEXT.common.messages.downloadFailed)); }
@@ -840,10 +842,11 @@ const openVersion = async (version: DocumentVersion) => {
}
try {
const contentType = response.headers?.["content-type"] || "application/octet-stream";
const filename = getContentDispositionFilename(response.headers?.["content-disposition"])
|| getVersionFileName(version)
|| `document-${version.version_no || version.id}.bin`;
const contentType = getHttpHeaderString(response.headers?.["content-type"]) || "application/octet-stream";
const filename =
getContentDispositionFilename(getHttpHeaderString(response.headers?.["content-disposition"])) ||
getVersionFileName(version) ||
`document-${version.version_no || version.id}.bin`;
await openFileWithFeedback({
suggestedName: filename,
mimeType: contentType,