Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
2e9d26e674
commit
58145f97a0
@ -138,12 +138,12 @@ async fn download_assets(state: State<'_, AppState>) -> Result<(), String> {
|
|||||||
let assets = [
|
let assets = [
|
||||||
(
|
(
|
||||||
"injector.exe",
|
"injector.exe",
|
||||||
"https://git.rlidentity.me/bits/RLidentity/src/branch/dll/injector.exe",
|
"https://git.rlidentity.me/bits/RLidentity/raw/branch/main/injector.exe",
|
||||||
"B447D618886EEDE9F6A331A5605BFC40FADEB3F508916D8B19916467EC8E0E69"
|
"B447D618886EEDE9F6A331A5605BFC40FADEB3F508916D8B19916467EC8E0E69"
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"RLIdentity.dll",
|
"RLIdentity.dll",
|
||||||
"https://git.rlidentity.me/bits/RLidentity/src/branch/main/RLIdentity.dll",
|
"https://git.rlidentity.me/bits/RLidentity/raw/branch/main/RLIdentity.dll",
|
||||||
"69108E3E1084EA9AE6AC97D4F19D68356213FEF3A29193D63CE3A6069D333CD8"
|
"69108E3E1084EA9AE6AC97D4F19D68356213FEF3A29193D63CE3A6069D333CD8"
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@ -169,6 +169,10 @@ async fn download_assets(state: State<'_, AppState>) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
#[tauri::command]
|
||||||
|
fn get_app_version(app: tauri::AppHandle) -> String {
|
||||||
|
app.package_info().version.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn check_status() -> Status {
|
async fn check_status() -> Status {
|
||||||
@ -177,6 +181,13 @@ async fn check_status() -> Status {
|
|||||||
let is_running = s.processes_by_exact_name("RocketLeague.exe").next().is_some();
|
let is_running = s.processes_by_exact_name("RocketLeague.exe").next().is_some();
|
||||||
Status { is_running, is_injected: false }
|
Status { is_running, is_injected: false }
|
||||||
}
|
}
|
||||||
|
#[tauri::command]
|
||||||
|
async fn save_config(config_data: String, state: State<'_, AppState>) -> Result<(), String> {
|
||||||
|
let config_path = state.app_data.join("config.json");
|
||||||
|
fs::write(config_path, config_data)
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("failed to save config: {}", e))
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn minimize_to_tray(window: WebviewWindow) {
|
fn minimize_to_tray(window: WebviewWindow) {
|
||||||
@ -203,7 +214,9 @@ pub fn run() {
|
|||||||
validate_key,
|
validate_key,
|
||||||
check_status,
|
check_status,
|
||||||
get_hwid,
|
get_hwid,
|
||||||
download_assets
|
download_assets,
|
||||||
|
get_app_version,
|
||||||
|
save_config
|
||||||
])
|
])
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
let window = app.get_webview_window("main").unwrap();
|
let window = app.get_webview_window("main").unwrap();
|
||||||
|
|||||||
19
src/App.tsx
19
src/App.tsx
@ -1,5 +1,6 @@
|
|||||||
import { useMemo, useState, useEffect } from "react";
|
import { useMemo, useState, useEffect } from "react";
|
||||||
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
const [version, setVersion] = useState('');
|
||||||
type Status =
|
type Status =
|
||||||
| "ready"
|
| "ready"
|
||||||
| "saved successfully"
|
| "saved successfully"
|
||||||
@ -87,7 +88,7 @@ export default function App() {
|
|||||||
const initialPlatform = useMemo(() => localStorage.getItem(LS_KEYS.platform) ?? "Epic", []);
|
const initialPlatform = useMemo(() => localStorage.getItem(LS_KEYS.platform) ?? "Epic", []);
|
||||||
const initialAutoInject = useMemo(() => localStorage.getItem(LS_KEYS.autoInject) === "true", []);
|
const initialAutoInject = useMemo(() => localStorage.getItem(LS_KEYS.autoInject) === "true", []);
|
||||||
const initialTheme = useMemo(() => (localStorage.getItem(LS_KEYS.theme) ?? "phantom") as ThemeId, []);
|
const initialTheme = useMemo(() => (localStorage.getItem(LS_KEYS.theme) ?? "phantom") as ThemeId, []);
|
||||||
|
const [version, setVersion] = useState('');
|
||||||
const [apiKey, setApiKey] = useState(initialApiKey);
|
const [apiKey, setApiKey] = useState(initialApiKey);
|
||||||
const [spoofedUsername, setSpoofedUsername] = useState(initialSpoofed);
|
const [spoofedUsername, setSpoofedUsername] = useState(initialSpoofed);
|
||||||
const [isAuthorized, setIsAuthorized] = useState(false);
|
const [isAuthorized, setIsAuthorized] = useState(false);
|
||||||
@ -138,17 +139,21 @@ export default function App() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialApiKey) authorize(initialApiKey);
|
if (initialApiKey) authorize(initialApiKey);
|
||||||
syncAssetsAndCheckUpdates();
|
syncAssetsAndCheckUpdates();
|
||||||
|
tryInvoke("get_app_version").then(v => setVersion(v as string));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
async function syncAssetsAndCheckUpdates() {
|
async function syncAssetsAndCheckUpdates() {
|
||||||
if (!isTauriRuntime()) return;
|
if (!isTauriRuntime()) return;
|
||||||
try {
|
try {
|
||||||
|
setStatus("syncing assets...");
|
||||||
await tryInvoke("download_assets");
|
await tryInvoke("download_assets");
|
||||||
|
setStatus("ready");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to sync assets:", e);
|
console.error("Failed to sync assets:", e);
|
||||||
|
setStatus("Sync Error: " + String(e));
|
||||||
}
|
}
|
||||||
checkForUpdates();
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
if (!isTauriRuntime()) return;
|
if (!isTauriRuntime()) return;
|
||||||
@ -300,9 +305,11 @@ export default function App() {
|
|||||||
style={{ cursor: "default" }}
|
style={{ cursor: "default" }}
|
||||||
/>
|
/>
|
||||||
<div className="titlebar-text" data-tauri-drag-region>
|
<div className="titlebar-text" data-tauri-drag-region>
|
||||||
<div className="app-name neon-text-soft">
|
<div className="app-name neon-text-soft">
|
||||||
RLidentity <span style={{ fontSize: "10px", opacity: 0.6, marginLeft: "4px" }}>v2.0.0</span>
|
RLidentity <span style={{ fontSize: "10px", opacity: 0.6, marginLeft: "4px" }}>
|
||||||
</div>
|
v{version || "2.0.1"}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div className="app-slogan">{isRevoked ? "License Revoked" : "Authorize to continue"}</div>
|
<div className="app-slogan">{isRevoked ? "License Revoked" : "Authorize to continue"}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user