@hot-updater/console 1.2.0-rc.12 → 1.2.0-rc.13
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/{-native-builds-search-C-TGpFAm.js → -native-builds-search-DC2PutLU.js} +1 -1
- package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-oMmbaqF6.js} +1 -1
- package/.output/public/assets/{EventDetails-Dl2RvPAk.js → EventDetails-ly7ygfdH.js} +1 -1
- package/.output/public/assets/{HashValueDisplay-6lNRxDJX.js → HashValueDisplay-BNoXZADg.js} +1 -1
- package/.output/public/assets/{InsightsPageHeader-DHhqY3DT.js → InsightsPageHeader-q2FgL8xS.js} +1 -1
- package/.output/public/assets/RolloutPercentageBadge-frllRncE.js +1 -0
- package/.output/public/assets/{StoreSubmission-ViTkW4eJ.js → StoreSubmission-D8BGGGgn.js} +1 -1
- package/.output/public/assets/api-BEEYDSCX.js +1 -0
- package/.output/public/assets/{api-keys-FueRkF9q.js → api-keys-B0N3SixL.js} +1 -1
- package/.output/public/assets/api-keys-DFAOfU4U.js +1 -0
- package/.output/public/assets/{index-DH9-mB8D.js → index-t0CToN0S.js} +3 -3
- package/.output/public/assets/insights-B0_8xNxr.js +1 -0
- package/.output/public/assets/{insights-B-0odqpt.js → insights-BbIzm_QG.js} +2 -2
- package/.output/public/assets/insights-BtmYg4vg.js +2 -0
- package/.output/public/assets/{insights-search-DghCbEnk.js → insights-search-B5cZsP6C.js} +1 -1
- package/.output/public/assets/{insights-usage-rpc-CKQH0pUS.js → insights-usage-rpc-zut_JaSS.js} +1 -1
- package/.output/public/assets/insights_.distribution-DLxq-IKU.js +1 -0
- package/.output/public/assets/insights_.distribution-izFBYfJL.js +2 -0
- package/.output/public/assets/{insights_.distribution-dvk6vYDM.js → insights_.distribution-rdeyNhH2.js} +1 -1
- package/.output/public/assets/{installations-B674P5Z5.js → installations-BRS-vuRJ.js} +2 -2
- package/.output/public/assets/installations-CWx7vYY5.js +1 -0
- package/.output/public/assets/{installations-BWxczZ2t.js → installations-Ce_dTa35.js} +1 -1
- package/.output/public/assets/native-builds-Br0onFRc.js +2 -0
- package/.output/public/assets/native-builds-CDYL3y0I.js +1 -0
- package/.output/public/assets/native-builds-DEWHul-_.js +1 -0
- package/.output/public/assets/native-builds_._buildId-D1XEPQ-V.js +1 -0
- package/.output/public/assets/native-builds_._buildId-x-uu1Vbr.js +2 -0
- package/.output/public/assets/{remote-config-B7ujqhLa.js → remote-config-Bw6sErCV.js} +3 -3
- package/.output/public/assets/{remote-config-WjpozBG5.js → remote-config-DQguWTMa.js} +1 -1
- package/.output/public/assets/remote-config-S3xj8r3x.js +1 -0
- package/.output/public/assets/{routes-CCD33Azv.js → routes-Dw8zgqXz.js} +2 -2
- package/.output/public/assets/routes-nKCEKnhh.js +1 -0
- package/.output/server/{__23tanstack-start-server-fn-resolver-C19x6erS.mjs → __23tanstack-start-server-fn-resolver-DI0OnlQe.mjs} +58 -46
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
- package/.output/server/_libs/_.mjs +2 -0
- package/.output/server/_ssr/{-native-builds-search-CwNcoXf4.mjs → -native-builds-search-Cl8EZ0Ud.mjs} +2 -2
- package/.output/server/_ssr/{BundleIdDisplay-Bf-L37zf.mjs → BundleIdDisplay-SAvC-NlE.mjs} +2 -2
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-iNGya64h.mjs → ConsoleFeatureUnavailable-BgHEoZ36.mjs} +6 -6
- package/.output/server/_ssr/{EventDetails-CZofL6Hn.mjs → EventDetails-VaS25yjE.mjs} +7 -7
- package/.output/server/_ssr/{HashValueDisplay-DC1TLS-8.mjs → HashValueDisplay-BGc-x_l8.mjs} +2 -2
- package/.output/server/_ssr/{InsightsPageHeader-sVotAhl0.mjs → InsightsPageHeader-gMuNJt-f.mjs} +7 -7
- package/.output/server/_ssr/{NotFoundPage-COb0erGp.mjs → NotFoundPage-DsRI-J4h.mjs} +2 -2
- package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-BsU0d0jN.mjs} +1 -1
- package/.output/server/_ssr/{RolloutPercentageBadge-BFBh0QWv.mjs → RolloutPercentageBadge-axz7VuIZ.mjs} +3 -3
- package/.output/server/_ssr/{StoreSubmission-Bvfq8pWk.mjs → StoreSubmission-BqXKtpqW.mjs} +5 -5
- package/.output/server/_ssr/{alert-dialog-C-Mck8_M.mjs → alert-dialog-lury59vV.mjs} +1 -1
- package/.output/server/_ssr/{api-oJajV-DG.mjs → api-BQ8ztUgU.mjs} +99 -22
- package/.output/server/_ssr/{api-keys-CcqDkOcC.mjs → api-keys-CHATVpa9.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-B0L1sj-W.mjs → api-keys-DVChzF3r.mjs} +8 -8
- package/.output/server/_ssr/{api-keys-rpc-Do6Rbl0V.mjs → api-keys-rpc-DXPJTfdr.mjs} +4 -4
- package/.output/server/_ssr/{api-rpc-DE0zy7iY.mjs → api-rpc-BexxmTM9.mjs} +43 -18
- package/.output/server/_ssr/{auth-rpc-0I_10FKy.mjs → auth-rpc-BgNCvy2L.mjs} +5 -5
- package/.output/server/_ssr/{auth.server-cdIC1rxo.mjs → auth.server-43UW34Rd.mjs} +165 -149
- package/.output/server/_ssr/{badge-BZZCX8Wn.mjs → badge-BYB825vl.mjs} +1 -1
- package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-BGVvqWx7.mjs} +1 -1
- package/.output/server/_ssr/{config.server-CydWUX0c.mjs → config.server-QRTmD4Hf.mjs} +4 -4
- package/.output/server/_ssr/{console-access-y52SJdFn.mjs → console-access-E91fYTIB.mjs} +2 -2
- package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-CgdQJQlX.mjs} +1 -1
- package/.output/server/_ssr/{console-features-api-BDrXaElT.mjs → console-features-api-CLRjxvy2.mjs} +5 -5
- package/.output/server/_ssr/{console-features-rpc-C9kKIDeK.mjs → console-features-rpc-C2rJ0u6i.mjs} +4 -4
- package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
- package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-XAvDetmn.mjs} +1 -1
- package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
- package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-BtRVBD0C.mjs} +3 -3
- package/.output/server/_ssr/{dialog-DKsDLcYQ.mjs → dialog-CcF1pxfR.mjs} +1 -1
- package/.output/server/_ssr/{dist-TEpM_UAD.mjs → dist-B6-irDRA.mjs} +1 -1
- package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-BX8ODCZT.mjs} +1 -1
- package/.output/server/_ssr/{empty-D-mnqnCP.mjs → empty-DkiJ7nWt.mjs} +2 -2
- package/.output/server/_ssr/{empty-plugin-adapters-zrZ0xs6n.mjs → empty-plugin-adapters-BYBYBaxo.mjs} +1 -1
- package/.output/server/_ssr/{failureReports-Cn_zU9S8.mjs → failureReports-C_CmBF4x.mjs} +3 -3
- package/.output/server/_ssr/{field-Bbw5SS9L.mjs → field-CHlDI06h.mjs} +2 -2
- package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-BJTufthT.mjs} +2 -2
- package/.output/server/_ssr/{git-CTA8Aqr0.mjs → git-WSg7LY17.mjs} +2 -2
- package/.output/server/_ssr/{input-group-DXofNRNJ.mjs → input-group-BPZ4UtB5.mjs} +1 -1
- package/.output/server/_ssr/{insights-Dm2UdEf_.mjs → insights-B3YetvBK.mjs} +5 -5
- package/.output/server/_ssr/{insights-C7rhyg61.mjs → insights-CEABWFk4.mjs} +26 -26
- package/.output/server/_ssr/{insights-D6kIjZuE.mjs → insights-Dn32lJ18.mjs} +2 -2
- package/.output/server/_ssr/{insights-api-DNmt4PWL.mjs → insights-api-CYPf5853.mjs} +5 -5
- package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-Bz3sWNZm.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-DNQ9qVVf.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-rpc-DkrdYXJk.mjs → insights-failures-rpc-CxPpBR1K.mjs} +11 -11
- package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-DOkpqnQ8.mjs} +1 -1
- package/.output/server/_ssr/{insights-recovery-rpc-DWLnLF_s.mjs → insights-recovery-rpc-CwnQMTE3.mjs} +7 -7
- package/.output/server/_ssr/{insights-rpc-CdYYZ7lE.mjs → insights-rpc-CKd5ATFI.mjs} +4 -4
- package/.output/server/_ssr/{insights-search-HVXIz64-.mjs → insights-search-B_92_iEj.mjs} +4 -4
- package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-4KDIN3Kg.mjs} +1 -1
- package/.output/server/_ssr/{insights-usage-rpc-CLHS5JhI.mjs → insights-usage-rpc-D90uHpJJ.mjs} +7 -7
- package/.output/server/_ssr/{insights-usage-rpc-BCMRZErp.mjs → insights-usage-rpc-RIMNhPtj.mjs} +4 -4
- package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-DmQdJZqT.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-zbVsH0TU.mjs → insights_.distribution-D42mHSe0.mjs} +14 -14
- package/.output/server/_ssr/{insights_.distribution-3NzANTBS.mjs → insights_.distribution-D4QWsHNo.mjs} +5 -5
- package/.output/server/_ssr/{insights_.distribution-BTbT0Z4H.mjs → insights_.distribution-DwjIdjQi.mjs} +2 -2
- package/.output/server/_ssr/{installations-BsCupWHx.mjs → installations-BIu66J6Q.mjs} +2 -2
- package/.output/server/_ssr/{installations-3XOT2V1j.mjs → installations-CfmO_V_R.mjs} +4 -4
- package/.output/server/_ssr/{installations-CpjqEYh_.mjs → installations-DyzKzWuv.mjs} +11 -11
- package/.output/server/_ssr/{listReleases-D_GY00SQ.mjs → listReleases-CQEceg8j.mjs} +1 -1
- package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
- package/.output/server/_ssr/native-artifact-H1MDP0Jz.mjs +593 -0
- package/.output/server/_ssr/{native-builds-CehTsEwY.mjs → native-builds-BCp8ICrn.mjs} +3 -3
- package/.output/server/_ssr/{native-builds-vYKOMlhp.mjs → native-builds-CqFeXByK.mjs} +17 -13
- package/.output/server/_ssr/{native-builds-DhXL5zf_.mjs → native-builds-qj346atQ.mjs} +49 -12
- package/.output/server/_ssr/{native-builds_._buildId-BHxp9NcZ.mjs → native-builds_._buildId-BAxkkEFo.mjs} +600 -168
- package/.output/server/_ssr/{native-builds_._buildId-euhJ0EI7.mjs → native-builds_._buildId-C8gsW-Rh.mjs} +3 -3
- package/.output/server/_ssr/nativeBuildDevice-nU480p5A.mjs +230 -0
- package/.output/server/_ssr/nativeBuildDownloadLink-c3tcq3G5.mjs +96 -0
- package/.output/server/_ssr/nativeBuildInstall-B-_lHDsS.mjs +203 -0
- package/.output/server/_ssr/nativeBuildQr-C5AFtpmE.mjs +115 -0
- package/.output/server/_ssr/{nativeBuilds-B_7BPjt_.mjs → nativeBuilds-CbxOJDhO.mjs} +61 -29
- package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-CX7wutet.mjs} +6 -6
- package/.output/server/_ssr/publicConsoleBase-3IHSHvqd.mjs +27 -0
- package/.output/server/_ssr/{qr-code-C7kNRIDX.mjs → qr-code-pENFuyy9.mjs} +1 -1
- package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-C7sUFDwa.mjs} +2 -2
- package/.output/server/_ssr/{release-adoption-rpc-BF8svHjV.mjs → release-adoption-rpc-BBwJO2hu.mjs} +9 -9
- package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-LLYlRnUB.mjs} +4 -4
- package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-D9dAMI17.mjs} +3 -3
- package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-EPhok_Py.mjs} +1 -1
- package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-DaZ7ifUF.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-Bn-BZgDt.mjs → remote-config-B1g7vrQD.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-ofOYh91b.mjs → remote-config-BDijmvj1.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-DdukdePk.mjs → remote-config-DjeXVIcr.mjs} +18 -18
- package/.output/server/_ssr/{remote-config-rpc-CzSU_Gwg.mjs → remote-config-rpc-B7bzKw4N.mjs} +5 -5
- package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
- package/.output/server/_ssr/{router-BQikCEhb.mjs → router-DhxgFNWn.mjs} +101 -50
- package/.output/server/_ssr/{routes-Brx45XtQ.mjs → routes-BC-rBuu_.mjs} +25 -25
- package/.output/server/_ssr/{routes-CTo-A_dj.mjs → routes-BDriEBtF.mjs} +12 -12
- package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-BsTTLV-B.mjs} +4 -4
- package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-3oDJJFWa.mjs} +1 -1
- package/.output/server/_ssr/{schema-migration-rpc-BcwNAFZJ.mjs → schema-migration-rpc-CNMqY0RE.mjs} +4 -4
- package/.output/server/_ssr/{select-Dk_Yv0IG.mjs → select-hFD2e3Bh.mjs} +1 -1
- package/.output/server/_ssr/{server-b1jUGuT2.mjs → server-D_hG9iIq.mjs} +6 -6
- package/.output/server/_ssr/{sidebar-CsRdKfb2.mjs → sidebar-Dmq4j1qr.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{start-BvDsQehg.mjs → start-RjhaPVFE.mjs} +2 -2
- package/.output/server/_ssr/{switch-DpYvZqIf.mjs → switch-CkNsEp9k.mjs} +2 -2
- package/.output/server/_ssr/{table-BAP-tdNn.mjs → table-CTtXogFJ.mjs} +1 -1
- package/.output/server/_ssr/{tabs-DGN9JEGV.mjs → tabs-BTKDM4AJ.mjs} +2 -2
- package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-DPYzv9bE.mjs} +3 -3
- package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-CmHbryZT.mjs} +2 -2
- package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-NmbU0MD2.mjs} +1 -1
- package/.output/server/_tanstack-start-manifest_v-BuGAtKIu.mjs +189 -0
- package/.output/server/index.mjs +275 -275
- package/package.json +7 -7
- package/src/components/features/native-builds/BuiltInBundleCard.tsx +82 -33
- package/src/components/features/native-builds/InstallCard.tsx +246 -46
- package/src/components/features/native-builds/IosInstall.tsx +300 -0
- package/src/components/features/native-builds/NativeBuildsTable.tsx +3 -0
- package/src/components/features/native-builds/PatchesCard.tsx +3 -2
- package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +4 -4
- package/src/components/features/native-builds/ServedNowCard.tsx +33 -1
- package/src/components/features/native-builds/StoreSubmission.tsx +1 -1
- package/src/lib/api-rpc.ts +55 -6
- package/src/lib/api.ts +85 -12
- package/src/lib/native-builds.ts +73 -11
- package/src/lib/server/local-console.ts +1 -1
- package/src/lib/server/nativeBuildDevice.ts +274 -0
- package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
- package/src/lib/server/nativeBuildInstall.ts +355 -0
- package/src/lib/server/nativeBuildQr.ts +114 -24
- package/src/lib/server/nativeBuilds.ts +87 -33
- package/src/lib/server/plistText.ts +17 -0
- package/src/lib/server/publicConsoleBase.ts +17 -0
- package/src/routeTree.gen.ts +114 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/device-response.ts +17 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/device.ts +17 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/device[.]mobileconfig.ts +17 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
- package/src/routes/[_]hot-updater/native-builds/preview-qr.ts +14 -0
- package/src/routes/api/native-builds/$buildId/download.ts +22 -1
- package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
- package/.output/public/assets/api-P2g8dCNg.js +0 -1
- package/.output/public/assets/api-keys-DWQC2q6y.js +0 -1
- package/.output/public/assets/insights-BSVGfxSL.js +0 -1
- package/.output/public/assets/insights-NK5B6ReS.js +0 -2
- package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
- package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
- package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
- package/.output/public/assets/native-builds-BGgFQTDW.js +0 -2
- package/.output/public/assets/native-builds-BOC71grI.js +0 -1
- package/.output/public/assets/native-builds-CxomzFqe.js +0 -1
- package/.output/public/assets/native-builds_._buildId-DD58_Phd.js +0 -1
- package/.output/public/assets/native-builds_._buildId-DvQDKnUQ.js +0 -2
- package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
- package/.output/public/assets/routes-BDdBIxYS.js +0 -1
- package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
- package/.output/server/_tanstack-start-manifest_v-uhJWytDm.mjs +0 -184
- /package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-fiaucvsO.js} +0 -0
- /package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-DCTtCP5t.js} +0 -0
- /package/.output/public/assets/{alert-dialog-BqYScr9y.js → alert-dialog-Z_RNBrFc.js} +0 -0
- /package/.output/public/assets/{badge-DWFcDWho.js → badge-UNnTz4Dl.js} +0 -0
- /package/.output/public/assets/{dialog-CNUPxNxH.js → dialog-C2U9bINi.js} +0 -0
- /package/.output/public/assets/{dist-CPlO6ko9.js → dist-UQUhRoJi.js} +0 -0
- /package/.output/public/assets/{empty-B3Uwdd6k.js → empty-PAp07lsC.js} +0 -0
- /package/.output/public/assets/{field-D-2-mnNh.js → field-DhKRWFG5.js} +0 -0
- /package/.output/public/assets/{history-DqHlgSuV.js → history-DakJoeSM.js} +0 -0
- /package/.output/public/assets/{input-group-D3OUBk4n.js → input-group-BJfBVqeI.js} +0 -0
- /package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-DzBe6DHr.js} +0 -0
- /package/.output/public/assets/{list--NIee1FZ.js → list-B6GeoQ_b.js} +0 -0
- /package/.output/public/assets/{plus-BReVKct-.js → plus-BVhOauU3.js} +0 -0
- /package/.output/public/assets/{refresh-cw-B9HHjLej.js → refresh-cw-C6svDMfM.js} +0 -0
- /package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-BscR0TsX.js} +0 -0
- /package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-CxFW64IG.js} +0 -0
- /package/.output/public/assets/{search-BCel4Oy6.js → search-bIYGuFCt.js} +0 -0
- /package/.output/public/assets/{smartphone-CMaSy_ir.js → smartphone-Bn5FtEwt.js} +0 -0
- /package/.output/public/assets/{switch-BpdiHL_t.js → switch-DtUu1RCw.js} +0 -0
- /package/.output/public/assets/{table-Bpy3SvSo.js → table-B22H8-RL.js} +0 -0
- /package/.output/public/assets/{tabs-Xmt7tZeG.js → tabs-Fgz3sA51.js} +0 -0
- /package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-7gOxArtb.js} +0 -0
- /package/.output/public/assets/{uuidv7-zXMtwR9Q.js → uuidv7-BLyD3pAM.js} +0 -0
- /package/.output/public/assets/{valueToPercent-BLwGy_xK.js → valueToPercent-DRLgSP0P.js} +0 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HotUpdaterCoreApi,
|
|
3
|
+
NativeBuildRow,
|
|
4
|
+
StorageAdapter,
|
|
5
|
+
} from "@hot-updater/plugin-core";
|
|
6
|
+
import {
|
|
7
|
+
type ByteSource,
|
|
8
|
+
type IpaInstallInfo,
|
|
9
|
+
normalizeIosUdid,
|
|
10
|
+
readIpaInstallInfo,
|
|
11
|
+
} from "@hot-updater/protocol/native-artifact";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM,
|
|
15
|
+
NATIVE_BUILD_INSTALL_LINK_TTL_MS,
|
|
16
|
+
nativeBuildDownloadPath,
|
|
17
|
+
nativeBuildManifestPath,
|
|
18
|
+
} from "../native-builds";
|
|
19
|
+
import {
|
|
20
|
+
issueNativeBuildDownloadLink,
|
|
21
|
+
type NativeBuildDownloadLinkResult,
|
|
22
|
+
refuseNativeBuildDownloadToken,
|
|
23
|
+
} from "./nativeBuildDownloadLink";
|
|
24
|
+
import { nativeBuildArtifactUrl } from "./nativeBuilds";
|
|
25
|
+
import { escapePlistText } from "./plistText";
|
|
26
|
+
import { publicConsoleBase } from "./publicConsoleBase";
|
|
27
|
+
|
|
28
|
+
const KiB = 1024;
|
|
29
|
+
const MiB = 1024 * KiB;
|
|
30
|
+
/**
|
|
31
|
+
* What one request asks for at least: a zip entry's local header and, for
|
|
32
|
+
* something the size of a profile, its data, so reading one takes one request.
|
|
33
|
+
*/
|
|
34
|
+
const READ_AHEAD_BYTES = 64 * KiB;
|
|
35
|
+
/** How many requests' bytes stay at hand: the archive's tail, and its entries. */
|
|
36
|
+
const KEPT_BLOCKS = 4;
|
|
37
|
+
/** The most one IPA's reading downloads: a directory and a few small files. */
|
|
38
|
+
const MAX_BYTES = 16 * MiB;
|
|
39
|
+
/** The most requests one IPA's reading makes, past a dozen extensions' profiles. */
|
|
40
|
+
const MAX_REQUESTS = 24;
|
|
41
|
+
const REQUEST_TIMEOUT_MS = 15_000;
|
|
42
|
+
|
|
43
|
+
/** Why a remote artifact can't be read in parts. */
|
|
44
|
+
export class RangeSourceError extends Error {
|
|
45
|
+
override readonly name = "RangeSourceError";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The bytes of `url` by HTTP Range requests, without ever downloading the
|
|
50
|
+
* file: a server that answers a Range request with the whole file (200) is
|
|
51
|
+
* cut off at once, as is one that sends more than it was asked for. Reading
|
|
52
|
+
* stops at `MAX_BYTES` and `MAX_REQUESTS`.
|
|
53
|
+
*/
|
|
54
|
+
export const httpRangeSource = ({
|
|
55
|
+
url,
|
|
56
|
+
size,
|
|
57
|
+
fetch = globalThis.fetch,
|
|
58
|
+
}: {
|
|
59
|
+
readonly url: string;
|
|
60
|
+
/** The artifact's length, as its build's row records it. */
|
|
61
|
+
readonly size: number;
|
|
62
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
63
|
+
}): ByteSource => {
|
|
64
|
+
const blocks: { readonly start: number; readonly bytes: Uint8Array }[] = [];
|
|
65
|
+
let requests = 0;
|
|
66
|
+
let downloaded = 0;
|
|
67
|
+
|
|
68
|
+
const request = async (start: number, end: number): Promise<Uint8Array> => {
|
|
69
|
+
if (requests === MAX_REQUESTS) {
|
|
70
|
+
throw new RangeSourceError(
|
|
71
|
+
"Reading the artifact took too many requests.",
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const length = end - start;
|
|
75
|
+
if (downloaded + length > MAX_BYTES) {
|
|
76
|
+
throw new RangeSourceError(
|
|
77
|
+
"Reading the artifact would download too much.",
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
requests += 1;
|
|
81
|
+
const response = await fetch(url, {
|
|
82
|
+
headers: {
|
|
83
|
+
range: `bytes=${start}-${end - 1}`,
|
|
84
|
+
"accept-encoding": "identity",
|
|
85
|
+
},
|
|
86
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
87
|
+
});
|
|
88
|
+
const contentRange = /^bytes (\d+)-(\d+)\/(\d+|\*)$/u.exec(
|
|
89
|
+
response.headers.get("content-range") ?? "",
|
|
90
|
+
);
|
|
91
|
+
if (
|
|
92
|
+
response.status !== 206 ||
|
|
93
|
+
Number(contentRange?.[1]) !== start ||
|
|
94
|
+
Number(contentRange?.[2]) !== end - 1 ||
|
|
95
|
+
(contentRange?.[3] !== "*" && Number(contentRange?.[3]) !== size) ||
|
|
96
|
+
response.body === null
|
|
97
|
+
) {
|
|
98
|
+
await response.body?.cancel().catch(() => {});
|
|
99
|
+
throw new RangeSourceError(
|
|
100
|
+
`The storage answered ${response.status} to a Range request.`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const bytes = new Uint8Array(length);
|
|
104
|
+
const reader = response.body.getReader();
|
|
105
|
+
let written = 0;
|
|
106
|
+
try {
|
|
107
|
+
for (;;) {
|
|
108
|
+
const { done, value } = await reader.read();
|
|
109
|
+
if (done) break;
|
|
110
|
+
if (written + value.byteLength > length) {
|
|
111
|
+
throw new RangeSourceError(
|
|
112
|
+
"The storage sent more than it was asked.",
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
bytes.set(value, written);
|
|
116
|
+
written += value.byteLength;
|
|
117
|
+
}
|
|
118
|
+
} finally {
|
|
119
|
+
await reader.cancel().catch(() => {});
|
|
120
|
+
}
|
|
121
|
+
if (written !== length) {
|
|
122
|
+
throw new RangeSourceError("The storage sent less than it was asked.");
|
|
123
|
+
}
|
|
124
|
+
downloaded += length;
|
|
125
|
+
return bytes;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
size,
|
|
130
|
+
async read(offset, length) {
|
|
131
|
+
const end = Math.min(size, offset + length);
|
|
132
|
+
if (offset >= end) return new Uint8Array(0);
|
|
133
|
+
for (const block of blocks) {
|
|
134
|
+
if (block.start <= offset && end <= block.start + block.bytes.length) {
|
|
135
|
+
return block.bytes.subarray(offset - block.start, end - block.start);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const blockEnd = Math.min(size, Math.max(end, offset + READ_AHEAD_BYTES));
|
|
139
|
+
const bytes = await request(offset, blockEnd);
|
|
140
|
+
blocks.push({ start: offset, bytes });
|
|
141
|
+
// The first block is the archive's tail, which holds its directory.
|
|
142
|
+
if (blocks.length > KEPT_BLOCKS) blocks.splice(1, 1);
|
|
143
|
+
return bytes.subarray(0, end - offset);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* What an IPA in storage installs as, or null when that can't be read in parts:
|
|
150
|
+
* a storage with no HTTPS download URL, one that ignores Range requests, or an
|
|
151
|
+
* artifact that isn't what it should be. It reads only the storage, and never
|
|
152
|
+
* logs the URL, which may be signed.
|
|
153
|
+
*/
|
|
154
|
+
export const readNativeBuildInstallInfo = async (
|
|
155
|
+
build: Pick<
|
|
156
|
+
NativeBuildRow,
|
|
157
|
+
"artifact_kind" | "artifact_storage_uri" | "byte_size"
|
|
158
|
+
>,
|
|
159
|
+
storage: StorageAdapter,
|
|
160
|
+
fetch: typeof globalThis.fetch = globalThis.fetch,
|
|
161
|
+
): Promise<IpaInstallInfo | null> => {
|
|
162
|
+
if (build.artifact_kind !== "ipa") return null;
|
|
163
|
+
try {
|
|
164
|
+
const url = await nativeBuildArtifactUrl(build, storage);
|
|
165
|
+
if (url === null || new URL(url).protocol !== "https:") return null;
|
|
166
|
+
return await readIpaInstallInfo(
|
|
167
|
+
httpRangeSource({ url, size: build.byte_size, fetch }),
|
|
168
|
+
);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.warn(
|
|
171
|
+
`Installation details unavailable: ${error instanceof Error ? error.message : String(error)}`,
|
|
172
|
+
);
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type NativeBuildInstallEligibility =
|
|
178
|
+
/** The IPA can't be read in parts, so nothing can be said or installed. */
|
|
179
|
+
| { readonly status: "unavailable" }
|
|
180
|
+
/** An App Store export, which installs through TestFlight only. */
|
|
181
|
+
| { readonly status: "store" }
|
|
182
|
+
| { readonly status: "expired"; readonly expiresAt: string }
|
|
183
|
+
| {
|
|
184
|
+
readonly status: "installable";
|
|
185
|
+
/** Whether the IPA lists the device: `unknown` without a UDID to look up. */
|
|
186
|
+
readonly device: "unknown" | "included" | "not-included";
|
|
187
|
+
readonly expiresAt: string | null;
|
|
188
|
+
/** The token of the Install button's manifest and download. */
|
|
189
|
+
readonly link: NativeBuildDownloadLinkResult;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const isExpired = ({ expiresAtMs }: IpaInstallInfo, now: number) =>
|
|
193
|
+
expiresAtMs !== null && expiresAtMs <= now;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* What an iPhone can do with a build, for a caller the Console already let in:
|
|
197
|
+
* one read of the build's row, and the IPA's few parts from storage. App Store
|
|
198
|
+
* Connect isn't asked, so this says what the IPA's bytes allow, which is what
|
|
199
|
+
* iOS enforces; registering a device changes nothing until a new IPA has it.
|
|
200
|
+
*/
|
|
201
|
+
export const checkNativeBuildInstall = async (
|
|
202
|
+
id: string,
|
|
203
|
+
udid: string | undefined,
|
|
204
|
+
{
|
|
205
|
+
core,
|
|
206
|
+
storage,
|
|
207
|
+
}: {
|
|
208
|
+
readonly core: Pick<HotUpdaterCoreApi, "getNativeBuild">;
|
|
209
|
+
readonly storage: StorageAdapter;
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
request,
|
|
213
|
+
now = Date.now(),
|
|
214
|
+
fetch = globalThis.fetch,
|
|
215
|
+
}: {
|
|
216
|
+
readonly request?: Request;
|
|
217
|
+
readonly now?: number;
|
|
218
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
219
|
+
} = {},
|
|
220
|
+
): Promise<NativeBuildInstallEligibility> => {
|
|
221
|
+
const build = await core.getNativeBuild(id);
|
|
222
|
+
if (build === null) return { status: "unavailable" };
|
|
223
|
+
const info = await readNativeBuildInstallInfo(build, storage, fetch);
|
|
224
|
+
if (info === null) return { status: "unavailable" };
|
|
225
|
+
if (info.distribution === "store") return { status: "store" };
|
|
226
|
+
const expiresAt =
|
|
227
|
+
info.expiresAtMs === null ? null : new Date(info.expiresAtMs).toISOString();
|
|
228
|
+
if (expiresAt !== null && isExpired(info, now)) {
|
|
229
|
+
return { status: "expired", expiresAt };
|
|
230
|
+
}
|
|
231
|
+
const key = udid === undefined ? null : normalizeIosUdid(udid);
|
|
232
|
+
return {
|
|
233
|
+
status: "installable",
|
|
234
|
+
device:
|
|
235
|
+
key === null
|
|
236
|
+
? "unknown"
|
|
237
|
+
: info.distribution === "enterprise" || info.devices.includes(key)
|
|
238
|
+
? "included"
|
|
239
|
+
: "not-included",
|
|
240
|
+
expiresAt,
|
|
241
|
+
link: await issueNativeBuildDownloadLink(
|
|
242
|
+
id,
|
|
243
|
+
request,
|
|
244
|
+
now,
|
|
245
|
+
NATIVE_BUILD_INSTALL_LINK_TTL_MS,
|
|
246
|
+
),
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const installRefusal = (status: number, message: string) =>
|
|
251
|
+
new Response(message, {
|
|
252
|
+
status,
|
|
253
|
+
headers: {
|
|
254
|
+
"cache-control": "no-store",
|
|
255
|
+
"content-type": "text/plain; charset=utf-8",
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The manifest iOS installs a build from, at `/_hot-updater/native-builds/
|
|
261
|
+
* <id>/manifest.plist?t=<download token>`. The installer has no session, so the
|
|
262
|
+
* token is all it answers to, and it is checked before anything is read. It
|
|
263
|
+
* mints nothing: the manifest's IPA URL carries the same token.
|
|
264
|
+
*
|
|
265
|
+
* - 403: no token, or one that isn't this build's, or has expired;
|
|
266
|
+
* - 404: no such build, or not an IPA;
|
|
267
|
+
* - 409: an IPA that can't install this way (App Store export, expired profile);
|
|
268
|
+
* - 503: the IPA can't be read in parts.
|
|
269
|
+
*/
|
|
270
|
+
export const serveNativeBuildManifest = async (
|
|
271
|
+
request: Request,
|
|
272
|
+
id: string,
|
|
273
|
+
loadDeps: () => Promise<{
|
|
274
|
+
readonly core: Pick<HotUpdaterCoreApi, "getNativeBuild">;
|
|
275
|
+
readonly storage: StorageAdapter;
|
|
276
|
+
}>,
|
|
277
|
+
fetch: typeof globalThis.fetch = globalThis.fetch,
|
|
278
|
+
): Promise<Response> => {
|
|
279
|
+
const token = new URL(request.url).searchParams.get(
|
|
280
|
+
NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM,
|
|
281
|
+
);
|
|
282
|
+
if (token === null) {
|
|
283
|
+
return installRefusal(
|
|
284
|
+
403,
|
|
285
|
+
"This install link isn't valid. Open the build's Console page for a new one.",
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
const refused = await refuseNativeBuildDownloadToken(request, id, token);
|
|
289
|
+
if (refused !== undefined) return refused;
|
|
290
|
+
|
|
291
|
+
const { core, storage } = await loadDeps();
|
|
292
|
+
const build = await core.getNativeBuild(id);
|
|
293
|
+
if (build === null || build.artifact_kind !== "ipa") {
|
|
294
|
+
return installRefusal(404, "This build has no IPA to install.");
|
|
295
|
+
}
|
|
296
|
+
const info = await readNativeBuildInstallInfo(build, storage, fetch);
|
|
297
|
+
if (info === null) {
|
|
298
|
+
return installRefusal(503, "Installation details unavailable.");
|
|
299
|
+
}
|
|
300
|
+
if (info.distribution === "store") {
|
|
301
|
+
return installRefusal(
|
|
302
|
+
409,
|
|
303
|
+
"This IPA is an App Store export, which installs through TestFlight.",
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
if (isExpired(info, Date.now())) {
|
|
307
|
+
return installRefusal(
|
|
308
|
+
409,
|
|
309
|
+
"This IPA's provisioning profile has expired. Rebuild it.",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const base = publicConsoleBase(request, nativeBuildManifestPath(id));
|
|
314
|
+
const ipaUrl = `${base}${nativeBuildDownloadPath(id)}?${NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM}=${encodeURIComponent(token)}`;
|
|
315
|
+
const manifest = `<?xml version="1.0" encoding="UTF-8"?>
|
|
316
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
317
|
+
<plist version="1.0">
|
|
318
|
+
<dict>
|
|
319
|
+
<key>items</key>
|
|
320
|
+
<array>
|
|
321
|
+
<dict>
|
|
322
|
+
<key>assets</key>
|
|
323
|
+
<array>
|
|
324
|
+
<dict>
|
|
325
|
+
<key>kind</key>
|
|
326
|
+
<string>software-package</string>
|
|
327
|
+
<key>url</key>
|
|
328
|
+
<string>${escapePlistText(ipaUrl)}</string>
|
|
329
|
+
</dict>
|
|
330
|
+
</array>
|
|
331
|
+
<key>metadata</key>
|
|
332
|
+
<dict>
|
|
333
|
+
<key>bundle-identifier</key>
|
|
334
|
+
<string>${escapePlistText(info.bundleId)}</string>
|
|
335
|
+
<key>bundle-version</key>
|
|
336
|
+
<string>${escapePlistText(info.bundleVersion)}</string>
|
|
337
|
+
<key>kind</key>
|
|
338
|
+
<string>software</string>
|
|
339
|
+
<key>title</key>
|
|
340
|
+
<string>${escapePlistText(info.title)}</string>
|
|
341
|
+
</dict>
|
|
342
|
+
</dict>
|
|
343
|
+
</array>
|
|
344
|
+
</dict>
|
|
345
|
+
</plist>
|
|
346
|
+
`;
|
|
347
|
+
return new Response(manifest, {
|
|
348
|
+
headers: {
|
|
349
|
+
"cache-control": "private, no-store",
|
|
350
|
+
"content-type": "text/xml; charset=utf-8",
|
|
351
|
+
"referrer-policy": "no-referrer",
|
|
352
|
+
"x-content-type-options": "nosniff",
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { isUUIDv7 } from "@hot-updater/protocol";
|
|
2
|
+
import { createPreviewLink } from "@hot-updater/protocol/native-artifact";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
nativeBuildDetailPath,
|
|
6
|
+
nativeBuildDownloadPath,
|
|
7
|
+
} from "../native-builds";
|
|
4
8
|
import { qrCodePath } from "../qr-code";
|
|
5
9
|
|
|
6
10
|
/** The header that carries the download URL the QR code holds. */
|
|
7
11
|
export const DOWNLOAD_URL_HEADER = "x-hot-updater-download-url";
|
|
8
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
|
+
|
|
9
16
|
/** The route that serves the QR code, under the console's own path. */
|
|
10
17
|
export const NATIVE_BUILD_QR_PATH = "/_hot-updater/native-builds/qr";
|
|
11
18
|
|
|
@@ -21,17 +28,49 @@ const refusal = (status: number, message: string) =>
|
|
|
21
28
|
},
|
|
22
29
|
});
|
|
23
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
|
+
|
|
24
59
|
/**
|
|
25
60
|
* The URL of a native build's console download, under the console path the
|
|
26
61
|
* QR request came to: the console answers it with a fresh storage URL on
|
|
27
62
|
* each request, so it never expires.
|
|
28
63
|
*/
|
|
29
|
-
export const nativeBuildDownloadUrl = (
|
|
64
|
+
export const nativeBuildDownloadUrl = (
|
|
65
|
+
request: Request,
|
|
66
|
+
id: string,
|
|
67
|
+
path: (id: string) => string = nativeBuildDownloadPath,
|
|
68
|
+
) => {
|
|
30
69
|
const url = new URL(request.url);
|
|
31
70
|
const base = url.pathname.endsWith(NATIVE_BUILD_QR_PATH)
|
|
32
71
|
? url.pathname.slice(0, -NATIVE_BUILD_QR_PATH.length)
|
|
33
72
|
: "";
|
|
34
|
-
return `${url.origin}${base}${
|
|
73
|
+
return `${url.origin}${base}${path(id)}`;
|
|
35
74
|
};
|
|
36
75
|
|
|
37
76
|
/**
|
|
@@ -41,33 +80,84 @@ export const nativeBuildDownloadUrl = (request: Request, id: string) => {
|
|
|
41
80
|
* request comment shows it, and GitHub fetches a comment's images
|
|
42
81
|
* anonymously. It reads nothing, no database and no storage, so it says
|
|
43
82
|
* nothing about whether the build exists; the download itself asks for the
|
|
44
|
-
* session.
|
|
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.
|
|
45
90
|
*
|
|
46
91
|
* - 400: `build` is missing or not a UUIDv7;
|
|
47
92
|
* - 405: a method other than GET or HEAD.
|
|
48
93
|
*/
|
|
49
94
|
export const serveNativeBuildQr = (request: Request): Response => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
const id = new URL(request.url).searchParams.get("build");
|
|
95
|
+
const refused = refuseMethod(request);
|
|
96
|
+
if (refused) return refused;
|
|
97
|
+
const { searchParams } = new URL(request.url);
|
|
98
|
+
const id = searchParams.get("build");
|
|
56
99
|
if (id === null || !isUUIDv7(id)) {
|
|
57
100
|
return refusal(400, "Pass ?build=<native build ID>.");
|
|
58
101
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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");
|
|
73
163
|
};
|