Files
cloud-mail/mail-vue/src/utils/convert.js
eoao 88a4b9dff5 KV存储改为默认开启
保存

保存
2026-01-01 15:11:41 +08:00

46 lines
793 B
JavaScript

import {useSettingStore} from "@/store/setting.js";
export function cvtR2Url(key) {
if (!key) {
return + 'https://' + ''
}
if (key.startsWith('https://')) {
return key
}
const { settings } = useSettingStore();
let domain = settings.r2Domain
if (!domain) {
return key;
}
if (!domain.startsWith('http')) {
return 'https://' + domain + '/' + key
}
if (domain.endsWith("/")) {
domain = domain.slice(0, -1);
}
return domain + '/' + key
}
export function toOssDomain(domain) {
if (!domain) {
return ''
}
if (!domain.startsWith('http')) {
return 'https://' + domain
}
if (domain.endsWith("/")) {
domain = domain.slice(0, -1);
}
return domain
}