Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
1052a4bffb | |||
2fd8730cdd | |||
bbc52af184 | |||
38ed348865 | |||
29548310c5 | |||
3617599d32 | |||
c724727886 | |||
d324aee160 | |||
5a5a7c1327 | |||
77a1d611be | |||
3dbb746a38 | |||
b88b57ae62 | |||
677ab3750d | |||
f95470504d | |||
8d45af5089 | |||
8a9c7a3b56 | |||
2a670c7023 | |||
d732d523a8 | |||
2bc52de233 | |||
20ba48513c | |||
ba0bc3a778 | |||
5de6b7bb6a | |||
bfa075fe57 | |||
056bb36b15 | |||
0035307762 | |||
a1257bdbfb |
@ -35,7 +35,7 @@ const start = async () => {
|
||||
await fs.outputJSON(path.join(outputPath, 'manifest.json'), {
|
||||
active: true,
|
||||
version,
|
||||
from: '0.1.5',
|
||||
from: '0.0.1',
|
||||
name: `${hashName}.zip`,
|
||||
hash: sha256
|
||||
})
|
||||
|
@ -14,8 +14,10 @@
|
||||
|
||||
## 使用说明
|
||||
|
||||
1. 下载工具后解压 - 下载地址: [Github](https://github.com/biuuu/star-rail-warp-export/releases/latest/download/StarRailWarpExport.zip) / [蓝奏云]()
|
||||
2. 打开游戏的跃迁历史记录
|
||||
1. 下载工具后解压 - 下载地址: [Github](https://github.com/biuuu/star-rail-warp-export/releases/latest/download/StarRailWarpExport.zip) / [蓝奏云](https://wwvt.lanzoum.com/b022mikwh) 密码:f1iy
|
||||
2. 打开游戏的跃迁详情页面
|
||||
|
||||

|
||||
|
||||
3. 点击工具的“加载数据”按钮
|
||||
|
||||
|
@ -17,7 +17,9 @@ If you feel that the existing translation is inappropriate, you can send a pull
|
||||
## Usage
|
||||
|
||||
1. Unzip after downloading the tool - [Download](https://github.com/biuuu/star-rail-warp-export/releases/latest/download/StarRailWarpExport.zip)
|
||||
2. Open the warp history of the game
|
||||
2. Open the warp details page of the game
|
||||
|
||||

|
||||
|
||||
3. Click the tool's "Load data" button
|
||||
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 55 KiB |
BIN
docs/preview.png
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 46 KiB |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "star-rail-warp-export",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.14",
|
||||
"main": "./dist/electron/main/main.js",
|
||||
"author": "biuuu <https://github.com/biuuu>",
|
||||
"license": "MIT",
|
||||
|
@ -30,9 +30,9 @@
|
||||
"ui.data.average": "5 star on average",
|
||||
"ui.data.chara5": "5 star character",
|
||||
"ui.data.chara4": "4 star character",
|
||||
"ui.data.weapon5": "5 star light cone",
|
||||
"ui.data.weapon4": "4 star light cone",
|
||||
"ui.data.weapon3": "3 star light cone",
|
||||
"ui.data.weapon5": "5 star Light Cone",
|
||||
"ui.data.weapon4": "4 star Light Cone",
|
||||
"ui.data.weapon3": "3 star Light Cone",
|
||||
"ui.setting.title": "Settings",
|
||||
"ui.setting.language": "Language",
|
||||
"ui.setting.languageHint": "When the translation is missing, English will be displayed by default.",
|
||||
@ -84,5 +84,5 @@
|
||||
"excel.filePrefix": "Star Rail Warp logger",
|
||||
"excel.fileType": "Excel file",
|
||||
"ui.extra.cacheClean": "1. Confirm whether the warp history in the game has been opened, and if the error \"User authentication expired\" still appears, try the following steps \n2. Close the game window of Star Rail \n3. Click the \"Open Web Cache Folder\" button above to open the \"Cache\" folder \n4. Delete the \"Cache_ Data\" folder \n5. Start the Star Rail game and open the warp history page in the game \n6. Close this dialog and click the \"Update Data\" button",
|
||||
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/Star Rail/Game/StarRail_Data/webCaches/Cache/\""
|
||||
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/Star Rail/Games/StarRail_Data/webCaches/Cache/\""
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
"ui.data.sum": "合計",
|
||||
"ui.data.no5star": "連星5取得しません",
|
||||
"ui.data.character": "キャラ",
|
||||
"ui.data.weapon": "武器",
|
||||
"ui.data.weapon": "光円錐",
|
||||
"ui.data.star5": "星5",
|
||||
"ui.data.star4": "星4",
|
||||
"ui.data.star3": "星3",
|
||||
@ -26,9 +26,9 @@
|
||||
"ui.data.average": "星5取得平均回数",
|
||||
"ui.data.chara5": "星5キャラ",
|
||||
"ui.data.chara4": "星4キャラ",
|
||||
"ui.data.weapon5": "星5武器",
|
||||
"ui.data.weapon4": "星4武器",
|
||||
"ui.data.weapon3": "星3武器",
|
||||
"ui.data.weapon5": "星5光円錐",
|
||||
"ui.data.weapon4": "星4光円錐",
|
||||
"ui.data.weapon3": "星3光円錐",
|
||||
"ui.setting.title": "設定",
|
||||
"ui.setting.language": "言語",
|
||||
"ui.setting.languageHint": "翻訳されていない場合は、デフォルトで英語が表示されます。",
|
||||
|
@ -22,7 +22,7 @@
|
||||
"ui.data.sum": "已累计",
|
||||
"ui.data.no5star": "抽未出5星",
|
||||
"ui.data.character": "角色",
|
||||
"ui.data.weapon": "武器",
|
||||
"ui.data.weapon": "光锥",
|
||||
"ui.data.star5": "5星",
|
||||
"ui.data.star4": "4星",
|
||||
"ui.data.star3": "3星",
|
||||
@ -30,9 +30,9 @@
|
||||
"ui.data.average": "5星平均出货次数为",
|
||||
"ui.data.chara5": "5星角色",
|
||||
"ui.data.chara4": "4星角色",
|
||||
"ui.data.weapon5": "5星武器",
|
||||
"ui.data.weapon4": "4星武器",
|
||||
"ui.data.weapon3": "3星武器",
|
||||
"ui.data.weapon5": "5星光锥",
|
||||
"ui.data.weapon4": "4星光锥",
|
||||
"ui.data.weapon3": "3星光锥",
|
||||
"ui.setting.title": "设置",
|
||||
"ui.setting.language": "语言",
|
||||
"ui.setting.languageHint": "缺少翻译时,会默认显示简体中文",
|
||||
@ -83,6 +83,6 @@
|
||||
"excel.customFont": "微软雅黑",
|
||||
"excel.filePrefix": "星穹铁道跃迁记录",
|
||||
"excel.fileType": "Excel文件",
|
||||
"ui.extra.cacheClean": "1. 确认是否已经打开游戏内的抽卡历史记录,如果仍然出现“身份认证已过期”的错误,再尝试下面的步骤\n2. 关闭原神的游戏窗口\n3. 点击上方的“打开缓存文件夹”按钮,打开Cache文件夹\n4. 删除Cache_Data文件夹\n5. 启动原神游戏,打开游戏内抽卡历史记录页面\n6. 关闭这个对话框,再点击“更新数据”按钮",
|
||||
"ui.extra.cacheClean": "1. 确认是否已经打开游戏内的抽卡历史记录,如果仍然出现“身份认证已过期”的错误,再尝试下面的步骤\n2. 关闭星穹铁道的游戏窗口\n3. 点击上方的“打开缓存文件夹”按钮,打开Cache文件夹\n4. 删除Cache_Data文件夹\n5. 启动星穹铁道游戏,打开游戏内抽卡历史记录页面\n6. 关闭这个对话框,再点击“更新数据”按钮",
|
||||
"ui.extra.findCacheFolder": "如果点“打开缓存文件夹”按钮没有反应,可以手动找到游戏的网页缓存文件夹,目录为“你的游戏安装路径/Star Rail/Game/StarRail_Data/webCaches/Cache/”"
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
"ui.button.setting": "設定",
|
||||
"ui.button.option": "選項",
|
||||
"ui.button.startProxy": "Proxy 模式",
|
||||
"ui.button.solution": "解決方案",
|
||||
"ui.button.solution": "解決方法",
|
||||
"ui.button.cacheFolder": "開啟快取資料夾",
|
||||
"ui.select.newAccount": "新帳號",
|
||||
"ui.hint.newAccount": "從其他帳號匯出資料",
|
||||
@ -16,13 +16,13 @@
|
||||
"ui.hint.lastUpdate": "上次資料更新時間為",
|
||||
"ui.hint.relaunchHint": "更新已完成,按下按鈕重新啟動工具後生效",
|
||||
"ui.hint.failed": "作業失敗",
|
||||
"ui.win.title": "",
|
||||
"ui.win.title": "崩壞:星穹鐵道 躍遷記錄匯出工具",
|
||||
"ui.data.total": "總計",
|
||||
"ui.data.times": "抽",
|
||||
"ui.data.sum": "已累計",
|
||||
"ui.data.no5star": "抽未出5星",
|
||||
"ui.data.character": "角色",
|
||||
"ui.data.weapon": "武器",
|
||||
"ui.data.weapon": "光錐",
|
||||
"ui.data.star5": "5星",
|
||||
"ui.data.star4": "4星",
|
||||
"ui.data.star3": "3星",
|
||||
@ -30,9 +30,9 @@
|
||||
"ui.data.average": "5星平均出貨次數為",
|
||||
"ui.data.chara5": "5星角色",
|
||||
"ui.data.chara4": "4星角色",
|
||||
"ui.data.weapon5": "5星武器",
|
||||
"ui.data.weapon4": "4星武器",
|
||||
"ui.data.weapon3": "3星武器",
|
||||
"ui.data.weapon5": "5星光錐",
|
||||
"ui.data.weapon4": "4星光錐",
|
||||
"ui.data.weapon3": "3星光錐",
|
||||
"ui.setting.title": "設定",
|
||||
"ui.setting.language": "語言",
|
||||
"ui.setting.languageHint": "缺少翻譯時,預設會顯示簡體中文。",
|
||||
@ -42,7 +42,7 @@
|
||||
"ui.setting.seaServer": "國際服",
|
||||
"ui.setting.logTypeHint": "使用遊戲記錄取得 URL 時,優先選擇哪種伺服器產生的記錄檔案。",
|
||||
"ui.setting.autoUpdate": "自動更新",
|
||||
"ui.setting.hideNovice": "",
|
||||
"ui.setting.hideNovice": "隱藏始發躍遷",
|
||||
"ui.setting.proxyMode": "Proxy 模式",
|
||||
"ui.setting.proxyModeHint": "透過設定系統 Proxy 以取得 URL,將會在從系統記錄中取得 URL 失敗時啟動。",
|
||||
"ui.setting.fetchFullHistory": "取得完整資料",
|
||||
@ -81,8 +81,8 @@
|
||||
"excel.header.remark": "備註",
|
||||
"excel.wish2": "躍遷-2",
|
||||
"excel.customFont": "微軟正黑體",
|
||||
"excel.filePrefix": "",
|
||||
"excel.filePrefix": "星穹鐵道躍遷紀錄",
|
||||
"excel.fileType": "Excel 檔案",
|
||||
"ui.extra.cacheClean": "1. 確認是否已經開啟遊戲內的躍遷歷史紀錄,如果仍然出現「身分驗證已過期」的錯誤,再嘗試下面的步驟\n2. 關閉原神的遊戲視窗\n3. 按一下上方的「開啟快取資料夾」按鈕,開啟「Cache」資料夾\n4. 刪除「Cache_Data」資料夾\n5. 啟動原神遊戲,開啟遊戲內躍遷歷史紀錄頁面\n6. 關閉這個對話方塊,再按下「更新資料」按鈕",
|
||||
"ui.extra.findCacheFolder": "如果按下「開啟快取資料夾」按鈕沒有回應,可以手動找到遊戲的網頁快取資料夾,目錄為「您的遊戲安裝路徑/Star Rail/Game/StarRail_Data/webCaches/Cache/」"
|
||||
"ui.extra.cacheClean": "1. 確認是否已經開啟遊戲內的躍遷歷史紀錄,如果仍然出現「身分驗證已過期」的錯誤,再嘗試下面的步驟\n2. 關閉「崩壞:星穹鐵道」的遊戲視窗\n3. 按一下上方的「開啟快取資料夾」按鈕,開啟「Cache」資料夾\n4. 刪除「Cache_Data」資料夾\n5. 啟動「崩壞:星穹鐵道」遊戲,開啟遊戲內躍遷歷史紀錄頁面\n6. 關閉這個對話方塊,再按下「更新資料」按鈕",
|
||||
"ui.extra.findCacheFolder": "如果按下「開啟快取資料夾」按鈕沒有回應,可以手動找到遊戲的網頁快取資料夾,目錄為「您的遊戲安裝路徑/Star Rail/Games/StarRail_Data/webCaches/Cache/」"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { readJSON, saveJSON, decipherAes, cipherAes, detectLocale } = require('./utils')
|
||||
const { readJSON, saveJSON, decipherAes, cipherAes, detectLocale, userDataPath, globalUserDataPath } = require('./utils')
|
||||
|
||||
const config = {
|
||||
urls: [],
|
||||
@ -13,7 +13,10 @@ const config = {
|
||||
}
|
||||
|
||||
const getLocalConfig = async () => {
|
||||
const localConfig = await readJSON('config.json')
|
||||
let localConfig = await readJSON(userDataPath, 'config.json')
|
||||
if (!localConfig) {
|
||||
localConfig = await readJSON(globalUserDataPath, 'config.json')
|
||||
}
|
||||
if (!localConfig) return
|
||||
const configTemp = {}
|
||||
for (let key in localConfig) {
|
||||
|
@ -4,7 +4,6 @@ const { app, ipcMain, dialog } = require('electron')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const i18n = require('./i18n')
|
||||
const cloneDeep = require('lodash-es/cloneDeep').default
|
||||
|
||||
function pad(num) {
|
||||
return `${num}`.padStart(2, "0");
|
||||
@ -87,7 +86,7 @@ const start = async () => {
|
||||
arr.push(total)
|
||||
arr.push(pity)
|
||||
temp.push(arr)
|
||||
if (log.rank_type === 5) {
|
||||
if (log.rank_type === '5') {
|
||||
pity = 0
|
||||
}
|
||||
// if (key === '301') {
|
||||
|
@ -3,7 +3,7 @@ const util = require('util')
|
||||
const path = require('path')
|
||||
const { URL } = require('url')
|
||||
const { app, ipcMain, shell } = require('electron')
|
||||
const { sleep, request, sendMsg, readJSON, saveJSON, detectLocale, userDataPath, userPath, localIp, langMap } = require('./utils')
|
||||
const { sleep, request, sendMsg, readJSON, saveJSON, detectLocale, userDataPath, userPath, localIp, langMap, globalUserDataPath } = require('./utils')
|
||||
const config = require('./config')
|
||||
const i18n = require('./i18n')
|
||||
const { enableProxy, disableProxy } = require('./module/system-proxy')
|
||||
@ -18,7 +18,6 @@ const saveData = async (data, url) => {
|
||||
const obj = Object.assign({}, data)
|
||||
obj.result = [...obj.result]
|
||||
obj.typeMap = [...obj.typeMap]
|
||||
config.urls.set(data.uid, url)
|
||||
await config.save()
|
||||
await saveJSON(`gacha-list-${data.uid}.json`, obj)
|
||||
}
|
||||
@ -30,25 +29,42 @@ const defaultTypeMap = new Map([
|
||||
['2', '始发跃迁']
|
||||
])
|
||||
|
||||
const findDataFiles = async (dataPath, fileMap) => {
|
||||
const files = await readdir(dataPath)
|
||||
if (files?.length) {
|
||||
for (let name of files) {
|
||||
if (/^gacha-list-\d+\.json$/.test(name) && !fileMap.has(name)) {
|
||||
fileMap.set(name, dataPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const collectDataFiles = async () => {
|
||||
await fs.ensureDir(userDataPath)
|
||||
await fs.ensureDir(globalUserDataPath)
|
||||
const fileMap = new Map()
|
||||
await findDataFiles(userDataPath, fileMap)
|
||||
await findDataFiles(globalUserDataPath, fileMap)
|
||||
return fileMap
|
||||
}
|
||||
|
||||
let localDataReaded = false
|
||||
const readdir = util.promisify(fs.readdir)
|
||||
const readData = async () => {
|
||||
if (localDataReaded) return
|
||||
localDataReaded = true
|
||||
await fs.ensureDir(userDataPath)
|
||||
const files = await readdir(userDataPath)
|
||||
for (let name of files) {
|
||||
if (/^gacha-list-\d+\.json$/.test(name)) {
|
||||
try {
|
||||
const data = await readJSON(name)
|
||||
data.typeMap = new Map(data.typeMap) || defaultTypeMap
|
||||
data.result = new Map(data.result)
|
||||
if (data.uid) {
|
||||
dataMap.set(data.uid, data)
|
||||
}
|
||||
} catch (e) {
|
||||
sendMsg(e, 'ERROR')
|
||||
const fileMap = await collectDataFiles()
|
||||
for (let [name, dataPath] of fileMap) {
|
||||
try {
|
||||
const data = await readJSON(dataPath, name)
|
||||
data.typeMap = new Map(data.typeMap) || defaultTypeMap
|
||||
data.result = new Map(data.result)
|
||||
if (data.uid) {
|
||||
dataMap.set(data.uid, data)
|
||||
}
|
||||
} catch (e) {
|
||||
sendMsg(e, 'ERROR')
|
||||
}
|
||||
}
|
||||
if ((!config.current && dataMap.size) || (config.current && dataMap.size && !dataMap.has(config.current))) {
|
||||
@ -67,7 +83,7 @@ const detectGameLocale = async (userPath) => {
|
||||
const arr = ['/miHoYo/崩坏:星穹铁道/', '/Cognosphere/Star Rail/']
|
||||
arr.forEach(str => {
|
||||
try {
|
||||
const pathname = path.join(userPath, '/AppData/LocalLow/', str, 'Player-prev.log')
|
||||
const pathname = path.join(userPath, '/AppData/LocalLow/', str, 'Player.log')
|
||||
fs.accessSync(pathname, fs.constants.F_OK)
|
||||
list.push(pathname)
|
||||
} catch (e) {}
|
||||
@ -85,17 +101,17 @@ const detectGameLocale = async (userPath) => {
|
||||
|
||||
const getLatestUrl = (list) => {
|
||||
let result = list[list.length - 1]
|
||||
let time = 0
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const tsMch = list[i].match(/timestamp=(\d+)/)
|
||||
if (tsMch?.[1]) {
|
||||
const ts = parseInt(tsMch[1])
|
||||
if (time < parseInt(tsMch[1])) {
|
||||
time = ts
|
||||
result = list[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
// let time = 0
|
||||
// for (let i = 0; i < list.length; i++) {
|
||||
// const tsMch = list[i].match(/timestamp=(\d+)/)
|
||||
// if (tsMch?.[1]) {
|
||||
// const ts = parseInt(tsMch[1])
|
||||
// if (time <= parseInt(tsMch[1])) {
|
||||
// time = ts
|
||||
// result = list[i]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return result
|
||||
}
|
||||
|
||||
@ -116,10 +132,13 @@ const readLog = async () => {
|
||||
}
|
||||
const promises = logPaths.map(async logpath => {
|
||||
const logText = await fs.readFile(logpath, 'utf8')
|
||||
const gamePathMch = logText.match(/\w:\/.+(Star\sRail\/Game\/StarRail_Data)/)
|
||||
const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i)
|
||||
if (gamePathMch) {
|
||||
const cacheText = await fs.readFile(path.join(gamePathMch[0], '/webCaches/Cache/Cache_Data/data_2'), 'utf8')
|
||||
const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+/g)
|
||||
let cacheText = ''
|
||||
try {
|
||||
cacheText = await fs.readFile(path.join(gamePathMch[0], '/webCaches/Cache/Cache_Data/data_2'), 'utf8')
|
||||
} catch (e) {}
|
||||
const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g)
|
||||
if (urlMch) {
|
||||
cacheFolder = path.join(gamePathMch[0], '/webCaches/Cache/')
|
||||
return getLatestUrl(urlMch)
|
||||
@ -236,7 +255,6 @@ const tryGetUid = async (queryString) => {
|
||||
try {
|
||||
for (let [key] of defaultTypeMap) {
|
||||
const res = await request(`${url}&gacha_type=${key}&page=1&size=6`)
|
||||
checkResStatus(res)
|
||||
if (res.data.list && res.data.list.length) {
|
||||
return res.data.list[0].uid
|
||||
}
|
||||
@ -334,10 +352,7 @@ const tryRequest = async (url, retry = false) => {
|
||||
const gachaTypeUrl = `${apiDomain}/common/gacha_record/api/getGachaLog?${queryString}&page=1&size=5&gacha_type=1&end_id=0`
|
||||
try {
|
||||
const res = await request(gachaTypeUrl)
|
||||
if (res.retcode !== 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
checkResStatus(res)
|
||||
} catch (e) {
|
||||
if (e.code === 'ERR_PROXY_CONNECTION_FAILED' && !retry) {
|
||||
await disableProxy()
|
||||
@ -352,11 +367,6 @@ const getUrl = async () => {
|
||||
let url = await readLog()
|
||||
if (!url && config.proxyMode) {
|
||||
url = await useProxy()
|
||||
} else if (url) {
|
||||
const result = await tryRequest(url)
|
||||
if (!result && config.proxyMode) {
|
||||
url = await useProxy()
|
||||
}
|
||||
}
|
||||
return url
|
||||
}
|
||||
@ -373,6 +383,9 @@ const fetchData = async (urlOverride) => {
|
||||
sendMsg(message)
|
||||
throw new Error(message)
|
||||
}
|
||||
|
||||
await tryRequest(url)
|
||||
|
||||
const searchParams = getQuerystring(url)
|
||||
if (!searchParams) {
|
||||
const message = text.url.incorrect
|
||||
@ -457,7 +470,7 @@ ipcMain.handle('READ_DATA', async () => {
|
||||
})
|
||||
|
||||
ipcMain.handle('CHANGE_UID', (event, uid) => {
|
||||
config.current = uid
|
||||
changeCurrent(uid)
|
||||
})
|
||||
|
||||
ipcMain.handle('GET_CONFIG', () => {
|
||||
|
@ -42,14 +42,24 @@ const parseData = (data) => {
|
||||
return result
|
||||
}
|
||||
|
||||
const assignData = (objA, objB) => {
|
||||
const temp = { ...objA }
|
||||
for (let key in objB) {
|
||||
if (objB[key]) {
|
||||
temp[key] = objB[key]
|
||||
}
|
||||
}
|
||||
return temp
|
||||
}
|
||||
|
||||
const i18nMap = new Map()
|
||||
const prepareData = () => {
|
||||
for (let key in raw) {
|
||||
let temp = {}
|
||||
if (key === 'zh-tw') {
|
||||
Object.assign(temp, raw['zh-cn'], raw[key])
|
||||
temp = assignData(raw['zh-cn'], raw[key])
|
||||
} else {
|
||||
Object.assign(temp, raw['zh-cn'], raw['en-us'], raw[key])
|
||||
temp = assignData(raw['zh-cn'], assignData(raw['en-us'], raw[key]))
|
||||
}
|
||||
i18nMap.set(key, parseData(temp))
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ const crypto = require('crypto')
|
||||
const unhandled = require('electron-unhandled')
|
||||
const windowStateKeeper = require('electron-window-state')
|
||||
const debounce = require('lodash/debounce')
|
||||
const Registry = require('winreg')
|
||||
|
||||
const isDev = !app.isPackaged
|
||||
|
||||
const userPath = app.getPath('userData')
|
||||
const appRoot = isDev ? path.resolve(__dirname, '..', '..') : userPath
|
||||
const appRoot = isDev ? path.resolve(__dirname, '..', '..') : path.resolve(app.getAppPath(), '..', '..')
|
||||
const userDataPath = path.resolve(appRoot, 'userData')
|
||||
const globalUserDataPath = path.resolve(userPath, 'userData')
|
||||
|
||||
let win = null
|
||||
const initWindow = () => {
|
||||
@ -25,6 +25,7 @@ const initWindow = () => {
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
backgroundColor: '#fff',
|
||||
webPreferences: {
|
||||
contextIsolation:false,
|
||||
nodeIntegration: true
|
||||
@ -56,7 +57,7 @@ const saveLog = () => {
|
||||
const text = item[2]
|
||||
return `[${type}][${time}]${text}`
|
||||
}).join('\r\n')
|
||||
fs.outputFileSync(path.join(userDataPath, 'log.txt'), text)
|
||||
fs.outputFile(path.join(userDataPath, 'log.txt'), text)
|
||||
}
|
||||
|
||||
const authkeyMask = (text = '') => {
|
||||
@ -134,7 +135,7 @@ const detectLocale = (value) => {
|
||||
const locale = value || app.getLocale()
|
||||
let result = 'zh-cn'
|
||||
for (let [key, list] of localeMap) {
|
||||
if (list.includes(locale)) {
|
||||
if (locale === key || list.includes(locale)) {
|
||||
result = key
|
||||
break
|
||||
}
|
||||
@ -144,19 +145,20 @@ const detectLocale = (value) => {
|
||||
|
||||
const saveJSON = async (name, data) => {
|
||||
try {
|
||||
await fs.outputJSON(path.join(userDataPath, name), data, {
|
||||
spaces: 2
|
||||
})
|
||||
await fs.outputJSON(path.join(userDataPath, name), data)
|
||||
if (!isDev) {
|
||||
await fs.outputJSON(path.join(globalUserDataPath, name), data)
|
||||
}
|
||||
} catch (e) {
|
||||
sendMsg(e, 'ERROR')
|
||||
await sleep(3)
|
||||
}
|
||||
}
|
||||
|
||||
const readJSON = async (name) => {
|
||||
const readJSON = async (dataPath, name) => {
|
||||
let data = null
|
||||
try {
|
||||
data = await fs.readJSON(path.join(userDataPath, name))
|
||||
data = await fs.readJSON(path.join(dataPath, name))
|
||||
} catch (e) {}
|
||||
return data
|
||||
}
|
||||
@ -203,5 +205,5 @@ const localIp = () => {
|
||||
module.exports = {
|
||||
sleep, request, hash, cipherAes, decipherAes, saveLog,
|
||||
sendMsg, readJSON, saveJSON, initWindow, getWin, localIp, userPath, detectLocale, langMap,
|
||||
appRoot, userDataPath
|
||||
appRoot, userDataPath, globalUserDataPath
|
||||
}
|
@ -55,10 +55,12 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="ui.button.solution" v-model="state.showCacheCleanDlg" width="90%" custom-class="max-w-md">
|
||||
<el-button plain icon="folder" type="primary" @click="openCacheFolder">{{ui.button.cacheFolder}}</el-button>
|
||||
<p class="my-4 leading-2 text-gray-600 text-sm whitespace-pre-line">{{ui.extra.cacheClean}}</p>
|
||||
<p class="my-2 text-gray-400 text-xs">{{ui.extra.findCacheFolder}}</p>
|
||||
<el-dialog :title="ui.button.solution" v-model="state.showCacheCleanDlg" width="90%" custom-class="max-w-md cache-clean-dialog">
|
||||
<el-button plain icon="folder" type="success" @click="openCacheFolder">{{ui.button.cacheFolder}}</el-button>
|
||||
<p class="my-2 flex flex-col text-teal-800 text-[13px]">
|
||||
<span class="my-1" v-for="txt of cacheCleanTextList">{{ txt }}</span>
|
||||
</p>
|
||||
<p class="my-2 text-gray-500 text-xs">{{ui.extra.findCacheFolder}}</p>
|
||||
<template #footer>
|
||||
<div class="dialog-footer text-center">
|
||||
<el-button type="primary" @click="state.showCacheCleanDlg = false" class="focus:outline-none">{{ui.common.ok}}</el-button>
|
||||
@ -99,6 +101,13 @@ const ui = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const cacheCleanTextList = computed(() => {
|
||||
if (ui.value) {
|
||||
return ui.value.extra?.cacheClean?.split('\n')
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
const gachaData = computed(() => {
|
||||
return state.dataMap.get(state.current)
|
||||
})
|
||||
|
@ -13,4 +13,10 @@
|
||||
body::-webkit-scrollbar-thumb {
|
||||
@apply rounded-full bg-gray-300;
|
||||
}
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.cache-clean-dialog .el-dialog__body {
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
import * as IconComponents from '@element-plus/icons-vue'
|
||||
|
||||
const weaponTypeNames = new Set([
|
||||
'光锥', 'Light Cone', '光錐', 'Lichtkegel', 'Conos de luz', 'cônes de lumière', '光円錐', '광추', 'Cones de Luz', 'Световые конусы', 'Nón Ánh Sáng'
|
||||
'光锥', '光錐', 'Lichtkegel', 'Light Cone', 'Conos de luz', 'cônes de lumière', '光円錐', '광추', 'Cones de Luz', 'Световые конусы', 'Nón Ánh Sáng'
|
||||
])
|
||||
|
||||
const characterTypeNames = new Set([
|
||||
'角色', 'Character', '캐릭터', 'キャラクター', 'Personaje', 'Personnage', 'Персонажи', 'ตัวละคร', 'Nhân Vật', 'Figur', 'Karakter', 'Personagem'
|
||||
'角色', 'Figur', 'Character', 'Personajes', 'Personnages', 'Karakter', 'キャラクター', '캐릭터', 'Personagens', 'Персонажи', 'ตัวละคร', 'Nhân Vật'
|
||||
])
|
||||
|
||||
const isCharacter = (name) => characterTypeNames.has(name)
|
||||
|