diff --git a/par-core/src/main/java/com/par/core/service/impl/SitePagesServiceImpl.java b/par-core/src/main/java/com/par/core/service/impl/SitePagesServiceImpl.java index 71e93d7..b6e8910 100644 --- a/par-core/src/main/java/com/par/core/service/impl/SitePagesServiceImpl.java +++ b/par-core/src/main/java/com/par/core/service/impl/SitePagesServiceImpl.java @@ -37,7 +37,6 @@ public class SitePagesServiceImpl implements SitePagesService { result.put("version", sp.getVersion()); result.put("entries", parsed.getOrDefault("entries", List.of())); if (parsed.containsKey("authType")) result.put("authType", parsed.get("authType")); - if (parsed.containsKey("authValue")) result.put("authValue", parsed.get("authValue")); result.put("updatedAt", sp.getUpdatedAt()); return result; } catch (Exception e) { @@ -65,7 +64,6 @@ public class SitePagesServiceImpl implements SitePagesService { Map full = new LinkedHashMap<>(); full.put("entries", entries); if (authType != null && !"NONE".equals(authType)) full.put("authType", authType); - if (authValue != null && !authValue.isBlank()) full.put("authValue", authValue); String json = om.writerWithDefaultPrettyPrinter().writeValueAsString(full); // 版本号递增 String currentVer = getVersion(siteId); diff --git a/web/src/views/SitePages.vue b/web/src/views/SitePages.vue index 5da7d7c..80a4f53 100644 --- a/web/src/views/SitePages.vue +++ b/web/src/views/SitePages.vue @@ -69,8 +69,8 @@ - - + API Key 由外部传入,无需配置值 + Header 由外部传入,无需配置值 mediabo 管理 cookie 生命周期 @@ -106,7 +106,7 @@ import api from '../api'; import { Refresh } from '@element-plus/icons-vue' const loading = ref(false), saving = ref(false), uploading = ref(false), deleting = ref(false), sites = ref([]), pagesMap = ref({}), sitesList = ref([]) const editSiteId = ref(''), editorJson = ref('{}') -const authType = ref('NONE'), authValue = ref('') +const authType = ref('NONE') const defaultTypes = ['nexusphp','mtorrent','gazelle','unit3d'] const isDefaultEditor = computed(() => editSiteId.value.startsWith('default:')) const pageKeys = ref([]) @@ -126,14 +126,11 @@ const parsed = computed(() => { try { return JSON.parse(editorJson.value).entrie const syncAuth = () => { const obj = (() => { try { return JSON.parse(editorJson.value) } catch { return {} } })() obj.authType = authType.value - if (authType.value !== 'NONE') obj.authValue = authValue.value - else delete obj.authValue obj.entries = parsed.value editorJson.value = JSON.stringify(obj, null, 2) } const syncToJson = () => { const obj = { authType: authType.value, entries: parsed.value } - if (authType.value !== 'NONE') obj.authValue = authValue.value editorJson.value = JSON.stringify(obj, null, 2) } const resolveUrl = (url) => url?.replace('{base}', sitesList.value.find(s=>s.siteId===editSiteId.value)?.urls?.[0] || '{base}') || '' @@ -169,8 +166,7 @@ const editPage = async (row) => { const r = await api.raw.get(url) const data = r?.data || r authType.value = data?.authType || 'NONE' - authValue.value = data?.authValue || '' - editorJson.value = JSON.stringify({ authType: authType.value, authValue: authValue.value || undefined, entries: data?.entries || [] }, null, 2) + editorJson.value = JSON.stringify({ authType: authType.value, entries: data?.entries || [] }, null, 2) } catch { editorJson.value = JSON.stringify({ authType:'NONE', entries:[] }, null, 2) } } @@ -200,7 +196,7 @@ const savePages = async () => { const url = editSiteId.value.startsWith('default:') ? '/admin/default-pages/' + editSiteId.value.replace('default:','') : '/sites/' + editSiteId.value + '/pages' - await api.raw.put(url, { entries: parsed.value, authType: authType.value, authValue: authType.value!=='NONE'?authValue.value:null }) + await api.raw.put(url, { entries: parsed.value, authType: authType.value }) ElMessage.success('已保存'); editSiteId.value=''; fetchAll() } catch { ElMessage.error('保存失败') } finally { saving.value = false }