chore: restart the repository with a clean history
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
This commit is contained in:
438 files changed
+45070
No files matched your search
@@ -0,0 +1,112 @@
|
||||
import "./styles.sass";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import Button from "@/common/components/Button";
|
||||
import Gate from "@/pages/Gate";
|
||||
import { getRequest } from "@/common/utils/RequestUtil.js";
|
||||
import { bindTab, readTab, rememberTab } from "@/common/utils/tunnelTab.js";
|
||||
|
||||
const POLL_INTERVAL = 2000;
|
||||
const BIND_TIMEOUT = 2000;
|
||||
const BLOCKED = {
|
||||
address: "This tunnel does not accept requests from your address.",
|
||||
country: "This tunnel does not accept requests from your country.",
|
||||
tor: "This tunnel does not accept requests from Tor exit nodes.",
|
||||
vpn: "This tunnel does not accept requests from VPN services.",
|
||||
datacenter: "This tunnel does not accept requests from datacenters.",
|
||||
blocklist: "This tunnel does not accept requests from blocklisted addresses.",
|
||||
};
|
||||
|
||||
export const Status = ({ kind, id, to, auth, authorize, ip, reason }) => {
|
||||
const target = to || new URLSearchParams(window.location.search).get("to") || "/";
|
||||
const [failed, setFailed] = useState(false);
|
||||
const started = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (started.current) return;
|
||||
started.current = true;
|
||||
|
||||
if (kind === "attach" || kind === "reattach") {
|
||||
const tunnel = kind === "attach" ? id : readTab();
|
||||
if (!tunnel) {
|
||||
window.location.replace("/@frislit/select");
|
||||
return;
|
||||
}
|
||||
rememberTab(tunnel);
|
||||
let done = false;
|
||||
const go = () => {
|
||||
if (done) return;
|
||||
done = true;
|
||||
window.location.replace(target);
|
||||
};
|
||||
bindTab(tunnel).then(go).catch(() => setFailed(true));
|
||||
const timer = setTimeout(go, BIND_TIMEOUT);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
|
||||
if (kind === "offline") {
|
||||
const timer = setInterval(async () => {
|
||||
try {
|
||||
const status = await getRequest(`status/${encodeURIComponent(id)}`);
|
||||
if (status.online) window.location.reload();
|
||||
if (!status.exists) setFailed(true);
|
||||
} catch { /* keep waiting, the server may be restarting too */ }
|
||||
}, POLL_INTERVAL);
|
||||
return () => clearInterval(timer);
|
||||
}
|
||||
}, [kind, id, target]);
|
||||
|
||||
if (kind === "gate") return <Gate id={id} auth={auth} authorize={authorize} />;
|
||||
|
||||
if (kind === "blocked") {
|
||||
return (
|
||||
<div className="status-page">
|
||||
<div className="form-head">
|
||||
<h1>Not allowed.</h1>
|
||||
<p>{BLOCKED[reason]}{ip ? <> Your address is <code>{ip}</code>.</> : null}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (kind === "attach" || kind === "reattach") {
|
||||
return (
|
||||
<div className="status-page">
|
||||
<div className="form-head">
|
||||
<h1>{failed ? "Could not open this tunnel." : "Opening…"}</h1>
|
||||
<p>{failed
|
||||
? "This browser could not start the tunnel router. Path mode needs HTTPS or localhost."
|
||||
: <>Attaching this tab to <code>{id || readTab()}</code>.</>}</p>
|
||||
</div>
|
||||
{failed && <div className="form-actions">
|
||||
<Button text="Choose a tunnel" buttonType="button" onClick={() => window.location.replace("/@frislit/select")} />
|
||||
</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (kind === "offline") {
|
||||
return (
|
||||
<div className="status-page">
|
||||
<div className="form-head">
|
||||
<h1>{failed ? "Tunnel closed." : "Reconnecting…"}</h1>
|
||||
<p>{failed
|
||||
? <>The tunnel <code>{id}</code> is gone.</>
|
||||
: <>The client for <code>{id}</code> is disconnected. This page continues by itself once it is back.</>}</p>
|
||||
</div>
|
||||
<div className="status-wait">{!failed && <span className="status-spinner" />}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="status-page">
|
||||
<div className="form-head">
|
||||
<h1>Tunnel not found.</h1>
|
||||
<p>There is no tunnel called <code>{id}</code>. It may have been closed, or the id was mistyped.</p>
|
||||
</div>
|
||||
<div className="form-actions">
|
||||
<Button text="Choose a tunnel" buttonType="button" onClick={() => window.location.replace("/@frislit/select")} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export { Status as default } from "./Status.jsx";
|
||||
@@ -0,0 +1,30 @@
|
||||
@use "@/common/styles/colors"
|
||||
|
||||
.status-page
|
||||
width: 100%
|
||||
|
||||
code
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace
|
||||
font-size: 0.85em
|
||||
color: var(--primary-bright)
|
||||
background: var(--surface-raised)
|
||||
border: 1px solid var(--border)
|
||||
border-radius: 0.375rem
|
||||
padding: 0.1rem 0.35rem
|
||||
|
||||
.status-wait
|
||||
display: flex
|
||||
align-items: center
|
||||
min-height: 2rem
|
||||
|
||||
.status-spinner
|
||||
width: 1.1rem
|
||||
height: 1.1rem
|
||||
border: 2px solid var(--border-strong)
|
||||
border-top-color: var(--primary-bright)
|
||||
border-radius: 50%
|
||||
animation: status-spin 0.9s linear infinite
|
||||
|
||||
@keyframes status-spin
|
||||
to
|
||||
transform: rotate(360deg)
|
||||
Reference in new issue
Block a user