mirror of
https://github.com/eoao/cloud-mail.git
synced 2026-06-07 22:48:52 +08:00
修改版本和图片域名转换
This commit is contained in:
@@ -68,6 +68,7 @@ import {useEmailStore} from "@/store/email.js";
|
||||
import {fileToBase64, formatBytes} from "@/utils/file-utils.js";
|
||||
import {getIconByName} from "@/utils/icon-utils.js";
|
||||
import sendPercent from "@/components/send-percent/index.vue"
|
||||
import {toOssDomain} from "@/utils/convert.js";
|
||||
import {formatDetailDate} from "@/utils/day.js";
|
||||
import {useSettingStore} from "@/store/setting.js";
|
||||
import {userDraftStore} from "@/store/draft.js";
|
||||
@@ -336,7 +337,7 @@ function openReply(email) {
|
||||
function formatImage(content) {
|
||||
content = content || '';
|
||||
const domain = settingStore.settings.r2Domain;
|
||||
return content.replace(/{{domain}}/g, domain + '/');
|
||||
return content.replace(/{{domain}}/g, toOssDomain(domain) + '/');
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
@@ -84,6 +84,7 @@ NProgress.configure({
|
||||
});
|
||||
|
||||
let timer
|
||||
let first = true
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
@@ -91,10 +92,9 @@ router.beforeEach((to, from, next) => {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
|
||||
// 延迟 50ms 才启动进度条
|
||||
timer = setTimeout(() => {
|
||||
NProgress.start()
|
||||
}, 100)
|
||||
}, first ? 200 : 100)
|
||||
|
||||
const token = localStorage.getItem('token')
|
||||
|
||||
@@ -118,19 +118,28 @@ router.beforeEach((to, from, next) => {
|
||||
function loadBackground(next) {
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
const src = cvtR2Url(settingStore.settings.background);
|
||||
|
||||
const img = new Image();
|
||||
img.src = src;
|
||||
if (settingStore.settings.background) {
|
||||
|
||||
img.onload = () => {
|
||||
const src = cvtR2Url(settingStore.settings.background);
|
||||
|
||||
const img = new Image();
|
||||
img.src = src;
|
||||
|
||||
img.onload = () => {
|
||||
next()
|
||||
};
|
||||
|
||||
img.onerror = () => {
|
||||
console.warn("背景图片加载失败:", img.src);
|
||||
next()
|
||||
};
|
||||
|
||||
} else {
|
||||
next()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
img.onerror = () => {
|
||||
console.warn("背景图片加载失败:", img.src);
|
||||
next()
|
||||
};
|
||||
}
|
||||
|
||||
router.afterEach((to) => {
|
||||
@@ -151,6 +160,7 @@ router.afterEach((to) => {
|
||||
uiStore.asideShow = false
|
||||
}
|
||||
|
||||
first = false
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
@@ -671,7 +671,7 @@ defineOptions({
|
||||
name: 'sys-setting'
|
||||
})
|
||||
|
||||
const currentVersion = 'v1.9.0'
|
||||
const currentVersion = 'v2.0.0'
|
||||
const hasUpdate = ref(false)
|
||||
let getUpdateErrorCount = 1;
|
||||
const {t, locale} = useI18n();
|
||||
|
||||
@@ -33,7 +33,6 @@ export default defineConfig(({mode}) => {
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
navigateFallbackDenylist: [/^\/api\/init/],
|
||||
disableDevLogs: true,
|
||||
globPatterns: [],
|
||||
runtimeCaching: [],
|
||||
|
||||
@@ -264,7 +264,7 @@ const init = {
|
||||
`ALTER TABLE setting ADD COLUMN site_key TEXT;`,
|
||||
`ALTER TABLE setting ADD COLUMN secret_key TEXT;`,
|
||||
`ALTER TABLE setting ADD COLUMN background TEXT;`,
|
||||
`ALTER TABLE setting ADD COLUMN login_opacity INTEGER NOT NULL DEFAULT 0.80;`,
|
||||
`ALTER TABLE setting ADD COLUMN login_opacity INTEGER NOT NULL DEFAULT 0.88;`,
|
||||
|
||||
`ALTER TABLE user ADD COLUMN create_ip TEXT;`,
|
||||
`ALTER TABLE user ADD COLUMN active_ip TEXT;`,
|
||||
|
||||
@@ -22,7 +22,7 @@ const attService = {
|
||||
metadate.contentDisposition = `attachment; filename="${attachment.filename}"`
|
||||
} else {
|
||||
metadate.contentDisposition = `inline; filename="${attachment.filename}"`
|
||||
metadate.cacheControl = `max-age=604800`
|
||||
metadate.cacheControl = `max-age=259200`
|
||||
}
|
||||
|
||||
await r2Service.putObj(c, attachment.key, attachment.content, metadate);
|
||||
@@ -119,7 +119,7 @@ const attService = {
|
||||
attData.type = attConst.type.EMBED;
|
||||
await r2Service.putObj(c, attData.key, attData.buff, {
|
||||
contentType: attData.mimeType,
|
||||
cacheControl: `max-age=604800`,
|
||||
cacheControl: `max-age=259200`,
|
||||
contentDisposition: `inline; filename="${attData.filename}"`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,17 +8,16 @@ enabled = true
|
||||
|
||||
#[[d1_databases]]
|
||||
#binding = "db" #d1数据库绑定名默认不可修改
|
||||
#database_name = "email" #d1数据库名字
|
||||
#database_id = "b1b1a63a-6ef5-4e6d-8e8c-b6d9e8feb810" #d1数据库id
|
||||
#
|
||||
#database_name = "" #d1数据库名字
|
||||
#database_id = "" #d1数据库id
|
||||
|
||||
#[[kv_namespaces]]
|
||||
#binding = "kv" #kv绑定名默认不可修改
|
||||
#id = "0fa01d4b299e481b9de060ece9e7785c" #kv数据库id
|
||||
#id = "" #kv数据库id
|
||||
|
||||
##(可选)
|
||||
#[[r2_buckets]]
|
||||
#binding = "r2" #r2对象存储绑定名默认不可修改
|
||||
#bucket_name = "email" #r2对象存储桶的名字
|
||||
#bucket_name = "" #r2对象存储桶的名字
|
||||
|
||||
[assets]
|
||||
binding = "assets" #静态资源绑定名默认不可修改
|
||||
|
||||
Reference in New Issue
Block a user