mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-14 18:38:13 +08:00
fix
This commit is contained in:
4
app.js
4
app.js
@@ -134,10 +134,14 @@ const { exportData } = require("./export");
|
||||
return server
|
||||
}).then(() => console.log("加载完毕"))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
if (e instanceof Error) {
|
||||
appcenter.uploadError(e, true)
|
||||
} else {
|
||||
appcenter.uploadError(Error(e), true)
|
||||
}
|
||||
console.log("按任意键退出")
|
||||
cp.execSync("pause > nul", { stdio: "inherit" })
|
||||
process.exit(0)
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message AllAchievement {
|
||||
repeated Achievement list = 1;
|
||||
}
|
||||
|
||||
message Achievement {
|
||||
|
||||
enum Status {
|
||||
INVALID = 0;
|
||||
UNFINISHED = 1;
|
||||
FINISHED = 2;
|
||||
REWARD_TAKEN = 3;
|
||||
}
|
||||
|
||||
uint32 id = 1;
|
||||
Status status = 2;
|
||||
uint32 current = 3;
|
||||
uint32 require = 4;
|
||||
uint32 finish_timestamp = 5;
|
||||
|
||||
}
|
||||
@@ -1,13 +1,34 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message AllAchievement {
|
||||
repeated Achievement list = 1;
|
||||
}
|
||||
|
||||
message Achievement {
|
||||
|
||||
enum Status {
|
||||
INVALID = 0;
|
||||
UNFINISHED = 1;
|
||||
FINISHED = 2;
|
||||
REWARD_TAKEN = 3;
|
||||
}
|
||||
|
||||
uint32 id = 1;
|
||||
Status status = 2;
|
||||
uint32 current = 3;
|
||||
uint32 require = 4;
|
||||
uint32 finish_timestamp = 5;
|
||||
|
||||
}
|
||||
|
||||
message QueryCurRegion {
|
||||
bytes field0 = 11;
|
||||
bytes field1 = 12;
|
||||
bytes field2 = 13;
|
||||
RegionInfo info = 3;
|
||||
msg0 info = 3;
|
||||
}
|
||||
|
||||
message RegionInfo {
|
||||
message msg0 {
|
||||
string ip = 1;
|
||||
uint32 port = 2;
|
||||
string field0 = 3;
|
||||
@@ -29,13 +50,27 @@ message RegionInfo {
|
||||
string fieldG = 31;
|
||||
string fieldH = 32;
|
||||
string fieldI = 33;
|
||||
ResVersionConfig fieldJ = 22;
|
||||
msg1 fieldJ = 22;
|
||||
}
|
||||
|
||||
message ResVersionConfig {
|
||||
message msg1 {
|
||||
uint32 field0 = 1;
|
||||
string field1 = 3;
|
||||
string field2 = 4;
|
||||
string field3 = 5;
|
||||
string field4 = 6;
|
||||
}
|
||||
|
||||
message QueryRegionList {
|
||||
bytes field0 = 5;
|
||||
bytes field1 = 6;
|
||||
bool field2 = 7;
|
||||
repeated msg2 list = 2;
|
||||
}
|
||||
|
||||
message msg2 {
|
||||
string field0 = 1;
|
||||
string field1 = 2;
|
||||
string field2 = 3;
|
||||
string url = 4;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message QueryRegionList {
|
||||
bytes field0 = 5;
|
||||
bytes field1 = 6;
|
||||
bool field2 = 7;
|
||||
repeated RegionSimpleInfo list = 2;
|
||||
}
|
||||
|
||||
message RegionSimpleInfo {
|
||||
string field0 = 1;
|
||||
string field1 = 2;
|
||||
string field2 = 3;
|
||||
string url = 4;
|
||||
}
|
||||
@@ -2,6 +2,8 @@ const fs = require("fs")
|
||||
const https = require("https")
|
||||
const axios = require("axios")
|
||||
const { decodeProto, encodeProto, debug } = require("./utils")
|
||||
const path = require("path")
|
||||
const cert = path.join(__dirname, "./cert/root.p12")
|
||||
|
||||
const preparedRegions = {}
|
||||
let currentProxy = undefined
|
||||
@@ -64,7 +66,7 @@ const create = async (conf, regionListLoadedCallback, regionSelectCallback) => {
|
||||
const regions = await getModifiedRegionList(conf)
|
||||
regionListLoadedCallback()
|
||||
const hServer = https.createServer({
|
||||
pfx: fs.readFileSync("./cert/root.p12"),
|
||||
pfx: fs.readFileSync(cert),
|
||||
passphrase: ""
|
||||
}, async (request, response) => {
|
||||
const url = request.url
|
||||
|
||||
6
utils.js
6
utils.js
@@ -8,6 +8,8 @@ const readline = require("readline")
|
||||
const protobuf = require("protobufjs")
|
||||
const { version } = require("./version")
|
||||
const { createHash } = require("crypto")
|
||||
const path = require("path")
|
||||
const messages = path.join(__dirname, "./proto/Messages.proto")
|
||||
|
||||
let axios = require("axios")
|
||||
|
||||
@@ -15,13 +17,13 @@ const sleep = ms => new Promise(resolve => {
|
||||
setTimeout(resolve, ms)
|
||||
})
|
||||
|
||||
const encodeProto = (object, name) => protobuf.load(`proto/${name}.proto`).then(r => {
|
||||
const encodeProto = (object, name) => protobuf.load(messages).then(r => {
|
||||
const msgType = r.lookupType(name)
|
||||
const msgInst = msgType.create(object)
|
||||
return msgType.encode(msgInst).finish()
|
||||
})
|
||||
|
||||
const decodeProto = (buf, name) => protobuf.load(`proto/${name}.proto`).then(r => {
|
||||
const decodeProto = (buf, name) => protobuf.load(messages).then(r => {
|
||||
return r.lookupType(name).decode(buf)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user