@hot-updater/console 1.2.0-rc.5 → 1.2.0-rc.51
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-6aptbS4G.js +1 -0
- package/.output/public/assets/BundleIdDisplay-CtbmyR7f.js +1 -0
- package/.output/public/assets/ChannelPicker-DPR-7lqV.js +1 -0
- package/.output/public/assets/CompositeItem-UhIlCBg4.js +1 -0
- package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-B3VCINom.js} +1 -1
- package/.output/public/assets/EventDetails-LQ8ejbsd.js +1 -0
- package/.output/public/assets/FoldedRows-ClHLI-NM.js +1 -0
- package/.output/public/assets/HashValueDisplay-DTSMSH9O.js +1 -0
- package/.output/public/assets/InsightsPageHeader-ypKKV3rL.js +1 -0
- package/.output/public/assets/IosInstall-1a_GRSNg.js +1 -0
- package/.output/public/assets/NativeBuildsNav-ChBahvFN.js +1 -0
- package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-BEpesHEm.js} +1 -1
- package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-D4KPXCHL.js} +1 -1
- package/.output/public/assets/QrCode-BFSCkbPj.js +1 -0
- package/.output/public/assets/RelativeTime-BQErgQRj.js +1 -0
- package/.output/public/assets/RolloutPercentageBadge-DF4EeZIJ.js +1 -0
- package/.output/public/assets/RowReason-BvIxbpPP.js +1 -0
- package/.output/public/assets/SandboxBadge-DPmJn40v.js +1 -0
- package/.output/public/assets/TargetDisplay-D0dVdFCk.js +1 -0
- package/.output/public/assets/alert-dialog-DGPqJBCk.js +1 -0
- package/.output/public/assets/api-keys-CAVLgicI.js +1 -0
- package/.output/public/assets/api-keys-ztwXoKcj.js +1 -0
- package/.output/public/assets/api-znPyglTl.js +1 -0
- package/.output/public/assets/arrow-left-68S4uy4I.js +1 -0
- package/.output/public/assets/arrow-right-DjRwIoF1.js +1 -0
- package/.output/public/assets/arrow-up-right-C_1ALUCD.js +1 -0
- package/.output/public/assets/badge-zMibJGR5.js +1 -0
- package/.output/public/assets/card-BAs80yql.js +1 -0
- package/.output/public/assets/check-C3VCvMOV.js +1 -0
- package/.output/public/assets/chevron-down-BkoJHAll.js +1 -0
- package/.output/public/assets/chevron-right-RAuPv9r1.js +1 -0
- package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-DvYMC5yF.js} +1 -1
- package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-D0JWZ1KF.js} +1 -1
- package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-CtbGqKyr.js} +1 -1
- package/.output/public/assets/{uuidv7-zXMtwR9Q.js → constants-yj-e3ahf.js} +1 -1
- package/.output/public/assets/{copy-DsuLj3oj.js → copy-BjVLMKbo.js} +1 -1
- package/.output/public/assets/dialog-BvZDZzdQ.js +1 -0
- package/.output/public/assets/dist-BEmib-ZM.js +1 -0
- package/.output/public/assets/{download-Cf24LBde.js → download-CgpaZb23.js} +1 -1
- package/.output/public/assets/empty-C5GqArX9.js +1 -0
- package/.output/public/assets/field-DInLQ5oV.js +1 -0
- package/.output/public/assets/git-branch-BGatQV8Q.js +1 -0
- package/.output/public/assets/history-Ci4dhphE.js +1 -0
- package/.output/public/assets/index-B8BpJ73Y.js +10 -0
- package/.output/public/assets/input-group-CIjTdxCW.js +1 -0
- package/.output/public/assets/insights-BrdBpqda.js +42 -0
- package/.output/public/assets/insights-DsmTCDix.js +2 -0
- package/.output/public/assets/insights-V3D8tYPQ.js +1 -0
- package/.output/public/assets/insights-api-C4Dmm34n.js +1 -0
- package/.output/public/assets/insights-search-B4NkHGeC.js +1 -0
- package/.output/public/assets/insights-usage-rpc-Dw5_pmRH.js +1 -0
- package/.output/public/assets/insights_.distribution-BHmK7ufZ.js +1 -0
- package/.output/public/assets/insights_.distribution-BNNw0whH.js +2 -0
- package/.output/public/assets/insights_.distribution-oIFSv2TC.js +1 -0
- package/.output/public/assets/installations-CcPrSZwW.js +1 -0
- package/.output/public/assets/installations-Cjx0648C.js +1 -0
- package/.output/public/assets/installations-m1v6oE-2.js +2 -0
- package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-BkeLvA1m.js} +1 -1
- package/.output/public/assets/{link-DTEyW70e.js → link-CRMwpc7-.js} +2 -2
- package/.output/public/assets/{list--NIee1FZ.js → list-DQ9YBIDW.js} +1 -1
- package/.output/public/assets/loader-circle-8lunBReu.js +1 -0
- package/.output/public/assets/native-builds-B6t0ZxKP.js +1 -0
- package/.output/public/assets/native-builds-CgPSpNsA.js +2 -0
- package/.output/public/assets/native-builds-TF9BhYrQ.js +1 -0
- package/.output/public/assets/native-builds_._buildId-2rPrtz9-.js +2 -0
- package/.output/public/assets/native-builds_._buildId-BqUOY1Az.js +1 -0
- package/.output/public/assets/native-builds_.devices-B9kLHngv.js +2 -0
- package/.output/public/assets/native-builds_.devices-COFYZcaA.js +1 -0
- package/.output/public/assets/plus-DztQIXYL.js +1 -0
- package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-RUNbaMyO.js} +1 -1
- package/.output/public/assets/remote-config-BCQHNGRY.js +1 -0
- package/.output/public/assets/remote-config-BIIj0Faf.js +1 -0
- package/.output/public/assets/remote-config-CDlB7JK8.js +6 -0
- package/.output/public/assets/rotate-ccw-tITIe0Bd.js +1 -0
- package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-BFQcpUTO.js} +1 -1
- package/.output/public/assets/routes-DMooqgLf.js +1 -0
- package/.output/public/assets/routes-Z2IGj8MK.js +2 -0
- package/.output/public/assets/search-BfEqtE64.js +1 -0
- package/.output/public/assets/select-iSWTEY9t.js +1 -0
- package/.output/public/assets/sidebar-BmzmPGuv.js +3 -0
- package/.output/public/assets/smartphone-Dy13ukaU.js +1 -0
- package/.output/public/assets/styles-D5kpHu-Z.css +2 -0
- package/.output/public/assets/switch-ByNYRVTN.js +1 -0
- package/.output/public/assets/table-DbZPkzdz.js +1 -0
- package/.output/public/assets/tabs-Byfy8Qls.js +1 -0
- package/.output/public/assets/trash-2-DI0biNI-.js +1 -0
- package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-CxhBbgJw.js} +1 -1
- package/.output/public/assets/useAnchoredPopupScrollLock-Cvx6CdPD.js +1 -0
- package/.output/public/assets/useCompositeListItem-BEDqZ9Ni.js +1 -0
- package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-D7IuoOLE.js} +1 -1
- package/.output/public/assets/valueToPercent-Db73Kirz.js +1 -0
- package/.output/server/{__23tanstack-start-server-fn-resolver-BsXXRtkN.mjs → __23tanstack-start-server-fn-resolver-pdhJfnex.mjs} +94 -46
- package/.output/server/_chunks/ssr-renderer.mjs +2 -2
- package/.output/server/_libs/@base-ui/react+[...].mjs +4436 -3131
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
- package/.output/server/_libs/_.mjs +2 -0
- package/.output/server/_libs/lucide-react.mjs +50 -28
- package/.output/server/_libs/next-themes.mjs +1 -1
- package/.output/server/_libs/react-redux+[...].mjs +1 -1
- package/.output/server/_libs/recharts+[...].mjs +1 -1
- package/.output/server/_libs/sonner.mjs +1 -1
- package/.output/server/_libs/tanstack__react-query.mjs +1 -1
- package/.output/server/_ssr/-native-builds-search-D10dMZzL.mjs +62 -0
- package/.output/server/_ssr/BundleIdDisplay-Bbf_lM0q.mjs +26 -0
- package/.output/server/_ssr/ChannelPicker-D6dQe9hV.mjs +251 -0
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-CGHVL37b.mjs → ConsoleFeatureUnavailable-cLOJizHM.mjs} +8 -8
- package/.output/server/_ssr/{EventDetails-DdJyaBZ5.mjs → EventDetails-Bf9A0sIH.mjs} +9 -9
- package/.output/server/_ssr/FoldedRows-CBXPkthB.mjs +152 -0
- package/.output/server/_ssr/HashValueDisplay-CTRuGnTF.mjs +65 -0
- package/.output/server/_ssr/{InsightsPageHeader-KtHEf8Q0.mjs → InsightsPageHeader-CZYqpzbC.mjs} +13 -13
- package/.output/server/_ssr/IosInstall-Dnv68fhL.mjs +767 -0
- package/.output/server/_ssr/NativeBuildsNav-Dg43O2Cd.mjs +39 -0
- package/.output/server/_ssr/{NotFoundPage-DZB6K98c.mjs → NotFoundPage-C0hUVtGq.mjs} +3 -3
- package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-C22qEcwo.mjs} +13 -3
- package/.output/server/_ssr/QrCode-BbK966IU.mjs +50 -0
- package/.output/server/_ssr/RelativeTime-CdBbi7fL.mjs +242 -0
- package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-CaK9SkbN.mjs} +20 -4
- package/.output/server/_ssr/RowReason-Cg035uIk.mjs +59 -0
- package/.output/server/_ssr/SandboxBadge-Zta6e__x.mjs +85 -0
- package/.output/server/_ssr/TargetDisplay-DGqswOee.mjs +105 -0
- package/.output/server/_ssr/{alert-dialog-CDr-Nsoo.mjs → alert-dialog-DFz9lm_Y.mjs} +4 -4
- package/.output/server/_ssr/{api-DGWwi1WN.mjs → api-B2LCh6pv.mjs} +186 -39
- package/.output/server/_ssr/{api-keys-BBb3xSox.mjs → api-keys-BbtiHE85.mjs} +14 -11
- package/.output/server/_ssr/{api-keys-e_eDCNr2.mjs → api-keys-D3oOFnP9.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-rpc-BXiXUAm9.mjs → api-keys-rpc-CJIR67Ch.mjs} +4 -4
- package/.output/server/_ssr/{api-rpc-CLreF5Vr.mjs → api-rpc-Bf7S-MaH.mjs} +83 -35
- package/.output/server/_ssr/{auth-rpc-Bbf80tQK.mjs → auth-rpc-Dp-DCqh6.mjs} +5 -5
- package/.output/server/_ssr/{auth.server-DGwe3eds.mjs → auth.server-Cc0ZRXjk.mjs} +1876 -358
- package/.output/server/_ssr/{badge-BXk5c2yv.mjs → badge-YEmoI1eN.mjs} +4 -45
- package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-a-pEDiqu.mjs} +1 -1
- package/.output/server/_ssr/card-D0a_6Dhh.mjs +49 -0
- package/.output/server/_ssr/{config.server-BIBSZpZE.mjs → config.server-CZRoGrFp.mjs} +4 -4
- package/.output/server/_ssr/{console-access-Cwha8dww.mjs → console-access-OPT4g-IS.mjs} +2 -2
- package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-DTYyXrWO.mjs} +1 -1
- package/.output/server/_ssr/{console-features-api-Bk24XYA5.mjs → console-features-api-tjmlaM_N.mjs} +4 -4
- package/.output/server/_ssr/{console-features-rpc-5WFiUFxb.mjs → console-features-rpc-SlXJxyZV.mjs} +4 -4
- package/.output/server/_ssr/constants-D-2jpCiJ.mjs +11 -0
- package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
- package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-B56IJxlu.mjs} +1 -1
- package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
- package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-D6bc51Xq.mjs} +5 -4
- package/.output/server/_ssr/deviceProfileToken-xzDLfE0T.mjs +98 -0
- package/.output/server/_ssr/{dialog-BG-juN_g.mjs → dialog-ChHbf-yX.mjs} +5 -5
- package/.output/server/_ssr/dist-CiOq3ygH.mjs +148 -0
- package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-C1KOnpiF.mjs} +1 -1
- package/.output/server/_ssr/{empty-DF3o-H8c.mjs → empty-jogqtpGm.mjs} +3 -3
- 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-BVufgM3l.mjs} +3 -3
- package/.output/server/_ssr/{field-5zvNofJH.mjs → field-Df_Q9TWZ.mjs} +3 -3
- package/.output/server/_ssr/foldedPage-CUjJqtlF.mjs +176 -0
- package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-DDqsd1pL.mjs} +2 -2
- package/.output/server/_ssr/{input-group-rcPxMqYq.mjs → input-group-CVf7oJb7.mjs} +3 -3
- package/.output/server/_ssr/{insights-Din0R0k-.mjs → insights-CWe8WEnp.mjs} +93 -215
- package/.output/server/_ssr/{insights-BwEiSUUy.mjs → insights-DFSywrbh.mjs} +5 -5
- package/.output/server/_ssr/{insights-BDa6T_cj.mjs → insights-DIRlQAyF.mjs} +2 -2
- package/.output/server/_ssr/{insights-api-BESfPrTq.mjs → insights-api-C9rxV0Tn.mjs} +5 -5
- package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-DwUaDs0Z.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-DGO2_3Vx.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-rpc-BD3vjHse.mjs → insights-failures-rpc-wIScA1Qn.mjs} +11 -11
- package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-Cdg3Msrj.mjs} +1 -1
- package/.output/server/_ssr/{insights-recovery-rpc-sVwplV7s.mjs → insights-recovery-rpc-BVt-dUJZ.mjs} +7 -7
- package/.output/server/_ssr/{insights-rpc-BdtBheBi.mjs → insights-rpc-BDQqwXjX.mjs} +4 -4
- package/.output/server/_ssr/{insights-search-BAaycSRp.mjs → insights-search-B56U9By9.mjs} +6 -8
- package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-BVm7CDw9.mjs} +1 -1
- package/.output/server/_ssr/{insights-usage-rpc-Bo5p-cuB.mjs → insights-usage-rpc-C084r9Yl.mjs} +5 -5
- package/.output/server/_ssr/{insights-usage-rpc-DCkLNAlG.mjs → insights-usage-rpc-D6QC7xMU.mjs} +7 -7
- package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-lPKyRC2o.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-5sgau7rB.mjs → insights_.distribution-BO1VAcAm.mjs} +5 -5
- package/.output/server/_ssr/{insights_.distribution-D4QQxZmG.mjs → insights_.distribution-CoTlEOe8.mjs} +16 -15
- package/.output/server/_ssr/{insights_.distribution-DoO2NDvS.mjs → insights_.distribution-DP1M7WJo.mjs} +2 -2
- package/.output/server/_ssr/{installations-C4MwFvp6.mjs → installations-BczGuyup.mjs} +13 -13
- package/.output/server/_ssr/{installations-CZZsFoXb.mjs → installations-CHXPyqGZ.mjs} +4 -4
- package/.output/server/_ssr/{installations-W6DXZ5Tp.mjs → installations-CY86CKgz.mjs} +2 -2
- package/.output/server/_ssr/ios-devices-rpc-B-9HHSKk.mjs +149 -0
- package/.output/server/_ssr/iosDeviceCookie-CZArbhzA.mjs +155 -0
- package/.output/server/_ssr/iosDeviceProfile-CxeXYxc-.mjs +176 -0
- package/.output/server/_ssr/iosDevices-Ckjp_S09.mjs +132 -0
- package/.output/server/_ssr/listReleases-QF91GLE7.mjs +94 -0
- package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
- package/.output/server/_ssr/native-artifact-0tXDLTsd.mjs +1517 -0
- package/.output/server/_ssr/native-builds-C2xGyB-t.mjs +273 -0
- package/.output/server/_ssr/native-builds-CKoFuBrT.mjs +698 -0
- package/.output/server/_ssr/{native-builds-BhBltXq2.mjs → native-builds-DGckAE3j.mjs} +3 -3
- package/.output/server/_ssr/native-builds_._buildId-BXfvqKmr.mjs +1204 -0
- package/.output/server/_ssr/{native-builds_._buildId-B5QgMg7D.mjs → native-builds_._buildId-EqbJ7R4A.mjs} +3 -3
- package/.output/server/_ssr/native-builds_.devices-BJ75om8d.mjs +10 -0
- package/.output/server/_ssr/native-builds_.devices-X6JpinwG.mjs +858 -0
- package/.output/server/_ssr/nativeBuildDownloadLink-BAfCV_k_.mjs +96 -0
- package/.output/server/_ssr/nativeBuildInstall-D2rK0m4j.mjs +256 -0
- package/.output/server/_ssr/nativeBuilds-B3LcuLs4.mjs +306 -0
- package/.output/server/_ssr/plistText-BORUpyEb.mjs +15 -0
- package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-D9CCkDjn.mjs} +7 -6
- package/.output/server/_ssr/publicConsoleBase-C3sNbafy.mjs +15 -0
- package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-gfhE5tz5.mjs} +2 -2
- package/.output/server/_ssr/{release-adoption-rpc-T00z1y9o.mjs → release-adoption-rpc-xKxB0Ir0.mjs} +9 -9
- package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-BNp2LKR5.mjs} +5 -4
- package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-CLDa8DuR.mjs} +23 -11
- package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-CqIc-SDE.mjs} +1 -1
- package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-Ch1JpJkY.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-bTCPTVky.mjs → remote-config-ByjC_BCV.mjs} +23 -22
- package/.output/server/_ssr/{remote-config-Wjia3haX.mjs → remote-config-DmEXPobC.mjs} +3 -3
- package/.output/server/_ssr/{remote-config-rpc-7Zvra2dm.mjs → remote-config-rpc-BNPLt44i.mjs} +5 -5
- package/.output/server/_ssr/{remote-config-D6YMPi4J.mjs → remote-config-w3s5hFj9.mjs} +2 -2
- package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
- package/.output/server/_ssr/{router-CLK13IPD.mjs → router-C8NZ0bVd.mjs} +136 -63
- package/.output/server/_ssr/{routes-h_nOUmOr.mjs → routes-B8Gmx46E.mjs} +49 -17
- package/.output/server/_ssr/{routes-CbdYptnV.mjs → routes-DvpKW5gf.mjs} +495 -476
- package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-BUbb281Z.mjs} +4 -4
- package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-CaIuQCXb.mjs} +1 -1
- package/.output/server/_ssr/{schema-migration-rpc-yB9ioGZE.mjs → schema-migration-rpc-DlahGhrf.mjs} +5 -5
- package/.output/server/_ssr/{select-BdzEzz-x.mjs → select-Csnyblf2.mjs} +12 -10
- package/.output/server/_ssr/{server-CddZkHk2.mjs → server-Yr7QLPLj.mjs} +7 -7
- package/.output/server/_ssr/{sidebar-DabmjV5E.mjs → sidebar-bKoOUlMN.mjs} +17 -10
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{start-BvDsQehg.mjs → start-BSkL2B6C.mjs} +2 -2
- package/.output/server/_ssr/{switch-84dzb1yG.mjs → switch-C-HJ8oZV.mjs} +4 -4
- package/.output/server/_ssr/{table-DP978C4F.mjs → table-DSB_9Amh.mjs} +2 -2
- package/.output/server/_ssr/tabs-DRTBxZTO.mjs +45 -0
- package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-DcCONz23.mjs} +8 -5
- package/.output/server/_ssr/{dist-TEpM_UAD.mjs → uuid-kZvLA0Ly-DNL0qBSj.mjs} +2 -147
- package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-C0jNe2Om.mjs} +2 -2
- package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-zW2fpHOZ.mjs} +1 -1
- package/.output/server/_tanstack-start-manifest_v-MJAIGQWT.mjs +229 -0
- package/.output/server/index.mjs +493 -381
- package/lib/index.d.mts +9 -0
- package/package.json +7 -30
- package/src/components/AppSidebar.tsx +11 -2
- package/src/components/BundleIdDisplay.tsx +30 -3
- package/src/components/ChannelBadge.tsx +9 -9
- package/src/components/ChannelPicker.tsx +227 -0
- package/src/components/DataTable.tsx +363 -0
- package/src/components/FoldedRows.tsx +219 -0
- package/src/components/HashValueDisplay.tsx +27 -8
- package/src/components/PlatformIcon.tsx +10 -0
- package/src/components/RelativeTime.tsx +31 -0
- package/src/components/RowReason.tsx +63 -0
- package/src/components/TargetDisplay.tsx +95 -0
- package/src/components/ThemeProvider.tsx +11 -2
- package/src/components/features/api-keys/ApiKeysPage.tsx +5 -3
- package/src/components/features/bundles/BundleMetadata.tsx +22 -1
- package/src/components/features/bundles/RolloutCohortsDialog.tsx +8 -1
- package/src/components/features/channels/ChannelManagementDialog.tsx +10 -11
- package/src/components/features/insights/AppUsage.tsx +3 -5
- package/src/components/features/insights/ComparedBundlesChart.tsx +1 -0
- package/src/components/features/insights/FailureReports.tsx +3 -2
- package/src/components/features/insights/InsightsControls.tsx +38 -73
- package/src/components/features/insights/InsightsOverview.tsx +10 -2
- package/src/components/features/insights/InsightsPageHeader.tsx +10 -15
- package/src/components/features/insights/ReleaseActivity.tsx +6 -2
- package/src/components/features/insights/ReleaseCombobox.tsx +8 -3
- package/src/components/features/insights/RollbackButton.tsx +1 -1
- package/src/components/features/insights/UpdateFailures.tsx +36 -10
- package/src/components/features/native-builds/BuiltInBundleCard.tsx +125 -63
- package/src/components/features/native-builds/CommitLink.tsx +3 -2
- package/src/components/features/native-builds/ImportBuild.tsx +1 -1
- package/src/components/features/native-builds/InstallCard.tsx +378 -93
- package/src/components/features/native-builds/IosDevicesPage.tsx +1145 -0
- package/src/components/features/native-builds/IosInstall.tsx +732 -0
- package/src/components/features/native-builds/IpaDevicesCard.tsx +123 -0
- package/src/components/features/native-builds/NativeBuildDetailPage.tsx +45 -9
- package/src/components/features/native-builds/NativeBuildsNav.tsx +45 -0
- package/src/components/features/native-builds/NativeBuildsPage.tsx +94 -108
- package/src/components/features/native-builds/NativeBuildsTable.tsx +652 -323
- package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
- package/src/components/features/native-builds/PatchesCard.tsx +28 -19
- package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +5 -5
- package/src/components/features/native-builds/SandboxBadge.tsx +21 -0
- package/src/components/features/native-builds/ServedNowCard.tsx +39 -4
- package/src/components/features/native-builds/ShortHash.tsx +6 -3
- package/src/components/features/native-builds/StoreSubmission.tsx +18 -12
- package/src/components/features/native-builds/playTracks.ts +7 -0
- package/src/components/features/releases/ReleaseEditorSheet.tsx +14 -9
- package/src/components/features/remote-config/PublishDialog.tsx +4 -1
- package/src/components/features/remote-config/VersionsCard.tsx +5 -2
- package/src/components/ui/alert-dialog.tsx +2 -2
- package/src/components/ui/badge.tsx +2 -0
- package/src/components/ui/button.tsx +11 -2
- package/src/components/ui/combobox.tsx +2 -2
- package/src/components/ui/dialog.tsx +3 -3
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/select.tsx +15 -7
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +2 -2
- package/src/components/ui/slider.tsx +1 -1
- package/src/components/ui/sonner.tsx +3 -1
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/textarea.tsx +1 -1
- package/src/index.ts +9 -0
- package/src/lib/api-rpc.ts +125 -35
- package/src/lib/api.ts +171 -16
- package/src/lib/constants.ts +18 -0
- package/src/lib/insights-search.ts +0 -3
- package/src/lib/ios-devices-api.ts +304 -0
- package/src/lib/ios-devices-rpc.ts +215 -0
- package/src/lib/native-builds.ts +269 -20
- package/src/lib/release-adoption.ts +2 -0
- package/src/lib/schema-migration-rpc.ts +1 -1
- package/src/lib/server/console-runtime.server.ts +9 -2
- package/src/lib/server/deviceProfileToken.ts +221 -0
- package/src/lib/server/foldedPage.ts +360 -0
- package/src/lib/server/iosDeviceCookie.ts +239 -0
- package/src/lib/server/iosDeviceProfile.ts +232 -0
- package/src/lib/server/iosDevices.ts +232 -0
- package/src/lib/server/listReleases.ts +101 -62
- package/src/lib/server/local-console.ts +1 -1
- package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
- package/src/lib/server/nativeBuildInstall.ts +513 -0
- package/src/lib/server/nativeBuilds.ts +327 -59
- package/src/lib/server/plistText.ts +17 -0
- package/src/lib/server/publicConsoleBase.ts +17 -0
- package/src/lib/server/releaseAdoption.ts +1 -0
- package/src/lib/server/updateFailures.ts +6 -1
- package/src/routeTree.gen.ts +129 -18
- package/src/routes/-native-builds-search.ts +61 -4
- package/src/routes/-releases-search.ts +63 -2
- package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
- package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
- package/src/routes/[_]hot-updater/devices/receipt.ts +28 -0
- package/src/routes/[_]hot-updater/devices/request.ts +28 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
- package/src/routes/api/native-builds/$buildId/download.ts +22 -1
- package/src/routes/index.tsx +662 -578
- package/src/routes/insights.tsx +3 -5
- package/src/routes/insights_.distribution.tsx +2 -2
- package/src/routes/native-builds_.devices.tsx +21 -0
- package/src/styles.css +24 -0
- package/.output/public/assets/-native-builds-search-C-TGpFAm.js +0 -1
- package/.output/public/assets/EventDetails-Dl2RvPAk.js +0 -1
- package/.output/public/assets/HashValueDisplay-6lNRxDJX.js +0 -1
- package/.output/public/assets/InsightsPageHeader-DHhqY3DT.js +0 -1
- package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
- package/.output/public/assets/StoreSubmission-ViTkW4eJ.js +0 -1
- package/.output/public/assets/alert-dialog-BqYScr9y.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/api-keys-FueRkF9q.js +0 -1
- package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
- package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
- package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
- package/.output/public/assets/badge-DWFcDWho.js +0 -1
- package/.output/public/assets/check-CXVR3s3X.js +0 -1
- package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
- package/.output/public/assets/dialog-CNUPxNxH.js +0 -1
- package/.output/public/assets/dist-CPlO6ko9.js +0 -1
- package/.output/public/assets/empty-B3Uwdd6k.js +0 -1
- package/.output/public/assets/field-D-2-mnNh.js +0 -1
- package/.output/public/assets/history-DqHlgSuV.js +0 -1
- package/.output/public/assets/index-CqP5HPV6.js +0 -10
- package/.output/public/assets/input-group-D3OUBk4n.js +0 -1
- package/.output/public/assets/insights-B-0odqpt.js +0 -42
- package/.output/public/assets/insights-BSVGfxSL.js +0 -1
- package/.output/public/assets/insights-NK5B6ReS.js +0 -2
- package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
- package/.output/public/assets/insights-search-DghCbEnk.js +0 -1
- package/.output/public/assets/insights-usage-rpc-CKQH0pUS.js +0 -1
- package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
- package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
- package/.output/public/assets/insights_.distribution-dvk6vYDM.js +0 -1
- package/.output/public/assets/installations-B674P5Z5.js +0 -2
- package/.output/public/assets/installations-BWxczZ2t.js +0 -1
- package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
- package/.output/public/assets/native-builds-BOC71grI.js +0 -1
- package/.output/public/assets/native-builds-D6rldpSh.js +0 -2
- package/.output/public/assets/native-builds-DAy2678K.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/plus-BReVKct-.js +0 -1
- package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
- package/.output/public/assets/refresh-cw-B9HHjLej.js +0 -1
- package/.output/public/assets/remote-config-B7ujqhLa.js +0 -6
- package/.output/public/assets/remote-config-WjpozBG5.js +0 -1
- package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
- package/.output/public/assets/routes-BDdBIxYS.js +0 -1
- package/.output/public/assets/routes-CCD33Azv.js +0 -2
- package/.output/public/assets/search-BCel4Oy6.js +0 -1
- package/.output/public/assets/select-CBIU0_M1.js +0 -1
- package/.output/public/assets/sidebar-Di9SN47G.js +0 -3
- package/.output/public/assets/smartphone-CMaSy_ir.js +0 -1
- package/.output/public/assets/styles-uK-0vUMk.css +0 -2
- package/.output/public/assets/switch-BpdiHL_t.js +0 -1
- package/.output/public/assets/table-Bpy3SvSo.js +0 -1
- package/.output/public/assets/tabs-Xmt7tZeG.js +0 -1
- package/.output/public/assets/useCompositeListItem-JmyDfo3-.js +0 -1
- package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
- package/.output/public/assets/valueToPercent-BLwGy_xK.js +0 -1
- package/.output/server/_ssr/-native-builds-search-CwNcoXf4.mjs +0 -37
- package/.output/server/_ssr/BundleIdDisplay-CFz1sCQl.mjs +0 -13
- package/.output/server/_ssr/HashValueDisplay-B85-LoBW.mjs +0 -55
- package/.output/server/_ssr/RolloutPercentageBadge-CKFY5OIh.mjs +0 -21
- package/.output/server/_ssr/StoreSubmission-CNukW8xF.mjs +0 -139
- package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
- package/.output/server/_ssr/native-builds-CoOxssXa.mjs +0 -510
- package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
- package/.output/server/_ssr/native-builds_._buildId-CysSVBT5.mjs +0 -813
- package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
- package/.output/server/_ssr/nativeBuilds-B_7BPjt_.mjs +0 -133
- package/.output/server/_ssr/qr-code-C7kNRIDX.mjs +0 -22
- package/.output/server/_ssr/tabs-kQRMEiQT.mjs +0 -45
- package/.output/server/_tanstack-start-manifest_v-B5nsO5L4.mjs +0 -184
- package/src/lib/server/nativeBuildQr.ts +0 -73
- package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import type { HotUpdaterCoreApi, IosDeviceRow } from "@hot-updater/plugin-core";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createKeptDeviceReceipt,
|
|
5
|
+
type DeviceReceipt,
|
|
6
|
+
KEPT_DEVICE_RECEIPT_TTL_MS,
|
|
7
|
+
verifyDeviceReceipt,
|
|
8
|
+
verifyKeptDeviceReceipt,
|
|
9
|
+
} from "./deviceProfileToken";
|
|
10
|
+
import { deviceName, type IosDeviceViewer } from "./iosDevices";
|
|
11
|
+
import { readConsoleSecret } from "./nativeBuildDownloadLink";
|
|
12
|
+
import { publicConsoleBase } from "./publicConsoleBase";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This iPhone's proof, kept by Safari: after the profile's answer, the page
|
|
16
|
+
* trades the fragment's one-hour receipt for a 30-day one in an HttpOnly
|
|
17
|
+
* cookie, so the same person can request this iPhone again, after a removal,
|
|
18
|
+
* without the profile. The Console stores nothing: the cookie is a receipt
|
|
19
|
+
* signed with its secret, checked against the session on every use.
|
|
20
|
+
*
|
|
21
|
+
* The cookie is `Secure`, `SameSite=Strict`, and scoped to these routes, so
|
|
22
|
+
* no other request carries it and no other site's request does either. Every
|
|
23
|
+
* route here needs the Console's session, and a POST or DELETE only from this
|
|
24
|
+
* Console's own pages.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const IOS_DEVICE_COOKIE = "hot-updater-ios-device";
|
|
28
|
+
|
|
29
|
+
/** The routes the cookie is sent to, under the Console's path. */
|
|
30
|
+
export const IOS_DEVICE_COOKIE_ROUTES = "/_hot-updater/devices";
|
|
31
|
+
|
|
32
|
+
export const IOS_DEVICE_RECEIPT_ROUTE = `${IOS_DEVICE_COOKIE_ROUTES}/receipt`;
|
|
33
|
+
export const IOS_DEVICE_REQUEST_ROUTE = `${IOS_DEVICE_COOKIE_ROUTES}/request`;
|
|
34
|
+
|
|
35
|
+
const json = (body: unknown, status = 200, headers: HeadersInit = {}) =>
|
|
36
|
+
new Response(JSON.stringify(body), {
|
|
37
|
+
status,
|
|
38
|
+
headers: {
|
|
39
|
+
"cache-control": "no-store",
|
|
40
|
+
"content-type": "application/json; charset=utf-8",
|
|
41
|
+
...headers,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const refusal = (status: number, message: string) =>
|
|
46
|
+
json({ error: message }, status);
|
|
47
|
+
|
|
48
|
+
const cookieOf = (request: Request): string | null => {
|
|
49
|
+
for (const part of (request.headers.get("cookie") ?? "").split(";")) {
|
|
50
|
+
const [name, ...value] = part.trim().split("=");
|
|
51
|
+
if (name === IOS_DEVICE_COOKIE) return value.join("=") || null;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** The cookie's `Path`: these routes, under the Console's own path. */
|
|
57
|
+
const cookiePath = (request: Request, route: string) =>
|
|
58
|
+
`${new URL(publicConsoleBase(request, route)).pathname.replace(/\/$/u, "")}${IOS_DEVICE_COOKIE_ROUTES}`;
|
|
59
|
+
|
|
60
|
+
const setCookie = (request: Request, route: string, value: string) =>
|
|
61
|
+
[
|
|
62
|
+
`${IOS_DEVICE_COOKIE}=${value}`,
|
|
63
|
+
`Path=${cookiePath(request, route)}`,
|
|
64
|
+
`Max-Age=${value === "" ? 0 : Math.floor(KEPT_DEVICE_RECEIPT_TTL_MS / 1000)}`,
|
|
65
|
+
"HttpOnly",
|
|
66
|
+
"Secure",
|
|
67
|
+
"SameSite=Strict",
|
|
68
|
+
].join("; ");
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether a request that changes something comes from this Console's own
|
|
72
|
+
* pages: a browser says so in `Sec-Fetch-Site` and `Origin`. With the
|
|
73
|
+
* cookie's `SameSite=Strict`, another site's form or script gets nowhere.
|
|
74
|
+
*/
|
|
75
|
+
const sameOrigin = (request: Request, route: string) => {
|
|
76
|
+
const site = request.headers.get("sec-fetch-site");
|
|
77
|
+
if (site !== null && site !== "same-origin") return false;
|
|
78
|
+
const origin = request.headers.get("origin");
|
|
79
|
+
if (origin === null) return site === "same-origin";
|
|
80
|
+
return (
|
|
81
|
+
origin === new URL(request.url).origin ||
|
|
82
|
+
origin === new URL(publicConsoleBase(request, route)).origin
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const readJson = async (request: Request) => {
|
|
87
|
+
if (
|
|
88
|
+
!(request.headers.get("content-type") ?? "").startsWith("application/json")
|
|
89
|
+
) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const body: unknown = await request.json();
|
|
94
|
+
return typeof body === "object" && body !== null
|
|
95
|
+
? (body as Record<string, unknown>)
|
|
96
|
+
: null;
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** The cookie's receipt, for this person only; null when it holds none. */
|
|
103
|
+
const keptReceipt = async (
|
|
104
|
+
request: Request,
|
|
105
|
+
secret: string,
|
|
106
|
+
viewer: IosDeviceViewer,
|
|
107
|
+
now: number,
|
|
108
|
+
): Promise<DeviceReceipt | null> => {
|
|
109
|
+
const cookie = cookieOf(request);
|
|
110
|
+
if (cookie === null) return null;
|
|
111
|
+
const receipt = await verifyKeptDeviceReceipt(secret, cookie, now);
|
|
112
|
+
return typeof receipt === "string" || receipt.e !== viewer.email
|
|
113
|
+
? null
|
|
114
|
+
: receipt;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export interface IosDeviceCookieDeps {
|
|
118
|
+
/** The signed-in viewer, or the access check's 401/403. */
|
|
119
|
+
readonly viewer: () => Promise<IosDeviceViewer>;
|
|
120
|
+
readonly core: () => Promise<Pick<HotUpdaterCoreApi, "requestIosDevice">>;
|
|
121
|
+
readonly now?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const withViewer = async (
|
|
125
|
+
deps: IosDeviceCookieDeps,
|
|
126
|
+
run: (viewer: IosDeviceViewer) => Promise<Response>,
|
|
127
|
+
) => {
|
|
128
|
+
let viewer: IosDeviceViewer;
|
|
129
|
+
try {
|
|
130
|
+
viewer = await deps.viewer();
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error instanceof Response) return error;
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return run(viewer);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* `/_hot-updater/devices/receipt`:
|
|
140
|
+
*
|
|
141
|
+
* - GET: the UDID this Safari proved for this person, or null.
|
|
142
|
+
* - POST `{ receipt }`: trades the fragment's receipt, for this person, for
|
|
143
|
+
* the cookie; 403 for anyone else's, an expired one, or a forged one.
|
|
144
|
+
* - DELETE: forgets the cookie, as sign-out does.
|
|
145
|
+
*/
|
|
146
|
+
export const handleIosDeviceReceipt = async (
|
|
147
|
+
request: Request,
|
|
148
|
+
deps: IosDeviceCookieDeps,
|
|
149
|
+
): Promise<Response> =>
|
|
150
|
+
withViewer(deps, async (viewer) => {
|
|
151
|
+
const now = deps.now ?? Date.now();
|
|
152
|
+
const route = IOS_DEVICE_RECEIPT_ROUTE;
|
|
153
|
+
if (request.method === "DELETE") {
|
|
154
|
+
if (!sameOrigin(request, route)) return refusal(403, "Forbidden");
|
|
155
|
+
return json({ udid: null }, 200, {
|
|
156
|
+
"set-cookie": setCookie(request, route, ""),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
const secret = readConsoleSecret(request);
|
|
160
|
+
if (request.method === "GET") {
|
|
161
|
+
const receipt =
|
|
162
|
+
secret === undefined
|
|
163
|
+
? null
|
|
164
|
+
: await keptReceipt(request, secret, viewer, now);
|
|
165
|
+
return json({ udid: receipt?.u ?? null });
|
|
166
|
+
}
|
|
167
|
+
if (request.method !== "POST") {
|
|
168
|
+
return new Response(null, {
|
|
169
|
+
status: 405,
|
|
170
|
+
headers: { allow: "GET, POST, DELETE" },
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (!sameOrigin(request, route)) return refusal(403, "Forbidden");
|
|
174
|
+
if (secret === undefined) {
|
|
175
|
+
return refusal(409, "This Console has no secret to sign with.");
|
|
176
|
+
}
|
|
177
|
+
const body = await readJson(request);
|
|
178
|
+
if (body === null || typeof body.receipt !== "string") {
|
|
179
|
+
return refusal(400, "Send this iPhone's receipt.");
|
|
180
|
+
}
|
|
181
|
+
const receipt = await verifyDeviceReceipt(secret, body.receipt, now);
|
|
182
|
+
if (typeof receipt === "string" || receipt.e !== viewer.email) {
|
|
183
|
+
return refusal(403, "Check this iPhone again from this account.");
|
|
184
|
+
}
|
|
185
|
+
return json({ udid: receipt.u }, 200, {
|
|
186
|
+
"set-cookie": setCookie(
|
|
187
|
+
request,
|
|
188
|
+
route,
|
|
189
|
+
await createKeptDeviceReceipt(secret, receipt, now),
|
|
190
|
+
),
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* `/_hot-updater/devices/request`, POST `{ name, receipt? }`: requests the
|
|
196
|
+
* iPhone a receipt names, for the signed-in person, under `name`. The UDID
|
|
197
|
+
* comes from the fragment's receipt when the page has one, else from the
|
|
198
|
+
* cookie, never from the request's own words.
|
|
199
|
+
*/
|
|
200
|
+
export const handleIosDeviceRequest = async (
|
|
201
|
+
request: Request,
|
|
202
|
+
deps: IosDeviceCookieDeps,
|
|
203
|
+
): Promise<Response> =>
|
|
204
|
+
withViewer(deps, async (viewer) => {
|
|
205
|
+
const now = deps.now ?? Date.now();
|
|
206
|
+
const route = IOS_DEVICE_REQUEST_ROUTE;
|
|
207
|
+
if (request.method !== "POST") {
|
|
208
|
+
return new Response(null, { status: 405, headers: { allow: "POST" } });
|
|
209
|
+
}
|
|
210
|
+
if (!sameOrigin(request, route)) return refusal(403, "Forbidden");
|
|
211
|
+
const secret = readConsoleSecret(request);
|
|
212
|
+
const body = await readJson(request);
|
|
213
|
+
if (body === null) return refusal(400, "Send this iPhone's name.");
|
|
214
|
+
let name: string;
|
|
215
|
+
try {
|
|
216
|
+
name = deviceName(body.name);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
return refusal(400, (error as Error).message);
|
|
219
|
+
}
|
|
220
|
+
let udid: string | null = null;
|
|
221
|
+
if (secret !== undefined) {
|
|
222
|
+
if (typeof body.receipt === "string") {
|
|
223
|
+
const receipt = await verifyDeviceReceipt(secret, body.receipt, now);
|
|
224
|
+
udid =
|
|
225
|
+
typeof receipt === "string" || receipt.e !== viewer.email
|
|
226
|
+
? null
|
|
227
|
+
: receipt.u;
|
|
228
|
+
}
|
|
229
|
+
// A page left open past its fragment's hour still has the cookie.
|
|
230
|
+
udid ??= (await keptReceipt(request, secret, viewer, now))?.u ?? null;
|
|
231
|
+
}
|
|
232
|
+
if (udid === null) {
|
|
233
|
+
return refusal(403, "Check this iPhone again from this account.");
|
|
234
|
+
}
|
|
235
|
+
const core = await deps.core();
|
|
236
|
+
const result: { device: IosDeviceRow; created: boolean } =
|
|
237
|
+
await core.requestIosDevice({ udid, name, requestedBy: viewer.email });
|
|
238
|
+
return json(result);
|
|
239
|
+
});
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { HotUpdaterCoreApi } from "@hot-updater/plugin-core";
|
|
2
|
+
import { readProfileServiceUdid } from "@hot-updater/protocol/native-artifact";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IOS_DEVICES_PATH,
|
|
6
|
+
IOS_DEVICE_PROFILE_PATH,
|
|
7
|
+
IOS_DEVICE_RESPONSE_PATH,
|
|
8
|
+
IOS_DEVICE_TOKEN_PARAM,
|
|
9
|
+
nativeBuildDetailPath,
|
|
10
|
+
} from "../native-builds";
|
|
11
|
+
import {
|
|
12
|
+
createDeviceReceipt,
|
|
13
|
+
type DeviceProfileGrant,
|
|
14
|
+
verifyDeviceProfileToken,
|
|
15
|
+
} from "./deviceProfileToken";
|
|
16
|
+
import { readConsoleSecret } from "./nativeBuildDownloadLink";
|
|
17
|
+
import { escapePlistText } from "./plistText";
|
|
18
|
+
import { publicConsoleBase } from "./publicConsoleBase";
|
|
19
|
+
|
|
20
|
+
/** The most a Profile Service answer holds: a plist and a device's certificates. */
|
|
21
|
+
const MAX_RESPONSE_BYTES = 64 * 1024;
|
|
22
|
+
|
|
23
|
+
const refusal = (status: number, message: string) =>
|
|
24
|
+
new Response(message, {
|
|
25
|
+
status,
|
|
26
|
+
headers: {
|
|
27
|
+
"cache-control": "no-store",
|
|
28
|
+
"content-type": "text/plain; charset=utf-8",
|
|
29
|
+
"referrer-policy": "no-referrer",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const methodRefusal = (allow: string) => {
|
|
34
|
+
const response = refusal(405, "Method Not Allowed");
|
|
35
|
+
response.headers.set("allow", allow);
|
|
36
|
+
return response;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The grant a request's `t` carries, or the 403 that refuses it, checked
|
|
41
|
+
* before anything else is read: the profile routes take no session.
|
|
42
|
+
*/
|
|
43
|
+
const grantOf = async (
|
|
44
|
+
request: Request,
|
|
45
|
+
): Promise<
|
|
46
|
+
| {
|
|
47
|
+
readonly grant: DeviceProfileGrant;
|
|
48
|
+
readonly token: string;
|
|
49
|
+
readonly secret: string;
|
|
50
|
+
}
|
|
51
|
+
| Response
|
|
52
|
+
> => {
|
|
53
|
+
const secret = readConsoleSecret(request);
|
|
54
|
+
if (secret === undefined) {
|
|
55
|
+
return refusal(
|
|
56
|
+
403,
|
|
57
|
+
"This Console can't register iPhones without its secret.",
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const token = new URL(request.url).searchParams.get(IOS_DEVICE_TOKEN_PARAM);
|
|
61
|
+
const grant =
|
|
62
|
+
token === null ? "invalid" : await verifyDeviceProfileToken(secret, token);
|
|
63
|
+
if (grant === "expired") {
|
|
64
|
+
return refusal(403, "This link has expired. Open the Console page again.");
|
|
65
|
+
}
|
|
66
|
+
if (grant === "invalid") {
|
|
67
|
+
return refusal(403, "This link isn't valid. Open the Console page again.");
|
|
68
|
+
}
|
|
69
|
+
return { grant, token: token!, secret };
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The profile an iPhone installs to report its UDID, at
|
|
74
|
+
* `/_hot-updater/devices/device.mobileconfig?t=<capability>`. It takes no
|
|
75
|
+
* session, since Safari's download carries none here, and reads nothing:
|
|
76
|
+
* the capability is all it answers to. The callback URL carries the same
|
|
77
|
+
* capability. It asks for the UDID alone, and iOS keeps no profile afterwards.
|
|
78
|
+
*
|
|
79
|
+
* - 400: the Console isn't on HTTPS, which iOS needs;
|
|
80
|
+
* - 403: no capability, or one that isn't valid or has expired;
|
|
81
|
+
* - 405: a method other than GET or HEAD.
|
|
82
|
+
*/
|
|
83
|
+
export const serveDeviceProfile = async (
|
|
84
|
+
request: Request,
|
|
85
|
+
): Promise<Response> => {
|
|
86
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
87
|
+
return methodRefusal("GET, HEAD");
|
|
88
|
+
}
|
|
89
|
+
const checked = await grantOf(request);
|
|
90
|
+
if (checked instanceof Response) return checked;
|
|
91
|
+
const base = publicConsoleBase(request, IOS_DEVICE_PROFILE_PATH);
|
|
92
|
+
if (!base.startsWith("https://")) {
|
|
93
|
+
return refusal(
|
|
94
|
+
400,
|
|
95
|
+
"An iPhone needs this Console on HTTPS with a certificate it trusts.",
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const host = new URL(base).host;
|
|
99
|
+
const callback = `${base}${IOS_DEVICE_RESPONSE_PATH}?${IOS_DEVICE_TOKEN_PARAM}=${encodeURIComponent(checked.token)}`;
|
|
100
|
+
const purpose =
|
|
101
|
+
checked.grant.m === "register"
|
|
102
|
+
? "to request this iPhone for ad hoc builds"
|
|
103
|
+
: "to check whether a build can install on it";
|
|
104
|
+
const profile = `<?xml version="1.0" encoding="UTF-8"?>
|
|
105
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
106
|
+
<plist version="1.0">
|
|
107
|
+
<dict>
|
|
108
|
+
<key>PayloadContent</key>
|
|
109
|
+
<dict>
|
|
110
|
+
<key>URL</key>
|
|
111
|
+
<string>${escapePlistText(callback)}</string>
|
|
112
|
+
<key>DeviceAttributes</key>
|
|
113
|
+
<array>
|
|
114
|
+
<string>UDID</string>
|
|
115
|
+
</array>
|
|
116
|
+
<key>Challenge</key>
|
|
117
|
+
<string>hot-updater</string>
|
|
118
|
+
</dict>
|
|
119
|
+
<key>PayloadOrganization</key>
|
|
120
|
+
<string>Hot Updater</string>
|
|
121
|
+
<key>PayloadDisplayName</key>
|
|
122
|
+
<string>Hot Updater Device Profile</string>
|
|
123
|
+
<key>PayloadDescription</key>
|
|
124
|
+
<string>Sends this iPhone's ID (UDID) to ${escapePlistText(host)}, ${purpose}. Nothing stays installed.</string>
|
|
125
|
+
<key>PayloadIdentifier</key>
|
|
126
|
+
<string>dev.hot-updater.device-profile</string>
|
|
127
|
+
<key>PayloadUUID</key>
|
|
128
|
+
<string>6D3F4C0E-52C4-4C8B-9E0A-7B1E5A0C2F11</string>
|
|
129
|
+
<key>PayloadVersion</key>
|
|
130
|
+
<integer>1</integer>
|
|
131
|
+
<key>PayloadType</key>
|
|
132
|
+
<string>Profile Service</string>
|
|
133
|
+
</dict>
|
|
134
|
+
</plist>
|
|
135
|
+
`;
|
|
136
|
+
return new Response(request.method === "HEAD" ? null : profile, {
|
|
137
|
+
headers: {
|
|
138
|
+
"cache-control": "no-store",
|
|
139
|
+
"content-type": "application/x-apple-aspen-config",
|
|
140
|
+
"referrer-policy": "no-referrer",
|
|
141
|
+
"x-content-type-options": "nosniff",
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** A request's body, or null past `limit` bytes, which are never buffered. */
|
|
147
|
+
const readBoundedBody = async (
|
|
148
|
+
request: Request,
|
|
149
|
+
limit: number,
|
|
150
|
+
): Promise<Uint8Array | null> => {
|
|
151
|
+
if (Number(request.headers.get("content-length") ?? 0) > limit) {
|
|
152
|
+
await request.body?.cancel().catch(() => {});
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const reader = request.body?.getReader();
|
|
156
|
+
if (reader === undefined) return new Uint8Array(0);
|
|
157
|
+
const body = new Uint8Array(limit);
|
|
158
|
+
let length = 0;
|
|
159
|
+
try {
|
|
160
|
+
for (;;) {
|
|
161
|
+
const { done, value } = await reader.read();
|
|
162
|
+
if (done) return body.subarray(0, length);
|
|
163
|
+
if (length + value.byteLength > limit) return null;
|
|
164
|
+
body.set(value, length);
|
|
165
|
+
length += value.byteLength;
|
|
166
|
+
}
|
|
167
|
+
} finally {
|
|
168
|
+
await reader.cancel().catch(() => {});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Where iOS posts the device's answer, at `/_hot-updater/devices/
|
|
174
|
+
* device-response?t=<capability>`, without a session, since Settings has
|
|
175
|
+
* none. The capability is checked before the body is read. It takes the
|
|
176
|
+
* UDID's text and verifies no signature: a person approves every device.
|
|
177
|
+
*
|
|
178
|
+
* - `register`: saves the iPhone as requested by the capability's email, one
|
|
179
|
+
* read and at most one write, and goes back to the iOS devices page;
|
|
180
|
+
* - `identify`: saves nothing and goes back to the build's page with a receipt
|
|
181
|
+
* of the UDID for that email, which Request access takes.
|
|
182
|
+
*
|
|
183
|
+
* Where it goes back to comes from the capability, never from the request.
|
|
184
|
+
* iOS asks for a 301.
|
|
185
|
+
*
|
|
186
|
+
* - 400: no well-formed UDID;
|
|
187
|
+
* - 403: no capability, or one that isn't valid or has expired;
|
|
188
|
+
* - 405: a method other than POST;
|
|
189
|
+
* - 413: a body over 64 KiB.
|
|
190
|
+
*/
|
|
191
|
+
export const receiveDeviceResponse = async (
|
|
192
|
+
request: Request,
|
|
193
|
+
loadCore: () => Promise<Pick<HotUpdaterCoreApi, "requestIosDevice">>,
|
|
194
|
+
): Promise<Response> => {
|
|
195
|
+
if (request.method !== "POST") return methodRefusal("POST");
|
|
196
|
+
const checked = await grantOf(request);
|
|
197
|
+
if (checked instanceof Response) {
|
|
198
|
+
await request.body?.cancel().catch(() => {});
|
|
199
|
+
return checked;
|
|
200
|
+
}
|
|
201
|
+
const body = await readBoundedBody(request, MAX_RESPONSE_BYTES);
|
|
202
|
+
if (body === null) return refusal(413, "This answer is too large.");
|
|
203
|
+
const udid = readProfileServiceUdid(body);
|
|
204
|
+
if (udid === null) return refusal(400, "This answer has no device ID.");
|
|
205
|
+
const { grant, secret } = checked;
|
|
206
|
+
const base = publicConsoleBase(request, IOS_DEVICE_RESPONSE_PATH);
|
|
207
|
+
let location: string;
|
|
208
|
+
// Either answer hands the page a receipt, which it trades for the cookie
|
|
209
|
+
// that lets this Safari request the iPhone again without the profile.
|
|
210
|
+
const receipt = await createDeviceReceipt(secret, { u: udid, e: grant.e });
|
|
211
|
+
if (grant.m === "register") {
|
|
212
|
+
const core = await loadCore();
|
|
213
|
+
await core.requestIosDevice({
|
|
214
|
+
udid,
|
|
215
|
+
name: grant.n ?? "iPhone",
|
|
216
|
+
requestedBy: grant.e,
|
|
217
|
+
});
|
|
218
|
+
location = `${base}${IOS_DEVICES_PATH}#udid=${encodeURIComponent(udid)}&r=${encodeURIComponent(receipt)}&requested=1`;
|
|
219
|
+
} else {
|
|
220
|
+
const page =
|
|
221
|
+
grant.b === undefined ? IOS_DEVICES_PATH : nativeBuildDetailPath(grant.b);
|
|
222
|
+
location = `${base}${page}#udid=${encodeURIComponent(udid)}&r=${encodeURIComponent(receipt)}`;
|
|
223
|
+
}
|
|
224
|
+
return new Response(null, {
|
|
225
|
+
status: 301,
|
|
226
|
+
headers: {
|
|
227
|
+
"cache-control": "no-store",
|
|
228
|
+
"referrer-policy": "no-referrer",
|
|
229
|
+
location,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HotUpdaterCoreApi,
|
|
3
|
+
IosDeviceRow,
|
|
4
|
+
IosDeviceStatus,
|
|
5
|
+
} from "@hot-updater/plugin-core";
|
|
6
|
+
|
|
7
|
+
import type { ConsolePrincipal } from "../../index";
|
|
8
|
+
import {
|
|
9
|
+
createDeviceProfileToken,
|
|
10
|
+
DEVICE_PROFILE_TOKEN_TTL_MS,
|
|
11
|
+
} from "./deviceProfileToken";
|
|
12
|
+
import {
|
|
13
|
+
CONSOLE_SECRET_ENV,
|
|
14
|
+
readConsoleSecret,
|
|
15
|
+
} from "./nativeBuildDownloadLink";
|
|
16
|
+
import { type KeysetPage, keysetPage } from "./nativeBuilds";
|
|
17
|
+
|
|
18
|
+
/** A registry page: past an Apple account's yearly limit of devices. */
|
|
19
|
+
const PAGE = 200;
|
|
20
|
+
|
|
21
|
+
/** `ios_devices.name`'s bound in core's schema. */
|
|
22
|
+
const NAME_MAX_LENGTH = 100;
|
|
23
|
+
|
|
24
|
+
/** Who is looking at the iOS devices page, and what they may do. */
|
|
25
|
+
export interface IosDeviceViewer {
|
|
26
|
+
/** The signed-in email, lower-cased. */
|
|
27
|
+
readonly email: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this person approves, renames, and removes devices: anyone on
|
|
30
|
+
* the local Console, or the hosted Console's `console.deviceApprovers`.
|
|
31
|
+
*/
|
|
32
|
+
readonly canApprove: boolean;
|
|
33
|
+
/** Whether the hosted Console lists anyone who approves. */
|
|
34
|
+
readonly approversConfigured: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const forbidden = (message: string) =>
|
|
38
|
+
new Response(message, {
|
|
39
|
+
status: 403,
|
|
40
|
+
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/** Whether this is `hot-updater console`, the local runtime, by its mode. */
|
|
44
|
+
const isLocalConsole = async () => {
|
|
45
|
+
const { default: localConsoleGuard } =
|
|
46
|
+
await import("virtual:hot-updater-console/request-guard");
|
|
47
|
+
return localConsoleGuard !== undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The viewer's rights over the registry. The local Console is recognized by
|
|
52
|
+
* its mode, never by an email, so a hosted user named like the local one
|
|
53
|
+
* gains nothing. A hosted approver is an email in `deviceApprovers`.
|
|
54
|
+
*/
|
|
55
|
+
export const iosDeviceViewer = async (
|
|
56
|
+
principal: ConsolePrincipal,
|
|
57
|
+
deviceApprovers: readonly string[],
|
|
58
|
+
): Promise<IosDeviceViewer> => {
|
|
59
|
+
const email = principal.email.trim().toLowerCase();
|
|
60
|
+
const local = await isLocalConsole();
|
|
61
|
+
return {
|
|
62
|
+
email,
|
|
63
|
+
canApprove: local || deviceApprovers.includes(email),
|
|
64
|
+
approversConfigured: local || deviceApprovers.length > 0,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Refuses anyone but an approver, on the server, whatever the UI sent. */
|
|
69
|
+
export const requireDeviceApprover = (viewer: IosDeviceViewer) => {
|
|
70
|
+
if (!viewer.canApprove) {
|
|
71
|
+
throw forbidden("Only a device approver can do this.");
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Every registry row, newest first, or one status's: for the statuses Apple
|
|
77
|
+
* caps, which an ad hoc build's device list names. The devices page reads
|
|
78
|
+
* `listIosDevicePage`.
|
|
79
|
+
*/
|
|
80
|
+
export const listIosDevices = async (
|
|
81
|
+
core: Pick<HotUpdaterCoreApi, "listIosDevices">,
|
|
82
|
+
status?: IosDeviceStatus,
|
|
83
|
+
): Promise<IosDeviceRow[]> => {
|
|
84
|
+
const rows: IosDeviceRow[] = [];
|
|
85
|
+
for (let after: string | undefined; ; ) {
|
|
86
|
+
const page = await core.listIosDevices({
|
|
87
|
+
order: "desc",
|
|
88
|
+
limit: PAGE,
|
|
89
|
+
...(status === undefined ? {} : { status }),
|
|
90
|
+
...(after === undefined ? {} : { after }),
|
|
91
|
+
});
|
|
92
|
+
rows.push(...page);
|
|
93
|
+
if (page.length < PAGE) return rows;
|
|
94
|
+
after = page.at(-1)!.id;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** How many devices one page of the iOS devices page lists. */
|
|
99
|
+
export const IOS_DEVICE_PAGE_SIZE = 50;
|
|
100
|
+
|
|
101
|
+
/** A page of the iOS devices page: one status or all, and a keyset cursor. */
|
|
102
|
+
export interface IosDevicePageInput {
|
|
103
|
+
readonly status?: IosDeviceStatus;
|
|
104
|
+
/** Devices older than this ID: the next page. */
|
|
105
|
+
readonly before?: string;
|
|
106
|
+
/** Devices newer than this ID: the previous page. */
|
|
107
|
+
readonly after?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* One page of the registry, newest first, or of one status: one keyset read,
|
|
112
|
+
* however many requests the registry holds.
|
|
113
|
+
*/
|
|
114
|
+
export const listIosDevicePage = (
|
|
115
|
+
core: Pick<HotUpdaterCoreApi, "listIosDevices">,
|
|
116
|
+
{ status, before, after }: IosDevicePageInput,
|
|
117
|
+
): Promise<KeysetPage<IosDeviceRow>> =>
|
|
118
|
+
keysetPage(
|
|
119
|
+
(input) =>
|
|
120
|
+
core.listIosDevices({
|
|
121
|
+
...input,
|
|
122
|
+
...(status === undefined ? {} : { status }),
|
|
123
|
+
}),
|
|
124
|
+
({ id }) => id,
|
|
125
|
+
{
|
|
126
|
+
limit: IOS_DEVICE_PAGE_SIZE,
|
|
127
|
+
...(before === undefined ? {} : { before }),
|
|
128
|
+
...(after === undefined ? {} : { after }),
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
/** A device name as the registry stores it, or a refusal. */
|
|
133
|
+
export const deviceName = (name: unknown): string => {
|
|
134
|
+
const trimmed = typeof name === "string" ? name.trim() : "";
|
|
135
|
+
if (trimmed.length === 0 || trimmed.length > NAME_MAX_LENGTH) {
|
|
136
|
+
throw new TypeError(
|
|
137
|
+
`Name the device in 1 to ${NAME_MAX_LENGTH} characters.`,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return trimmed;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/** The name a device gets before anyone types one: the person's, then "iPhone". */
|
|
144
|
+
export const defaultDeviceName = (principal: ConsolePrincipal) => {
|
|
145
|
+
const owner =
|
|
146
|
+
principal.name?.trim() || principal.email.split("@")[0]?.trim() || "";
|
|
147
|
+
return owner === ""
|
|
148
|
+
? "iPhone"
|
|
149
|
+
: `${owner}'s iPhone`.slice(0, NAME_MAX_LENGTH);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Whether an iPhone can register through this Console: not through the local
|
|
154
|
+
* one, which an iPhone can't reach, nor without the secret that signs links.
|
|
155
|
+
*/
|
|
156
|
+
export const deviceRegistration = async (
|
|
157
|
+
request: Request,
|
|
158
|
+
): Promise<"ready" | "local-console" | "no-secret"> => {
|
|
159
|
+
if (await isLocalConsole()) return "local-console";
|
|
160
|
+
return readConsoleSecret(request) === undefined ? "no-secret" : "ready";
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type DeviceProfileLinkResult =
|
|
164
|
+
| {
|
|
165
|
+
readonly status: "issued";
|
|
166
|
+
/** The `t` of the profile route. */
|
|
167
|
+
readonly token: string;
|
|
168
|
+
readonly expiresAt: string;
|
|
169
|
+
}
|
|
170
|
+
/** An iPhone can't reach a Console on this computer. */
|
|
171
|
+
| { readonly status: "local-console" }
|
|
172
|
+
| { readonly status: "no-secret"; readonly secretName: string };
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A new capability for this person's iPhone profile: `register` saves the
|
|
176
|
+
* iPhone as requested under `name`, `identify` only tells build `buildId`'s
|
|
177
|
+
* page which iPhone it is. It reads and stores nothing.
|
|
178
|
+
*/
|
|
179
|
+
export const issueDeviceProfileLink = async (
|
|
180
|
+
request: Request,
|
|
181
|
+
viewer: IosDeviceViewer,
|
|
182
|
+
input:
|
|
183
|
+
| { readonly mode: "register"; readonly name: string }
|
|
184
|
+
| { readonly mode: "identify"; readonly buildId: string },
|
|
185
|
+
now: number = Date.now(),
|
|
186
|
+
): Promise<DeviceProfileLinkResult> => {
|
|
187
|
+
if (await isLocalConsole()) return { status: "local-console" };
|
|
188
|
+
const secret = readConsoleSecret(request);
|
|
189
|
+
if (secret === undefined) {
|
|
190
|
+
return { status: "no-secret", secretName: CONSOLE_SECRET_ENV };
|
|
191
|
+
}
|
|
192
|
+
const token = await createDeviceProfileToken(
|
|
193
|
+
secret,
|
|
194
|
+
input.mode === "register"
|
|
195
|
+
? { m: "register", e: viewer.email, n: deviceName(input.name) }
|
|
196
|
+
: { m: "identify", e: viewer.email, b: input.buildId },
|
|
197
|
+
now,
|
|
198
|
+
);
|
|
199
|
+
return {
|
|
200
|
+
status: "issued",
|
|
201
|
+
token,
|
|
202
|
+
expiresAt: new Date(now + DEVICE_PROFILE_TOKEN_TTL_MS).toISOString(),
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Removes a device from the registry, as read now: an approver removes any,
|
|
208
|
+
* and the person who asked withdraws their own while it is still requested.
|
|
209
|
+
* Null when it is gone already.
|
|
210
|
+
*/
|
|
211
|
+
export const removeIosDevice = async (
|
|
212
|
+
core: Pick<HotUpdaterCoreApi, "findIosDevice" | "deleteIosDevice">,
|
|
213
|
+
viewer: IosDeviceViewer,
|
|
214
|
+
udid: string,
|
|
215
|
+
): Promise<IosDeviceRow | null> => {
|
|
216
|
+
const device = await core.findIosDevice(udid);
|
|
217
|
+
if (device === null) return null;
|
|
218
|
+
if (viewer.canApprove) return core.deleteIosDevice(device.id);
|
|
219
|
+
if (device.status !== "pending" || device.requested_by !== viewer.email) {
|
|
220
|
+
throw forbidden("Only a device approver can remove this device.");
|
|
221
|
+
}
|
|
222
|
+
// Only while it is still this person's request: an approval meanwhile
|
|
223
|
+
// makes it an approver's to remove.
|
|
224
|
+
const withdrawn = await core.deleteIosDevice(device.id, {
|
|
225
|
+
status: "pending",
|
|
226
|
+
requestedBy: viewer.email,
|
|
227
|
+
});
|
|
228
|
+
if (withdrawn === null && (await core.findIosDevice(udid)) !== null) {
|
|
229
|
+
throw forbidden("It was approved meanwhile. A device approver removes it.");
|
|
230
|
+
}
|
|
231
|
+
return withdrawn;
|
|
232
|
+
};
|