Merge remote-tracking branch 'upstream/main' into splashcat-exporter
commit
186ef7dcca
|
|
@ -16,6 +16,7 @@
|
||||||
"https://deno.land/std@0.160.0/bytes/mod.ts": "b2e342fd3669176a27a4e15061e9d588b89c1aaf5008ab71766e23669565d179",
|
"https://deno.land/std@0.160.0/bytes/mod.ts": "b2e342fd3669176a27a4e15061e9d588b89c1aaf5008ab71766e23669565d179",
|
||||||
"https://deno.land/std@0.160.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2",
|
"https://deno.land/std@0.160.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2",
|
||||||
"https://deno.land/std@0.160.0/flags/mod.ts": "686b6b36e14b00f11c9e26cecf439021158436a6e34f60eeb0d927f0b169ae20",
|
"https://deno.land/std@0.160.0/flags/mod.ts": "686b6b36e14b00f11c9e26cecf439021158436a6e34f60eeb0d927f0b169ae20",
|
||||||
|
"https://deno.land/std@0.160.0/fmt/colors.ts": "9e36a716611dcd2e4865adea9c4bec916b5c60caad4cdcdc630d4974e6bb8bd4",
|
||||||
"https://deno.land/std@0.160.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289",
|
"https://deno.land/std@0.160.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289",
|
||||||
"https://deno.land/std@0.160.0/io/mod.ts": "6e781ebafd5cdccf9ab4afa1f499b08c513602d023cb08ceebc58758501f78bd",
|
"https://deno.land/std@0.160.0/io/mod.ts": "6e781ebafd5cdccf9ab4afa1f499b08c513602d023cb08ceebc58758501f78bd",
|
||||||
"https://deno.land/std@0.160.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6",
|
"https://deno.land/std@0.160.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6",
|
||||||
|
|
@ -32,6 +33,9 @@
|
||||||
"https://deno.land/std@0.160.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9",
|
"https://deno.land/std@0.160.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9",
|
||||||
"https://deno.land/std@0.160.0/path/win32.ts": "ee8826dce087d31c5c81cd414714e677eb68febc40308de87a2ce4b40e10fb8d",
|
"https://deno.land/std@0.160.0/path/win32.ts": "ee8826dce087d31c5c81cd414714e677eb68febc40308de87a2ce4b40e10fb8d",
|
||||||
"https://deno.land/std@0.160.0/streams/conversion.ts": "328afbedee0a7e0c330ac4c7b4c1af569ee53974f970230f6a78f545b93abb9b",
|
"https://deno.land/std@0.160.0/streams/conversion.ts": "328afbedee0a7e0c330ac4c7b4c1af569ee53974f970230f6a78f545b93abb9b",
|
||||||
|
"https://deno.land/std@0.160.0/testing/_diff.ts": "a23e7fc2b4d8daa3e158fa06856bedf5334ce2a2831e8bf9e509717f455adb2c",
|
||||||
|
"https://deno.land/std@0.160.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832",
|
||||||
|
"https://deno.land/std@0.160.0/testing/asserts.ts": "1e340c589853e82e0807629ba31a43c84ebdcdeca910c4a9705715dfdb0f5ce8",
|
||||||
"https://deno.land/std@0.160.0/uuid/_common.ts": "76e1fdfb03aecf733f7b3a5edc900f5734f2433b359fdb1535f8de72873bdb3f",
|
"https://deno.land/std@0.160.0/uuid/_common.ts": "76e1fdfb03aecf733f7b3a5edc900f5734f2433b359fdb1535f8de72873bdb3f",
|
||||||
"https://deno.land/std@0.160.0/uuid/mod.ts": "e57ba10200d75f2b17570f13eba19faa6734b1be2da5091e2c01039df41274a5",
|
"https://deno.land/std@0.160.0/uuid/mod.ts": "e57ba10200d75f2b17570f13eba19faa6734b1be2da5091e2c01039df41274a5",
|
||||||
"https://deno.land/std@0.160.0/uuid/v1.ts": "7123410ef9ce980a4f2e54a586ccde5ed7063f6f119a70d86eebd92f8e100295",
|
"https://deno.land/std@0.160.0/uuid/v1.ts": "7123410ef9ce980a4f2e54a586ccde5ed7063f6f119a70d86eebd92f8e100295",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Tauri + React + Typescript
|
# s3si.ts GUI
|
||||||
|
|
||||||
This template should help get you started developing with Tauri, React and Typescript in Vite.
|
## Development
|
||||||
|
|
||||||
## Recommended IDE Setup
|
```
|
||||||
|
pnpm tauri dev
|
||||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
```
|
||||||
|
|
|
||||||
|
|
@ -11,31 +11,32 @@
|
||||||
"lint": "eslint --max-warnings=0 src"
|
"lint": "eslint --max-warnings=0 src"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^1.3.0",
|
"@tauri-apps/api": "^1.4.0",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
"daisyui": "^2.52.0",
|
"daisyui": "^3.1.7",
|
||||||
"i18next": "^22.5.0",
|
"i18next": "^23.2.6",
|
||||||
"i18next-browser-languagedetector": "^7.0.2",
|
"i18next-browser-languagedetector": "^7.1.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^12.3.1",
|
"react-i18next": "^13.0.1",
|
||||||
"react-icons": "^4.9.0",
|
"react-icons": "^4.10.1",
|
||||||
"react-router-dom": "^6.11.2",
|
"react-router-dom": "^6.14.1",
|
||||||
"react-use": "^17.4.0"
|
"react-use": "^17.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^1.3.1",
|
"@tauri-apps/cli": "^1.4.0",
|
||||||
"@types/node": "^20.2.5",
|
"@types/node": "^20.3.3",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@vitejs/plugin-react": "^4.0.0",
|
"@typescript-eslint/parser": "^5.61.0",
|
||||||
|
"@vitejs/plugin-react": "^4.0.1",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.44.0",
|
||||||
"eslint-config-react-app": "^7.0.1",
|
"eslint-config-react-app": "^7.0.1",
|
||||||
"i18next-http-backend": "^2.2.1",
|
"i18next-http-backend": "^2.2.1",
|
||||||
"postcss": "^8.4.24",
|
"postcss": "^8.4.24",
|
||||||
"tailwindcss": "^3.3.2",
|
"tailwindcss": "^3.3.2",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.1.6",
|
||||||
"vite": "^4.3.9",
|
"vite": "^4.3.9",
|
||||||
"vite-plugin-eslint": "^1.8.1",
|
"vite-plugin-eslint": "^1.8.1",
|
||||||
"vite-tsconfig-paths": "^4.2.0"
|
"vite-tsconfig-paths": "^4.2.0"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -10,14 +10,21 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "1.2", features = [] }
|
tauri-build = { version = "1.4.0", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "1.2", features = ["fs-all", "path-all", "process-relaunch", "shell-execute", "shell-open", "shell-sidecar", "window-all"] }
|
tauri = { version = "1.4.1", features = [
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
"fs-all",
|
||||||
serde_json = "1.0"
|
"path-all",
|
||||||
tokio = { version = "1.0", features = ["time"] }
|
"process-relaunch",
|
||||||
urlencoding = "2.1.2"
|
"shell-execute",
|
||||||
|
"shell-open",
|
||||||
|
"shell-sidecar",
|
||||||
|
"window-all",
|
||||||
|
] }
|
||||||
|
serde = { version = "1.0.164", features = ["derive"] }
|
||||||
|
serde_json = "1.0.97"
|
||||||
|
tokio = { version = "1.28.2", features = ["time"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,12 @@ function onSelectUserClick(e) {
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// very hacky way...
|
// a little official way...
|
||||||
window.ipc.postMessage(JSON.stringify({
|
window.__TAURI_INVOKE__({
|
||||||
"cmd":"tauri",
|
|
||||||
"callback":0,
|
|
||||||
"error":0,
|
|
||||||
"__tauriModule":"Event",
|
"__tauriModule":"Event",
|
||||||
|
"cmd": "tauri",
|
||||||
"message":{"cmd":"emit","event":"login","payload":{"url":element.href}}
|
"message":{"cmd":"emit","event":"login","payload":{"url":element.href}}
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
function detectAndInject() {
|
function detectAndInject() {
|
||||||
const element = document.getElementById('authorize-switch-approval-link');
|
const element = document.getElementById('authorize-switch-approval-link');
|
||||||
|
|
@ -74,18 +72,13 @@ document.addEventListener("DOMContentLoaded", () => {{
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn open_login_window(app: tauri::AppHandle, url: String) -> Option<String> {
|
async fn open_login_window(app: tauri::AppHandle, url: String) -> Option<String> {
|
||||||
let encoded = urlencoding::encode(&url);
|
let window = WindowBuilder::new(&app, "login", tauri::WindowUrl::App(url.into()))
|
||||||
let window = WindowBuilder::new(
|
.title("Login")
|
||||||
&app,
|
.center()
|
||||||
"login",
|
.inner_size(1040.0, 960.0)
|
||||||
tauri::WindowUrl::App(format!("/redirect?url={encoded}").into()),
|
.initialization_script(INIT_SCRIPT)
|
||||||
)
|
.build()
|
||||||
.title("Login")
|
.ok()?;
|
||||||
.center()
|
|
||||||
.inner_size(1040.0, 960.0)
|
|
||||||
.initialization_script(INIT_SCRIPT)
|
|
||||||
.build()
|
|
||||||
.ok()?;
|
|
||||||
let result: Arc<Mutex<Option<String>>> = Arc::new(Mutex::new(None));
|
let result: Arc<Mutex<Option<String>>> = Arc::new(Mutex::new(None));
|
||||||
let r2 = result.clone();
|
let r2 = result.clone();
|
||||||
let r3 = result.clone();
|
let r3 = result.clone();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"$schema": "https://github.com/tauri-apps/tauri/raw/tauri-v1.4.1/core/tauri-config-schema/schema.json",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "pnpm dev",
|
"beforeDevCommand": "pnpm dev",
|
||||||
"beforeBuildCommand": "pnpm build",
|
"beforeBuildCommand": "pnpm build",
|
||||||
|
|
@ -69,7 +70,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"security": {
|
"security": {
|
||||||
"csp": null
|
"csp": null,
|
||||||
|
"dangerousRemoteDomainIpcAccess": [
|
||||||
|
{
|
||||||
|
"windows": [
|
||||||
|
"login"
|
||||||
|
],
|
||||||
|
"domain": "accounts.nintendo.com",
|
||||||
|
"enableTauriAPI": true
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"updater": {
|
"updater": {
|
||||||
"active": false,
|
"active": false,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { Layout } from "components/Layout";
|
||||||
import { Home } from "pages/Home";
|
import { Home } from "pages/Home";
|
||||||
import { Settings } from "pages/Settings";
|
import { Settings } from "pages/Settings";
|
||||||
import { Guide } from 'pages/Guide';
|
import { Guide } from 'pages/Guide';
|
||||||
import { RedirectLogin } from 'pages/RedirectLogin';
|
|
||||||
import { useShowWindow } from 'hooks/useShowWindow';
|
import { useShowWindow } from 'hooks/useShowWindow';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|
@ -15,7 +14,6 @@ function App() {
|
||||||
<Route index element={<Home />} />
|
<Route index element={<Home />} />
|
||||||
<Route path='/settings' element={<Settings />} />
|
<Route path='/settings' element={<Settings />} />
|
||||||
<Route path='/guide' element={<Guide />} />
|
<Route path='/guide' element={<Guide />} />
|
||||||
<Route path='/redirect' element={<RedirectLogin />} />
|
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ export const OpenSplatnet: React.FC<OpenSplatnetProps> = ({ children }) => {
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const btnLoading = loading || doing;
|
||||||
return <>
|
return <>
|
||||||
<button className={classNames('btn', {
|
<button className={classNames('btn w-full', {
|
||||||
'btn-disabled': !result?.profile.state.loginState?.sessionToken,
|
'btn-disabled': !result?.profile.state.loginState?.sessionToken,
|
||||||
'loading': loading || doing,
|
})} onClick={onClick} disabled={btnLoading}>{btnLoading ? <span className='loading' /> : children}</button>
|
||||||
})} onClick={onClick}>{children}</button>
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ export const RunPanel: React.FC<RunPanelProps> = () => {
|
||||||
<Checkbox disabled={disabled || loading} value={exportCoop} onChange={setExportCoop}>{t('导出打工数据')}</Checkbox>
|
<Checkbox disabled={disabled || loading} value={exportCoop} onChange={setExportCoop}>{t('导出打工数据')}</Checkbox>
|
||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={classNames('btn w-full', {
|
className={classNames('btn btn-primary w-full', {
|
||||||
'btn-disabled': disabled || (!exportBattle && !exportCoop),
|
'btn-disabled': disabled || (!exportBattle && !exportCoop),
|
||||||
'loading': loading,
|
|
||||||
})}
|
})}
|
||||||
>{t('导出')}</button>
|
disabled={loading}
|
||||||
|
>{loading ? <span className='loading' /> : t('导出')}</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,40 +2,17 @@
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
:root {
|
|
||||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 24px;
|
|
||||||
font-weight: 400;
|
|
||||||
|
|
||||||
color: #0f0f0f;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
|
|
||||||
font-synthesis: none;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
-webkit-text-size-adjust: 100%;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
#root {
|
#root {
|
||||||
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
color: #f6f6f6;
|
|
||||||
background-color: #2f2f2f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* custom classes */
|
/* custom classes */
|
||||||
|
|
||||||
.flex-auto-all > * {
|
.flex-auto-all > * {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const Home: React.FC = () => {
|
||||||
<Link to='/settings' className='btn'>{t('设置')}</Link>
|
<Link to='/settings' className='btn'>{t('设置')}</Link>
|
||||||
<div className='flex gap-2 flex-auto-all'>
|
<div className='flex gap-2 flex-auto-all'>
|
||||||
<OpenSplatnet>{t('打开鱿鱼圈3')}</OpenSplatnet>
|
<OpenSplatnet>{t('打开鱿鱼圈3')}</OpenSplatnet>
|
||||||
<a className='btn' href={STAT_INK} target='_blank' rel='noreferrer'>{t('前往 stat.ink')}</a>
|
<a className='btn w-full' href={STAT_INK} target='_blank' rel='noreferrer'>{t('前往 stat.ink')}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { Loading } from 'components/Loading';
|
|
||||||
import React, { useEffect } from 'react'
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { useLocation } from 'react-use';
|
|
||||||
|
|
||||||
export const RedirectLogin: React.FC = () => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const state = useLocation();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const search = state.search ?? '';
|
|
||||||
|
|
||||||
const index = search.indexOf('url=');
|
|
||||||
if (index === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const url = decodeURIComponent(search.substring(index + 4));
|
|
||||||
|
|
||||||
window.location.href = url;
|
|
||||||
}, [state])
|
|
||||||
|
|
||||||
return <div className='h-full flex justify-center items-center'>
|
|
||||||
<span className='flex justify-center items-center gap-1'><Loading className='align-middle' />{t('正在跳转到登录页面...')}</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
@ -347,6 +347,10 @@ export class RankTracker {
|
||||||
async updateState(
|
async updateState(
|
||||||
history: HistoryGroups<BattleListNode>["nodes"],
|
history: HistoryGroups<BattleListNode>["nodes"],
|
||||||
) {
|
) {
|
||||||
|
if (history.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// history order by time. 0 is the oldest.
|
// history order by time. 0 is the oldest.
|
||||||
const flatten: FlattenItem[] = await Promise.all(
|
const flatten: FlattenItem[] = await Promise.all(
|
||||||
history
|
history
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export const AGENT_NAME = "splashcat / s3si.ts";
|
||||||
export const AGENT_VERSION = "1.1.1";
|
export const AGENT_VERSION = "1.1.1";
|
||||||
export const S3SI_VERSION = "0.4.5";
|
export const S3SI_VERSION = "0.4.5";
|
||||||
export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`;
|
export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`;
|
||||||
export const NSOAPP_VERSION = "2.5.2";
|
export const NSOAPP_VERSION = "2.6.0";
|
||||||
export const WEB_VIEW_VERSION = "4.0.0-d5178440";
|
export const WEB_VIEW_VERSION = "4.0.0-d5178440";
|
||||||
export enum Queries {
|
export enum Queries {
|
||||||
HomeQuery = "7dcc64ea27a08e70919893a0d3f70871",
|
HomeQuery = "7dcc64ea27a08e70919893a0d3f70871",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue