Commit 7d557654 authored by chechunchi's avatar chechunchi

refactor neos.config.json

parent a7d6c103
Pipeline #30259 passed with stages
in 14 minutes and 45 seconds
{ {
"version": 4961, "version": 4961,
"servers": [{ "servers": [
"name": "koishi", {
"ip": "koishi.momobako.com", "name": "koishi",
"port": "7211" "ip": "koishi.momobako.com",
}, "port": "7211"
{ },
"name": "mycard-athletic", {
"ip": "tiramisu.moecube.com", "name": "mycard-athletic",
"port": "8912" "ip": "tiramisu.moecube.com",
}, "port": "8912"
{ },
"name": "mycard-custom", {
"ip": "tiramisu.moecube.com", "name": "mycard-custom",
"port": "7912" "ip": "tiramisu.moecube.com",
}, "port": "7912"
{ },
"name": "pre-release", {
"ip": "koishi.momobako.com", "name": "pre-release",
"port": "889" "ip": "koishi.momobako.com",
} "port": "889"
], }
"assetsPath": "/neos-assets", ],
"releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "assetsPath": "/neos-assets",
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics", "releaseResource": {
"releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "img": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"preReleaseDbUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.cdb", "cdb": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb"
"preReleaseConfig": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json", },
"stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf", "preReleaseResource": {
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf", "img": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"replayUrl": "replay.neos.moe", "cdb": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.cdb",
"loginUrl": "https://accounts.moecube.com/signin", "config": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json"
"logoutUrl": "https://accounts.moecube.com/signout", },
"profileUrl": "https://accounts.moecube.com/profiles", "stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"athleticWatchUrl": "wss://tiramisu.moecube.com:8923", "lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"entertainWatchUrl": "wss://tiramisu.moecube.com:7923", "replayUrl": "replay.neos.moe",
"userApi": "https://sapi.moecube.com:444/accounts/users/{username}.json", "loginUrl": "https://accounts.moecube.com/signin",
"logoutUrl": "https://accounts.moecube.com/signout",
"profileUrl": "https://accounts.moecube.com/profiles",
"athleticWatchUrl": "wss://tiramisu.moecube.com:8923",
"entertainWatchUrl": "wss://tiramisu.moecube.com:7923",
"userApi": "https://sapi.moecube.com:444/accounts/users/{username}.json",
"mdproServer": "https://rarnu.xyz:38443", "mdproServer": "https://rarnu.xyz:38443",
"agentServer": "https://sapi.moecube.com:444/neos-ai-agent", "agentServer": "https://sapi.moecube.com:444/neos-ai-agent",
"streamInterval": 20, "startDelay": 1000,
"startDelay": 1000, "ui": {
"ui": { "hint": {
"hint": { "maxCount": 1
"maxCount": 1 }
} }
},
"unimplementedWhiteList": [
1,
6,
7,
34,
54,
55,
56,
60,
61,
62,
63,
64,
65,
70,
71,
72,
73,
74,
75,
76,
80,
81,
83,
93,
95,
96,
97,
101,
102,
110,
111,
112,
113,
114,
120,
121,
122,
123,
130,
131,
132,
133,
160,
161,
163,
164,
165,
170,
180,
230,
231,
236
]
} }
{ {
"version": 4961, "version": 4961,
"servers": [{ "servers": [
"name": "koishi", {
"ip": "koishi.momobako.com", "name": "koishi",
"port": "7211" "ip": "koishi.momobako.com",
}, "port": "7211"
{ },
"name": "mycard-athletic", {
"ip": "tiramisu.moecube.com", "name": "mycard-athletic",
"port": "8912" "ip": "tiramisu.moecube.com",
}, "port": "8912"
{ },
"name": "mycard-custom", {
"ip": "tiramisu.moecube.com", "name": "mycard-custom",
"port": "7912" "ip": "tiramisu.moecube.com",
}, "port": "7912"
{ },
"name": "pre-release", {
"ip": "koishi.momobako.com", "name": "pre-release",
"port": "889" "ip": "koishi.momobako.com",
} "port": "889"
], }
"assetsPath": "/neos-assets", ],
"releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "assetsPath": "/neos-assets",
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics", "releaseResource": {
"releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "img": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"preReleaseDbUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.cdb", "cdb": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb"
"preReleaseConfig": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json", },
"stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf", "preReleaseResource": {
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf", "img": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"replayUrl": "replay.neos.moe", "cdb": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.cdb",
"loginUrl": "https://accounts.moecube.com/signin", "config": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json"
"logoutUrl": "https://accounts.moecube.com/signout", },
"profileUrl": "https://accounts.moecube.com/profiles", "stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"athleticWatchUrl": "wss://tiramisu.moecube.com:8923", "lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"entertainWatchUrl": "wss://tiramisu.moecube.com:7923", "replayUrl": "replay.neos.moe",
"userApi": "https://sapi.moecube.com:444/accounts/users/{username}.json", "loginUrl": "https://accounts.moecube.com/signin",
"logoutUrl": "https://accounts.moecube.com/signout",
"profileUrl": "https://accounts.moecube.com/profiles",
"athleticWatchUrl": "wss://tiramisu.moecube.com:8923",
"entertainWatchUrl": "wss://tiramisu.moecube.com:7923",
"userApi": "https://sapi.moecube.com:444/accounts/users/{username}.json",
"mdproServer": "https://rarnu.xyz:38443", "mdproServer": "https://rarnu.xyz:38443",
"agentServer": "https://sapi.moecube.com:444/neos-ai-agent", "agentServer": "https://sapi.moecube.com:444/neos-ai-agent",
"streamInterval": 20, "startDelay": 1000,
"startDelay": 1000, "ui": {
"ui": { "hint": {
"hint": { "maxCount": 1
"maxCount": 1 }
} }
},
"unimplementedWhiteList": [
1,
6,
7,
34,
54,
55,
56,
60,
61,
62,
63,
64,
65,
70,
71,
72,
73,
74,
75,
76,
80,
81,
83,
93,
95,
96,
97,
101,
102,
110,
111,
112,
113,
114,
120,
121,
122,
123,
130,
131,
132,
133,
160,
161,
163,
164,
165,
170,
180,
230,
231,
236
]
} }
...@@ -4,7 +4,7 @@ import { FtsParams } from "@/middleware/sqlite/fts"; ...@@ -4,7 +4,7 @@ import { FtsParams } from "@/middleware/sqlite/fts";
import { isSuperReleaseCard } from "./superPreRelease"; import { isSuperReleaseCard } from "./superPreRelease";
const NeosConfig = useConfig(); const { assetsPath, releaseResource, preReleaseResource } = useConfig();
export interface CardMeta { export interface CardMeta {
id: number; id: number;
...@@ -80,33 +80,31 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined { ...@@ -80,33 +80,31 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined {
export function getCardImgUrl(code: number, back = false) { export function getCardImgUrl(code: number, back = false) {
const ASSETS_BASE = const ASSETS_BASE =
import.meta.env.BASE_URL === "/" import.meta.env.BASE_URL === "/"
? NeosConfig.assetsPath ? assetsPath
: `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`; : `${import.meta.env.BASE_URL}${assetsPath}`;
if (back || code === 0) { if (back || code === 0) {
return `${ASSETS_BASE}/card_back.jpg`; return `${ASSETS_BASE}/card_back.jpg`;
} } else if (isSuperReleaseCard(code)) {
return `${preReleaseResource.img}/${code}.jpg`;
} else {
// Define translations for different languages (I18N)
const language = localStorage.getItem("language");
let imgUrl;
// Define translations for different languages (I18N) switch (language) {
const language = localStorage.getItem("language"); case "en":
let imgUrl; case "br":
case "pt":
case "fr":
case "es":
imgUrl = releaseResource.img.replace("zh-CN", "en-US");
break;
default:
imgUrl = releaseResource.img;
break;
}
/* End of definition (I18N) */
switch (language) {
case "en":
case "br":
case "pt":
case "fr":
case "es":
imgUrl = NeosConfig.releaseImgUrl.replace("zh-CN", "en-US");
break;
default:
imgUrl = NeosConfig.releaseImgUrl;
break;
}
/* End of definition (I18N) */
if (isSuperReleaseCard(code)) {
return `${NeosConfig.preReleaseImgUrl}/${code}.jpg`;
} else {
return `${imgUrl}/${code}.jpg`; return `${imgUrl}/${code}.jpg`;
} }
} }
import { useConfig } from "@/config"; import { useConfig } from "@/config";
const { preReleaseConfig } = useConfig(); const {
preReleaseResource: { config },
} = useConfig();
interface SuperPreInfo { interface SuperPreInfo {
/* only use id currently, other fields see: /* only use id currently, other fields see:
...@@ -12,7 +14,7 @@ interface SuperPreInfo { ...@@ -12,7 +14,7 @@ interface SuperPreInfo {
let superPreList: SuperPreInfo[] = []; let superPreList: SuperPreInfo[] = [];
export async function initSuperPrerelease() { export async function initSuperPrerelease() {
const json = await (await fetch(preReleaseConfig)).text(); const json = await (await fetch(config)).text();
const list: SuperPreInfo[] = JSON.parse(json); const list: SuperPreInfo[] = JSON.parse(json);
superPreList = list; superPreList = list;
} }
......
...@@ -69,7 +69,6 @@ export class WebSocketStream { ...@@ -69,7 +69,6 @@ export class WebSocketStream {
// but now it seems that we don't need wait any more, // but now it seems that we don't need wait any more,
// so comment the following line and check if it's ok without it. // so comment the following line and check if it's ok without it.
// //
// await sleep(useConfig().streamInterval);
await onMessage(value); await onMessage(value);
} else { } else {
console.warn("value from ReadableStream is undefined!"); console.warn("value from ReadableStream is undefined!");
......
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { useConfig } from "@/config";
import { Container } from "@/container"; import { Container } from "@/container";
const NeosConfig = useConfig(); const UNIMPLEMENTED_WHITE_LIST = [
1, 6, 7, 34, 54, 55, 56, 60, 61, 62, 63, 64, 65, 70, 71, 72, 73, 74, 75, 76,
80, 81, 83, 93, 95, 96, 97, 101, 102, 110, 111, 112, 113, 114, 120, 121, 122,
123, 130, 131, 132, 133, 160, 161, 163, 164, 165, 170, 180, 230, 231, 236,
];
export default ( export default (
container: Container, container: Container,
unimplemented: ygopro.StocGameMessage.MsgUnimplemented, unimplemented: ygopro.StocGameMessage.MsgUnimplemented,
) => { ) => {
if (!NeosConfig.unimplementedWhiteList.includes(unimplemented.command)) { if (!UNIMPLEMENTED_WHITE_LIST.includes(unimplemented.command)) {
container.context.matStore.unimplemented = unimplemented.command; container.context.matStore.unimplemented = unimplemented.command;
} }
}; };
...@@ -12,7 +12,7 @@ import { useConfig } from "@/config"; ...@@ -12,7 +12,7 @@ import { useConfig } from "@/config";
import { useEnv } from "@/hook"; import { useEnv } from "@/hook";
import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite"; import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite";
import { accountStore, deckStore, initStore, type User } from "@/stores"; import { accountStore, deckStore, initStore, type User } from "@/stores";
const { releaseDbUrl, preReleaseDbUrl } = useConfig(); const { releaseResource, preReleaseResource } = useConfig();
const { BASE_URL } = useEnv(); const { BASE_URL } = useEnv();
/** 加载ygodb */ /** 加载ygodb */
...@@ -24,7 +24,11 @@ export const initSqlite = async () => { ...@@ -24,7 +24,11 @@ export const initSqlite = async () => {
sqlite.progress = 0.01; sqlite.progress = 0.01;
await sqliteMiddleWare({ await sqliteMiddleWare({
cmd: sqliteCmd.INIT, cmd: sqliteCmd.INIT,
initInfo: { releaseDbUrl, preReleaseDbUrl, progressCallback }, initInfo: {
releaseDbUrl: releaseResource.cdb,
preReleaseDbUrl: preReleaseResource.cdb,
progressCallback,
},
}); });
sqlite.progress = 1; sqlite.progress = 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment