增加安全图片域名功能,优化自定义壁纸API相关提示信息

This commit is contained in:
jxxghp
2025-05-15 09:59:51 +08:00
parent 17e19da3d8
commit ab3db66195
4 changed files with 80 additions and 13 deletions

View File

@@ -1075,8 +1075,12 @@ export default {
hour: 'hour',
customizeWallpaperApi: 'Customize Wallpaper Api',
customizeWallpaperApiHint:
'It will get the image file extension format images that are allowed in all the settings in the content returned by the API.',
'It will get the image file extension format images that are allowed in settings in the content returned by the API.',
customizeWallpaperApiRequired: 'Required field; please enter Wallpaper API',
securityImageDomains: 'Security Image Domains',
securityImageDomainsHint: 'Allowed image domains whitelist for caching, used to control trusted image sources',
noSecurityImageDomains: 'No security domains',
securityImageDomainAdd: 'Add domain, e.g.: image.tmdb.org',
},
site: {
siteSync: 'Site Synchronization',

View File

@@ -1064,9 +1064,13 @@ export default {
},
mb: 'MB',
hour: '小时',
customizeWallpaperApi: '自定义壁纸API',
customizeWallpaperApiHint: '会获取API返回内容中所有设置中允许的图片文件后缀格式图片',
customizeWallpaperApi: '自定义壁纸API地址',
customizeWallpaperApiHint: '会获取API返回内容中所有允许的安全域名地址的图片,需要同步设置安全域名地址',
customizeWallpaperApiRequired: '必填项请输入自定义壁纸API',
securityImageDomains: '安全图片域名',
securityImageDomainsHint: '允许缓存的图片域名白名单,用于控制可信任的图片来源',
noSecurityImageDomains: '暂无安全域名',
securityImageDomainAdd: '添加域名image.tmdb.org',
},
site: {
siteSync: '站点同步',

View File

@@ -1067,8 +1067,12 @@ export default {
mb: 'MB',
hour: '小時',
customizeWallpaperApi: '自定義壁紙API',
customizeWallpaperApiHint: '會獲取 API 返回內容中所有設置中允許的圖片文件後綴格式圖片',
customizeWallpaperApiHint: '會獲取 API 返回內容中所有安全設置中允許的圖片地址,需要設置安全域名白名單',
customizeWallpaperApiRequired: '必填項請輸出自定義壁紙API',
securityImageDomains: '安全圖片域名',
securityImageDomainsHint: '允許緩存的圖片域名白名單,用於控制可信任的圖片來源',
noSecurityImageDomains: '暫無安全域名',
securityImageDomainAdd: '添加域名image.tmdb.org',
},
site: {
siteSync: '站點同步',

View File

@@ -52,6 +52,7 @@ const SystemSettings = ref<any>({
DOH_ENABLE: false,
DOH_RESOLVERS: null,
DOH_DOMAINS: null,
SECURITY_IMAGE_DOMAINS: [],
// 日志
DEBUG: false,
LOG_LEVEL: 'INFO',
@@ -92,6 +93,29 @@ const tmdbLanguageItems = [
{ title: t('setting.system.tmdbLanguage.en'), value: 'en' },
]
// 日志等级
const logLevelItems = [
{ title: t('setting.system.logLevelItems.debug'), value: 'DEBUG' },
{ title: t('setting.system.logLevelItems.info'), value: 'INFO' },
{ title: t('setting.system.logLevelItems.warning'), value: 'WARNING' },
{ title: t('setting.system.logLevelItems.error'), value: 'ERROR' },
{ title: t('setting.system.logLevelItems.critical'), value: 'CRITICAL' },
]
// 安全域名添加变量
const newSecurityDomain = ref('')
// 添加安全域名
function addSecurityDomain() {
if (
newSecurityDomain.value &&
!SystemSettings.value.Advanced.SECURITY_IMAGE_DOMAINS.includes(newSecurityDomain.value)
) {
SystemSettings.value.Advanced.SECURITY_IMAGE_DOMAINS.push(newSecurityDomain.value)
newSecurityDomain.value = ''
}
}
// 调用API查询下载器设置
async function loadDownloaderSetting() {
try {
@@ -297,15 +321,6 @@ const pipProxyDisplay = computed({
},
})
// 日志等级
const logLevelItems = [
{ title: t('setting.system.logLevelItems.debug'), value: 'DEBUG' },
{ title: t('setting.system.logLevelItems.info'), value: 'INFO' },
{ title: t('setting.system.logLevelItems.warning'), value: 'WARNING' },
{ title: t('setting.system.logLevelItems.error'), value: 'ERROR' },
{ title: t('setting.system.logLevelItems.critical'), value: 'CRITICAL' },
]
// 创建随机字符串
function createRandomString() {
const charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'
@@ -832,6 +847,46 @@ onDeactivated(() => {
/>
</VCol>
</VRow>
<VRow>
<VCol cols="12">
<!-- 安全域名 -->
<VCard>
<VCardItem>
<VCardTitle>{{ t('setting.system.securityImageDomains') }}</VCardTitle>
<VCardSubtitle>{{ t('setting.system.securityImageDomainsHint') }}</VCardSubtitle>
</VCardItem>
<VCardText>
<div class="d-flex flex-wrap gap-2 mb-3">
<VChip
v-for="(domain, index) in SystemSettings.Advanced.SECURITY_IMAGE_DOMAINS"
:key="index"
closable
@click:close="SystemSettings.Advanced.SECURITY_IMAGE_DOMAINS.splice(index, 1)"
>
{{ domain }}
</VChip>
<VChip v-if="SystemSettings.Advanced.SECURITY_IMAGE_DOMAINS.length === 0" color="warning">
{{ t('setting.system.noSecurityImageDomains') }}
</VChip>
</div>
<div class="d-flex align-center gap-2">
<VTextField
v-model="newSecurityDomain"
:placeholder="t('setting.system.securityImageDomainAdd')"
hide-details
density="compact"
>
<template #append>
<VBtn icon color="primary" @click="addSecurityDomain" :disabled="!newSecurityDomain">
<VIcon icon="mdi-plus" />
</VBtn>
</template>
</VTextField>
</div>
</VCardText>
</VCard>
</VCol>
</VRow>
</div>
</VWindowItem>
<VWindowItem value="log">