feat: automated most of operator config detection
This commit is contained in:
25
packages/operator/libs/updater.ts
Normal file
25
packages/operator/libs/updater.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import path from 'node:path'
|
||||
import { githubDownload } from '@aklive2d/downloader'
|
||||
import config from '@aklive2d/config'
|
||||
import { AUTO_UPDATE_FOLDER } from '../index.ts'
|
||||
|
||||
export const update = async () => {
|
||||
const character_table_json = path.resolve(
|
||||
AUTO_UPDATE_FOLDER,
|
||||
config.module.operator.character_table_json
|
||||
)
|
||||
const skin_table_json = path.resolve(
|
||||
AUTO_UPDATE_FOLDER,
|
||||
config.module.operator.skin_table_json
|
||||
)
|
||||
await githubDownload(
|
||||
`https://api.github.com/repos/Kengxxiao/ArknightsGameData/commits?path=zh_CN/gamedata/excel/character_table.json`,
|
||||
`https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/excel/character_table.json`,
|
||||
character_table_json
|
||||
)
|
||||
await githubDownload(
|
||||
`https://api.github.com/repos/Kengxxiao/ArknightsGameData/commits?path=zh_CN/gamedata/excel/skin_table.json`,
|
||||
`https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/excel/skin_table.json`,
|
||||
skin_table_json
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user