@hot-updater/console 1.2.0-rc.24 → 1.2.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{EventDetails-Dcpdu7re.js → EventDetails-DZsRlDHk.js} +1 -1
- package/.output/public/assets/{InsightsPageHeader-CSas9gM0.js → InsightsPageHeader-2bTrjXln.js} +1 -1
- package/.output/public/assets/{RelativeTime-CiZ7yXNJ.js → RelativeTime-TCmpOVPg.js} +1 -1
- package/.output/public/assets/{RolloutPercentageBadge-D-tZKnX7.js → RolloutPercentageBadge-G6qt8rVb.js} +1 -1
- package/.output/public/assets/StoreSubmission-CqSg880n.js +1 -0
- package/.output/public/assets/{TargetDisplay-CoYY8Fs4.js → TargetDisplay-DwOaMOiI.js} +1 -1
- package/.output/public/assets/{api-keys-3IL4dIHe.js → api-keys-uFY8FsN9.js} +1 -1
- package/.output/public/assets/{badge-laIuYW1U.js → badge-D0NFvUY5.js} +1 -1
- package/.output/public/assets/{index-BKB82n6Y.js → index-CJclLsbG.js} +3 -3
- package/.output/public/assets/{insights-_6iMn8GR.js → insights-B75txQ_F.js} +1 -1
- package/.output/public/assets/{insights-DDRfERph.js → insights-C17Z0whn.js} +2 -2
- package/.output/public/assets/{insights_.distribution-BGAqgPi0.js → insights_.distribution-_dZi1_ay.js} +1 -1
- package/.output/public/assets/{insights_.distribution-CjYkDRA4.js → insights_.distribution-gDqNqI5E.js} +2 -2
- package/.output/public/assets/{installations-CSZfo1rG.js → installations-D0g3xvw8.js} +2 -2
- package/.output/public/assets/{installations-CwQYwQ6K.js → installations-Y_7QW_p8.js} +1 -1
- package/.output/public/assets/{native-builds-B4pD_O7E.js → native-builds-Ba6cEZfm.js} +2 -2
- package/.output/public/assets/native-builds-C3_-21we.js +1 -0
- package/.output/public/assets/native-builds_._buildId-BnP31v32.js +1 -0
- package/.output/public/assets/{native-builds_._buildId-D5tnmyu7.js → native-builds_._buildId-Cp9LJiMP.js} +2 -2
- package/.output/public/assets/{remote-config-Dwdc-sij.js → remote-config-BRdy8QFR.js} +1 -1
- package/.output/public/assets/{remote-config-ZJ_IRSKE.js → remote-config-C9p5Pcdj.js} +3 -3
- package/.output/public/assets/{routes-BUWLcUqW.js → routes-BLTF7nwe.js} +1 -1
- package/.output/public/assets/{routes-Rtz-KcQO.js → routes-gQXSzO_n.js} +2 -2
- package/.output/public/assets/styles-BdlrKlVs.css +2 -0
- package/.output/server/{__23tanstack-start-server-fn-resolver-CcDHdMzp.mjs → __23tanstack-start-server-fn-resolver-z8rr63xV.mjs} +49 -49
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
- package/.output/server/_libs/_.mjs +1 -1
- package/.output/server/_ssr/{-native-builds-search-Cl8EZ0Ud.mjs → -native-builds-search-M6t7EIt4.mjs} +1 -1
- package/.output/server/_ssr/{BundleIdDisplay-BOFw0I4S.mjs → BundleIdDisplay-DRnAzJse.mjs} +2 -2
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-CLb3FQ37.mjs → ConsoleFeatureUnavailable-BEU7r4aH.mjs} +6 -6
- package/.output/server/_ssr/{EventDetails-DCcm4h8I.mjs → EventDetails-CjT6o2sJ.mjs} +6 -6
- package/.output/server/_ssr/{HashValueDisplay-Bo7HtMVb.mjs → HashValueDisplay-Bkim8r3-.mjs} +2 -2
- package/.output/server/_ssr/{InsightsPageHeader-D0CFqoqK.mjs → InsightsPageHeader-Ctw4N3SZ.mjs} +6 -6
- package/.output/server/_ssr/{NotFoundPage-CrM2mNho.mjs → NotFoundPage-Bh3gFsR6.mjs} +2 -2
- package/.output/server/_ssr/{PlatformIcon-Cuhy0CIO.mjs → PlatformIcon-CMLs3Wez.mjs} +1 -1
- package/.output/server/_ssr/{RelativeTime-pdNaQt7K.mjs → RelativeTime-DjdCU0J7.mjs} +3 -3
- package/.output/server/_ssr/{RolloutPercentageBadge-D2fgomoj.mjs → RolloutPercentageBadge-BiIHw-V2.mjs} +3 -3
- package/.output/server/_ssr/{StoreSubmission-tbaU5Jxl.mjs → StoreSubmission-Cv59joPo.mjs} +29 -7
- package/.output/server/_ssr/{TargetDisplay-c4AmIqUa.mjs → TargetDisplay-D1PKOupt.mjs} +4 -4
- package/.output/server/_ssr/{alert-dialog-Bl_9bN7q.mjs → alert-dialog-BOKQTpmP.mjs} +1 -1
- package/.output/server/_ssr/{api-bPCSYWmk.mjs → api-CDvGGB1B.mjs} +4 -4
- package/.output/server/_ssr/{api-keys-DCdpQxvq.mjs → api-keys-DvbSgd9L.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-CWc-kMoo.mjs → api-keys-NYJ0VaDB.mjs} +9 -9
- package/.output/server/_ssr/{api-keys-rpc-r2mnoc7r.mjs → api-keys-rpc-B0MrcD15.mjs} +3 -3
- package/.output/server/_ssr/{api-rpc--JDsqZkl.mjs → api-rpc-CIB9gcI7.mjs} +10 -10
- package/.output/server/_ssr/{auth-rpc-c6zZj3k7.mjs → auth-rpc-DsIffEXe.mjs} +4 -4
- package/.output/server/_ssr/{auth.server-D1lLWwx9.mjs → auth.server-Dt9XHLs_.mjs} +42 -15
- package/.output/server/_ssr/{badge-Cf4fbU_q.mjs → badge-KS3YftV5.mjs} +2 -1
- package/.output/server/_ssr/{card-Bx_12-o-.mjs → card-CG5GqIoA.mjs} +1 -1
- package/.output/server/_ssr/{config.server-DBFnQIeD.mjs → config.server-CJs-9Zd_.mjs} +4 -4
- package/.output/server/_ssr/{console-access-Dah0AEYy.mjs → console-access-ClmTMpo_.mjs} +2 -2
- package/.output/server/_ssr/{console-features-CgdQJQlX.mjs → console-features-CRP-pfov.mjs} +1 -1
- package/.output/server/_ssr/{console-features-api-CP8VgLf_.mjs → console-features-api-CpMYF0Pb.mjs} +5 -5
- package/.output/server/_ssr/{console-features-rpc-BWc5qG3c.mjs → console-features-rpc-D-dr-WF8.mjs} +3 -3
- package/.output/server/_ssr/{dialog-B5-o4y_0.mjs → dialog-DvHMJkq7.mjs} +1 -1
- package/.output/server/_ssr/{empty-sGLINpS3.mjs → empty-Bx8DnyWN.mjs} +2 -2
- package/.output/server/_ssr/{field-CYSNwGK0.mjs → field-BVI4lxoz.mjs} +2 -2
- package/.output/server/_ssr/{input-group-LpWc50V4.mjs → input-group-CpJwooTk.mjs} +1 -1
- package/.output/server/_ssr/{insights-CRjccjYz.mjs → insights-B-VtObqr.mjs} +5 -5
- package/.output/server/_ssr/{insights-CjQ9FDjt.mjs → insights-DxlHHXPK.mjs} +21 -21
- package/.output/server/_ssr/{insights-api-ChTevZmg.mjs → insights-api-8PWQ7PiR.mjs} +3 -3
- package/.output/server/_ssr/{insights-C3eT73Ut.mjs → insights-b1hq1O0p.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-rpc-C2SBL0t-.mjs → insights-failures-rpc-pY2KV9HI.mjs} +7 -7
- package/.output/server/_ssr/{insights-recovery-rpc-fBmK_XwY.mjs → insights-recovery-rpc-CejmWL_y.mjs} +4 -4
- package/.output/server/_ssr/{insights-rpc-CoIPmXt3.mjs → insights-rpc-D_7d_AAJ.mjs} +3 -3
- package/.output/server/_ssr/{insights-search-DqI-4UF6.mjs → insights-search-CoMkZvRt.mjs} +2 -2
- package/.output/server/_ssr/{insights-usage-rpc-DpI7VDWn.mjs → insights-usage-rpc-B1XSuara.mjs} +3 -3
- package/.output/server/_ssr/{insights-usage-rpc-37TTUAr6.mjs → insights-usage-rpc-CrGZDHzO.mjs} +4 -4
- package/.output/server/_ssr/{insights_.distribution-W4fpzgsj.mjs → insights_.distribution-B9sPDvG4.mjs} +5 -5
- package/.output/server/_ssr/{insights_.distribution-RwlJNvF6.mjs → insights_.distribution-CpqnDZNG.mjs} +15 -15
- package/.output/server/_ssr/{insights_.distribution-pdBXAM-9.mjs → insights_.distribution-EOOOOTb6.mjs} +2 -2
- package/.output/server/_ssr/{installations-DKKAVTSE.mjs → installations-BOI_y7Ma.mjs} +11 -11
- package/.output/server/_ssr/{installations-BmIh7M2B.mjs → installations-D0_0hzdi.mjs} +4 -4
- package/.output/server/_ssr/{installations-PHNRkSUb.mjs → installations-dWlOOS7Y.mjs} +2 -2
- package/.output/server/_ssr/{native-builds-CymG4aTV.mjs → native-builds-Bx_az6YZ.mjs} +3 -3
- package/.output/server/_ssr/{native-builds-q-yQUcmQ.mjs → native-builds-C721Rw23.mjs} +25 -21
- package/.output/server/_ssr/{native-builds-CWA9Y__P.mjs → native-builds-OUdRtp6m.mjs} +2 -2
- package/.output/server/_ssr/{native-builds_._buildId-CzJKPxiV.mjs → native-builds_._buildId-YItxv8j9.mjs} +3 -3
- package/.output/server/_ssr/{native-builds_._buildId-bLt4WRQ0.mjs → native-builds_._buildId-ubi48Sfs.mjs} +118 -85
- package/.output/server/_ssr/{nativeBuildDevice-Dn16gNmZ.mjs → nativeBuildDevice-DJUAzAIj.mjs} +26 -46
- package/.output/server/_ssr/{nativeBuildDownloadLink-mzzxooek.mjs → nativeBuildDownloadLink-C0I8eLpS.mjs} +2 -2
- package/.output/server/_ssr/{nativeBuildInstall-C52_rFTA.mjs → nativeBuildInstall-CxG8K8TL.mjs} +5 -6
- package/.output/server/_ssr/{nativeBuilds-D84Qo6jn.mjs → nativeBuilds-CRLmvFaO.mjs} +2 -2
- package/.output/server/_ssr/{native-artifact-H1MDP0Jz.mjs → publicConsoleBase-DvHYxDaG.mjs} +26 -17
- package/.output/server/_ssr/{release-adoption-rpc-CiQeg2XC.mjs → release-adoption-rpc-DcZAYRWJ.mjs} +7 -7
- package/.output/server/_ssr/{releaseAdoption-LLYlRnUB.mjs → releaseAdoption-D6ScSu-W.mjs} +1 -1
- package/.output/server/_ssr/{remote-config-D6_98aiF.mjs → remote-config-BZ_vGV97.mjs} +19 -19
- package/.output/server/_ssr/{remote-config-CHXk0t0Y.mjs → remote-config-DOcSXzxG.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-DFcP3X_W.mjs → remote-config-gKqDKMxk.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-rpc-CmjtaLZo.mjs → remote-config-rpc-CVPd3V69.mjs} +3 -3
- package/.output/server/_ssr/{router-DlRo8qJe.mjs → router-Bcyej4cr.mjs} +60 -75
- package/.output/server/_ssr/{routes-BemtQYlj.mjs → routes-B10xsCh4.mjs} +22 -22
- package/.output/server/_ssr/{routes-DeokFLZU.mjs → routes-ddBRVSju.mjs} +10 -10
- package/.output/server/_ssr/{runtime.server-BsTTLV-B.mjs → runtime.server-wcHT2Cop.mjs} +2 -2
- package/.output/server/_ssr/{schema-migration-rpc-8sXxCyev.mjs → schema-migration-rpc-iWZzLv70.mjs} +3 -3
- package/.output/server/_ssr/{select-C-Xg3M0y.mjs → select-i4WT0c9r.mjs} +1 -1
- package/.output/server/_ssr/{server-BMeXGwaI.mjs → server-CMgMPrDx.mjs} +4 -4
- package/.output/server/_ssr/{sidebar-C-YtAmhJ.mjs → sidebar-mIQgB0iy.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{start-C0XSSCq4.mjs → start-By4wHYjG.mjs} +1 -1
- package/.output/server/_ssr/{switch-Bq_TE-f9.mjs → switch-DR8EAh5C.mjs} +2 -2
- package/.output/server/_ssr/{table-DvW7CEdk.mjs → table-DXmK6G7A.mjs} +1 -1
- package/.output/server/_ssr/{tabs-X3A6lDz5.mjs → tabs-DAfypcYe.mjs} +2 -2
- package/.output/server/_ssr/{updateFailures-DPYzv9bE.mjs → updateFailures-DNiv3S_y.mjs} +1 -1
- package/.output/server/{_tanstack-start-manifest_v-Df6g3sSt.mjs → _tanstack-start-manifest_v-8M7ggCuB.mjs} +36 -38
- package/.output/server/index.mjs +211 -211
- package/package.json +7 -7
- package/src/components/ThemeProvider.tsx +11 -2
- package/src/components/features/native-builds/InstallCard.tsx +20 -21
- package/src/components/features/native-builds/IosInstall.tsx +77 -47
- package/src/components/features/native-builds/NativeBuildsTable.tsx +14 -9
- package/src/components/features/native-builds/SandboxBadge.tsx +8 -2
- package/src/components/features/native-builds/StoreSubmission.tsx +7 -10
- package/src/components/features/native-builds/playTracks.ts +19 -0
- package/src/components/ui/badge.tsx +2 -0
- package/src/lib/server/nativeBuildDevice.ts +22 -43
- package/src/routeTree.gen.ts +0 -44
- package/src/styles.css +8 -0
- package/.output/public/assets/StoreSubmission-CGFw9Mjw.js +0 -1
- package/.output/public/assets/native-builds-CKSg6cCF.js +0 -1
- package/.output/public/assets/native-builds_._buildId-BuVvRbMp.js +0 -1
- package/.output/public/assets/styles-83XEjOMT.css +0 -2
- package/.output/server/_ssr/nativeBuildQr-P9qKcI7l.mjs +0 -115
- package/.output/server/_ssr/publicConsoleBase-3IHSHvqd.mjs +0 -27
- package/.output/server/_ssr/qr-code-pENFuyy9.mjs +0 -22
- package/src/lib/server/nativeBuildQr.ts +0 -163
- package/src/routes/[_]hot-updater/native-builds/preview-qr.ts +0 -14
- package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { isUUIDv7 } from "@hot-updater/protocol";
|
|
2
|
-
import { createPreviewLink } from "@hot-updater/protocol/native-artifact";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
nativeBuildDetailPath,
|
|
6
|
-
nativeBuildDownloadPath,
|
|
7
|
-
} from "../native-builds";
|
|
8
|
-
import { qrCodePath } from "../qr-code";
|
|
9
|
-
|
|
10
|
-
/** The header that carries the download URL the QR code holds. */
|
|
11
|
-
export const DOWNLOAD_URL_HEADER = "x-hot-updater-download-url";
|
|
12
|
-
|
|
13
|
-
/** The header that carries the sandbox link the QR code holds. */
|
|
14
|
-
export const PREVIEW_LINK_HEADER = "x-hot-updater-preview-link";
|
|
15
|
-
|
|
16
|
-
/** The route that serves the QR code, under the console's own path. */
|
|
17
|
-
export const NATIVE_BUILD_QR_PATH = "/_hot-updater/native-builds/qr";
|
|
18
|
-
|
|
19
|
-
/** The pixel size of one module, so the image is legible at its own size. */
|
|
20
|
-
const MODULE_PX = 6;
|
|
21
|
-
|
|
22
|
-
const refusal = (status: number, message: string) =>
|
|
23
|
-
new Response(message, {
|
|
24
|
-
status,
|
|
25
|
-
headers: {
|
|
26
|
-
"cache-control": "no-store",
|
|
27
|
-
"content-type": "text/plain; charset=utf-8",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
/** The image of a QR code, with the header that says what it holds. */
|
|
32
|
-
const qrImage = (
|
|
33
|
-
request: Request,
|
|
34
|
-
value: string,
|
|
35
|
-
header: string,
|
|
36
|
-
cacheControl: string,
|
|
37
|
-
) => {
|
|
38
|
-
const { size, path } = qrCodePath(value);
|
|
39
|
-
const pixels = size * MODULE_PX;
|
|
40
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${pixels}" height="${pixels}" viewBox="0 0 ${size} ${size}" shape-rendering="crispEdges"><rect fill="#fff" width="${size}" height="${size}"/><path fill="#000" d="${path}"/></svg>`;
|
|
41
|
-
return new Response(request.method === "HEAD" ? null : svg, {
|
|
42
|
-
headers: {
|
|
43
|
-
"cache-control": cacheControl,
|
|
44
|
-
"content-type": "image/svg+xml",
|
|
45
|
-
"content-security-policy": "default-src 'none'",
|
|
46
|
-
"x-content-type-options": "nosniff",
|
|
47
|
-
[header]: value,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const refuseMethod = (request: Request) => {
|
|
53
|
-
if (request.method === "GET" || request.method === "HEAD") return null;
|
|
54
|
-
const response = refusal(405, "Method Not Allowed");
|
|
55
|
-
response.headers.set("allow", "GET, HEAD");
|
|
56
|
-
return response;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The URL of a native build's console download, under the console path the
|
|
61
|
-
* QR request came to: the console answers it with a fresh storage URL on
|
|
62
|
-
* each request, so it never expires.
|
|
63
|
-
*/
|
|
64
|
-
export const nativeBuildDownloadUrl = (
|
|
65
|
-
request: Request,
|
|
66
|
-
id: string,
|
|
67
|
-
path: (id: string) => string = nativeBuildDownloadPath,
|
|
68
|
-
) => {
|
|
69
|
-
const url = new URL(request.url);
|
|
70
|
-
const base = url.pathname.endsWith(NATIVE_BUILD_QR_PATH)
|
|
71
|
-
? url.pathname.slice(0, -NATIVE_BUILD_QR_PATH.length)
|
|
72
|
-
: "";
|
|
73
|
-
return `${url.origin}${base}${path(id)}`;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The QR code of a native build's download URL, `<console>/api/native-builds/
|
|
78
|
-
* <id>/download`, as an SVG image, served at
|
|
79
|
-
* `/_hot-updater/native-builds/qr?build=<id>` without a session: a pull
|
|
80
|
-
* request comment shows it, and GitHub fetches a comment's images
|
|
81
|
-
* anonymously. It reads nothing, no database and no storage, so it says
|
|
82
|
-
* nothing about whether the build exists; the download itself asks for the
|
|
83
|
-
* session. Anyone can ask for this image, so it never holds a signed link:
|
|
84
|
-
* those come only to a caller the console let in. The response's
|
|
85
|
-
* `x-hot-updater-download-url` header is the URL.
|
|
86
|
-
*
|
|
87
|
-
* With `target=page` the code holds the build's console page instead, where an
|
|
88
|
-
* iPhone checks whether the IPA includes it before anything downloads. The
|
|
89
|
-
* caller chooses, since telling an IPA from anything else would take a read.
|
|
90
|
-
*
|
|
91
|
-
* - 400: `build` is missing or not a UUIDv7;
|
|
92
|
-
* - 405: a method other than GET or HEAD.
|
|
93
|
-
*/
|
|
94
|
-
export const serveNativeBuildQr = (request: Request): Response => {
|
|
95
|
-
const refused = refuseMethod(request);
|
|
96
|
-
if (refused) return refused;
|
|
97
|
-
const { searchParams } = new URL(request.url);
|
|
98
|
-
const id = searchParams.get("build");
|
|
99
|
-
if (id === null || !isUUIDv7(id)) {
|
|
100
|
-
return refusal(400, "Pass ?build=<native build ID>.");
|
|
101
|
-
}
|
|
102
|
-
// The URL depends only on the build ID and the console's own address.
|
|
103
|
-
return qrImage(
|
|
104
|
-
request,
|
|
105
|
-
nativeBuildDownloadUrl(
|
|
106
|
-
request,
|
|
107
|
-
id,
|
|
108
|
-
searchParams.get("target") === "page"
|
|
109
|
-
? nativeBuildDetailPath
|
|
110
|
-
: nativeBuildDownloadPath,
|
|
111
|
-
),
|
|
112
|
-
DOWNLOAD_URL_HEADER,
|
|
113
|
-
"public, max-age=86400",
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/** An app ID as `bundleIdentifier` and `packageName` hold one. */
|
|
118
|
-
const APP_ID = /^[A-Za-z][A-Za-z0-9._-]{0,254}$/;
|
|
119
|
-
/** A channel a pull request previews on, such as `pr-12` or `pr-12-tv`. */
|
|
120
|
-
const CHANNEL = /^[A-Za-z0-9._-]{1,128}$/;
|
|
121
|
-
/** A fingerprint hash: `@expo/fingerprint`'s SHA-1, or cli-tools' SHA-256. */
|
|
122
|
-
const FINGERPRINT = /^[a-f0-9]{40,64}$/;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* The QR code of a sandbox preview link, `hu-sandbox-<app ID>://hot-updater/
|
|
126
|
-
* preview?channel=<channel>&fingerprint=<hash>`, as an SVG image, served at
|
|
127
|
-
* `/_hot-updater/native-builds/preview-qr?app=&channel=&fingerprint=` without a
|
|
128
|
-
* session, as a pull request comment shows it. The link holds no secret, this
|
|
129
|
-
* reads nothing, and it mints nothing. It takes the link's three parts rather
|
|
130
|
-
* than the link: each has a narrow alphabet, and `createPreviewLink` writes the
|
|
131
|
-
* rest, so no request gets any other text into a QR code. The response's
|
|
132
|
-
* `x-hot-updater-preview-link` header is the link.
|
|
133
|
-
*
|
|
134
|
-
* - 400: a part is missing or isn't what a sandbox build has;
|
|
135
|
-
* - 405: a method other than GET or HEAD.
|
|
136
|
-
*/
|
|
137
|
-
export const serveSandboxPreviewQr = (request: Request): Response => {
|
|
138
|
-
const refused = refuseMethod(request);
|
|
139
|
-
if (refused) return refused;
|
|
140
|
-
const query = new URL(request.url).searchParams;
|
|
141
|
-
const appId = query.get("app");
|
|
142
|
-
const channel = query.get("channel");
|
|
143
|
-
const fingerprintHash = query.get("fingerprint");
|
|
144
|
-
const usage = "Pass ?app=<app ID>&channel=<channel>&fingerprint=<hash>.";
|
|
145
|
-
if (
|
|
146
|
-
appId === null ||
|
|
147
|
-
channel === null ||
|
|
148
|
-
fingerprintHash === null ||
|
|
149
|
-
!APP_ID.test(appId) ||
|
|
150
|
-
!CHANNEL.test(channel) ||
|
|
151
|
-
!FINGERPRINT.test(fingerprintHash)
|
|
152
|
-
) {
|
|
153
|
-
return refusal(400, usage);
|
|
154
|
-
}
|
|
155
|
-
let link: string;
|
|
156
|
-
try {
|
|
157
|
-
link = createPreviewLink({ appId, channel, fingerprintHash });
|
|
158
|
-
} catch {
|
|
159
|
-
return refusal(400, usage);
|
|
160
|
-
}
|
|
161
|
-
// The link depends only on the query.
|
|
162
|
-
return qrImage(request, link, PREVIEW_LINK_HEADER, "public, max-age=86400");
|
|
163
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
-
|
|
3
|
-
// A sandbox preview link's QR code takes no session and reads nothing: see
|
|
4
|
-
// nativeBuildQr.ts.
|
|
5
|
-
const handle = async ({ request }: { readonly request: Request }) => {
|
|
6
|
-
const { serveSandboxPreviewQr } = await import("@/lib/server/nativeBuildQr");
|
|
7
|
-
return serveSandboxPreviewQr(request);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const Route = createFileRoute("/_hot-updater/native-builds/preview-qr")({
|
|
11
|
-
server: {
|
|
12
|
-
handlers: { ANY: handle },
|
|
13
|
-
},
|
|
14
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
-
|
|
3
|
-
// A native build's download QR code takes no session and reads nothing:
|
|
4
|
-
// see nativeBuildQr.ts.
|
|
5
|
-
const handle = async ({ request }: { readonly request: Request }) => {
|
|
6
|
-
const { serveNativeBuildQr } = await import("@/lib/server/nativeBuildQr");
|
|
7
|
-
return serveNativeBuildQr(request);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const Route = createFileRoute("/_hot-updater/native-builds/qr")({
|
|
11
|
-
server: {
|
|
12
|
-
handlers: { ANY: handle },
|
|
13
|
-
},
|
|
14
|
-
});
|