Commit 421051af authored by Chunchi Che's avatar Chunchi Che

remove pre-rerelease

parent 5d65cf42
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
], ],
"assetsPath": "/neos-assets", "assetsPath": "/neos-assets",
"releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb",
"preReleaseDbUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.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", "stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf", "lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"replayUrl": "replay.neos.moe", "replayUrl": "replay.neos.moe",
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"version": 4960, "version": 4960,
"servers": [{ "servers": [{
"name": "koishi", "name": "koishi",
"ip": "koishi.momobako.com", "ip": "127.0.0.1",
"port": "7211" "port": "8080"
}, },
{ {
"name": "mycard-athletic", "name": "mycard-athletic",
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
], ],
"assetsPath": "/neos-assets", "assetsPath": "/neos-assets",
"releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "releaseImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "releaseDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb",
"preReleaseDbUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.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", "stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf", "lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"replayUrl": "replay.neos.moe", "replayUrl": "replay.neos.moe",
......
...@@ -5,4 +5,3 @@ export * from "./mycard"; ...@@ -5,4 +5,3 @@ export * from "./mycard";
export * from "./ocgcore/idl/ocgcore"; export * from "./ocgcore/idl/ocgcore";
export * from "./ocgcore/ocgHelper"; export * from "./ocgcore/ocgHelper";
export * from "./strings"; export * from "./strings";
export * from "./superPreRelease";
import { useConfig } from "@/config";
const { preReleaseConfig } = useConfig();
interface SuperPreInfo {
/* only use id currently, other fields see:
* https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json
* */
id: number;
}
let superPreList: SuperPreInfo[] = [];
export async function initSuperPrerelease() {
const json = await (await fetch(preReleaseConfig)).text();
const list: SuperPreInfo[] = JSON.parse(json);
superPreList = list;
}
export function isSuperReleaseCard(code: number): boolean {
if (superPreList.length === 0)
console.warn("Super pre release config has not been initialized!");
return superPreList.find(({ id }) => id === code) !== undefined;
}
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import initSqlJs, { Database } from "sql.js"; import initSqlJs, { Database } from "sql.js";
import { isSuperReleaseCard } from "@/api";
import { CardData, CardMeta, CardText } from "@/api/cards"; import { CardData, CardMeta, CardText } from "@/api/cards";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { pfetch } from "@/infra"; import { pfetch } from "@/infra";
...@@ -30,7 +29,6 @@ export interface sqliteAction<T extends sqliteCmd> { ...@@ -30,7 +29,6 @@ export interface sqliteAction<T extends sqliteCmd> {
// 初始化DB需要业务方传入的数据 // 初始化DB需要业务方传入的数据
initInfo?: { initInfo?: {
releaseDbUrl: string; releaseDbUrl: string;
preReleaseDbUrl: string;
progressCallback?: (progress: number) => void; // 用于获取读取进度 progressCallback?: (progress: number) => void; // 用于获取读取进度
}; };
payload?: { payload?: {
...@@ -57,10 +55,9 @@ export default function <T extends sqliteCmd>( ...@@ -57,10 +55,9 @@ export default function <T extends sqliteCmd>(
// TODO: may defining a class be better? // TODO: may defining a class be better?
interface YgoDbs { interface YgoDbs {
release: Database | null; release: Database | null;
preRelease: Database | null;
} }
let YGODBS: YgoDbs = { release: null, preRelease: null }; let YGODBS: YgoDbs = { release: null };
// FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败 // FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败
function helper<T extends sqliteCmd>(action: sqliteAction<T>) { function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
...@@ -71,39 +68,24 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) { ...@@ -71,39 +68,24 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
const releasePromise = pfetch(info.releaseDbUrl, { const releasePromise = pfetch(info.releaseDbUrl, {
progressCallback: action.initInfo?.progressCallback, progressCallback: action.initInfo?.progressCallback,
}).then((res) => res.arrayBuffer()); // TODO: i18n }).then((res) => res.arrayBuffer()); // TODO: i18n
const preReleasePromise = pfetch(info.preReleaseDbUrl, {
progressCallback: action.initInfo?.progressCallback, return Promise.all([sqlPromise, releasePromise]).then(
}).then((res) => res.arrayBuffer()); ([SQL, releaseBuffer]) => {
YGODBS.release = new SQL.Database(new Uint8Array(releaseBuffer));
return Promise.all([
sqlPromise, console.log("YGODB inited!");
releasePromise, },
preReleasePromise, );
]).then(([SQL, releaseBuffer, preReleaseBuffer]) => {
YGODBS.release = new SQL.Database(new Uint8Array(releaseBuffer));
YGODBS.preRelease = new SQL.Database(
new Uint8Array(preReleaseBuffer),
);
console.log("YGODB inited!");
});
} else { } else {
console.warn("init YGODB action without initInfo"); console.warn("init YGODB action without initInfo");
return {}; return {};
} }
} }
case sqliteCmd.SELECT: { case sqliteCmd.SELECT: {
if ( if (YGODBS.release && action.payload && action.payload.id) {
YGODBS.release &&
YGODBS.preRelease &&
action.payload &&
action.payload.id
) {
const code = action.payload.id; const code = action.payload.id;
const db = isSuperReleaseCard(code) const db = YGODBS.release;
? YGODBS.preRelease
: YGODBS.release;
const dataStmt = db.prepare("SELECT * FROM datas WHERE ID = $id"); const dataStmt = db.prepare("SELECT * FROM datas WHERE ID = $id");
const dataResult = dataStmt.getAsObject({ $id: code }); const dataResult = dataStmt.getAsObject({ $id: code });
...@@ -123,22 +105,8 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) { ...@@ -123,22 +105,8 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
return {}; return {};
} }
case sqliteCmd.FTS: { case sqliteCmd.FTS: {
if ( if (YGODBS.release && action.payload && action.payload.ftsParams) {
YGODBS.release && const metas = invokeFts(YGODBS.release, action.payload.ftsParams);
YGODBS.preRelease &&
action.payload &&
action.payload.ftsParams
) {
const releaseMetas = invokeFts(
YGODBS.release,
action.payload.ftsParams,
);
const preReleaseMetas = invokeFts(
YGODBS.preRelease,
action.payload.ftsParams,
);
const metas = releaseMetas.concat(preReleaseMetas);
return { ftsResult: metas }; return { ftsResult: metas };
} else { } else {
......
...@@ -26,7 +26,6 @@ import { ...@@ -26,7 +26,6 @@ import {
initForbidden, initForbidden,
initI18N, initI18N,
initSqlite, initSqlite,
initSuper,
initWASM, initWASM,
} from "./utils"; } from "./utils";
...@@ -39,7 +38,6 @@ export const loader: LoaderFunction = async () => { ...@@ -39,7 +38,6 @@ export const loader: LoaderFunction = async () => {
initWASM(); initWASM();
initForbidden(); initForbidden();
initI18N(); initI18N();
initSuper();
return null; return null;
}; };
......
...@@ -5,14 +5,13 @@ import { ...@@ -5,14 +5,13 @@ import {
forbidden, forbidden,
getCookie, getCookie,
initStrings, initStrings,
initSuperPrerelease,
setCookie, setCookie,
} from "@/api"; } from "@/api";
import { useConfig } from "@/config"; 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 { releaseDbUrl } = useConfig();
const { BASE_URL } = useEnv(); const { BASE_URL } = useEnv();
/** 加载ygodb */ /** 加载ygodb */
...@@ -24,7 +23,7 @@ export const initSqlite = async () => { ...@@ -24,7 +23,7 @@ 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, progressCallback },
}); });
sqlite.progress = 1; sqlite.progress = 1;
} }
...@@ -64,14 +63,6 @@ export const initI18N = async () => { ...@@ -64,14 +63,6 @@ export const initI18N = async () => {
} }
}; };
/** 加载超先行服配置 */
export const initSuper = async () => {
if (!initStore.superprerelease) {
await initSuperPrerelease();
initStore.superprerelease = true;
}
};
/** sso登录跳转回来 */ /** sso登录跳转回来 */
export const handleSSOLogin = async (search: string) => { export const handleSSOLogin = async (search: string) => {
/** 从SSO跳转回的URL之中,解析用户信息 */ /** 从SSO跳转回的URL之中,解析用户信息 */
......
import rustInit from "rust-src"; import rustInit from "rust-src";
import { initStrings, initSuperPrerelease } from "@/api"; import { initStrings } from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import socketMiddleWare, { socketCmd } from "@/middleware/socket"; import socketMiddleWare, { socketCmd } from "@/middleware/socket";
import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite"; import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite";
...@@ -27,16 +27,12 @@ export const connectSrvpro = async (params: { ...@@ -27,16 +27,12 @@ export const connectSrvpro = async (params: {
cmd: sqliteCmd.INIT, cmd: sqliteCmd.INIT,
initInfo: { initInfo: {
releaseDbUrl: NeosConfig.releaseDbUrl, releaseDbUrl: NeosConfig.releaseDbUrl,
preReleaseDbUrl: NeosConfig.preReleaseDbUrl,
}, },
}); });
// 初始化I18N文案 // 初始化I18N文案
await initStrings(); await initStrings();
// 初始化超先行配置
await initSuperPrerelease();
if (params.replay && params.replayData) { if (params.replay && params.replayData) {
// 连接回放websocket服务 // 连接回放websocket服务
socketMiddleWare({ socketMiddleWare({
......
import classNames from "classnames"; import classNames from "classnames";
import { CSSProperties, useMemo } from "react"; import { CSSProperties, useMemo } from "react";
import { isSuperReleaseCard } from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
...@@ -63,9 +62,5 @@ export function getCardImgUrl(code: number, back = false) { ...@@ -63,9 +62,5 @@ export function getCardImgUrl(code: number, back = false) {
return `${ASSETS_BASE}/card_back.jpg`; return `${ASSETS_BASE}/card_back.jpg`;
} }
if (isSuperReleaseCard(code)) { return `${NeosConfig.releaseImgUrl}/${code}.jpg`;
return `${NeosConfig.preReleaseImgUrl}/${code}.jpg`;
} else {
return `${NeosConfig.releaseImgUrl}/${code}.jpg`;
}
} }
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