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