mirror of
https://github.com/earthjasonlin/zzz-signal-search-export.git
synced 2026-09-03 08:30:11 +08:00
Merge pull request #19 from Aues6uen11Z/feat/api-url
feat: 添加用于小程序的API URL复制
This commit is contained in:
6 files changed
+389
-203
No files matched your search
+10
-1
@@ -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
@@ -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
|
||||
Reference in New Issue
Block a user