From 88702085bba7e94732a86ebe434f3dbbeb37282a Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:49:31 -0500 Subject: [PATCH] [-] Remove unnecessary showOpenFilePicker library --- AquaNet/package.json | 1 - AquaNet/src/components/RatingCompSong.svelte | 2 -- AquaNet/src/libs/i18n/en_ref.ts | 2 +- AquaNet/src/libs/i18n/zh.ts | 2 +- .../src/pages/Home/ImportDataAction.svelte | 27 +++++++------------ 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/AquaNet/package.json b/AquaNet/package.json index cce9c24f..1f9f6506 100644 --- a/AquaNet/package.json +++ b/AquaNet/package.json @@ -40,7 +40,6 @@ "lxgw-wenkai-lite-webfont": "^1.7.0", "modern-normalize": "^3.0.1", "moment": "^2.30.1", - "show-open-file-picker": "^0.2.2" }, "packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf" } diff --git a/AquaNet/src/components/RatingCompSong.svelte b/AquaNet/src/components/RatingCompSong.svelte index 925cc585..5e5d42e9 100644 --- a/AquaNet/src/components/RatingCompSong.svelte +++ b/AquaNet/src/components/RatingCompSong.svelte @@ -19,8 +19,6 @@ let mapRank: number | undefined = meta?.notes?.[mapData[1] === 10 ? 0 : mapData[1]]?.lv const rounding = useLocalStorage("rounding", true); - console.log(rounding.value) - let gameIndexMap = { 'mai2': 3, 'ongeki': 2, diff --git a/AquaNet/src/libs/i18n/en_ref.ts b/AquaNet/src/libs/i18n/en_ref.ts index 87539149..bdda8016 100644 --- a/AquaNet/src/libs/i18n/en_ref.ts +++ b/AquaNet/src/libs/i18n/en_ref.ts @@ -113,7 +113,7 @@ export const EN_REF_HOME = { 'home.setup.ask': 'If you have any questions, please ask in our', 'home.setup.support': 'server', 'home.setup.keychip-tips': 'This is your unique keychip, do not share it with anyone', - 'home.import.unknown-game': 'Unknown game type', + 'home.import.unknown-game': 'Unknown game type. Currently only maimai and chunithm are supported for importing.', 'home.import.new-data': 'Data to import', 'home.import.data-conflict': 'Proceed will override your current data', } diff --git a/AquaNet/src/libs/i18n/zh.ts b/AquaNet/src/libs/i18n/zh.ts index eb64f6b7..fbb52218 100644 --- a/AquaNet/src/libs/i18n/zh.ts +++ b/AquaNet/src/libs/i18n/zh.ts @@ -122,7 +122,7 @@ const zhHome: typeof EN_REF_HOME = { 'home.setup.ask': "如果您有任何问题, 请加入我们的", 'home.setup.support': "以获取支持", 'home.setup.keychip-tips': "这是你的狗号, 不要与任何人分享", - 'home.import.unknown-game': '未知游戏类型', + 'home.import.unknown-game': '未知游戏类型 (目前导入只支持舞萌和中二)', 'home.import.new-data': '要导入的数据', 'home.import.data-conflict': '继续导入将覆盖现有数据', } diff --git a/AquaNet/src/pages/Home/ImportDataAction.svelte b/AquaNet/src/pages/Home/ImportDataAction.svelte index 42c763af..52f44bb6 100644 --- a/AquaNet/src/pages/Home/ImportDataAction.svelte +++ b/AquaNet/src/pages/Home/ImportDataAction.svelte @@ -5,7 +5,6 @@ import StatusOverlays from "../../components/StatusOverlays.svelte"; import { CARD, GAME, USER } from "../../libs/sdk"; import Icon from "@iconify/svelte"; - import { showOpenFilePicker } from 'show-open-file-picker' let load = false; let error = ""; @@ -17,25 +16,14 @@ } | null; let confirmAction: (override: boolean) => void; - const startImport = async () => { - const [fileHandle] = await (window.showOpenFilePicker || showOpenFilePicker)({ - id: 'aquadx_import' as any, - startIn: 'downloads', - types: [ - { - description: "Aqua Player Data", - accept: { - "application/json": [".json"], - }, - }, - ], - }); + let fileInput: HTMLInputElement; + const startImport = async (e: Event & { currentTarget: EventTarget & HTMLInputElement; }) => { + const file = e.currentTarget.files?.[0] - if (!fileHandle) return; + if (!file) return; load = true; try { - const file = await fileHandle.getFile(); const data = JSON.parse(await file.text()) as any; const me = await USER.me(); @@ -68,6 +56,7 @@ location.href = `/u/${me.username}/${game}`; } catch (e: any) { error = e.message; + console.error(e); } finally { conflict = null; load = false; @@ -75,7 +64,7 @@ } const getGameByCode = (code: string) => { - switch (code.toUpperCase()) { + switch (code?.toUpperCase()) { case 'SDEZ': return 'mai2'; case 'SDHD': @@ -86,9 +75,11 @@ } - + fileInput.click()}>

{t('home.import')}

{t('home.import-description')} +