add native freesr
All checks were successful
Gitea Auto Deploy / Deploy-Container (push) Successful in 1m50s

This commit is contained in:
2025-08-14 12:14:02 +07:00
parent 03affc8593
commit 586241d3ec
3 changed files with 21 additions and 5 deletions

View File

@@ -59,6 +59,7 @@ export default function FreeSRImport() {
const handlerReadFile = (event: React.ChangeEvent<HTMLInputElement>) => {
setIsLoading(true)
const file = event.target.files?.[0];
console.log(event.target.files)
if (!file) {
setSelectedCharacters([])
setFreeSRData(null)
@@ -104,10 +105,11 @@ export default function FreeSRImport() {
})) ?? [],
} as CharacterInfoCardType
}));
} catch {
} catch (e) {
console.log(e)
setSelectedCharacters([])
setFreeSRData(null)
setError(transI18n("fileIsNotAValidFreeSRJsonFile"))
setError(transI18n("fileMustBeAValidJsonFile"))
}
};
reader.readAsText(file);

View File

@@ -28,7 +28,7 @@ export interface AvatarData {
}
export interface AvatarJson {
owner_uid: number;
owner_uid?: number;
avatar_id: number;
data: AvatarData;
level: number;
@@ -64,12 +64,18 @@ export interface BattleConfigJson {
path_resonance_id: number;
monsters: MonsterJson[][];
}
type LoadoutJson = {
name: string
avatar_id: number
relic_list: string[]
}
export interface FreeSRJson {
key?: string;
lightcones: LightconeJson[];
relics: RelicJson[];
avatars: { [key: string]: AvatarJson };
battle_config: BattleConfigJson;
loadout?: LoadoutJson[];
}
export interface PSResponse {

View File

@@ -32,7 +32,7 @@ export const avatarDataSchema = z.object({
});
export const avatarJsonSchema = z.object({
owner_uid: z.number(),
owner_uid: z.number().optional(),
avatar_id: z.number(),
data: avatarDataSchema,
level: z.number(),
@@ -69,11 +69,19 @@ export const battleConfigJsonSchema = z.object({
monsters: z.array(z.array(monsterJsonSchema)),
});
export const loadoutJsonSchema = z.object({
name: z.string(),
avatar_id: z.number(),
relic_list: z.array(z.string()),
});
export const freeSRJsonSchema = z.object({
key: z.string().optional(),
lightcones: z.array(lightconeJsonSchema),
relics: z.array(relicJsonSchema),
avatars: z.record(avatarJsonSchema),
battle_config: battleConfigJsonSchema,
loadout: z.array(loadoutJsonSchema).optional(),
});
export const pSResponseSchema = z.object({