mirror of
https://github.com/by-sonic/tglock.git
synced 2026-07-31 15:55:11 +03:00
feat: rebuild TGLock with adaptive transport and Tauri UI
This commit is contained in:
+383
@@ -0,0 +1,383 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import "./styles.css";
|
||||
|
||||
type View = "home" | "settings" | "diagnostics";
|
||||
|
||||
type Status = {
|
||||
running: boolean;
|
||||
activeConnections: number;
|
||||
tunnels: number;
|
||||
dataCenter: number | null;
|
||||
route: string;
|
||||
failures: number;
|
||||
uptimeSeconds: number;
|
||||
port: number;
|
||||
logs: LogLine[];
|
||||
};
|
||||
|
||||
type LogLine = {
|
||||
timestamp: string;
|
||||
message: string;
|
||||
error: boolean;
|
||||
};
|
||||
|
||||
type Settings = {
|
||||
lanMode: boolean;
|
||||
port: number;
|
||||
workerDomain: string;
|
||||
};
|
||||
|
||||
const root = document.querySelector<HTMLDivElement>("#app")!;
|
||||
|
||||
let view: View = "home";
|
||||
let status: Status = {
|
||||
running: false,
|
||||
activeConnections: 0,
|
||||
tunnels: 0,
|
||||
dataCenter: null,
|
||||
route: "Автоматический маршрут",
|
||||
failures: 0,
|
||||
uptimeSeconds: 0,
|
||||
port: 1080,
|
||||
logs: [],
|
||||
};
|
||||
let settings: Settings = { lanMode: false, port: 1080, workerDomain: "" };
|
||||
let busy = false;
|
||||
let toastTimer: number | undefined;
|
||||
|
||||
const icons = {
|
||||
arrowLeft: `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>`,
|
||||
settings: `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z"/><path d="M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.86 2.86-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 0-.4 1.1V21H9.6v-.1A1.7 1.7 0 0 0 8.5 19.4a1.7 1.7 0 0 0-1.88.34l-.06.06L3.7 16.94l.06-.06A1.7 1.7 0 0 0 4.1 15a1.7 1.7 0 0 0-.6-1 1.7 1.7 0 0 0-1.1-.4H2.3V9.6h.1A1.7 1.7 0 0 0 4.1 8.5a1.7 1.7 0 0 0-.34-1.88l-.06-.06L6.56 3.7l.06.06A1.7 1.7 0 0 0 8.5 4.1a1.7 1.7 0 0 0 1-.6 1.7 1.7 0 0 0 .4-1.1V2.3h4v.1A1.7 1.7 0 0 0 15 4.1a1.7 1.7 0 0 0 1.88-.34l.06-.06 2.86 2.86-.06.06A1.7 1.7 0 0 0 19.4 8.5a1.7 1.7 0 0 0 .6 1 1.7 1.7 0 0 0 1.1.4h.1v4h-.1a1.7 1.7 0 0 0-1.7 1.1Z"/></svg>`,
|
||||
activity: `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12h4l2.4-7 5.1 14 2.4-7H21"/></svg>`,
|
||||
plane: `<svg viewBox="0 0 64 64" aria-hidden="true"><path fill="currentColor" d="M52.4 11.7 8.2 28.8c-3 1.2-3 2.8-.6 3.5l11.3 3.5 4.4 13.4c.5 1.5.3 2.1 1.8 2.1 1.2 0 1.7-.5 2.4-1.2l5.5-5.3 11.5 8.5c2.1 1.2 3.7.6 4.2-2l7.6-35.8c.8-3.1-1.2-4.5-3.9-3.8ZM22.7 35l22.1-13.9c1.1-.7 2.1-.3 1.3.4L27.9 38l-.7 7.4L22.7 35Z"/></svg>`,
|
||||
};
|
||||
|
||||
function escapeHtml(value: string): string {
|
||||
return value
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """);
|
||||
}
|
||||
|
||||
function formatUptime(seconds: number): string {
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const minutes = Math.floor((seconds % 3600) / 60);
|
||||
const rest = seconds % 60;
|
||||
return [hours, minutes, rest].map((value) => value.toString().padStart(2, "0")).join(":");
|
||||
}
|
||||
|
||||
function connectionState(): { title: string; subtitle: string; className: string } {
|
||||
if (!status.running) {
|
||||
return {
|
||||
title: "Защита выключена",
|
||||
subtitle: "Нажмите кнопку, чтобы подключить Telegram",
|
||||
className: "offline",
|
||||
};
|
||||
}
|
||||
if (status.failures > 0 && status.tunnels === 0) {
|
||||
return {
|
||||
title: "Ищем новый маршрут",
|
||||
subtitle: "Переключаемся на резервное подключение",
|
||||
className: "warning",
|
||||
};
|
||||
}
|
||||
if (status.tunnels > 0) {
|
||||
return {
|
||||
title: "Telegram на связи",
|
||||
subtitle: "Соединение защищено и работает",
|
||||
className: "online",
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: "Защита включена",
|
||||
subtitle: "Откройте Telegram — маршрут готов",
|
||||
className: "online",
|
||||
};
|
||||
}
|
||||
|
||||
function shell(content: string, pageClass = ""): string {
|
||||
return `
|
||||
<main class="app-shell ${pageClass}">
|
||||
<div class="drag-region" data-tauri-drag-region></div>
|
||||
${content}
|
||||
<div id="toast" class="toast" role="status"></div>
|
||||
</main>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderHome(): void {
|
||||
const connection = connectionState();
|
||||
root.innerHTML = shell(`
|
||||
<section class="home">
|
||||
<header class="brand">
|
||||
<div class="wordmark"><span>TG</span>Lock</div>
|
||||
<p>Свободный Telegram. В один клик.</p>
|
||||
</header>
|
||||
|
||||
<div class="hero ${connection.className}">
|
||||
<div class="orb-field">
|
||||
<div class="orbit orbit-one"></div>
|
||||
<div class="orbit orbit-two"></div>
|
||||
<div class="orb">
|
||||
<div class="orb-shine"></div>
|
||||
${icons.plane}
|
||||
</div>
|
||||
</div>
|
||||
<div class="connection-copy">
|
||||
<div class="status-line">
|
||||
<span class="status-dot"></span>
|
||||
<h1>${connection.title}</h1>
|
||||
</div>
|
||||
<p>${connection.subtitle}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="power" class="power-button ${status.running ? "stop" : ""}" ${busy ? "disabled" : ""}>
|
||||
<span>${busy ? "Подождите…" : status.running ? "Выключить" : "Включить защиту"}</span>
|
||||
<span class="button-arrow">→</span>
|
||||
</button>
|
||||
|
||||
<div class="route-pill">
|
||||
<span class="route-pulse"></span>
|
||||
<span>${escapeHtml(status.route)}</span>
|
||||
<span class="route-separator">·</span>
|
||||
<span>порт ${status.port}</span>
|
||||
</div>
|
||||
|
||||
<nav class="bottom-nav" aria-label="Разделы">
|
||||
<button id="settings-nav" class="nav-button">
|
||||
<span class="nav-icon">${icons.settings}</span>
|
||||
<span>Настройки</span>
|
||||
</button>
|
||||
<div class="nav-divider"></div>
|
||||
<button id="diagnostics-nav" class="nav-button">
|
||||
<span class="nav-icon">${icons.activity}</span>
|
||||
<span>Диагностика</span>
|
||||
</button>
|
||||
</nav>
|
||||
</section>
|
||||
`, "home-page");
|
||||
|
||||
document.querySelector("#power")?.addEventListener("click", toggleProtection);
|
||||
document.querySelector("#settings-nav")?.addEventListener("click", () => navigate("settings"));
|
||||
document.querySelector("#diagnostics-nav")?.addEventListener("click", () => navigate("diagnostics"));
|
||||
}
|
||||
|
||||
function pageHeader(title: string, subtitle: string): string {
|
||||
return `
|
||||
<header class="page-header">
|
||||
<button class="back-button" id="back" aria-label="Назад">${icons.arrowLeft}</button>
|
||||
<div>
|
||||
<h1>${title}</h1>
|
||||
<p>${subtitle}</p>
|
||||
</div>
|
||||
</header>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderSettings(): void {
|
||||
root.innerHTML = shell(`
|
||||
<section class="subpage">
|
||||
${pageHeader("Настройки", "Подключение и локальная сеть")}
|
||||
|
||||
<form id="settings-form" class="settings-form">
|
||||
<div class="setting-card">
|
||||
<label class="field-label" for="worker">Cloudflare Worker</label>
|
||||
<input
|
||||
id="worker"
|
||||
name="worker"
|
||||
type="text"
|
||||
value="${escapeHtml(settings.workerDomain)}"
|
||||
placeholder="example.workers.dev"
|
||||
autocomplete="off"
|
||||
${status.running ? "disabled" : ""}
|
||||
/>
|
||||
<p class="field-hint">Необязательно. Используется как резервный маршрут.</p>
|
||||
</div>
|
||||
|
||||
<div class="setting-list">
|
||||
<label class="setting-row" for="lan-mode">
|
||||
<span>
|
||||
<strong>Доступ из локальной сети</strong>
|
||||
<small>Подключение других устройств</small>
|
||||
</span>
|
||||
<span class="switch">
|
||||
<input id="lan-mode" type="checkbox" ${settings.lanMode ? "checked" : ""} ${status.running ? "disabled" : ""}/>
|
||||
<span class="switch-track"></span>
|
||||
</span>
|
||||
</label>
|
||||
<div class="setting-rule"></div>
|
||||
<label class="setting-row compact" for="port">
|
||||
<span>
|
||||
<strong>Локальный порт</strong>
|
||||
<small>SOCKS5 и MTProto</small>
|
||||
</span>
|
||||
<input id="port" class="port-input" type="number" min="1" max="65535" value="${settings.port}" ${status.running ? "disabled" : ""}/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
${status.running ? `<div class="locked-note"><span></span>Выключите защиту, чтобы изменить настройки</div>` : ""}
|
||||
|
||||
<button class="save-button" type="submit" ${status.running || busy ? "disabled" : ""}>
|
||||
${busy ? "Сохраняю…" : "Сохранить настройки"}
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
`, "subpage-shell");
|
||||
|
||||
document.querySelector("#back")?.addEventListener("click", () => navigate("home"));
|
||||
document.querySelector("#settings-form")?.addEventListener("submit", saveSettings);
|
||||
}
|
||||
|
||||
function renderDiagnostics(): void {
|
||||
const recentLogs = status.logs.slice(-4).reverse();
|
||||
root.innerHTML = shell(`
|
||||
<section class="subpage">
|
||||
${pageHeader("Диагностика", "Состояние маршрута в реальном времени")}
|
||||
|
||||
<div class="connection-banner ${status.running ? "active" : ""}">
|
||||
<span class="banner-icon">${icons.activity}</span>
|
||||
<div>
|
||||
<strong>${status.running ? "Сервис работает" : "Сервис остановлен"}</strong>
|
||||
<small>${status.running ? "Локальный прокси принимает подключения" : "Включите защиту на главном экране"}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="metrics-grid">
|
||||
<article class="metric-card">
|
||||
<span>Соединения</span>
|
||||
<strong>${status.activeConnections}</strong>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<span>Туннели</span>
|
||||
<strong>${status.tunnels}</strong>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<span>Дата-центр</span>
|
||||
<strong>${status.dataCenter ? `DC${status.dataCenter}` : "—"}</strong>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<span>Время работы</span>
|
||||
<strong class="time">${formatUptime(status.uptimeSeconds)}</strong>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="log-panel">
|
||||
<div class="log-heading">
|
||||
<span>Последние события</span>
|
||||
<span class="live-label"><i></i>LIVE</span>
|
||||
</div>
|
||||
<div class="logs">
|
||||
${recentLogs.length
|
||||
? recentLogs
|
||||
.map(
|
||||
(line) => `
|
||||
<div class="log-line ${line.error ? "error" : ""}">
|
||||
<time>${line.timestamp}</time>
|
||||
<span>${escapeHtml(line.message)}</span>
|
||||
</div>`,
|
||||
)
|
||||
.join("")
|
||||
: `<div class="empty-log">События появятся после включения защиты</div>`}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
`, "subpage-shell");
|
||||
|
||||
document.querySelector("#back")?.addEventListener("click", () => navigate("home"));
|
||||
}
|
||||
|
||||
function render(): void {
|
||||
if (view === "settings") renderSettings();
|
||||
else if (view === "diagnostics") renderDiagnostics();
|
||||
else renderHome();
|
||||
}
|
||||
|
||||
function navigate(next: View): void {
|
||||
view = next;
|
||||
render();
|
||||
}
|
||||
|
||||
async function refreshStatus(): Promise<void> {
|
||||
try {
|
||||
status = await invoke<Status>("get_status");
|
||||
if (view !== "settings") render();
|
||||
} catch (error) {
|
||||
showToast(String(error), true);
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleProtection(): Promise<void> {
|
||||
if (busy) return;
|
||||
busy = true;
|
||||
renderHome();
|
||||
try {
|
||||
status = status.running
|
||||
? await invoke<Status>("stop_proxy")
|
||||
: await invoke<Status>("start_proxy");
|
||||
} catch (error) {
|
||||
showToast(String(error), true);
|
||||
} finally {
|
||||
busy = false;
|
||||
await refreshStatus();
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSettings(event: Event): Promise<void> {
|
||||
event.preventDefault();
|
||||
if (busy || status.running) return;
|
||||
const worker = document.querySelector<HTMLInputElement>("#worker");
|
||||
const lanMode = document.querySelector<HTMLInputElement>("#lan-mode");
|
||||
const port = document.querySelector<HTMLInputElement>("#port");
|
||||
if (!worker || !lanMode || !port) return;
|
||||
|
||||
const parsedPort = Number(port.value);
|
||||
if (!Number.isInteger(parsedPort) || parsedPort < 1 || parsedPort > 65535) {
|
||||
showToast("Порт должен быть от 1 до 65535", true);
|
||||
return;
|
||||
}
|
||||
|
||||
busy = true;
|
||||
settings = {
|
||||
workerDomain: worker.value.trim(),
|
||||
lanMode: lanMode.checked,
|
||||
port: parsedPort,
|
||||
};
|
||||
renderSettings();
|
||||
try {
|
||||
settings = await invoke<Settings>("save_settings", { settings });
|
||||
showToast("Настройки сохранены");
|
||||
window.setTimeout(() => navigate("home"), 350);
|
||||
} catch (error) {
|
||||
showToast(String(error), true);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
function showToast(message: string, error = false): void {
|
||||
window.clearTimeout(toastTimer);
|
||||
window.requestAnimationFrame(() => {
|
||||
const toast = document.querySelector<HTMLDivElement>("#toast");
|
||||
if (!toast) return;
|
||||
toast.textContent = message.replace(/^["']|["']$/g, "");
|
||||
toast.className = `toast visible${error ? " error" : ""}`;
|
||||
toastTimer = window.setTimeout(() => toast.classList.remove("visible"), 2800);
|
||||
});
|
||||
}
|
||||
|
||||
async function bootstrap(): Promise<void> {
|
||||
try {
|
||||
[status, settings] = await Promise.all([
|
||||
invoke<Status>("get_status"),
|
||||
invoke<Settings>("get_settings"),
|
||||
]);
|
||||
} catch {
|
||||
// The browser preview intentionally uses the initial local state.
|
||||
}
|
||||
render();
|
||||
window.setInterval(refreshStatus, 1000);
|
||||
}
|
||||
|
||||
void bootstrap();
|
||||
+849
@@ -0,0 +1,849 @@
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
font-family:
|
||||
Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display",
|
||||
"Segoe UI", sans-serif;
|
||||
font-synthesis: none;
|
||||
text-rendering: geometricPrecision;
|
||||
--bg: #070a10;
|
||||
--panel: rgba(18, 24, 36, 0.78);
|
||||
--panel-strong: #111827;
|
||||
--line: rgba(148, 163, 184, 0.12);
|
||||
--text: #f4f8ff;
|
||||
--muted: #7e8ca3;
|
||||
--blue: #45a9ff;
|
||||
--blue-strong: #168dff;
|
||||
--green: #55e7a6;
|
||||
--red: #ff6b7d;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
button,
|
||||
input {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.app-shell {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(circle at 50% 31%, rgba(19, 116, 220, 0.16), transparent 34%),
|
||||
radial-gradient(circle at 88% 4%, rgba(71, 119, 255, 0.08), transparent 30%),
|
||||
linear-gradient(165deg, #0b1019 0%, #070a10 58%, #090d15 100%);
|
||||
}
|
||||
|
||||
.app-shell::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0.13;
|
||||
pointer-events: none;
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.drag-region {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.home,
|
||||
.subpage {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.home {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 48px 34px 24px;
|
||||
}
|
||||
|
||||
.brand {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wordmark {
|
||||
font-size: 27px;
|
||||
font-weight: 760;
|
||||
letter-spacing: -1.1px;
|
||||
}
|
||||
|
||||
.wordmark span {
|
||||
color: var(--blue);
|
||||
}
|
||||
|
||||
.brand p {
|
||||
margin: 5px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 480;
|
||||
letter-spacing: 0.08px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.orb-field {
|
||||
position: relative;
|
||||
display: grid;
|
||||
width: 184px;
|
||||
height: 184px;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.orb-field::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 108px;
|
||||
height: 108px;
|
||||
border-radius: 50%;
|
||||
background: rgba(35, 126, 221, 0.26);
|
||||
filter: blur(30px);
|
||||
transform: scale(1.25);
|
||||
transition: background 500ms ease;
|
||||
}
|
||||
|
||||
.online .orb-field::before {
|
||||
background: rgba(33, 203, 149, 0.28);
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: absolute;
|
||||
border: 1px solid rgba(83, 174, 255, 0.15);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.orbit-one {
|
||||
inset: 10px;
|
||||
border-left-color: rgba(79, 172, 255, 0.48);
|
||||
transform: rotate(-30deg);
|
||||
}
|
||||
|
||||
.orbit-two {
|
||||
inset: 22px;
|
||||
border-right-color: rgba(79, 172, 255, 0.34);
|
||||
transform: rotate(22deg);
|
||||
}
|
||||
|
||||
.orb {
|
||||
position: relative;
|
||||
display: grid;
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
overflow: hidden;
|
||||
color: white;
|
||||
border: 1px solid rgba(137, 204, 255, 0.66);
|
||||
border-radius: 50%;
|
||||
place-items: center;
|
||||
background:
|
||||
linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 40%),
|
||||
linear-gradient(145deg, #269fff, #0d5fbd);
|
||||
box-shadow:
|
||||
inset 0 1px 1px rgba(255, 255, 255, 0.38),
|
||||
inset 0 -14px 28px rgba(1, 21, 56, 0.28),
|
||||
0 0 0 8px rgba(34, 129, 223, 0.06),
|
||||
0 18px 45px rgba(2, 90, 183, 0.34);
|
||||
transition: filter 300ms ease, background 500ms ease;
|
||||
}
|
||||
|
||||
.offline .orb {
|
||||
filter: saturate(0.44) brightness(0.72);
|
||||
}
|
||||
|
||||
.online .orb {
|
||||
border-color: rgba(112, 245, 192, 0.72);
|
||||
background:
|
||||
linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 40%),
|
||||
linear-gradient(145deg, #29c995, #087e78);
|
||||
box-shadow:
|
||||
inset 0 1px 1px rgba(255, 255, 255, 0.38),
|
||||
inset 0 -14px 28px rgba(1, 46, 54, 0.28),
|
||||
0 0 0 8px rgba(34, 220, 157, 0.06),
|
||||
0 18px 45px rgba(9, 182, 133, 0.3);
|
||||
}
|
||||
|
||||
.orb svg {
|
||||
z-index: 1;
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
transform: translate(-1px, 1px);
|
||||
filter: drop-shadow(0 5px 10px rgba(0, 32, 75, 0.3));
|
||||
}
|
||||
|
||||
.orb-shine {
|
||||
position: absolute;
|
||||
top: -34px;
|
||||
left: 6px;
|
||||
width: 96px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.11);
|
||||
transform: rotate(-20deg);
|
||||
filter: blur(5px);
|
||||
}
|
||||
|
||||
.connection-copy {
|
||||
margin-top: 11px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.status-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 9px;
|
||||
}
|
||||
|
||||
.status-line h1 {
|
||||
margin: 0;
|
||||
font-size: 19px;
|
||||
font-weight: 680;
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: #526177;
|
||||
box-shadow: 0 0 0 4px rgba(82, 97, 119, 0.11);
|
||||
}
|
||||
|
||||
.online .status-dot {
|
||||
background: var(--green);
|
||||
box-shadow: 0 0 12px rgba(85, 231, 166, 0.8);
|
||||
}
|
||||
|
||||
.warning .status-dot {
|
||||
background: #ffbf5b;
|
||||
}
|
||||
|
||||
.connection-copy p {
|
||||
margin: 6px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 11.5px;
|
||||
}
|
||||
|
||||
.power-button {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 54px;
|
||||
margin-top: 24px;
|
||||
padding: 0 21px 0 25px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(118, 196, 255, 0.5);
|
||||
border-radius: 16px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent),
|
||||
linear-gradient(135deg, #3eaaff, #1685ee);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.26),
|
||||
0 12px 28px rgba(7, 103, 204, 0.28);
|
||||
font-size: 14px;
|
||||
font-weight: 690;
|
||||
transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
|
||||
}
|
||||
|
||||
.power-button:hover {
|
||||
filter: brightness(1.08);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.26),
|
||||
0 14px 34px rgba(7, 103, 204, 0.38);
|
||||
}
|
||||
|
||||
.power-button:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
.power-button.stop {
|
||||
color: #c9d6e8;
|
||||
border-color: rgba(148, 163, 184, 0.18);
|
||||
background: rgba(26, 34, 48, 0.8);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.power-button:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.62;
|
||||
}
|
||||
|
||||
.button-arrow {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.route-pill {
|
||||
display: flex;
|
||||
height: 30px;
|
||||
margin-top: 12px;
|
||||
padding: 0 12px;
|
||||
color: #78879e;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
background: rgba(17, 24, 37, 0.54);
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.route-pulse {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--blue);
|
||||
box-shadow: 0 0 8px rgba(69, 169, 255, 0.7);
|
||||
}
|
||||
|
||||
.route-separator {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.bottom-nav {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-top: auto;
|
||||
padding: 11px 8px 3px;
|
||||
border-top: 1px solid var(--line);
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-button {
|
||||
display: flex;
|
||||
min-width: 134px;
|
||||
height: 38px;
|
||||
padding: 0 14px;
|
||||
cursor: pointer;
|
||||
color: #8694aa;
|
||||
border: 0;
|
||||
border-radius: 11px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
background: transparent;
|
||||
font-size: 11px;
|
||||
transition: color 150ms ease, background 150ms ease;
|
||||
}
|
||||
|
||||
.nav-button:hover {
|
||||
color: #cbd8ea;
|
||||
background: rgba(255, 255, 255, 0.035);
|
||||
}
|
||||
|
||||
.nav-icon,
|
||||
.banner-icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.nav-icon svg {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.6;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.nav-divider {
|
||||
width: 1px;
|
||||
height: 20px;
|
||||
margin: 9px 5px;
|
||||
background: var(--line);
|
||||
}
|
||||
|
||||
.subpage {
|
||||
padding: 54px 30px 26px;
|
||||
}
|
||||
|
||||
.subpage-shell {
|
||||
background:
|
||||
radial-gradient(circle at 100% 0, rgba(32, 123, 220, 0.13), transparent 35%),
|
||||
linear-gradient(165deg, #0b1019, #070a10);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.back-button {
|
||||
display: grid;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
color: #bdc9da;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
place-items: center;
|
||||
background: rgba(18, 26, 40, 0.72);
|
||||
transition: background 150ms ease, border-color 150ms ease;
|
||||
}
|
||||
|
||||
.back-button:hover {
|
||||
border-color: rgba(92, 174, 255, 0.3);
|
||||
background: rgba(28, 42, 61, 0.82);
|
||||
}
|
||||
|
||||
.back-button svg {
|
||||
width: 18px;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.8;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 720;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.page-header p {
|
||||
margin: 4px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
margin-top: 27px;
|
||||
}
|
||||
|
||||
.setting-card,
|
||||
.setting-list,
|
||||
.connection-banner,
|
||||
.metric-card,
|
||||
.log-panel {
|
||||
border: 1px solid var(--line);
|
||||
background:
|
||||
linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent),
|
||||
rgba(15, 22, 34, 0.76);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
|
||||
}
|
||||
|
||||
.setting-card {
|
||||
padding: 18px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
color: #dfe8f5;
|
||||
font-size: 12px;
|
||||
font-weight: 630;
|
||||
}
|
||||
|
||||
.setting-card input,
|
||||
.port-input {
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
border: 1px solid rgba(125, 154, 190, 0.18);
|
||||
background: rgba(6, 10, 17, 0.72);
|
||||
transition: border-color 150ms ease, box-shadow 150ms ease;
|
||||
}
|
||||
|
||||
.setting-card input {
|
||||
width: 100%;
|
||||
height: 42px;
|
||||
padding: 0 13px;
|
||||
border-radius: 11px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.setting-card input:focus,
|
||||
.port-input:focus {
|
||||
border-color: rgba(69, 169, 255, 0.65);
|
||||
box-shadow: 0 0 0 3px rgba(69, 169, 255, 0.1);
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: #4f5b6d;
|
||||
}
|
||||
|
||||
input:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.field-hint {
|
||||
margin: 8px 0 0;
|
||||
color: #66758b;
|
||||
font-size: 9.5px;
|
||||
}
|
||||
|
||||
.setting-list {
|
||||
margin-top: 13px;
|
||||
padding: 4px 18px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.setting-row {
|
||||
display: flex;
|
||||
min-height: 68px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.setting-row strong {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 620;
|
||||
}
|
||||
|
||||
.setting-row small {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
color: var(--muted);
|
||||
font-size: 9.5px;
|
||||
}
|
||||
|
||||
.setting-rule {
|
||||
height: 1px;
|
||||
background: var(--line);
|
||||
}
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
width: 42px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.switch-track {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(148, 163, 184, 0.2);
|
||||
border-radius: 999px;
|
||||
background: #202a39;
|
||||
transition: background 180ms ease;
|
||||
}
|
||||
|
||||
.switch-track::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
background: #8e9bad;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
||||
transition: transform 180ms ease, background 180ms ease;
|
||||
}
|
||||
|
||||
.switch input:checked + .switch-track {
|
||||
border-color: rgba(69, 169, 255, 0.5);
|
||||
background: var(--blue-strong);
|
||||
}
|
||||
|
||||
.switch input:checked + .switch-track::after {
|
||||
background: white;
|
||||
transform: translateX(18px);
|
||||
}
|
||||
|
||||
.port-input {
|
||||
width: 78px;
|
||||
height: 34px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
appearance: textfield;
|
||||
}
|
||||
|
||||
.locked-note {
|
||||
display: flex;
|
||||
margin: 13px 2px 0;
|
||||
color: #8d9aab;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.locked-note span {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #ffb84f;
|
||||
}
|
||||
|
||||
.save-button {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
margin-top: 18px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
border: 1px solid rgba(100, 186, 255, 0.45);
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(135deg, #36a8ff, #147fe8);
|
||||
box-shadow: 0 10px 24px rgba(6, 94, 185, 0.22);
|
||||
font-size: 12px;
|
||||
font-weight: 680;
|
||||
}
|
||||
|
||||
.save-button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.45;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.connection-banner {
|
||||
display: flex;
|
||||
margin-top: 27px;
|
||||
padding: 16px;
|
||||
border-radius: 16px;
|
||||
align-items: center;
|
||||
gap: 13px;
|
||||
}
|
||||
|
||||
.connection-banner.active {
|
||||
border-color: rgba(68, 219, 159, 0.18);
|
||||
background:
|
||||
linear-gradient(145deg, rgba(44, 207, 151, 0.055), transparent),
|
||||
rgba(15, 22, 34, 0.76);
|
||||
}
|
||||
|
||||
.banner-icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
color: #7c8da5;
|
||||
border-radius: 12px;
|
||||
background: rgba(112, 129, 153, 0.1);
|
||||
}
|
||||
|
||||
.active .banner-icon {
|
||||
color: var(--green);
|
||||
background: rgba(65, 221, 159, 0.1);
|
||||
}
|
||||
|
||||
.banner-icon svg {
|
||||
width: 19px;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.7;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.connection-banner strong,
|
||||
.connection-banner small {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.connection-banner strong {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.connection-banner small {
|
||||
margin-top: 4px;
|
||||
color: var(--muted);
|
||||
font-size: 9.5px;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
margin-top: 13px;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
height: 84px;
|
||||
padding: 16px;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.metric-card span {
|
||||
display: block;
|
||||
color: var(--muted);
|
||||
font-size: 9.5px;
|
||||
}
|
||||
|
||||
.metric-card strong {
|
||||
display: block;
|
||||
margin-top: 9px;
|
||||
font-size: 21px;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.metric-card strong.time {
|
||||
font-family: "SF Mono", ui-monospace, monospace;
|
||||
font-size: 17px;
|
||||
letter-spacing: -0.7px;
|
||||
}
|
||||
|
||||
.log-panel {
|
||||
margin-top: 13px;
|
||||
padding: 16px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.log-heading {
|
||||
display: flex;
|
||||
color: #dbe5f3;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 10px;
|
||||
font-weight: 640;
|
||||
}
|
||||
|
||||
.live-label {
|
||||
display: flex;
|
||||
color: #65748a;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.7px;
|
||||
}
|
||||
|
||||
.live-label i {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--green);
|
||||
box-shadow: 0 0 7px rgba(85, 231, 166, 0.75);
|
||||
}
|
||||
|
||||
.logs {
|
||||
min-height: 96px;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
.log-line {
|
||||
display: grid;
|
||||
padding: 6px 0;
|
||||
color: #8c9ab0;
|
||||
grid-template-columns: 58px 1fr;
|
||||
gap: 6px;
|
||||
font-family: "SF Mono", ui-monospace, monospace;
|
||||
font-size: 8.7px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.log-line.error {
|
||||
color: var(--red);
|
||||
}
|
||||
|
||||
.log-line time {
|
||||
color: #556276;
|
||||
}
|
||||
|
||||
.empty-log {
|
||||
display: grid;
|
||||
height: 92px;
|
||||
color: #59677b;
|
||||
place-items: center;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: absolute;
|
||||
z-index: 20;
|
||||
left: 50%;
|
||||
bottom: 22px;
|
||||
max-width: calc(100% - 48px);
|
||||
padding: 10px 14px;
|
||||
pointer-events: none;
|
||||
color: #dff9ed;
|
||||
border: 1px solid rgba(73, 222, 161, 0.25);
|
||||
border-radius: 10px;
|
||||
opacity: 0;
|
||||
background: rgba(16, 44, 38, 0.94);
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
transform: translate(-50%, 8px);
|
||||
transition: opacity 160ms ease, transform 160ms ease;
|
||||
}
|
||||
|
||||
.toast.error {
|
||||
color: #ffe0e4;
|
||||
border-color: rgba(255, 107, 125, 0.25);
|
||||
background: rgba(60, 23, 32, 0.96);
|
||||
}
|
||||
|
||||
.toast.visible {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.online .orbit-one {
|
||||
animation: orbit-spin 12s linear infinite;
|
||||
}
|
||||
|
||||
.online .orbit-two {
|
||||
animation: orbit-spin-reverse 16s linear infinite;
|
||||
}
|
||||
|
||||
.online .orb {
|
||||
animation: orb-breathe 3.6s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes orbit-spin {
|
||||
to {
|
||||
transform: rotate(330deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes orbit-spin-reverse {
|
||||
to {
|
||||
transform: rotate(-338deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes orb-breathe {
|
||||
50% {
|
||||
box-shadow:
|
||||
inset 0 1px 1px rgba(255, 255, 255, 0.38),
|
||||
inset 0 -14px 28px rgba(1, 46, 54, 0.28),
|
||||
0 0 0 11px rgba(34, 220, 157, 0.04),
|
||||
0 19px 52px rgba(9, 182, 133, 0.4);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user