Compare commits

...

5 Commits

Author SHA1 Message Date
mio
23d102fe67 fix: sometimes appid error 2024-03-31 15:01:35 +08:00
mio
e307d21bb2 feat: save data only in the current program directory 2024-01-22 15:15:17 +08:00
mio
8ff629b655 Upgrade version 2023-10-28 10:01:55 +08:00
0c778c09f4 fixed: unknown host (#54)
Closes #53 
我這邊yarn build之後運行正常

---------

Co-authored-by: biuuu <10892119+biuuu@users.noreply.github.com>
2023-10-28 09:57:14 +08:00
8c370ff0a7 Update Français.json (#50)
Added : 
- ui.setting.dataManagerHint

Updated :
- ui.button.files

Small fix. Translation is now complete. And no formatting issues this
time (sorry for that).
2023-10-14 16:46:01 +08:00
5 changed files with 10 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "star-rail-warp-export", "name": "star-rail-warp-export",
"version": "0.1.5", "version": "0.1.7",
"main": "./dist/electron/main/main.js", "main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>", "author": "biuuu <https://github.com/biuuu>",
"homepage": "https://github.com/biuuu/star-rail-warp-export", "homepage": "https://github.com/biuuu/star-rail-warp-export",

View File

@ -3,7 +3,7 @@
"ui.button.load": "Charger les données", "ui.button.load": "Charger les données",
"ui.button.update": "Mettre à jour", "ui.button.update": "Mettre à jour",
"ui.button.directUpdate": "Mise à jour directe", "ui.button.directUpdate": "Mise à jour directe",
"ui.button.files": "Export les fichiers", "ui.button.files": "Exporter les fichiers",
"ui.button.excel": "Exporter vers Excel", "ui.button.excel": "Exporter vers Excel",
"ui.button.srgf": "Exporter vers JSON", "ui.button.srgf": "Exporter vers JSON",
"ui.button.url": "URL d'import", "ui.button.url": "URL d'import",
@ -44,6 +44,7 @@
"ui.setting.cnServer": "Serveur Chinois", "ui.setting.cnServer": "Serveur Chinois",
"ui.setting.seaServer": "Serveur Global", "ui.setting.seaServer": "Serveur Global",
"ui.setting.logTypeHint": "Choisissez les journaux générés par le serveur à utiliser en priorité lors de la récupération de l'URL à partir des journaux du jeu.", "ui.setting.logTypeHint": "Choisissez les journaux générés par le serveur à utiliser en priorité lors de la récupération de l'URL à partir des journaux du jeu.",
"ui.setting.dataManagerHint": "Les données inutilisées peuvent être supprimées",
"ui.setting.autoUpdate": "Mise à jour automatique", "ui.setting.autoUpdate": "Mise à jour automatique",
"ui.setting.hideNovice": "Masquer les sauts hyperespaces de départ", "ui.setting.hideNovice": "Masquer les sauts hyperespaces de départ",
"ui.setting.proxyMode": "Mode Proxy", "ui.setting.proxyMode": "Mode Proxy",

View File

@ -1,4 +1,4 @@
const { readJSON, saveJSON, decipherAes, cipherAes, detectLocale, userDataPath, globalUserDataPath } = require('./utils') const { readJSON, saveJSON, decipherAes, cipherAes, detectLocale, userDataPath } = require('./utils')
const config = { const config = {
urls: [], urls: [],
@ -14,9 +14,7 @@ const config = {
const getLocalConfig = async () => { const getLocalConfig = async () => {
let localConfig = await readJSON(userDataPath, 'config.json') let localConfig = await readJSON(userDataPath, 'config.json')
if (!localConfig) {
localConfig = await readJSON(globalUserDataPath, 'config.json')
}
if (!localConfig) return if (!localConfig) return
const configTemp = {} const configTemp = {}
for (let key in localConfig) { for (let key in localConfig) {

View File

@ -3,7 +3,7 @@ const util = require('util')
const path = require('path') const path = require('path')
const { URL } = require('url') const { URL } = require('url')
const { app, ipcMain, shell } = require('electron') const { app, ipcMain, shell } = require('electron')
const { sleep, request, sendMsg, readJSON, saveJSON, detectLocale, getCacheText, userDataPath, userPath, localIp, langMap, globalUserDataPath } = require('./utils') const { sleep, request, sendMsg, readJSON, saveJSON, detectLocale, getCacheText, userDataPath, userPath, localIp, langMap } = require('./utils')
const config = require('./config') const config = require('./config')
const i18n = require('./i18n') const i18n = require('./i18n')
const { enableProxy, disableProxy } = require('./module/system-proxy') const { enableProxy, disableProxy } = require('./module/system-proxy')
@ -42,10 +42,8 @@ const findDataFiles = async (dataPath, fileMap) => {
const collectDataFiles = async () => { const collectDataFiles = async () => {
await fs.ensureDir(userDataPath) await fs.ensureDir(userDataPath)
await fs.ensureDir(globalUserDataPath)
const fileMap = new Map() const fileMap = new Map()
await findDataFiles(userDataPath, fileMap) await findDataFiles(userDataPath, fileMap)
await findDataFiles(globalUserDataPath, fileMap)
return fileMap return fileMap
} }
@ -143,7 +141,7 @@ const readLog = async () => {
const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i) const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i)
if (gamePathMch) { if (gamePathMch) {
const [cacheText, cacheFile] = await getCacheText(gamePathMch[0]) const [cacheText, cacheFile] = await getCacheText(gamePathMch[0])
const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g) const urlMch = cacheText.match(/https[^?]+?\?[^?]+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g)
if (urlMch) { if (urlMch) {
cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '') cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '')
return getLatestUrl(urlMch) return getLatestUrl(urlMch)
@ -290,7 +288,7 @@ const fixAuthkey = (url) => {
const getQuerystring = (url) => { const getQuerystring = (url) => {
const text = i18n.log const text = i18n.log
const { searchParams, host } = new URL(fixAuthkey(url)) const { searchParams, host } = new URL(fixAuthkey(url))
if (host.includes('webstatic-sea') || host.includes('hkrpg-api-os') || host.includes("api-os-takumi")) { if (host.includes('webstatic-sea') || host.includes('hkrpg-api-os') || host.includes('api-os-takumi') || host.includes('hoyoverse.com')) {
apiDomain = 'https://api-os-takumi.mihoyo.com' apiDomain = 'https://api-os-takumi.mihoyo.com'
} else { } else {
apiDomain = 'https://api-takumi.mihoyo.com' apiDomain = 'https://api-takumi.mihoyo.com'

View File

@ -13,7 +13,7 @@ const isDev = !app.isPackaged
const userPath = app.getPath('userData') const userPath = app.getPath('userData')
const appRoot = isDev ? path.resolve(__dirname, '..', '..') : path.resolve(app.getAppPath(), '..', '..') const appRoot = isDev ? path.resolve(__dirname, '..', '..') : path.resolve(app.getAppPath(), '..', '..')
const userDataPath = path.resolve(appRoot, 'userData') const userDataPath = path.resolve(appRoot, 'userData')
const globalUserDataPath = path.resolve(userPath, 'userData') // const globalUserDataPath = path.resolve(userPath, 'userData')
let win = null let win = null
const initWindow = () => { const initWindow = () => {
@ -147,9 +147,6 @@ const detectLocale = (value) => {
const saveJSON = async (name, data) => { const saveJSON = async (name, data) => {
try { try {
await fs.outputJSON(path.join(userDataPath, name), data) await fs.outputJSON(path.join(userDataPath, name), data)
if (!isDev) {
await fs.outputJSON(path.join(globalUserDataPath, name), data)
}
} catch (e) { } catch (e) {
sendMsg(e, 'ERROR') sendMsg(e, 'ERROR')
await sleep(3) await sleep(3)
@ -221,5 +218,5 @@ async function getCacheText(gamePath) {
module.exports = { module.exports = {
sleep, request, hash, cipherAes, decipherAes, saveLog, getCacheText, sleep, request, hash, cipherAes, decipherAes, saveLog, getCacheText,
sendMsg, readJSON, saveJSON, initWindow, getWin, localIp, userPath, detectLocale, langMap, sendMsg, readJSON, saveJSON, initWindow, getWin, localIp, userPath, detectLocale, langMap,
appRoot, userDataPath, globalUserDataPath appRoot, userDataPath
} }