feat: 页面配置默认初始化时带预设URL,初次编辑即可直接使用
sync → /index.php
signIn → /attendance.php
search → /torrents.php?search={keyword}
download → /download.php?id={id}
rss → /torrentrss.php?rows=10&search={keyword}&search_mode=1&linktype=dl&passkey={passkey}
detail → /details.php?id={id}
This commit is contained in:
@@ -137,6 +137,14 @@ const sites = ref([]), pagesMap = ref({}), sitesList = ref([])
|
|||||||
const editSiteId = ref(''), editorJson = ref('{}'), originalJson = ref('')
|
const editSiteId = ref(''), editorJson = ref('{}'), originalJson = ref('')
|
||||||
const snapshotStatus = ref(null)
|
const snapshotStatus = ref(null)
|
||||||
const authType = ref('NONE')
|
const authType = ref('NONE')
|
||||||
|
const defaultUrls = {
|
||||||
|
sync: '/index.php',
|
||||||
|
signIn: '/attendance.php',
|
||||||
|
search: '/torrents.php?search={keyword}',
|
||||||
|
download: '/download.php?id={id}',
|
||||||
|
rss: '/torrentrss.php?rows=10&search={keyword}&search_mode=1&linktype=dl&passkey={passkey}',
|
||||||
|
detail: '/details.php?id={id}',
|
||||||
|
}
|
||||||
const defaultTypes = ['nexusphp','mtorrent','gazelle','unit3d']
|
const defaultTypes = ['nexusphp','mtorrent','gazelle','unit3d']
|
||||||
const isDefaultEditor = computed(() => editSiteId.value.startsWith('default:'))
|
const isDefaultEditor = computed(() => editSiteId.value.startsWith('default:'))
|
||||||
const pageKeys = ref([])
|
const pageKeys = ref([])
|
||||||
@@ -243,9 +251,9 @@ const editPage = async (row) => {
|
|||||||
const data = r?.data || r
|
const data = r?.data || r
|
||||||
authType.value = data?.authType || 'NONE'
|
authType.value = data?.authType || 'NONE'
|
||||||
const existing = data?.entries || []
|
const existing = data?.entries || []
|
||||||
// 无配置则默认初始化所有页面类型
|
// 无配置则默认初始化所有页面类型(带默认URL)
|
||||||
const entries = existing.length ? existing
|
const entries = existing.length ? existing
|
||||||
: pageKeys.value.map(k => ({ key: k.key, method: k.defaultMethod || 'GET', url: '' }))
|
: pageKeys.value.map(k => ({ key: k.key, method: k.defaultMethod || 'GET', url: defaultUrls[k.key] || '' }))
|
||||||
editorJson.value = JSON.stringify({ authType: authType.value, entries }, null, 2)
|
editorJson.value = JSON.stringify({ authType: authType.value, entries }, null, 2)
|
||||||
} catch { editorJson.value = JSON.stringify({ authType:'NONE', entries:[] }, null, 2) }
|
} catch { editorJson.value = JSON.stringify({ authType:'NONE', entries:[] }, null, 2) }
|
||||||
originalJson.value = editorJson.value
|
originalJson.value = editorJson.value
|
||||||
@@ -299,7 +307,7 @@ const discardDraft = async () => {
|
|||||||
|
|
||||||
const remove = (idx) => { parsed.value.splice(idx,1); syncToJson() }
|
const remove = (idx) => { parsed.value.splice(idx,1); syncToJson() }
|
||||||
const addEntryByKey = (k) => {
|
const addEntryByKey = (k) => {
|
||||||
parsed.value.push({ key: k.key, method: k.defaultMethod || 'GET', url: '' })
|
parsed.value.push({ key: k.key, method: k.defaultMethod || 'GET', url: defaultUrls[k.key] || '' })
|
||||||
syncToJson()
|
syncToJson()
|
||||||
}
|
}
|
||||||
const deletePages = async () => {
|
const deletePages = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user