Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(league): native opt-in League of Legends menu

tonhowtf7e2727682395
diff --git a/src-tauri/omniget-core/src/models/settings.rs b/src-tauri/omniget-core/src/models/settings.rs
index 4b4abcb2..1ec4faba 100644
--- a/src-tauri/omniget-core/src/models/settings.rs
+++ b/src-tauri/omniget-core/src/models/settings.rs
@@ -29,6 +29,16 @@ pub struct AppSettings {
pub rpc: RpcSettings,
#[serde(default)]
pub bridge: BridgeSettings,
+ #[serde(default)]
+ pub league: LeagueSettings,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct LeagueSettings {
+ #[serde(default)]
+ pub enabled: bool,
+ #[serde(default)]
+ pub auto_accept: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -540,7 +550,8 @@ impl Default for AppSettings {
last_download_options: LastDownloadOptions::default(),
typography: TypographySettings::default(),
rpc: RpcSettings::default(),
- bridge: BridgeSettings::default(),
+ bridge: BridgeSettings::default(),
+ league: LeagueSettings::default(),
}
}
}
diff --git a/src-tauri/src/commands/league.rs b/src-tauri/src/commands/league.rs
new file mode 100644
index 00000000..4ce445a3
--- /dev/null
+++ b/src-tauri/src/commands/league.rs
@@ -0,0 +1,296 @@
+use once_cell::sync::Lazy;
+use serde::Serialize;
+use serde_json::Value;
+use std::sync::atomic::{AtomicBool, Ordering};
+use tokio::sync::Mutex;
+
+#[derive(Clone)]
+struct LcuClient {
+ port: u16,
+ token: String,
+ region: Option<String>,
+}
+
+#[derive(Serialize)]
+pub struct LeagueStatus {
+ pub connected: bool,
+ pub port: Option<u16>,
+ pub region: Option<String>,
+}
+
+static CACHED_CLIENT: Lazy<Mutex<Option<LcuClient>>> = Lazy::new(|| Mutex::new(None));
+static AUTO_ACCEPT: AtomicBool = AtomicBool::new(false);
+static POLLER_STARTED: AtomicBool = AtomicBool::new(false);
+
+fn extract_arg(cmdline: &str, key: &str) -> Option<String> {
+ let needle = format!("--{}=", key);
+ let start = cmdline.find(&needle)? + needle.len();
+ let rest = &cmdline[start..];
+ let value: String = rest
+ .chars()
+ .take_while(|c| !c.is_whitespace() && *c != '"' && *c != '\'')
+ .collect();
+ if value.is_empty() {
+ None
+ } else {
+ Some(value)
+ }
+}
+
+async fn read_process_command_lines() -> Result<String, String> {
+ #[cfg(windows)]
+ {
+ let output = crate::core::process::command("powershell")
+ .args([
+ "-NoProfile",
+ "-Command",
+ "Get-CimInstance Win32_Process -Filter \"Name='LeagueClientUx.exe'\" | Select-Object -ExpandProperty CommandLine",
+ ])
+ .output()
+ .await
+ .map_err(|e| format!("failed to query processes: {}", e))?;
+ Ok(String::from_utf8_lossy(&output.stdout).to_string())
+ }
+ #[cfg(not(windows))]
+ {
+ let output = tokio::process::Command::new("ps")
+ .args(["-axo", "command"])
+ .output()
+ .await
+ .map_err(|e| format!("failed to query processes: {}", e))?;
+ Ok(String::from_utf8_lossy(&output.stdout).to_string())
+ }
+}
+
+async fn discover_client() -> Option<LcuClient> {
+ let listing = read_process_command_lines().await.ok()?;
+ for line in listing.lines() {
+ if !line.contains("LeagueClientUx") {
+ continue;
+ }
+ let port = extract_arg(line, "app-port").and_then(|p| p.parse::<u16>().ok());
+ let token = extract_arg(line, "remoting-auth-token");
+ if let (Some(port), Some(token)) = (port, token) {
+ let region = extract_arg(line, "region")
+ .or_else(|| extract_arg(line, "rso_platform_id"));
+ return Some(LcuClient {
+ port,
+ token,
+ region,
+ });
+ }
+ }
+ None
+}
+
+async fn get_client() -> Result<LcuClient, String> {
+ {
+ let cached = CACHED_CLIENT.lock().await;
+ if let Some(client) = cached.as_ref() {
+ if lcu_reachable(client).await {
+ return Ok(client.clone());
+ }
+ }
+ }
+ let discovered = discover_client()
+ .await
+ .ok_or_else(|| "league client not running".to_string())?;
+ let mut cached = CACHED_CLIENT.lock().await;
+ *cached = Some(discovered.clone());
+ Ok(discovered)
+}
+
+fn http_client() -> Result<reqwest::Client, String> {
+ reqwest::Client::builder()
+ .danger_accept_invalid_certs(true)
+ .timeout(std::time::Duration::from_secs(10))
+ .no_proxy()
+ .build()
+ .map_err(|e| e.to_string())
+}
+
+async fn lcu_reachable(client: &LcuClient) -> bool {
+ match lcu_get_raw(client, "/lol-gameflow/v1/gameflow-phase").await {
+ Ok(_) => true,
+ Err(_) => false,
+ }
+}
+
+async fn lcu_get_raw(client: &LcuClient, path: &str) -> Result<Value, String> {
+ let url = format!("https://127.0.0.1:{}{}", client.port, path);
+ let resp = http_client()?
+ .get(&url)
+ .basic_auth("riot", Some(&client.token))
+ .send()
+ .await
+ .map_err(|e| format!("lcu request failed: {}", e))?;
+ let status = resp.status();
+ if !status.is_success() {
+ return Err(format!("lcu returned {} for {}", status.as_u16(), path));
+ }
+ resp.json::<Value>()
+ .await
+ .map_err(|e| format!("invalid lcu response: {}", e))
+}
+
+async fn lcu_post_raw(client: &LcuClient, path: &str) -> Result<Value, String> {
+ let url = format!("https://127.0.0.1:{}{}", client.port, path);
+ let resp = http_client()?
+ .post(&url)
+ .basic_auth("riot", Some(&client.token))
+ .header("content-length", "0")
+ .send()
+ .await
+ .map_err(|e| format!("lcu request failed: {}", e))?;
+ let status = resp.status();
+ if !status.is_success() {
+ return Err(format!("lcu returned {} for {}", status.as_u16(), path));
+ }
+ Ok(resp.json::<Value>().await.unwrap_or(Value::Null))
+}
+
+fn league_enabled() -> bool {
+ crate::storage::config::load_settings_standalone().league.enabled
+}
+
+fn ensure_enabled() -> Result<(), String> {
+ if league_enabled() {
+ Ok(())
+ } else {
+ Err("league menu is disabled in settings".to_string())
+ }
+}
+
+#[tauri::command]
+pub async fn league_status() -> LeagueStatus {
+ if !league_enabled() {
+ return LeagueStatus {
+ connected: false,
+ port: None,
+ region: None,
+ };
+ }
+ match get_client().await {
+ Ok(client) => LeagueStatus {
+ connected: true,
+ port: Some(client.port),
+ region: client.region,
+ },
+ Err(_) => LeagueStatus {
+ connected: false,
+ port: None,
+ region: None,
+ },
+ }
+}
+
+#[tauri::command]
+pub async fn league_get(path: String) -> Result<Value, String> {
+ ensure_enabled()?;
+ let allowed = path.starts_with("/lol-") || path.starts_with("/riotclient/");
+ if !allowed || path.contains("..") {
+ return Err(format!("path not allowed: {}", path));
+ }
+ let client = get_client().await?;
+ lcu_get_raw(&client, &path).await
+}
+
+#[tauri::command]
+pub async fn league_summoner() -> Result<Value, String> {
+ ensure_enabled()?;
+ let client = get_client().await?;
+ lcu_get_raw(&client, "/lol-summoner/v1/current-summoner").await
+}
+
+#[tauri::command]
+pub async fn league_ranked() -> Result<Value, String> {
+ ensure_enabled()?;
+ let client = get_client().await?;
+ lcu_get_raw(&client, "/lol-ranked/v1/current-ranked-stats").await
+}
+
+#[tauri::command]
+pub async fn league_gameflow() -> Result<Value, String> {
+ ensure_enabled()?;
+ let client = get_client().await?;
+ lcu_get_raw(&client, "/lol-gameflow/v1/gameflow-phase").await
+}
+
+#[tauri::command]
+pub async fn league_match_history(beg_index: u32, end_index: u32) -> Result<Value, String> {
+ ensure_enabled()?;
+ let client = get_client().await?;
+ let summoner = lcu_get_raw(&client, "/lol-summoner/v1/current-summoner").await?;
+ let puuid = summoner
+ .get("puuid")
+ .and_then(Value::as_str)
+ .ok_or_else(|| "no puuid in summoner response".to_string())?;
+ let path = format!(
+ "/lol-match-history/v1/products/lol/{}/matches?begIndex={}&endIndex={}",
+ puuid, beg_index, end_index
+ );
+ lcu_get_raw(&client, &path).await
+}
+
+#[tauri::command]
+pub async fn league_accept_ready_check() -> Result<(), String> {
+ ensure_enabled()?;
+ let client = get_client().await?;
+ lcu_post_raw(&client, "/lol-matchmaking/v1/ready-check/accept").await?;
+ Ok(())
+}
+
+#[tauri::command]
+pub async fn league_auto_accept_set(enabled: bool) -> Result<(), String> {
+ ensure_enabled()?;
+ AUTO_ACCEPT.store(enabled, Ordering::Relaxed);
+ if enabled {
+ spawn_poller();
+ }
+ tracing::info!("[league] auto-accept {}", if enabled { "on" } else { "off" });
+ Ok(())
+}
+
+#[tauri::command]
+pub fn league_auto_accept_get() -> bool {
+ AUTO_ACCEPT.load(Ordering::Relaxed)
+}
+
+fn spawn_poller() {
+ if POLLER_STARTED.swap(true, Ordering::SeqCst) {
+ return;
+ }
+ tauri::async_runtime::spawn(async move {
+ loop {
+ tokio::time::sleep(std::time::Duration::from_secs(2)).await;
+ if !AUTO_ACCEPT.load(Ordering::Relaxed) || !league_enabled() {
+ continue;
+ }
+ let client = match get_client().await {
+ Ok(c) => c,
+ Err(_) => continue,
+ };
+ let phase = match lcu_get_raw(&client, "/lol-gameflow/v1/gameflow-phase").await {
+ Ok(v) => v,
+ Err(_) => continue,
+ };
+ if phase.as_str() == Some("ReadyCheck") {
+ if let Err(e) =
+ lcu_post_raw(&client, "/lol-matchmaking/v1/ready-check/accept").await
+ {
+ tracing::warn!("[league] auto-accept failed: {}", e);
+ } else {
+ tracing::info!("[league] ready check accepted");
+ }
+ }
+ }
+ });
+}
+
+pub fn start_background() {
+ let settings = crate::storage::config::load_settings_standalone();
+ if settings.league.enabled && settings.league.auto_accept {
+ AUTO_ACCEPT.store(true, Ordering::Relaxed);
+ spawn_poller();
+ }
+}
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 0b107955..36fb26ff 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -10,6 +10,7 @@ pub mod diagnostics;
pub mod downloads;
pub mod host_queue;
pub mod integration;
+pub mod league;
pub mod p2p;
pub mod plugins;
pub mod reencode;
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 5e7a24bb..72f2f620 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -484,6 +484,7 @@ pub fn run() {
core::channels::init_from_disk();
core::channel_poller::start(app.handle().clone());
core::queue::start_scheduler(app.handle().clone());
+ commands::league::start_background();
{
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
@@ -702,6 +703,15 @@ pub fn run() {
})
.invoke_handler(tauri::generate_handler![
commands::auth_webview::open_auth_webview,
+ commands::league::league_status,
+ commands::league::league_get,
+ commands::league::league_summoner,
+ commands::league::league_ranked,
+ commands::league::league_gameflow,
+ commands::league::league_match_history,
+ commands::league::league_accept_ready_check,
+ commands::league::league_auto_accept_set,
+ commands::league::league_auto_accept_get,
commands::bilibili_auth::bilibili_qr_generate,
commands::bilibili_auth::bilibili_qr_poll,
commands::bilibili_auth::bilibili_captcha_challenge,
diff --git a/src/components/settings/SettingsAdvanced.svelte b/src/components/settings/SettingsAdvanced.svelte
index 2212a587..c682c6f9 100644
--- a/src/components/settings/SettingsAdvanced.svelte
+++ b/src/components/settings/SettingsAdvanced.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
import { t } from "$lib/i18n";
import { isDebugEnabled, setDebugEnabled, setDebugPanelOpen } from "$lib/stores/debug-store.svelte";
import { getSettings, updateSettings, toggleBool, changeNumber } from "./settings-helpers";
@@ -15,7 +16,7 @@
searchActive?: boolean;
} = $props();
- type AdvancedDrill = "performance" | "torrent" | "expert" | "debug";
+ type AdvancedDrill = "performance" | "torrent" | "expert" | "league" | "debug";
let subView = $state<AdvancedDrill | null>(null);
let settings = $derived(getSettings());
@@ -24,6 +25,7 @@
{ id: "performance", titleKey: "settings.advanced.section_performance", hintKey: "settings.advanced.section_performance_desc" },
{ id: "torrent", titleKey: "settings.advanced.section_torrent", hintKey: "settings.advanced.section_torrent_desc" },
{ id: "expert", titleKey: "settings.advanced.section_expert", hintKey: "settings.advanced.section_expert_desc" },
+ { id: "league", titleKey: "league.settings_title", hintKey: "league.settings_desc" },
{ id: "debug", titleKey: "settings.advanced.section_debug", hintKey: "settings.advanced.section_debug_desc" },
];
@@ -299,6 +301,26 @@
<input type="text" class="input-text" placeholder={$t('settings.advanced.user_agent_placeholder')} value={settings.advanced?.user_agent ?? ""} onchange={(e) => updateSettings({ advanced: { user_agent: (e.target as HTMLInputElement).value.trim() } })} />
</div>
</div>
+ {:else if subView === "league"}
+ <div class="card">
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('league.settings_enable')}</span>
+ <span class="setting-path">{$t('league.settings_enable_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.league?.enabled} onclick={() => updateSettings({ league: { enabled: !(settings.league?.enabled ?? false) } })} role="switch" aria-checked={settings.league?.enabled ?? false} aria-label={$t('league.settings_enable') as string}><span class="toggle-knob"></span></button>
+ </div>
+ {#if settings.league?.enabled}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('league.settings_auto_accept')}</span>
+ <span class="setting-path">{$t('league.settings_auto_accept_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.league?.auto_accept} onclick={() => { const next = !(settings.league?.auto_accept ?? false); updateSettings({ league: { auto_accept: next } }); invoke("league_auto_accept_set", { enabled: next }).catch(() => {}); }} role="switch" aria-checked={settings.league?.auto_accept ?? false} aria-label={$t('league.settings_auto_accept') as string}><span class="toggle-knob"></span></button>
+ </div>
+ {/if}
+ </div>
{:else if subView === "debug"}
<div class="card">
<div class="setting-row">
diff --git a/src/components/shell/NavIcon.svelte b/src/components/shell/NavIcon.svelte
index ddb12002..15fa684f 100644
--- a/src/components/shell/NavIcon.svelte
+++ b/src/components/shell/NavIcon.svelte
@@ -34,6 +34,10 @@
{:else if icon === "settings"}
<path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<circle cx="12" cy="12" r="3" />
+ {:else if icon === "league"}
+ <path d="M6 14L17 3h4v4L10 18" />
+ <path d="M3 21l5-5" />
+ <path d="M5 14l5 5" />
{:else if icon === "about"}
<circle cx="12" cy="12" r="10" />
<path d="M12 16v-4m0-4h.01" />
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index f29f439f..bc587806 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -36,6 +36,34 @@
"nav_home": "Μετάβαση στην Αρχική",
"nav_downloads": "Μετάβαση στις Λήψεις"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Προαιρετικό μενού πελάτη League. Απενεργοποιημένο από προεπιλογή.",
+ "settings_enable": "Ενεργοποίηση μενού League",
+ "settings_enable_desc": "Προσθέτει μενού League of Legends με εργαλεία πελάτη. Απαιτεί τον πελάτη League σε λειτουργία.",
+ "settings_auto_accept": "Αυτόματη αποδοχή αγώνων",
+ "settings_auto_accept_desc": "Αποδέχεται αυτόματα τον έλεγχο ετοιμότητας όταν βρεθεί αγώνας.",
+ "disabled_title": "Το μενού League είναι απενεργοποιημένο",
+ "disabled_body": "Ενεργοποιήστε το στις Ρυθμίσεις → Για προχωρημένους → League of Legends. Τίποτα δεν εκτελείται μέχρι να το ενεργοποιήσετε.",
+ "open_settings": "Άνοιγμα Ρυθμίσεων",
+ "connected": "Συνδεδεμένο",
+ "disconnected_title": "Ο πελάτης δεν εντοπίστηκε",
+ "disconnected_body": "Ανοίξτε τον πελάτη League of Legends και αυτή η σελίδα θα συνδεθεί αυτόματα.",
+ "level": "Επίπεδο",
+ "phase_label": "Κατάσταση πελάτη",
+ "accept_now": "Αποδοχή αγώνα",
+ "auto_accept": "Αυτόματη αποδοχή αγώνων",
+ "auto_accept_desc": "Αποδέχεται τον αγώνα για εσάς μόλις εμφανιστεί.",
+ "ranked_solo": "Κατάταξη Solo/Duo",
+ "ranked_flex": "Κατάταξη Flex",
+ "unranked": "Χωρίς κατάταξη",
+ "history_title": "Πρόσφατοι αγώνες",
+ "history_empty": "Δεν βρέθηκαν αγώνες ακόμα.",
+ "refresh": "Ανανέωση",
+ "victory": "Νίκη",
+ "defeat": "Ήττα"
+ },
"nav": {
"home": "Αρχική",
"downloads": "Λήψεις",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index e1925e1c..acc0f32e 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -36,6 +36,34 @@
"nav_home": "Go to Home",
"nav_downloads": "Go to Downloads"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Optional League client menu. Off by default.",
+ "settings_enable": "Enable League menu",
+ "settings_enable_desc": "Adds a League of Legends menu with client tools. Requires the League client running.",
+ "settings_auto_accept": "Auto-accept matches",
+ "settings_auto_accept_desc": "Automatically accepts the ready check when a match is found.",
+ "disabled_title": "The League menu is off",
+ "disabled_body": "Enable it in Settings → Advanced → League of Legends. Nothing runs until you turn it on.",
+ "open_settings": "Open Settings",
+ "connected": "Connected",
+ "disconnected_title": "Client not detected",
+ "disconnected_body": "Open the League of Legends client and this page will connect automatically.",
+ "level": "Level",
+ "phase_label": "Client status",
+ "accept_now": "Accept match",
+ "auto_accept": "Auto-accept matches",
+ "auto_accept_desc": "Accepts the ready check for you the moment a match pops.",
+ "ranked_solo": "Ranked Solo/Duo",
+ "ranked_flex": "Ranked Flex",
+ "unranked": "Unranked",
+ "history_title": "Recent matches",
+ "history_empty": "No matches found yet.",
+ "refresh": "Refresh",
+ "victory": "Victory",
+ "defeat": "Defeat"
+ },
"nav": {
"home": "Home",
"downloads": "Downloads",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 6d2125b0..49f2dffb 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -36,6 +36,34 @@
"nav_home": "Ir a Inicio",
"nav_downloads": "Ir a Descargas"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Menú opcional del cliente de League. Desactivado por defecto.",
+ "settings_enable": "Activar menú de League",
+ "settings_enable_desc": "Añade un menú de League of Legends con herramientas del cliente. Requiere el cliente de League abierto.",
+ "settings_auto_accept": "Aceptar partidas automáticamente",
+ "settings_auto_accept_desc": "Acepta automáticamente la comprobación de preparación cuando se encuentra una partida.",
+ "disabled_title": "El menú de League está desactivado",
+ "disabled_body": "Actívalo en Ajustes → Avanzado → League of Legends. Nada se ejecuta hasta que lo actives.",
+ "open_settings": "Abrir Ajustes",
+ "connected": "Conectado",
+ "disconnected_title": "Cliente no detectado",
+ "disconnected_body": "Abre el cliente de League of Legends y esta página se conectará automáticamente.",
+ "level": "Nivel",
+ "phase_label": "Estado del cliente",
+ "accept_now": "Aceptar partida",
+ "auto_accept": "Aceptar partidas automáticamente",
+ "auto_accept_desc": "Acepta la partida por ti en cuanto aparezca.",
+ "ranked_solo": "Clasificatoria Solo/Dúo",
+ "ranked_flex": "Clasificatoria Flexible",
+ "unranked": "Sin clasificar",
+ "history_title": "Partidas recientes",
+ "history_empty": "Aún no se han encontrado partidas.",
+ "refresh": "Actualizar",
+ "victory": "Victoria",
+ "defeat": "Derrota"
+ },
"nav": {
"home": "Inicio",
"downloads": "Descargas",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index 51b3d7f6..0fe26eb4 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -36,6 +36,34 @@
"nav_home": "Aller à l'Accueil",
"nav_downloads": "Aller aux Téléchargements"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Menu optionnel du client League. Désactivé par défaut.",
+ "settings_enable": "Activer le menu League",
+ "settings_enable_desc": "Ajoute un menu League of Legends avec des outils du client. Nécessite le client League ouvert.",
+ "settings_auto_accept": "Accepter les parties automatiquement",
+ "settings_auto_accept_desc": "Accepte automatiquement la vérification quand une partie est trouvée.",
+ "disabled_title": "Le menu League est désactivé",
+ "disabled_body": "Activez-le dans Paramètres → Avancé → League of Legends. Rien ne s'exécute tant que vous ne l'activez pas.",
+ "open_settings": "Ouvrir les Paramètres",
+ "connected": "Connecté",
+ "disconnected_title": "Client non détecté",
+ "disconnected_body": "Ouvrez le client League of Legends et cette page se connectera automatiquement.",
+ "level": "Niveau",
+ "phase_label": "État du client",
+ "accept_now": "Accepter la partie",
+ "auto_accept": "Accepter les parties automatiquement",
+ "auto_accept_desc": "Accepte la partie pour vous dès qu'elle apparaît.",
+ "ranked_solo": "Classée Solo/Duo",
+ "ranked_flex": "Classée Flexible",
+ "unranked": "Non classé",
+ "history_title": "Parties récentes",
+ "history_empty": "Aucune partie trouvée pour l'instant.",
+ "refresh": "Actualiser",
+ "victory": "Victoire",
+ "defeat": "Défaite"
+ },
"nav": {
"home": "Accueil",
"downloads": "Téléchargements",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 5410aadb..5961af55 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -36,6 +36,34 @@
"nav_home": "Vai alla Home",
"nav_downloads": "Vai ai Download"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Menu opzionale del client di League. Disattivato per impostazione predefinita.",
+ "settings_enable": "Attiva menu League",
+ "settings_enable_desc": "Aggiunge un menu di League of Legends con strumenti del client. Richiede il client di League aperto.",
+ "settings_auto_accept": "Accetta partite automaticamente",
+ "settings_auto_accept_desc": "Accetta automaticamente il controllo di prontezza quando viene trovata una partita.",
+ "disabled_title": "Il menu League è disattivato",
+ "disabled_body": "Attivalo in Impostazioni → Avanzate → League of Legends. Nulla viene eseguito finché non lo attivi.",
+ "open_settings": "Apri Impostazioni",
+ "connected": "Connesso",
+ "disconnected_title": "Client non rilevato",
+ "disconnected_body": "Apri il client di League of Legends e questa pagina si connetterà automaticamente.",
+ "level": "Livello",
+ "phase_label": "Stato del client",
+ "accept_now": "Accetta partita",
+ "auto_accept": "Accetta partite automaticamente",
+ "auto_accept_desc": "Accetta la partita per te appena appare.",
+ "ranked_solo": "Classificata Solo/Duo",
+ "ranked_flex": "Classificata Flessibile",
+ "unranked": "Non classificato",
+ "history_title": "Partite recenti",
+ "history_empty": "Nessuna partita trovata finora.",
+ "refresh": "Aggiorna",
+ "victory": "Vittoria",
+ "defeat": "Sconfitta"
+ },
"nav": {
"home": "Home",
"downloads": "Download",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index f2ad0a03..e25b04a7 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -36,6 +36,34 @@
"nav_home": "ホームへ移動",
"nav_downloads": "ダウンロードへ移動"
},
+ "league": {
+ "nav": "リーグ・オブ・レジェンド",
+ "settings_title": "リーグ・オブ・レジェンド",
+ "settings_desc": "オプションのLeagueクライアントメニュー。デフォルトはオフです。",
+ "settings_enable": "Leagueメニューを有効化",
+ "settings_enable_desc": "クライアントツール付きのLeague of Legendsメニューを追加します。Leagueクライアントの起動が必要です。",
+ "settings_auto_accept": "マッチを自動承認",
+ "settings_auto_accept_desc": "マッチが見つかったとき、準備確認を自動的に承認します。",
+ "disabled_title": "Leagueメニューはオフです",
+ "disabled_body": "設定 → 詳細 → リーグ・オブ・レジェンドで有効にしてください。有効にするまで何も実行されません。",
+ "open_settings": "設定を開く",
+ "connected": "接続済み",
+ "disconnected_title": "クライアントが見つかりません",
+ "disconnected_body": "League of Legendsクライアントを起動すると、このページは自動的に接続します。",
+ "level": "レベル",
+ "phase_label": "クライアントの状態",
+ "accept_now": "マッチを承認",
+ "auto_accept": "マッチを自動承認",
+ "auto_accept_desc": "マッチが見つかった瞬間に自動で承認します。",
+ "ranked_solo": "ランク ソロ/デュオ",
+ "ranked_flex": "ランク フレックス",
+ "unranked": "アンランク",
+ "history_title": "最近のマッチ",
+ "history_empty": "まだマッチが見つかりません。",
+ "refresh": "更新",
+ "victory": "勝利",
+ "defeat": "敗北"
+ },
"nav": {
"home": "ホーム",
"downloads": "ダウンロード",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 4ba39f30..c787afa7 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -364,6 +364,33 @@ export type TranslationKeys =
| 'hotmart.unavailable'
| 'hotmart.unknown_error'
+ | 'league.accept_now'
+ | 'league.auto_accept'
+ | 'league.auto_accept_desc'
+ | 'league.connected'
+ | 'league.defeat'
+ | 'league.disabled_body'
+ | 'league.disabled_title'
+ | 'league.disconnected_body'
+ | 'league.disconnected_title'
+ | 'league.history_empty'
+ | 'league.history_title'
+ | 'league.level'
+ | 'league.nav'
+ | 'league.open_settings'
+ | 'league.phase_label'
+ | 'league.ranked_flex'
+ | 'league.ranked_solo'
+ | 'league.refresh'
+ | 'league.settings_auto_accept'
+ | 'league.settings_auto_accept_desc'
+ | 'league.settings_desc'
+ | 'league.settings_enable'
+ | 'league.settings_enable_desc'
+ | 'league.settings_title'
+ | 'league.unranked'
+ | 'league.victory'
+
| 'legal.acknowledge'
| 'legal.body_paragraph_1'
| 'legal.body_paragraph_2'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index b03e76e4..3079b10c 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -36,6 +36,34 @@
"nav_home": "Ir para Início",
"nav_downloads": "Ir para Downloads"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Menu opcional do cliente do League. Desligado por padrão.",
+ "settings_enable": "Ativar menu do League",
+ "settings_enable_desc": "Adiciona um menu do League of Legends com ferramentas do cliente. Requer o cliente do League aberto.",
+ "settings_auto_accept": "Aceitar partidas automaticamente",
+ "settings_auto_accept_desc": "Aceita automaticamente a verificação de prontidão quando uma partida é encontrada.",
+ "disabled_title": "O menu do League está desligado",
+ "disabled_body": "Ative em Configurações → Avançado → League of Legends. Nada roda até você ligar.",
+ "open_settings": "Abrir Configurações",
+ "connected": "Conectado",
+ "disconnected_title": "Cliente não detectado",
+ "disconnected_body": "Abra o cliente do League of Legends e esta página conecta automaticamente.",
+ "level": "Nível",
+ "phase_label": "Status do cliente",
+ "accept_now": "Aceitar partida",
+ "auto_accept": "Aceitar partidas automaticamente",
+ "auto_accept_desc": "Aceita a partida por você assim que ela aparecer.",
+ "ranked_solo": "Ranqueada Solo/Duo",
+ "ranked_flex": "Ranqueada Flexível",
+ "unranked": "Sem ranque",
+ "history_title": "Partidas recentes",
+ "history_empty": "Nenhuma partida encontrada ainda.",
+ "refresh": "Atualizar",
+ "victory": "Vitória",
+ "defeat": "Derrota"
+ },
"nav": {
"home": "Início",
"downloads": "Downloads",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index 86e8b8ab..3e7fed2d 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -36,6 +36,34 @@
"nav_home": "Перейти на главную",
"nav_downloads": "Перейти к загрузкам"
},
+ "league": {
+ "nav": "League of Legends",
+ "settings_title": "League of Legends",
+ "settings_desc": "Опциональное меню клиента League. По умолчанию выключено.",
+ "settings_enable": "Включить меню League",
+ "settings_enable_desc": "Добавляет меню League of Legends с инструментами клиента. Требуется запущенный клиент League.",
+ "settings_auto_accept": "Автопринятие матчей",
+ "settings_auto_accept_desc": "Автоматически принимает проверку готовности, когда матч найден.",
+ "disabled_title": "Меню League выключено",
+ "disabled_body": "Включите его в Настройки → Дополнительно → League of Legends. Ничего не запускается, пока вы его не включите.",
+ "open_settings": "Открыть настройки",
+ "connected": "Подключено",
+ "disconnected_title": "Клиент не обнаружен",
+ "disconnected_body": "Откройте клиент League of Legends — эта страница подключится автоматически.",
+ "level": "Уровень",
+ "phase_label": "Статус клиента",
+ "accept_now": "Принять матч",
+ "auto_accept": "Автопринятие матчей",
+ "auto_accept_desc": "Принимает матч за вас, как только он найден.",
+ "ranked_solo": "Ранговая Соло/Дуо",
+ "ranked_flex": "Ранговая Флекс",
+ "unranked": "Без ранга",
+ "history_title": "Недавние матчи",
+ "history_empty": "Матчи пока не найдены.",
+ "refresh": "Обновить",
+ "victory": "Победа",
+ "defeat": "Поражение"
+ },
"nav": {
"home": "Главная",
"downloads": "Загрузки",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index c5b953f4..2f28ded3 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -36,6 +36,34 @@
"nav_home": "前往首頁",
"nav_downloads": "前往下載"
},
+ "league": {
+ "nav": "英雄聯盟",
+ "settings_title": "英雄聯盟",
+ "settings_desc": "可選的 League 客戶端選單。預設關閉。",
+ "settings_enable": "啟用英雄聯盟選單",
+ "settings_enable_desc": "新增帶有客戶端工具的英雄聯盟選單。需要 League 客戶端運行中。",
+ "settings_auto_accept": "自動接受對戰",
+ "settings_auto_accept_desc": "找到對戰時自動接受準備確認。",
+ "disabled_title": "英雄聯盟選單已關閉",
+ "disabled_body": "在 設定 → 進階 → 英雄聯盟 中啟用。啟用之前不會執行任何內容。",
+ "open_settings": "開啟設定",
+ "connected": "已連線",
+ "disconnected_title": "未偵測到客戶端",
+ "disconnected_body": "開啟英雄聯盟客戶端後,此頁面會自動連線。",
+ "level": "等級",
+ "phase_label": "客戶端狀態",
+ "accept_now": "接受對戰",
+ "auto_accept": "自動接受對戰",
+ "auto_accept_desc": "對戰跳出的瞬間自動幫你接受。",
+ "ranked_solo": "單雙積分",
+ "ranked_flex": "彈性積分",
+ "unranked": "未定位",
+ "history_title": "最近對戰",
+ "history_empty": "尚未找到對戰。",
+ "refresh": "重新整理",
+ "victory": "勝利",
+ "defeat": "敗北"
+ },
"nav": {
"home": "首頁",
"downloads": "下載",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index 650da81e..4be4e6b6 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -36,6 +36,34 @@
"nav_home": "前往首页",
"nav_downloads": "前往下载"
},
+ "league": {
+ "nav": "英雄联盟",
+ "settings_title": "英雄联盟",
+ "settings_desc": "可选的 League 客户端菜单。默认关闭。",
+ "settings_enable": "启用英雄联盟菜单",
+ "settings_enable_desc": "添加带有客户端工具的英雄联盟菜单。需要 League 客户端处于运行状态。",
+ "settings_auto_accept": "自动接受对局",
+ "settings_auto_accept_desc": "找到对局时自动接受准备确认。",
+ "disabled_title": "英雄联盟菜单已关闭",
+ "disabled_body": "在 设置 → 高级 → 英雄联盟 中启用。启用之前不会运行任何内容。",
+ "open_settings": "打开设置",
+ "connected": "已连接",
+ "disconnected_title": "未检测到客户端",
+ "disconnected_body": "打开英雄联盟客户端后,此页面会自动连接。",
+ "level": "等级",
+ "phase_label": "客户端状态",
+ "accept_now": "接受对局",
+ "auto_accept": "自动接受对局",
+ "auto_accept_desc": "对局弹出的瞬间自动帮你接受。",
+ "ranked_solo": "单双排位",
+ "ranked_flex": "灵活排位",
+ "unranked": "未定级",
+ "history_title": "最近对局",
+ "history_empty": "暂未找到对局。",
+ "refresh": "刷新",
+ "victory": "胜利",
+ "defeat": "失败"
+ },
"nav": {
"home": "首页",
"downloads": "下载",
diff --git a/src/lib/stores/settings-store.svelte.ts b/src/lib/stores/settings-store.svelte.ts
index 16aedf9d..504c1d4b 100644
--- a/src/lib/stores/settings-store.svelte.ts
+++ b/src/lib/stores/settings-store.svelte.ts
@@ -90,6 +90,10 @@ export type AppSettings = {
app_id: string;
large_image_key: string;
};
+ league?: {
+ enabled?: boolean;
+ auto_accept?: boolean;
+ };
onboarding_completed: boolean;
start_with_system: boolean;
start_minimized: boolean;
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 6acdf026..32a940f6 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -36,7 +36,13 @@
let pluginNavItems = $state<NavItem[]>([]);
- let allNav = $derived([...CORE_NAV_ITEMS, ...pluginNavItems].sort((a, b) => (a.order ?? 50) - (b.order ?? 50)));
+ let leagueNavItems = $derived<NavItem[]>(
+ getSettings()?.league?.enabled
+ ? [{ href: "/league", labelKey: "league.nav", icon: "league", group: "app", order: 45 }]
+ : []
+ );
+
+ let allNav = $derived([...CORE_NAV_ITEMS, ...leagueNavItems, ...pluginNavItems].sort((a, b) => (a.order ?? 50) - (b.order ?? 50)));
let primaryNav = $derived(allNav.filter((item) => item.group === "primary"));
let appNav = $derived(allNav.filter((item) => item.group === "app"));
let pluginNav = $derived(allNav.filter((item) => item.group === "plugins"));
@@ -55,6 +61,7 @@
page.url.pathname.startsWith("/downloads") ||
page.url.pathname.startsWith("/settings") ||
page.url.pathname.startsWith("/marketplace") ||
+ page.url.pathname.startsWith("/league") ||
page.url.pathname.startsWith("/about"),
);
diff --git a/src/routes/league/+page.svelte b/src/routes/league/+page.svelte
new file mode 100644
index 00000000..49ebdb99
--- /dev/null
+++ b/src/routes/league/+page.svelte
@@ -0,0 +1,572 @@
+<script lang="ts">
+ import { onMount, onDestroy } from "svelte";
+ import { goto } from "$app/navigation";
+ import { invoke } from "@tauri-apps/api/core";
+ import { t, locale } from "$lib/i18n";
+ import { getSettings, updateSettings } from "$lib/stores/settings-store.svelte";
+ import timeAgo from "$lib/time-ago";
+
+ const CDRAGON = "https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1";
+
+ type LeagueStatus = { connected: boolean; port: number | null; region: string | null };
+ type RankedEntry = { tier?: string; division?: string; leaguePoints?: number; wins?: number; losses?: number };
+
+ let settings = $derived(getSettings());
+ let enabled = $derived(settings?.league?.enabled ?? false);
+
+ let status = $state<LeagueStatus>({ connected: false, port: null, region: null });
+ let summoner = $state<any>(null);
+ let ranked = $state<Record<string, RankedEntry>>({});
+ let phase = $state<string>("");
+ let games = $state<any[]>([]);
+ let loadingHistory = $state(false);
+ let autoAccept = $state(false);
+ let pollTimer: ReturnType<typeof setInterval> | null = null;
+
+ const QUEUE_NAMES: Record<number, string> = {
+ 420: "Solo/Duo",
+ 440: "Flex",
+ 400: "Draft",
+ 430: "Blind",
+ 450: "ARAM",
+ 900: "URF",
+ 1700: "Arena",
+ 490: "Quickplay",
+ };
+
+ function queueName(id: number, mode: string): string {
+ return QUEUE_NAMES[id] ?? mode ?? "";
+ }
+
+ function rankLabel(entry: RankedEntry | undefined): string {
+ if (!entry?.tier || entry.tier === "NONE" || entry.tier === "") return $t("league.unranked") as string;
+ const tier = entry.tier.charAt(0) + entry.tier.slice(1).toLowerCase();
+ return `${tier} ${entry.division ?? ""} · ${entry.leaguePoints ?? 0} LP`;
+ }
+
+ async function refreshStatus() {
+ try {
+ status = await invoke<LeagueStatus>("league_status");
+ } catch {
+ status = { connected: false, port: null, region: null };
+ }
+ if (!status.connected) {
+ summoner = null;
+ phase = "";
+ return;
+ }
+ try {
+ phase = await invoke<string>("league_gameflow");
+ } catch {
+ phase = "";
+ }
+ if (!summoner) {
+ await loadProfile();
+ }
+ }
+
+ async function loadProfile() {
+ try {
+ summoner = await invoke<any>("league_summoner");
+ } catch {
+ summoner = null;
+ return;
+ }
+ try {
+ const stats = await invoke<any>("league_ranked");
+ ranked = stats?.queueMap ?? {};
+ } catch {
+ ranked = {};
+ }
+ loadHistory();
+ }
+
+ async function loadHistory() {
+ if (loadingHistory) return;
+ loadingHistory = true;
+ try {
+ const data = await invoke<any>("league_match_history", { begIndex: 0, endIndex: 12 });
+ games = data?.games?.games ?? [];
+ } catch {
+ games = [];
+ } finally {
+ loadingHistory = false;
+ }
+ }
+
+ async function toggleAutoAccept() {
+ const next = !autoAccept;
+ autoAccept = next;
+ updateSettings({ league: { auto_accept: next } });
+ try {
+ await invoke("league_auto_accept_set", { enabled: next });
+ } catch {
+ autoAccept = !next;
+ }
+ }
+
+ async function acceptNow() {
+ try {
+ await invoke("league_accept_ready_check");
+ } catch {}
+ }
+
+ function playerStats(game: any): { championId: number; kills: number; deaths: number; assists: number; win: boolean } {
+ const p = game?.participants?.[0];
+ return {
+ championId: p?.championId ?? 0,
+ kills: p?.stats?.kills ?? 0,
+ deaths: p?.stats?.deaths ?? 0,
+ assists: p?.stats?.assists ?? 0,
+ win: p?.stats?.win ?? false,
+ };
+ }
+
+ onMount(() => {
+ if (!enabled) return;
+ invoke<boolean>("league_auto_accept_get")
+ .then((v) => { autoAccept = v; })
+ .catch(() => {});
+ refreshStatus();
+ pollTimer = setInterval(refreshStatus, 4000);
+ });
+
+ onDestroy(() => {
+ if (pollTimer) clearInterval(pollTimer);
+ });
+</script>
+
+<div class="league-page">
+ {#if !enabled}
+ <div class="guard-card">
+ <h2>{$t("league.disabled_title")}</h2>
+ <p>{$t("league.disabled_body")}</p>
+ <button class="button primary" onclick={() => goto("/settings")}>{$t("league.open_settings")}</button>
+ </div>
+ {:else}
+ <header class="league-header">
+ <h2>{$t("league.nav")}</h2>
+ <div class="status-chip" class:connected={status.connected}>
+ <span class="dot"></span>
+ {status.connected ? $t("league.connected") : $t("league.disconnected_title")}
+ {#if status.connected && status.region}
+ <span class="region">{status.region}</span>
+ {/if}
+ </div>
+ </header>
+
+ {#if !status.connected}
+ <div class="guard-card">
+ <p>{$t("league.disconnected_body")}</p>
+ </div>
+ {:else}
+ {#if summoner}
+ <section class="profile-card">
+ <img
+ class="profile-icon"
+ src={`${CDRAGON}/profile-icons/${summoner.profileIconId}.jpg`}
+ alt=""
+ loading="lazy"
+ />
+ <div class="profile-info">
+ <span class="profile-name">
+ {summoner.gameName ?? summoner.displayName}{#if summoner.tagLine}<span class="tag">#{summoner.tagLine}</span>{/if}
+ </span>
+ <span class="profile-level">{$t("league.level")} {summoner.summonerLevel}</span>
+ </div>
+ <div class="ranked-chips">
+ <div class="ranked-chip">
+ <span class="ranked-queue">{$t("league.ranked_solo")}</span>
+ <span class="ranked-value">{rankLabel(ranked?.RANKED_SOLO_5x5)}</span>
+ </div>
+ <div class="ranked-chip">
+ <span class="ranked-queue">{$t("league.ranked_flex")}</span>
+ <span class="ranked-value">{rankLabel(ranked?.RANKED_FLEX_SR)}</span>
+ </div>
+ </div>
+ </section>
+ {/if}
+
+ <section class="actions-card">
+ <div class="action-row">
+ <div class="action-col">
+ <span class="action-label">{$t("league.auto_accept")}</span>
+ <span class="action-hint">{$t("league.auto_accept_desc")}</span>
+ </div>
+ <button
+ class="toggle"
+ class:on={autoAccept}
+ onclick={toggleAutoAccept}
+ role="switch"
+ aria-checked={autoAccept}
+ aria-label={$t("league.auto_accept") as string}
+ >
+ <span class="toggle-knob"></span>
+ </button>
+ </div>
+ {#if phase && phase !== "None"}
+ <div class="divider"></div>
+ <div class="action-row">
+ <div class="action-col">
+ <span class="action-label">{$t("league.phase_label")}</span>
+ <span class="action-hint">{phase}</span>
+ </div>
+ {#if phase === "ReadyCheck"}
+ <button class="button primary" onclick={acceptNow}>{$t("league.accept_now")}</button>
+ {/if}
+ </div>
+ {/if}
+ </section>
+
+ <section class="history-section">
+ <div class="history-head">
+ <h3>{$t("league.history_title")}</h3>
+ <button class="button" onclick={loadHistory} disabled={loadingHistory}>{$t("league.refresh")}</button>
+ </div>
+ {#if games.length === 0}
+ <p class="history-empty">{$t("league.history_empty")}</p>
+ {:else}
+ <div class="game-list">
+ {#each games as game (game.gameId)}
+ {@const p = playerStats(game)}
+ <div class="game-row" class:win={p.win} class:loss={!p.win}>
+ <img
+ class="champ-icon"
+ src={`${CDRAGON}/champion-icons/${p.championId}.png`}
+ alt=""
+ loading="lazy"
+ />
+ <div class="game-info">
+ <span class="game-result">{p.win ? $t("league.victory") : $t("league.defeat")}</span>
+ <span class="game-mode">{queueName(game.queueId, game.gameMode)}</span>
+ </div>
+ <span class="game-kda">{p.kills} / {p.deaths} / {p.assists}</span>
+ <span class="game-time">{timeAgo(game.gameCreation, $locale)}</span>
+ </div>
+ {/each}
+ </div>
+ {/if}
+ </section>
+ {/if}
+ {/if}
+</div>
+
+<style>
+ .league-page {
+ display: flex;
+ flex-direction: column;
+ gap: var(--padding);
+ padding: var(--padding);
+ max-width: 720px;
+ margin: 0 auto;
+ width: 100%;
+ }
+
+ .guard-card {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ padding: calc(var(--padding) * 2);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ }
+
+ .guard-card h2 {
+ margin: 0;
+ font-size: 18px;
+ }
+
+ .guard-card p {
+ margin: 0;
+ color: var(--gray);
+ font-size: 13.5px;
+ }
+
+ .league-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ }
+
+ .league-header h2 {
+ margin: 0;
+ font-size: 20px;
+ }
+
+ .status-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ padding: 5px 12px;
+ font-size: 12.5px;
+ color: var(--gray);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ }
+
+ .status-chip .dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: var(--gray);
+ }
+
+ .status-chip.connected {
+ color: var(--text);
+ }
+
+ .status-chip.connected .dot {
+ background: var(--green, #4ade80);
+ }
+
+ .status-chip .region {
+ color: var(--gray);
+ text-transform: uppercase;
+ }
+
+ .profile-card {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ padding: var(--padding);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ }
+
+ .profile-icon {
+ width: 56px;
+ height: 56px;
+ border-radius: 50%;
+ border: 2px solid var(--border);
+ object-fit: cover;
+ }
+
+ .profile-info {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ min-width: 0;
+ }
+
+ .profile-name {
+ font-size: 16px;
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .profile-name .tag {
+ color: var(--gray);
+ font-weight: 400;
+ }
+
+ .profile-level {
+ font-size: 12.5px;
+ color: var(--gray);
+ }
+
+ .ranked-chips {
+ display: flex;
+ gap: 8px;
+ margin-left: auto;
+ flex-wrap: wrap;
+ }
+
+ .ranked-chip {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ padding: 7px 12px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 2px);
+ }
+
+ .ranked-queue {
+ font-size: 11px;
+ color: var(--gray);
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ }
+
+ .ranked-value {
+ font-size: 13px;
+ }
+
+ .actions-card {
+ display: flex;
+ flex-direction: column;
+ padding: var(--padding);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ }
+
+ .action-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ }
+
+ .action-col {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ min-width: 0;
+ }
+
+ .action-label {
+ font-size: 14px;
+ }
+
+ .action-hint {
+ font-size: 12.5px;
+ color: var(--gray);
+ }
+
+ .divider {
+ height: 1px;
+ background: var(--border);
+ margin: 10px 0;
+ }
+
+ .history-section {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+
+ .history-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .history-head h3 {
+ margin: 0;
+ font-size: 15px;
+ }
+
+ .history-empty {
+ color: var(--gray);
+ font-size: 13px;
+ margin: 0;
+ }
+
+ .game-list {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ }
+
+ .game-row {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 9px 12px;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-left-width: 3px;
+ border-radius: calc(var(--border-radius) - 2px);
+ }
+
+ .game-row.win {
+ border-left-color: var(--green, #4ade80);
+ }
+
+ .game-row.loss {
+ border-left-color: var(--red, #f87171);
+ }
+
+ .champ-icon {
+ width: 34px;
+ height: 34px;
+ border-radius: 6px;
+ object-fit: cover;
+ }
+
+ .game-info {
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ min-width: 0;
+ }
+
+ .game-result {
+ font-size: 13px;
+ font-weight: 600;
+ }
+
+ .game-mode {
+ font-size: 11.5px;
+ color: var(--gray);
+ }
+
+ .game-kda {
+ margin-left: auto;
+ font-size: 13px;
+ font-variant-numeric: tabular-nums;
+ }
+
+ .game-time {
+ font-size: 11.5px;
+ color: var(--gray);
+ min-width: 70px;
+ text-align: right;
+ }
+
+ .button {
+ padding: 6px 14px;
+ font-size: 13px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 2px);
+ color: var(--text);
+ cursor: pointer;
+ }
+
+ .button.primary {
+ background: var(--accent, var(--secondary));
+ color: var(--on-accent, var(--primary));
+ border-color: transparent;
+ }
+
+ .button:disabled {
+ opacity: 0.6;
+ cursor: default;
+ }
+
+ .toggle {
+ position: relative;
+ width: 40px;
+ height: 22px;
+ border-radius: 999px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ cursor: pointer;
+ flex-shrink: 0;
+ }
+
+ .toggle .toggle-knob {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ width: 16px;
+ height: 16px;
+ border-radius: 50%;
+ background: var(--gray);
+ transition: transform 0.15s ease, background 0.15s ease;
+ }
+
+ .toggle.on .toggle-knob {
+ transform: translateX(18px);
+ background: var(--accent, var(--secondary));
+ }
+</style>