mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 01:00:18 +02:00
A site can link to frame-control://install?manifest=URL (or ?url=URL) to install a title with Frame Control. Manifests use FrameDrop's format, so framedrop.install/v1 is accepted as well as frame-control.install/v1. - app/install-link.js parses links; main.js registers the scheme (plus electron-builder protocols for Info.plist and the .desktop file), takes links from open-url, second-instance argv and the first argv, and holds them until the page asks for them through preload's onInstallLink. - ui/frame_webinstall.py checks the URLs (HTTPS only; localhost over http only when the link itself is local; no userinfo; every address public, rechecked on redirects and pinned for the connection), reads the manifest, downloads with a size cap and sha256 check, and dispatch() sends .apk to frame_android and .zip/.exe to frame_titles when present. - server.py adds /api/webinstall/check, start, job and cancel behind the existing Host and X-Frame-UI guards; a start needs a one-time id from check. Downloads stop on cancel and on shutdown, and leftovers from a killed server are swept by PID. - index.html asks before anything downloads (name, source host, file, type, size, whether a sha256 was given) and shows progress. - docs/web-install.md, docs/install.html (landing page, unpublished). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
64 lines
2.9 KiB
HTML
64 lines
2.9 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="referrer" content="no-referrer">
|
|
<title>Install with Frame Control</title>
|
|
<!-- Landing page for install links (docs/web-install.md): install.html?manifest=URL
|
|
or ?url=URL opens frame-control://install?… and offers the download if the
|
|
app doesn't open. Static, no requests of its own. Not published yet. -->
|
|
<style>
|
|
body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #0d1117; color: #e6edf3;
|
|
font: 15px/1.5 -apple-system, "Segoe UI", sans-serif; }
|
|
main { max-width: 520px; padding: 32px; }
|
|
h1 { font-size: 20px; margin: 0 0 8px; }
|
|
p { color: #8b98a8; }
|
|
code { color: #e6edf3; overflow-wrap: anywhere; }
|
|
a.btn { display: inline-block; margin: 8px 12px 0 0; padding: 9px 16px; border-radius: 3px; text-decoration: none;
|
|
background: #2d333b; color: #e6edf3; }
|
|
a.btn.go { background: #1a9fff; color: #fff; font-weight: 600; }
|
|
.err { color: #ff7b72; }
|
|
[hidden] { display: none !important; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>Install with Frame Control</h1>
|
|
<p id="what"></p>
|
|
<p id="bad" class="err" hidden>This link doesn't name an https:// manifest or file, so there's nothing to install.</p>
|
|
<div id="actions" hidden>
|
|
<a class="btn go" id="open">Open in Frame Control</a>
|
|
<a class="btn" href="https://github.com/saphid/steam-frame/releases/latest">Get Frame Control</a>
|
|
</div>
|
|
<p id="missing" hidden>Nothing happened? Frame Control isn't installed on this computer, or is older than the
|
|
version that handles install links. Get it, open it once, then use the link again.</p>
|
|
</main>
|
|
<script>
|
|
(() => {
|
|
const q = new URLSearchParams(location.search);
|
|
const kind = q.has("manifest") ? "manifest" : q.has("url") ? "url" : null;
|
|
const target = kind && q.get(kind);
|
|
let ok = false;
|
|
try {
|
|
const u = new URL(target);
|
|
const local = ["localhost", "127.0.0.1"].includes(u.hostname);
|
|
ok = !u.username && !u.password && (u.protocol === "https:" || (u.protocol === "http:" && local));
|
|
} catch {}
|
|
if (!ok) { document.getElementById("bad").hidden = false; return; }
|
|
const link = `frame-control://install?${kind}=${encodeURIComponent(target)}`;
|
|
document.getElementById("what").textContent = `From ${new URL(target).hostname}. Frame Control shows what it will `
|
|
+ "install and asks you before downloading anything.";
|
|
document.getElementById("open").href = link;
|
|
document.getElementById("actions").hidden = false;
|
|
// If the app opens, this page loses focus or is hidden; if not, say how to get it.
|
|
let left = false;
|
|
window.addEventListener("blur", () => { left = true; });
|
|
document.addEventListener("visibilitychange", () => { if (document.hidden) left = true; });
|
|
setTimeout(() => { if (!left) document.getElementById("missing").hidden = false; }, 2000);
|
|
location.href = link;
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|