Commit 89b0e9c9 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/super-pre-release' into 'main'

动态加载超先行卡列表

See merge request !356
parents c6d45cc7 f9d61019
Pipeline #26154 passed with stages
in 8 minutes and 44 seconds
......@@ -62,7 +62,6 @@ ts_check_lint:
tags:
- linux
script:
- sh sync_super_prerelease.sh
- npx tsc
- npm run lint
......@@ -74,7 +73,6 @@ npm_build:
tags:
- linux
script:
- sh sync_super_prerelease.sh
- cp neos.config.prod.json neos.config.json
- npm run build:prod
artifacts:
......
......@@ -26,6 +26,7 @@
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"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",
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"replayUrl": "replay.neos.moe",
......
......@@ -26,6 +26,7 @@
"preReleaseImgUrl": "https://cdn02.moecube.com:444/ygopro-super-pre/data/pics",
"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",
"lflistUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/lflist.conf",
"replayUrl": "replay.neos.moe",
......
......@@ -5,3 +5,4 @@ export * from "./mycard";
export * from "./ocgcore/idl/ocgcore";
export * from "./ocgcore/ocgHelper";
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,10 +7,10 @@
import initSqlJs, { Database } from "sql.js";
import { isSuperReleaseCard } from "@/api";
import { CardData, CardMeta, CardText } from "@/api/cards";
import { useConfig } from "@/config";
import { pfetch } from "@/infra";
import { isSuperReleaseCard } from "@/superPreRelease";
import { FtsParams, invokeFts } from "./fts";
......
......@@ -10,6 +10,7 @@ export const initStore = proxy({
i18n: false,
wasm: false,
forbidden: false, // 禁卡表
superprerelease: false, // 超先行
// ...
reset() {},
} satisfies NeosStore);
import SuperReleaseData from "../../super-pre-release.json";
export function isSuperReleaseCard(code: number): boolean {
return SuperReleaseData.find((id) => id === code) !== undefined;
}
......@@ -26,6 +26,7 @@ import {
initForbidden,
initI18N,
initSqlite,
initSuper,
initWASM,
} from "./utils";
......@@ -38,6 +39,7 @@ export const loader: LoaderFunction = async () => {
initWASM();
initForbidden();
initI18N();
initSuper();
return null;
};
......
......@@ -5,6 +5,7 @@ import {
forbidden,
getCookie,
initStrings,
initSuperPrerelease,
setCookie,
} from "@/api";
import { useConfig } from "@/config";
......@@ -63,6 +64,14 @@ export const initI18N = async () => {
}
};
/** 加载超先行服配置 */
export const initSuper = async () => {
if (!initStore.superprerelease) {
await initSuperPrerelease();
initStore.superprerelease = true;
}
};
/** sso登录跳转回来 */
export const handleSSOLogin = async (search: string) => {
/** 从SSO跳转回的URL之中,解析用户信息 */
......
import rustInit from "rust-src";
import { initStrings } from "@/api";
import { initStrings, initSuperPrerelease } from "@/api";
import { useConfig } from "@/config";
import socketMiddleWare, { socketCmd } from "@/middleware/socket";
import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite";
......@@ -34,6 +34,9 @@ export const connectSrvpro = async (params: {
// 初始化I18N文案
await initStrings();
// 初始化超先行配置
await initSuperPrerelease();
if (params.replay && params.replayData) {
// 连接回放websocket服务
socketMiddleWare({
......
import classNames from "classnames";
import { CSSProperties, useMemo } from "react";
import { isSuperReleaseCard } from "@/api";
import { useConfig } from "@/config";
import { isSuperReleaseCard } from "@/superPreRelease";
import styles from "./index.module.scss";
......
[
101204092,
101205074,
100230201,
100220201,
100220202,
100220203,
100220204,
100220205,
100220206,
101205007,
101205008,
101205009,
101205042,
101205043,
101205056,
101205070,
101205025,
101205026,
101205041,
101205045,
101205051,
101205022,
101205032,
101205076,
101205017,
101205035,
101205036,
101205046,
101205047,
101205061,
101205062,
101205072,
101205000,
101205001,
101205002,
101205003,
101205004,
101205005,
101205006,
101205033,
101205053,
101205054,
101205055,
101205068,
101205069
]
#!/bin/bash
# 更新超先行服卡片列表
curl --proto '=https' --tlsv1.2 -sS https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release-v2.json | jq '[.[].id]' > super-pre-release.json
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