mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-14 10:28:15 +08:00
add oversea(NA-SiliconValley) api
This commit is contained in:
6
app.js
6
app.js
@@ -1,7 +1,8 @@
|
|||||||
const proxy = require("udp-proxy")
|
const proxy = require("udp-proxy")
|
||||||
const cp = require("child_process")
|
const cp = require("child_process")
|
||||||
const rs = require("./regionServer")
|
const cloud = require("./secret")
|
||||||
const appcenter = require("./appcenter")
|
const appcenter = require("./appcenter")
|
||||||
|
const regionServer = require("./regionServer")
|
||||||
const {
|
const {
|
||||||
initConfig, splitPacket, upload, decodeProto, log, setupHost, KPacket, debug, checkUpdate,
|
initConfig, splitPacket, upload, decodeProto, log, setupHost, KPacket, debug, checkUpdate,
|
||||||
brotliCompressSync, brotliDecompressSync, checkGameIsRunning, checkPortIsUsing
|
brotliCompressSync, brotliDecompressSync, checkGameIsRunning, checkPortIsUsing
|
||||||
@@ -37,13 +38,14 @@ const onExit = () => {
|
|||||||
}
|
}
|
||||||
appcenter.startup()
|
appcenter.startup()
|
||||||
let conf = await initConfig()
|
let conf = await initConfig()
|
||||||
|
cloud.init(conf)
|
||||||
checkPortIsUsing()
|
checkPortIsUsing()
|
||||||
checkGameIsRunning()
|
checkGameIsRunning()
|
||||||
log("检查更新")
|
log("检查更新")
|
||||||
await checkUpdate()
|
await checkUpdate()
|
||||||
let gameProcess
|
let gameProcess
|
||||||
let unexpectedExit = true
|
let unexpectedExit = true
|
||||||
rs.create(conf,() => {
|
regionServer.create(conf,() => {
|
||||||
setupHost()
|
setupHost()
|
||||||
gameProcess = cp.execFile(conf.executable, { cwd: conf.path },err => {
|
gameProcess = cp.execFile(conf.executable, { cwd: conf.path },err => {
|
||||||
if (err !== null && !err.killed) {
|
if (err !== null && !err.killed) {
|
||||||
|
|||||||
7
utils.js
7
utils.js
@@ -45,7 +45,8 @@ const initConfig = async () => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conf = {
|
conf = {
|
||||||
path: []
|
path: [],
|
||||||
|
oversea_api: false
|
||||||
}
|
}
|
||||||
const p = path.dirname(native.selectGameExecutable())
|
const p = path.dirname(native.selectGameExecutable())
|
||||||
await checkPath(p).catch(reason => {
|
await checkPath(p).catch(reason => {
|
||||||
@@ -55,6 +56,10 @@ const initConfig = async () => {
|
|||||||
conf.path.push(p)
|
conf.path.push(p)
|
||||||
fs.writeFileSync(configFileName, JSON.stringify(conf, null, 2))
|
fs.writeFileSync(configFileName, JSON.stringify(conf, null, 2))
|
||||||
}
|
}
|
||||||
|
if (conf.oversea_api === undefined) {
|
||||||
|
conf.oversea_api = false
|
||||||
|
fs.writeFileSync(configFileName, JSON.stringify(conf, null, 2))
|
||||||
|
}
|
||||||
if (conf.path.length === 1) {
|
if (conf.path.length === 1) {
|
||||||
await checkPath(conf.path[0]).catch(reason => {
|
await checkPath(conf.path[0]).catch(reason => {
|
||||||
console.log(reason)
|
console.log(reason)
|
||||||
|
|||||||
Reference in New Issue
Block a user