feat: save data in the current folder

This commit is contained in:
mio
2023-05-03 21:22:37 +08:00
parent b88b57ae62
commit 3dbb746a38
4 changed files with 47 additions and 25 deletions

View File

@ -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) {