Merge pull request #19 from Aues6uen11Z/feat/api-url

feat: 添加用于小程序的API URL复制
This commit is contained in:
Aues6uen11Z
2026-01-09 22:09:13 +08:00
committed by GitHub
parent 176a7de220
commit 0e2a345371
6 files changed
+389 -203

No files matched your search

+10 -1
View File
@@ -1,5 +1,5 @@
const { clipboard, ipcMain } = require('electron')
const { getUrl, deleteData } = require('./getData')
const { getUrl, deleteData, getApiUrl } = require('./getData')
ipcMain.handle('COPY_URL', async () => {
const url = await getUrl()
@@ -10,6 +10,15 @@ ipcMain.handle('COPY_URL', async () => {
return false
})
ipcMain.handle('COPY_API_URL', async () => {
const apiUrl = await getApiUrl()
if (apiUrl) {
clipboard.writeText(apiUrl)
return true
}
return false
})
ipcMain.handle('DELETE_DATA', async (event, uid, action) => {
await deleteData(uid, action)
})
+13 -1
View File
@@ -408,6 +408,17 @@ const getUrl = async () => {
return url
}
const getApiUrl = async () => {
const url = await getUrl()
if (!url) return null
const searchParams = getQuerystring(url)
if (!searchParams) return null
const apiUrl = `${apiDomain}/common/gacha_record/api/getGachaLog?${searchParams.toString()}`
return apiUrl
}
const fetchData = async (urlOverride) => {
const text = i18n.log
await readData()
@@ -558,4 +569,5 @@ exports.getUrl = getUrl
exports.deleteData = deleteData
exports.saveData = saveData
exports.changeCurrent = changeCurrent
exports.convertTimeZone = convertTimeZone
exports.convertTimeZone = convertTimeZone
exports.getApiUrl = getApiUrl