Repository navigation
Expand file tree
/
Copy pathopen.html
More file actions
281 lines (258 loc) · 11.9 KB
/
Copy pathopen.html
File metadata and controls
281 lines (258 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Install with SideInstaller</title>
<!-- The target link only ever comes from this page's own query string and is
only ever written with textContent / as the button's href, so nothing here
needs to load anything beyond the icon. -->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https://raw.githubusercontent.com; style-src 'unsafe-inline'; script-src 'unsafe-inline'; base-uri 'none'; form-action 'none'">
<meta name="referrer" content="no-referrer">
<meta name="robots" content="noindex">
<link rel="icon" type="image/png" sizes="32x32" href="https://raw.githubusercontent.com/FrizzleM/SideInstaller/main/favicon-32.png">
<link rel="icon" type="image/png" sizes="192x192" href="https://raw.githubusercontent.com/FrizzleM/SideInstaller/main/favicon-192.png">
<link rel="apple-touch-icon" href="https://raw.githubusercontent.com/FrizzleM/SideInstaller/main/app-icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="color-scheme" content="dark">
<meta name="theme-color" content="#050b18">
<!-- What Discord and other chat apps show under a posted link. -->
<meta property="og:site_name" content="SideInstaller">
<meta property="og:title" content="Install with SideInstaller">
<meta property="og:description" content="Tap to open this .ipa in SideInstaller. The app shows where it comes from and asks before downloading anything.">
<meta property="og:image" content="https://raw.githubusercontent.com/FrizzleM/SideInstaller/main/app-icon.png">
<style>
/* The site's palette (assets/site.css in FrizzleM/SideInstaller-Signed, from
the app's Theme.swift), kept in this file: its Content-Security-Policy
lets it load nothing but the icon. */
:root{
--page:#050b18; --card:#0d1524;
--control:rgba(185,211,249,.07); --hairline:rgba(185,211,249,.1);
--text:#f1f4f9; --text-2:#aeb8ca; --muted:#7f8da5;
--blue:#2669ed; --blue-hover:#3a78f2; --accent:#60a7fd; --warning:#e5a140; --negative:#e5484d;
--ease:cubic-bezier(.22,1,.36,1);
--sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue","Segoe UI",Roboto,Arial,sans-serif;
--mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
html{-webkit-text-size-adjust:100%; overflow-x:clip; background:var(--page)}
body{
margin:0; min-height:100vh; color:var(--text); overflow-x:clip;
background:radial-gradient(ellipse 100% 640px at 50% 0, rgba(9,50,143,.4), rgba(9,50,143,0)) no-repeat, var(--page);
font:400 17px/1.47 var(--sans); -webkit-font-smoothing:antialiased;
padding:max(24px,env(safe-area-inset-top)) 24px 64px;
}
:focus-visible{outline:2px solid var(--accent); outline-offset:3px}
.wrap{max-width:520px; margin:0 auto}
.hero,.panel,.footer{animation:rise .7s var(--ease) both}
.panel{animation-delay:.08s}
.footer{animation-delay:.16s}
@keyframes rise{from{opacity:0; transform:translateY(12px)}}
@media (prefers-reduced-motion:reduce){ .hero,.panel,.footer{animation:none} }
/* ---- hero ---- */
.hero{text-align:center; padding:32px 0 8px}
.logo{
display:block; width:72px; height:72px; margin:0 auto 24px; border-radius:17px;
box-shadow:0 0 0 1px var(--hairline);
}
h1{margin:0; font-size:clamp(28px,7vw,40px); line-height:1.1; font-weight:600; letter-spacing:-.025em}
.tagline{margin:12px auto 0; max-width:26rem; color:var(--text-2)}
/* ---- the link ---- */
.panel{margin-top:32px}
.card{
padding:20px; color:var(--text-2); font-size:15px;
background:var(--card); border:1px solid var(--hairline); border-radius:20px;
}
.card.error{border-color:rgba(229,72,77,.4)}
.card p{margin:0}
.card p + p{margin-top:12px}
.label{margin:0 0 4px; color:var(--muted); font-size:13px}
.host-row + .label{margin-top:16px}
.host-row{display:flex; align-items:center; gap:8px 12px; flex-wrap:wrap}
.host{margin:0; color:var(--text); font-size:21px; line-height:1.3; font-weight:600; letter-spacing:-.01em; overflow-wrap:anywhere}
/* A link that isn't encrypted, said the way the app says how something stands. */
.flag{display:inline-flex; align-items:center; gap:8px; font-size:13px; color:var(--warning); white-space:nowrap}
.flag::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--warning)}
.url{
display:block; margin:0; padding:12px; border-radius:12px;
background:var(--control); color:var(--text);
font:400 13px/1.5 var(--mono);
overflow-wrap:anywhere; word-break:break-all;
}
.error-title{margin:0 0 4px; color:var(--negative); font-size:17px; font-weight:600}
.card code{
padding:1px 6px; border-radius:6px; background:var(--control);
font:400 13px/1.5 var(--mono); color:var(--text); overflow-wrap:anywhere;
}
.card .url + p, .card p + .url{margin-top:12px}
/* ---- open button ---- */
.open-btn{
display:flex; align-items:center; justify-content:center; gap:8px;
width:100%; height:52px; margin-top:16px; border-radius:26px;
background:var(--blue); color:#fff;
font-size:17px; font-weight:500; text-decoration:none;
transition:background-color .15s var(--ease), transform .15s var(--ease);
}
.open-btn svg{width:20px; height:20px; flex:none; stroke-width:1.8}
.open-btn:hover{background:var(--blue-hover)}
.open-btn:active{transform:scale(.98)}
.status{margin:12px 4px 0; text-align:center; color:var(--muted); font-size:14px}
.get-app{margin:24px 4px 0; text-align:center; color:var(--text-2); font-size:15px}
.get-app a, .status a{color:var(--accent); text-decoration:none}
.get-app a:hover, .status a:hover{text-decoration:underline; text-underline-offset:3px}
.footer{margin-top:48px; text-align:center; color:var(--muted); font-size:14px}
.footer a{color:var(--text-2); text-decoration:none}
.footer a:hover{color:var(--text)}
</style>
</head>
<body>
<div class="wrap">
<header class="hero">
<img class="logo" src="https://raw.githubusercontent.com/FrizzleM/SideInstaller/main/app-icon.png" alt="SideInstaller">
<h1 id="title">Install with SideInstaller</h1>
<p class="tagline" id="tagline">SideInstaller shows you this link and asks before it downloads anything.</p>
</header>
<main class="panel">
<noscript>
<div class="card error">
<p class="error-title">JavaScript is off</p>
<p>This page needs JavaScript to read the link it was given.</p>
</div>
</noscript>
<!-- A valid link: where it downloads from, the whole link, and the button. -->
<div id="ok" hidden>
<div class="card">
<p class="label">Downloads from</p>
<div class="host-row">
<p class="host" id="host"></p>
<span class="flag" id="insecure" hidden>Not encrypted (http)</span>
</div>
<p class="label">Full link</p>
<code class="url" id="url"></code>
</div>
<a class="open-btn" id="open" href="#">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M5 21h14"/></svg>
<span>Open in SideInstaller</span>
</a>
<p class="status" id="status"></p>
</div>
<!-- No link, or one this page won't hand on. -->
<div class="card error" id="error" hidden>
<p class="error-title" id="error-title"></p>
<p id="error-text"></p>
<code class="url" id="error-value" hidden></code>
<p id="error-usage" hidden>Links to this page look like <code>https://sideinstaller.net/open.html?url=</code> followed by the <code>https://</code> address the .ipa downloads from.</p>
</div>
<p class="get-app">Don't have SideInstaller yet? <a href="index.html#setup">Get it from the install page</a></p>
</main>
<footer class="footer">
<a href="index.html">SideInstaller</a> · <a href="index.html#setup">Install</a> · <a href="terms.html">Terms of Service</a>
</footer>
</div>
<script>
(function () {
"use strict";
// The `url` parameter as written, or null. Taken from the raw query rather
// than URLSearchParams so a "+" in the link stays a "+". A link pasted in
// without encoding (…?url=https://host/App.ipa?token=a&b=c) keeps its own
// "?" and "&", so everything after "url=" is the link.
function readTarget() {
var query = location.search.replace(/^\?/, "");
if (!query) return null;
var parts = query.split("&");
for (var i = 0; i < parts.length; i++) {
var eq = parts[i].indexOf("=");
var name = eq < 0 ? parts[i] : parts[i].slice(0, eq);
if (name.toLowerCase() !== "url") continue;
var raw = eq < 0 ? "" : parts.slice(i).join("&").slice(eq + 1);
if (/^https?:\/\//i.test(raw)) return raw;
raw = eq < 0 ? "" : parts[i].slice(eq + 1);
try {
return decodeURIComponent(raw);
} catch (e) {
return { malformed: raw };
}
}
return null;
}
function show(id) { document.getElementById(id).hidden = false; }
function setText(id, text) { document.getElementById(id).textContent = text; }
function clip(text) {
return text.length > 300 ? text.slice(0, 300) + "…" : text;
}
function fail(title, text, value, usage) {
document.title = "SideInstaller: link can't be opened";
setText("title", "Can't open this link");
setText("tagline", "Nothing was sent to SideInstaller.");
setText("error-title", title);
setText("error-text", text);
if (value) {
setText("error-value", clip(value));
show("error-value");
}
if (usage) show("error-usage");
show("error");
}
var target = readTarget();
if (target === null || (typeof target === "string" && !target.trim())) {
fail("No link to open",
"This page passes a link to an .ipa on to SideInstaller, but it wasn't given one.",
null, true);
return;
}
if (typeof target !== "string") {
fail("That link is garbled",
"Its percent-encoding is broken, so it can't be read back.",
target.malformed, true);
return;
}
target = target.trim();
var link;
try {
link = new URL(target);
} catch (e) {
link = null;
}
if (!link || (link.protocol !== "https:" && link.protocol !== "http:")) {
var scheme = link ? link.protocol : (target.match(/^[a-z][a-z0-9+.\-]*:/i) || [""])[0];
fail("Only web links can be opened",
scheme
? "This page only opens http:// and https:// links, not " + scheme + " ones."
: "This page only opens http:// and https:// links, and this isn't one.",
target, true);
return;
}
if (!link.hostname) {
fail("That link has no host", "There's no server name in it to download from.", target, true);
return;
}
// What SideInstaller is given is exactly what's shown: the parsed link.
var appLink = "sideinstaller://install?url=" + encodeURIComponent(link.href);
setText("host", link.host);
setText("url", link.href);
if (link.protocol === "http:") show("insecure");
document.getElementById("open").href = appLink;
show("ok");
// SideInstaller only runs on iPhone and iPad (iPadOS reports itself as a
// Mac, so count touch points), so only try opening it there. iOS often
// ignores this without a tap, which is what the button is for.
var ua = navigator.userAgent;
var appleTouch = /iPhone|iPad|iPod/.test(ua) ||
(/Macintosh/.test(ua) && navigator.maxTouchPoints > 1);
if (!appleTouch) {
setText("status", "SideInstaller runs on iPhone and iPad. Open this page there to install.");
return;
}
setText("status", "Opening SideInstaller… If nothing happens, tap the button.");
var tried = false;
function tryOpen() {
if (tried || document.visibilityState === "hidden") return;
tried = true;
setTimeout(function () { location.href = appLink; }, 300);
}
tryOpen();
if (!tried) document.addEventListener("visibilitychange", tryOpen);
})();
</script>
</body>
</html>