@hot-updater/console 1.2.0-rc.4 → 1.2.0-rc.41
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-BFcW2mlI.js +1 -0
- package/.output/public/assets/BundleIdDisplay-C0X-k49t.js +1 -0
- package/.output/public/assets/ChannelBadge-BgVCJfJs.js +1 -0
- package/.output/public/assets/ChannelPicker-BQKoyxnf.js +1 -0
- package/.output/public/assets/CompositeItem-B7uxFM46.js +1 -0
- package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-B3VCINom.js} +1 -1
- package/.output/public/assets/EventDetails-CWiI1CXb.js +1 -0
- package/.output/public/assets/HashValueDisplay-DvwvQchI.js +1 -0
- package/.output/public/assets/InsightsPageHeader-BjUAikRe.js +1 -0
- package/.output/public/assets/IosInstall-B5IdjCP2.js +1 -0
- package/.output/public/assets/NativeBuildsNav-BKdnlKMN.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-5ZP9WlQ6.js +1 -0
- package/.output/public/assets/RolloutPercentageBadge-DCtG7c1o.js +1 -0
- package/.output/public/assets/RowReason-CXMCJ-Jc.js +1 -0
- package/.output/public/assets/SandboxBadge-PM92jCk6.js +1 -0
- package/.output/public/assets/TargetDisplay-DG_I3qln.js +1 -0
- package/.output/public/assets/alert-dialog-DGPqJBCk.js +1 -0
- package/.output/public/assets/api-eO-sq3Jd.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/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-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-C5gi7fdZ.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-Ck4fZq4M.js +10 -0
- package/.output/public/assets/input-group-CIjTdxCW.js +1 -0
- package/.output/public/assets/insights-V3D8tYPQ.js +1 -0
- package/.output/public/assets/insights-api-D4-FZeEI.js +1 -0
- package/.output/public/assets/insights-fSY6n4k3.js +42 -0
- package/.output/public/assets/insights-osTmFzzR.js +2 -0
- package/.output/public/assets/insights-search-CZtvD-Vf.js +1 -0
- package/.output/public/assets/insights-usage-rpc-Dw5_pmRH.js +1 -0
- package/.output/public/assets/insights_.distribution-Cws8lYLC.js +1 -0
- package/.output/public/assets/insights_.distribution-DpppHhaU.js +2 -0
- package/.output/public/assets/insights_.distribution-oIFSv2TC.js +1 -0
- package/.output/public/assets/installations-Byojb0Rv.js +2 -0
- package/.output/public/assets/installations-CFGDrY-W.js +1 -0
- package/.output/public/assets/installations-CcPrSZwW.js +1 -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-C4u6JvxV.js +2 -0
- package/.output/public/assets/native-builds-D9hoJd6W.js +1 -0
- package/.output/public/assets/native-builds-zwqucwx2.js +1 -0
- package/.output/public/assets/native-builds_._buildId-CXx2xjoI.js +1 -0
- package/.output/public/assets/native-builds_._buildId-DymsEZlO.js +2 -0
- package/.output/public/assets/native-builds_.devices-DF3g--dt.js +1 -0
- package/.output/public/assets/native-builds_.devices-QToUV8FB.js +2 -0
- package/.output/public/assets/plus-DztQIXYL.js +1 -0
- package/.output/public/assets/preload-helper-CE9OukVC.js +1 -0
- package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-RUNbaMyO.js} +1 -1
- package/.output/public/assets/remote-config-BIIj0Faf.js +1 -0
- package/.output/public/assets/remote-config-BJJAxy_g.js +6 -0
- package/.output/public/assets/remote-config-Dm1MCHDN.js +1 -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-9gxYg__u.js +1 -0
- package/.output/public/assets/routes-CUsayL0T.js +2 -0
- package/.output/public/assets/search-BfEqtE64.js +1 -0
- package/.output/public/assets/select-Bk52fOVX.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-C1iqL6CR.css +2 -0
- package/.output/public/assets/switch-CI393qIT.js +1 -0
- package/.output/public/assets/table-DbZPkzdz.js +1 -0
- package/.output/public/assets/tabs-BnpNC0zf.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-JmyDfo3-.js → useCompositeListItem-Cbk_weKW.js} +1 -1
- 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-X9YQcrQI.mjs → __23tanstack-start-server-fn-resolver-76SKGuoc.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 +2 -2
- package/.output/server/_libs/_.mjs +2 -0
- package/.output/server/_libs/lucide-react.mjs +34 -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-Bwt8tQzp.mjs +55 -0
- package/.output/server/_ssr/{BundleIdDisplay-BVrZXzTm.mjs → BundleIdDisplay-By3CbbRM.mjs} +3 -3
- package/.output/server/_ssr/ChannelBadge-CDup7l56.mjs +23 -0
- package/.output/server/_ssr/ChannelPicker-Du2TmP3P.mjs +251 -0
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-CULyV3nR.mjs → ConsoleFeatureUnavailable-C6aGoKDE.mjs} +8 -8
- package/.output/server/_ssr/{EventDetails-DeI1rOQc.mjs → EventDetails-VbcnMnSs.mjs} +9 -9
- package/.output/server/_ssr/{HashValueDisplay-DpnPD3U2.mjs → HashValueDisplay-CnC2fHER.mjs} +7 -7
- package/.output/server/_ssr/{InsightsPageHeader-Dwmdtelg.mjs → InsightsPageHeader-BuOanVZL.mjs} +13 -13
- package/.output/server/_ssr/IosInstall-BAFhW7Q9.mjs +751 -0
- package/.output/server/_ssr/NativeBuildsNav-BoTu4aLF.mjs +38 -0
- package/.output/server/_ssr/{NotFoundPage-Dddp1HSc.mjs → NotFoundPage-Bz05xF5Q.mjs} +3 -3
- package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-C22qEcwo.mjs} +13 -3
- package/.output/server/_ssr/QrCode-DWshAW81.mjs +50 -0
- package/.output/server/_ssr/RelativeTime-D5kDQVn1.mjs +242 -0
- package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-Dwx7dEeQ.mjs} +20 -4
- package/.output/server/_ssr/RowReason-pVOWQ7t5.mjs +186 -0
- package/.output/server/_ssr/SandboxBadge-DFbUYwhO.mjs +85 -0
- package/.output/server/_ssr/TargetDisplay-BtE5vntq.mjs +105 -0
- package/.output/server/_ssr/{alert-dialog-ei2c1b6A.mjs → alert-dialog-tcfkkNUX.mjs} +4 -4
- package/.output/server/_ssr/{api-keys-CVi7E0qS.mjs → api-keys-12_U0SQM.mjs} +14 -11
- package/.output/server/_ssr/{api-keys-BLHCygD_.mjs → api-keys-Bm8uDp2u.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-rpc-CLZsTwih.mjs → api-keys-rpc-BxkfToWI.mjs} +4 -4
- package/.output/server/_ssr/{api-rpc-p-7EhGIG.mjs → api-rpc-TSnLWB7e.mjs} +83 -35
- package/.output/server/_ssr/{api-CvwqILEx.mjs → api-xOHZxbzu.mjs} +174 -37
- package/.output/server/_ssr/{auth-rpc-B1W4-hxa.mjs → auth-rpc-D3w54vsW.mjs} +5 -5
- package/.output/server/_ssr/{auth.server-CVKs7SWJ.mjs → auth.server-a2eP6q5P.mjs} +952 -186
- package/.output/server/_ssr/{badge-nS9EbEA0.mjs → badge-DrfbN1n0.mjs} +4 -45
- package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-a-pEDiqu.mjs} +1 -1
- package/.output/server/_ssr/card-DEItjgKG.mjs +49 -0
- package/.output/server/_ssr/{config.server-BAdvotbH.mjs → config.server-K8dd4dRv.mjs} +4 -4
- package/.output/server/_ssr/{console-access-BiuC2QFp.mjs → console-access-D-DHU4YH.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-FvbqhbTg.mjs → console-features-api-Chy2PrzZ.mjs} +5 -5
- package/.output/server/_ssr/{console-features-rpc-Cl3J66aP.mjs → console-features-rpc-_31L0k1i.mjs} +4 -4
- package/.output/server/_ssr/constants-BjsJZqaU.mjs +10 -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-BZMFl5QV.mjs} +3 -3
- package/.output/server/_ssr/deviceProfileToken-xzDLfE0T.mjs +98 -0
- package/.output/server/_ssr/{dialog-GmTPeUS4.mjs → dialog-SAl1vP74.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-CXWKv24M.mjs → empty-opJc9Fjw.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-lwIHAwLc.mjs → field-D6Y7zDZd.mjs} +3 -3
- package/.output/server/_ssr/foldedPage-CUjJqtlF.mjs +176 -0
- package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-CnOf4Frp.mjs} +2 -2
- package/.output/server/_ssr/{input-group-Dgr4DNbE.mjs → input-group-D2PvPRdm.mjs} +3 -3
- package/.output/server/_ssr/{insights-BxtyBLt0.mjs → insights-Cro4cYp7.mjs} +2 -2
- package/.output/server/_ssr/{insights-api-PN_9ilr8.mjs → insights-api-BPyvQert.mjs} +5 -5
- package/.output/server/_ssr/{insights-DSnQTQw1.mjs → insights-dWeLneo1.mjs} +45 -191
- 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-Cxu3UtyB.mjs → insights-failures-rpc-D7M8-Et9.mjs} +11 -11
- package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-Cdg3Msrj.mjs} +1 -1
- package/.output/server/_ssr/{insights-recovery-rpc--c6kBp3k.mjs → insights-recovery-rpc-BUMK4m4H.mjs} +7 -7
- package/.output/server/_ssr/{insights-rpc-oTMaAqc1.mjs → insights-rpc-BZZ4U2Ll.mjs} +4 -4
- package/.output/server/_ssr/{insights-search-r-Z50f0Y.mjs → insights-search-Czi553oN.mjs} +6 -8
- package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-BVm7CDw9.mjs} +1 -1
- package/.output/server/_ssr/{insights-usage-rpc-DoElOI5b.mjs → insights-usage-rpc-BXvUr-z6.mjs} +7 -7
- package/.output/server/_ssr/{insights-usage-rpc-B00vjt0a.mjs → insights-usage-rpc-HOr6mniz.mjs} +5 -5
- package/.output/server/_ssr/{insights-B9NvjAWc.mjs → insights-vmCmvfXx.mjs} +5 -5
- package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-lPKyRC2o.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-CnYddZ2Y.mjs → insights_.distribution-B2dxcCd_.mjs} +2 -2
- package/.output/server/_ssr/{insights_.distribution-mpZ0wS_R.mjs → insights_.distribution-B5V_NbK4.mjs} +17 -16
- package/.output/server/_ssr/{insights_.distribution-B8AMBp-Q.mjs → insights_.distribution-DongF2jp.mjs} +5 -5
- package/.output/server/_ssr/{installations-BfhcY_XQ.mjs → installations-B7w4LGJp.mjs} +4 -4
- package/.output/server/_ssr/{installations-CWTRzcR7.mjs → installations-B84kSetd.mjs} +2 -2
- package/.output/server/_ssr/{installations-O6Jzc5PO.mjs → installations-bieZA3xt.mjs} +13 -13
- package/.output/server/_ssr/ios-devices-rpc-DOQg4dpb.mjs +137 -0
- package/.output/server/_ssr/iosDeviceCookie-DhWNFpC6.mjs +155 -0
- package/.output/server/_ssr/iosDeviceProfile-jC8w4zEF.mjs +176 -0
- package/.output/server/_ssr/iosDevices-B4kQLURA.mjs +113 -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-D4ZISXRZ.mjs +1517 -0
- package/.output/server/_ssr/native-builds-BU9Njiwm.mjs +696 -0
- package/.output/server/_ssr/native-builds-lEyKQemV.mjs +262 -0
- package/.output/server/_ssr/{native-builds-UIgRLMb8.mjs → native-builds-zpCsEYyA.mjs} +3 -3
- package/.output/server/_ssr/{native-builds_._buildId-DjUqI5sa.mjs → native-builds_._buildId-BJ4R32fq.mjs} +3 -3
- package/.output/server/_ssr/native-builds_._buildId-RHUotAYb.mjs +1148 -0
- package/.output/server/_ssr/native-builds_.devices-C0IlQkLv.mjs +10 -0
- package/.output/server/_ssr/native-builds_.devices-D1Ke-Fc-.mjs +820 -0
- package/.output/server/_ssr/nativeBuildDownloadLink-MCd5xUqP.mjs +96 -0
- package/.output/server/_ssr/nativeBuildInstall-DcsqDS-O.mjs +253 -0
- package/.output/server/_ssr/nativeBuilds-CRa36wNn.mjs +287 -0
- package/.output/server/_ssr/plistText-DkzlCfPI.mjs +15 -0
- package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-D9CCkDjn.mjs} +7 -6
- package/.output/server/_ssr/publicConsoleBase-wTKw3_iB.mjs +15 -0
- package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-gfhE5tz5.mjs} +2 -2
- package/.output/server/_ssr/{release-adoption-rpc-PLyiDnas.mjs → release-adoption-rpc-C4G_d8qK.mjs} +9 -9
- package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-DfEYq7I4.mjs} +4 -4
- package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-CJ2Shida.mjs} +4 -3
- 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-C5j4CfGa.mjs → remote-config-1QZ0HgEu.mjs} +3 -3
- package/.output/server/_ssr/{remote-config-eNxv5Kzc.mjs → remote-config-CsbpqWAR.mjs} +24 -23
- package/.output/server/_ssr/{remote-config-tOdzsFMi.mjs → remote-config-DkgBxBka.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-rpc-Cy4VwdMt.mjs → remote-config-rpc-KjJA9DC-.mjs} +5 -5
- package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
- package/.output/server/_ssr/{router-DaQ6OkIp.mjs → router-Dy3fmb8q.mjs} +137 -64
- package/.output/server/_ssr/{routes-Drni4c1E.mjs → routes-68rZQGee.mjs} +470 -474
- package/.output/server/_ssr/{routes-BYmUIYfN.mjs → routes-Ug9uqzob.mjs} +50 -18
- 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-mZ_19Wt_.mjs → schema-migration-rpc-kntY9oPm.mjs} +4 -4
- package/.output/server/_ssr/{select-Cjrp1Sl9.mjs → select-BOKFFr_G.mjs} +12 -10
- package/.output/server/_ssr/{server-y3KoaSil.mjs → server-DetMvRBJ.mjs} +7 -7
- package/.output/server/_ssr/{sidebar-tRHVNWpo.mjs → sidebar-B46houn0.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-YrqCYfP-.mjs → switch-BMYzd71j.mjs} +4 -4
- package/.output/server/_ssr/{table-NHakBPSp.mjs → table-DWrYwJ_a.mjs} +2 -2
- package/.output/server/_ssr/tabs-DusHAcYy.mjs +45 -0
- package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-BwDwIoNu.mjs} +3 -3
- 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-CD1q5k0m.mjs +228 -0
- package/.output/server/index.mjs +503 -391
- package/lib/index.d.mts +9 -0
- package/package.json +7 -30
- package/src/components/AppSidebar.tsx +11 -2
- 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 +6 -3
- package/src/components/PlatformIcon.tsx +10 -0
- package/src/components/RelativeTime.tsx +31 -0
- package/src/components/RowReason.tsx +56 -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 +1 -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/FailureReports.tsx +3 -2
- package/src/components/features/insights/InsightsControls.tsx +10 -69
- package/src/components/features/insights/InsightsOverview.tsx +7 -1
- 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 +1 -1
- package/src/components/features/insights/UpdateFailures.tsx +1 -0
- package/src/components/features/native-builds/BuiltInBundleCard.tsx +122 -61
- 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 +316 -91
- package/src/components/features/native-builds/IosDevicesPage.tsx +1100 -0
- package/src/components/features/native-builds/IosInstall.tsx +732 -0
- package/src/components/features/native-builds/IpaDevicesCard.tsx +111 -0
- package/src/components/features/native-builds/NativeBuildDetailPage.tsx +30 -6
- package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
- package/src/components/features/native-builds/NativeBuildsPage.tsx +94 -108
- package/src/components/features/native-builds/NativeBuildsTable.tsx +649 -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 +33 -1
- 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 +8 -6
- 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 +160 -16
- package/src/lib/constants.ts +15 -0
- package/src/lib/insights-search.ts +0 -3
- package/src/lib/ios-devices-api.ts +290 -0
- package/src/lib/ios-devices-rpc.ts +188 -0
- package/src/lib/native-builds.ts +261 -20
- 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 +193 -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 +502 -0
- package/src/lib/server/nativeBuilds.ts +314 -58
- package/src/lib/server/plistText.ts +17 -0
- package/src/lib/server/publicConsoleBase.ts +17 -0
- package/src/routeTree.gen.ts +129 -18
- package/src/routes/-native-builds-search.ts +52 -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 +657 -577
- 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/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/RolloutPercentageBadge-CoBhJtv9.mjs +0 -21
- package/.output/server/_ssr/StoreSubmission-CPg_Rn5E.mjs +0 -139
- package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
- package/.output/server/_ssr/native-builds-BDcOlKnd.mjs +0 -510
- package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
- package/.output/server/_ssr/native-builds_._buildId-BjsdQO93.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-BgTTFotk.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,1517 @@
|
|
|
1
|
+
import { n as assertCanonicalChannelName, o as encodeChannelKey, r as canonicalizeAppVersion, s as isUUIDv7 } from "./uuid-kZvLA0Ly-DNL0qBSj.mjs";
|
|
2
|
+
//#region node_modules/.nitro/vite/services/ssr/assets/native-artifact-D4ZISXRZ.js
|
|
3
|
+
/** A `Blob`, such as Node's `fs.openAsBlob`, read by slices. */
|
|
4
|
+
var blobSource = (blob) => ({
|
|
5
|
+
size: blob.size,
|
|
6
|
+
async read(offset, length) {
|
|
7
|
+
return new Uint8Array(await blob.slice(offset, Math.min(blob.size, offset + length)).arrayBuffer());
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
/** Why an artifact can't be read, or can't serve as a native build. */
|
|
11
|
+
var NativeArtifactError = class extends Error {
|
|
12
|
+
code;
|
|
13
|
+
name = "NativeArtifactError";
|
|
14
|
+
constructor(code, message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.code = code;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var corrupt$1 = () => new NativeArtifactError("UNREADABLE", "The artifact's AndroidManifest.xml is corrupt.");
|
|
20
|
+
var view$3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
21
|
+
var RES_STRING_POOL_TYPE = 1;
|
|
22
|
+
var RES_XML_TYPE = 3;
|
|
23
|
+
var RES_XML_START_ELEMENT_TYPE = 258;
|
|
24
|
+
var RES_XML_END_ELEMENT_TYPE = 259;
|
|
25
|
+
var RES_XML_RESOURCE_MAP_TYPE = 384;
|
|
26
|
+
var UTF8_FLAG = 256;
|
|
27
|
+
var NO_INDEX = 4294967295;
|
|
28
|
+
/** A `ResXMLTree_attrExt`, and a `ResXMLTree_attribute`, in bytes. */
|
|
29
|
+
var ELEMENT_EXT_BYTES = 20;
|
|
30
|
+
var ATTRIBUTE_BYTES = 20;
|
|
31
|
+
/** How deep a manifest's elements nest: an AndroidManifest.xml, a few levels. */
|
|
32
|
+
var MAX_ELEMENT_DEPTH = 64;
|
|
33
|
+
var TYPE_REFERENCE = 1;
|
|
34
|
+
var TYPE_STRING = 3;
|
|
35
|
+
var TYPE_INT_DEC = 16;
|
|
36
|
+
var TYPE_INT_HEX = 17;
|
|
37
|
+
var TYPE_INT_BOOLEAN = 18;
|
|
38
|
+
/**
|
|
39
|
+
* How many bytes a manifest's strings decode to in all. A pool's offsets can
|
|
40
|
+
* point many indexes, or overlapping ranges, at one long string, so the
|
|
41
|
+
* manifest's own size bounds nothing.
|
|
42
|
+
*/
|
|
43
|
+
var DECODED_STRING_BYTES = 16777216;
|
|
44
|
+
/**
|
|
45
|
+
* A `ResStringPool` chunk's strings, decoded when an index is read: each
|
|
46
|
+
* offset once, against one budget, within the chunk.
|
|
47
|
+
*/
|
|
48
|
+
var readStringPool = (bytes, start, size) => {
|
|
49
|
+
const data = view$3(bytes);
|
|
50
|
+
const end = start + size;
|
|
51
|
+
if (size < 28) throw corrupt$1();
|
|
52
|
+
const count = data.getUint32(start + 8, true);
|
|
53
|
+
const flags = data.getUint32(start + 16, true);
|
|
54
|
+
const stringsStart = start + data.getUint32(start + 20, true);
|
|
55
|
+
if (start + 28 + count * 4 > end || stringsStart > end) throw corrupt$1();
|
|
56
|
+
const utf8 = (flags & UTF8_FLAG) !== 0;
|
|
57
|
+
const decoder = new TextDecoder(utf8 ? "utf-8" : "utf-16le");
|
|
58
|
+
const decoded = /* @__PURE__ */ new Map();
|
|
59
|
+
let budget = DECODED_STRING_BYTES;
|
|
60
|
+
return (index) => {
|
|
61
|
+
if (index === NO_INDEX || index >= count) return "";
|
|
62
|
+
const offset = data.getUint32(start + 28 + index * 4, true);
|
|
63
|
+
const known = decoded.get(offset);
|
|
64
|
+
if (known !== void 0) return known;
|
|
65
|
+
let at = stringsStart + offset;
|
|
66
|
+
let byteLength;
|
|
67
|
+
if (at + 4 > end) throw corrupt$1();
|
|
68
|
+
if (utf8) {
|
|
69
|
+
at += bytes[at] & 128 ? 2 : 1;
|
|
70
|
+
let length = bytes[at];
|
|
71
|
+
if (length & 128) {
|
|
72
|
+
length = (length & 127) << 8 | bytes[at + 1];
|
|
73
|
+
at += 2;
|
|
74
|
+
} else at += 1;
|
|
75
|
+
byteLength = length;
|
|
76
|
+
} else {
|
|
77
|
+
let length = data.getUint16(at, true);
|
|
78
|
+
if (length & 32768) {
|
|
79
|
+
length = (length & 32767) << 16 | data.getUint16(at + 2, true);
|
|
80
|
+
at += 4;
|
|
81
|
+
} else at += 2;
|
|
82
|
+
byteLength = length * 2;
|
|
83
|
+
}
|
|
84
|
+
budget -= byteLength;
|
|
85
|
+
if (at + byteLength > end || budget < 0) throw corrupt$1();
|
|
86
|
+
const text = decoder.decode(bytes.subarray(at, at + byteLength));
|
|
87
|
+
decoded.set(offset, text);
|
|
88
|
+
return text;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
var parseBinaryManifest = (bytes) => {
|
|
92
|
+
const data = view$3(bytes);
|
|
93
|
+
if (bytes.byteLength < 8 || data.getUint16(0, true) !== RES_XML_TYPE) throw corrupt$1();
|
|
94
|
+
let stringAt = () => "";
|
|
95
|
+
let resourceIds = [];
|
|
96
|
+
const stack = [];
|
|
97
|
+
let root = null;
|
|
98
|
+
for (let at = data.getUint16(2, true); at + 8 <= bytes.byteLength;) {
|
|
99
|
+
const type = data.getUint16(at, true);
|
|
100
|
+
const headerSize = data.getUint16(at + 2, true);
|
|
101
|
+
const size = data.getUint32(at + 4, true);
|
|
102
|
+
if (size < 8 || at + size > bytes.byteLength) throw corrupt$1();
|
|
103
|
+
if (type === RES_STRING_POOL_TYPE) stringAt = readStringPool(bytes, at, size);
|
|
104
|
+
else if (type === RES_XML_RESOURCE_MAP_TYPE) {
|
|
105
|
+
resourceIds = [];
|
|
106
|
+
for (let i = at + headerSize; i + 4 <= at + size; i += 4) resourceIds.push(data.getUint32(i, true));
|
|
107
|
+
} else if (type === RES_XML_START_ELEMENT_TYPE) {
|
|
108
|
+
const ext = at + headerSize;
|
|
109
|
+
const attributeStart = data.getUint16(ext + 8, true);
|
|
110
|
+
const attributeSize = data.getUint16(ext + 10, true);
|
|
111
|
+
const attributeCount = data.getUint16(ext + 12, true);
|
|
112
|
+
if (headerSize < 16 || ext + ELEMENT_EXT_BYTES > at + size || attributeStart < ELEMENT_EXT_BYTES || attributeSize < ATTRIBUTE_BYTES || ext + attributeStart + attributeCount * attributeSize > at + size || stack.length >= MAX_ELEMENT_DEPTH) throw corrupt$1();
|
|
113
|
+
const name = stringAt(data.getUint32(ext + 4, true));
|
|
114
|
+
const attributes = [];
|
|
115
|
+
for (let i = 0; i < attributeCount; i += 1) {
|
|
116
|
+
const attr = ext + attributeStart + i * attributeSize;
|
|
117
|
+
const nameIndex = data.getUint32(attr + 4, true);
|
|
118
|
+
const raw = data.getUint32(attr + 8, true);
|
|
119
|
+
const dataType = bytes[attr + 15];
|
|
120
|
+
const value = data.getUint32(attr + 16, true);
|
|
121
|
+
attributes.push({
|
|
122
|
+
name: stringAt(nameIndex),
|
|
123
|
+
resourceId: resourceIds[nameIndex] ?? 0,
|
|
124
|
+
value: dataType === TYPE_STRING ? {
|
|
125
|
+
type: "string",
|
|
126
|
+
value: stringAt(raw === NO_INDEX ? value : raw)
|
|
127
|
+
} : dataType === TYPE_INT_BOOLEAN ? {
|
|
128
|
+
type: "boolean",
|
|
129
|
+
value: value !== 0
|
|
130
|
+
} : dataType === TYPE_INT_DEC || dataType === TYPE_INT_HEX ? {
|
|
131
|
+
type: "int",
|
|
132
|
+
value: value | 0
|
|
133
|
+
} : dataType === TYPE_REFERENCE ? {
|
|
134
|
+
type: "reference",
|
|
135
|
+
id: value
|
|
136
|
+
} : { type: "other" }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
stack.push({
|
|
140
|
+
name,
|
|
141
|
+
attributes,
|
|
142
|
+
children: []
|
|
143
|
+
});
|
|
144
|
+
} else if (type === RES_XML_END_ELEMENT_TYPE) {
|
|
145
|
+
const element = stack.pop();
|
|
146
|
+
if (element === void 0) throw corrupt$1();
|
|
147
|
+
const parent = stack.at(-1);
|
|
148
|
+
if (parent === void 0) root ??= element;
|
|
149
|
+
else parent.children.push(element);
|
|
150
|
+
}
|
|
151
|
+
at += size;
|
|
152
|
+
}
|
|
153
|
+
if (root === null) throw corrupt$1();
|
|
154
|
+
return root;
|
|
155
|
+
};
|
|
156
|
+
/** A minimal protobuf reader: fields of one message, by number. */
|
|
157
|
+
var readMessage = (bytes) => {
|
|
158
|
+
const fields = [];
|
|
159
|
+
let at = 0;
|
|
160
|
+
const varint = () => {
|
|
161
|
+
let value = 0;
|
|
162
|
+
let multiplier = 1;
|
|
163
|
+
for (;;) {
|
|
164
|
+
if (at >= bytes.byteLength) throw corrupt$1();
|
|
165
|
+
const byte = bytes[at++];
|
|
166
|
+
value += (byte & 127) * multiplier;
|
|
167
|
+
if ((byte & 128) === 0) return value;
|
|
168
|
+
multiplier *= 128;
|
|
169
|
+
if (multiplier > 2 ** 63) throw corrupt$1();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
while (at < bytes.byteLength) {
|
|
173
|
+
const key = varint();
|
|
174
|
+
const field = Math.floor(key / 8);
|
|
175
|
+
const wireType = key % 8;
|
|
176
|
+
if (wireType === 0) fields.push({
|
|
177
|
+
field,
|
|
178
|
+
wireType,
|
|
179
|
+
value: varint()
|
|
180
|
+
});
|
|
181
|
+
else if (wireType === 2) {
|
|
182
|
+
const length = varint();
|
|
183
|
+
if (at + length > bytes.byteLength) throw corrupt$1();
|
|
184
|
+
fields.push({
|
|
185
|
+
field,
|
|
186
|
+
wireType,
|
|
187
|
+
value: bytes.subarray(at, at + length)
|
|
188
|
+
});
|
|
189
|
+
at += length;
|
|
190
|
+
} else if (wireType === 5) at += 4;
|
|
191
|
+
else if (wireType === 1) at += 8;
|
|
192
|
+
else throw corrupt$1();
|
|
193
|
+
}
|
|
194
|
+
return fields;
|
|
195
|
+
};
|
|
196
|
+
var decoder = new TextDecoder();
|
|
197
|
+
var bytesOf = (fields, field) => fields.filter((f) => f.field === field && f.value instanceof Uint8Array).map((f) => f.value);
|
|
198
|
+
var stringOf = (fields, field) => {
|
|
199
|
+
const [value] = bytesOf(fields, field);
|
|
200
|
+
return value === void 0 ? "" : decoder.decode(value);
|
|
201
|
+
};
|
|
202
|
+
var numberOf = (fields, field) => {
|
|
203
|
+
const found = fields.find((f) => f.field === field && f.wireType === 0);
|
|
204
|
+
return found === void 0 ? void 0 : found.value;
|
|
205
|
+
};
|
|
206
|
+
/** An `Item` of aapt2's Resources.proto, as an attribute's compiled value. */
|
|
207
|
+
var protoItemValue = (item, raw) => {
|
|
208
|
+
const fields = readMessage(item);
|
|
209
|
+
const [reference] = bytesOf(fields, 1);
|
|
210
|
+
if (reference !== void 0) {
|
|
211
|
+
const ref = readMessage(reference);
|
|
212
|
+
return {
|
|
213
|
+
type: "reference",
|
|
214
|
+
id: numberOf(ref, 2) ?? 0,
|
|
215
|
+
name: stringOf(ref, 3) || void 0
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
const [str] = bytesOf(fields, 2);
|
|
219
|
+
if (str !== void 0) return {
|
|
220
|
+
type: "string",
|
|
221
|
+
value: stringOf(readMessage(str), 1)
|
|
222
|
+
};
|
|
223
|
+
const [primitive] = bytesOf(fields, 7);
|
|
224
|
+
if (primitive !== void 0) {
|
|
225
|
+
const prim = readMessage(primitive);
|
|
226
|
+
const boolean = numberOf(prim, 8);
|
|
227
|
+
if (boolean !== void 0) return {
|
|
228
|
+
type: "boolean",
|
|
229
|
+
value: boolean !== 0
|
|
230
|
+
};
|
|
231
|
+
const int = numberOf(prim, 6) ?? numberOf(prim, 7);
|
|
232
|
+
if (int !== void 0) return {
|
|
233
|
+
type: "int",
|
|
234
|
+
value: int | 0
|
|
235
|
+
};
|
|
236
|
+
if (raw !== "") return {
|
|
237
|
+
type: "string",
|
|
238
|
+
value: raw
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
};
|
|
243
|
+
/** An `XmlElement` of aapt2's Resources.proto. */
|
|
244
|
+
var protoElement = (bytes, depth = 0) => {
|
|
245
|
+
if (depth >= MAX_ELEMENT_DEPTH) throw corrupt$1();
|
|
246
|
+
const fields = readMessage(bytes);
|
|
247
|
+
const attributes = bytesOf(fields, 4).map((attribute) => {
|
|
248
|
+
const attr = readMessage(attribute);
|
|
249
|
+
const raw = stringOf(attr, 3);
|
|
250
|
+
const [item] = bytesOf(attr, 6);
|
|
251
|
+
return {
|
|
252
|
+
name: stringOf(attr, 2),
|
|
253
|
+
resourceId: numberOf(attr, 5) ?? 0,
|
|
254
|
+
value: (item && protoItemValue(item, raw)) ?? {
|
|
255
|
+
type: "string",
|
|
256
|
+
value: raw
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
const children = bytesOf(fields, 5).flatMap((node) => {
|
|
261
|
+
const [element] = bytesOf(readMessage(node), 1);
|
|
262
|
+
return element === void 0 ? [] : [protoElement(element, depth + 1)];
|
|
263
|
+
});
|
|
264
|
+
return {
|
|
265
|
+
name: stringOf(fields, 3),
|
|
266
|
+
attributes,
|
|
267
|
+
children
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* An `.aab` module's `manifest/AndroidManifest.xml`, an `XmlNode` of
|
|
272
|
+
* aapt2's Resources.proto.
|
|
273
|
+
*/
|
|
274
|
+
var parseProtoManifest = (bytes) => {
|
|
275
|
+
const [element] = bytesOf(readMessage(bytes), 1);
|
|
276
|
+
if (element === void 0) throw corrupt$1();
|
|
277
|
+
return protoElement(element);
|
|
278
|
+
};
|
|
279
|
+
var VERSION_CODE = 16843291;
|
|
280
|
+
var VERSION_NAME = 16843292;
|
|
281
|
+
var NAME = 16842755;
|
|
282
|
+
var VALUE = 16842788;
|
|
283
|
+
var RESOURCE = 16842789;
|
|
284
|
+
var SCHEME = 16842791;
|
|
285
|
+
var COMPONENTS = /* @__PURE__ */ new Set(["activity", "activity-alias"]);
|
|
286
|
+
var attributeOf = (element, resourceId, name) => element.attributes.find((attribute) => attribute.resourceId !== 0 ? attribute.resourceId === resourceId : attribute.name === name)?.value ?? null;
|
|
287
|
+
/** The values of a parsed manifest that import reads. */
|
|
288
|
+
var readAndroidManifest = (manifest) => {
|
|
289
|
+
if (manifest.name !== "manifest") throw corrupt$1();
|
|
290
|
+
const packageValue = manifest.attributes.find((attribute) => attribute.name === "package")?.value;
|
|
291
|
+
const versionCode = attributeOf(manifest, VERSION_CODE, "versionCode");
|
|
292
|
+
const application = manifest.children.find(({ name }) => name === "application");
|
|
293
|
+
const metaData = /* @__PURE__ */ new Map();
|
|
294
|
+
const launchers = [];
|
|
295
|
+
const urlSchemes = /* @__PURE__ */ new Map();
|
|
296
|
+
const componentMetaData = /* @__PURE__ */ new Map();
|
|
297
|
+
const metaDataOf = (element, into) => {
|
|
298
|
+
const name = attributeOf(element, NAME, "name");
|
|
299
|
+
const value = attributeOf(element, VALUE, "value") ?? attributeOf(element, RESOURCE, "resource");
|
|
300
|
+
if (name?.type === "string" && value !== null) into.set(name.value, value);
|
|
301
|
+
};
|
|
302
|
+
const stringAttribute = (element, id, name) => {
|
|
303
|
+
const value = attributeOf(element, id, name);
|
|
304
|
+
return value?.type === "string" ? value.value : null;
|
|
305
|
+
};
|
|
306
|
+
for (const element of application?.children ?? []) {
|
|
307
|
+
if (COMPONENTS.has(element.name)) {
|
|
308
|
+
const component = stringAttribute(element, NAME, "name");
|
|
309
|
+
if (component === null) continue;
|
|
310
|
+
for (const item of element.children) {
|
|
311
|
+
if (item.name !== "meta-data") continue;
|
|
312
|
+
const own = componentMetaData.get(component) ?? /* @__PURE__ */ new Map();
|
|
313
|
+
metaDataOf(item, own);
|
|
314
|
+
componentMetaData.set(component, own);
|
|
315
|
+
}
|
|
316
|
+
for (const filter of element.children) {
|
|
317
|
+
if (filter.name !== "intent-filter") continue;
|
|
318
|
+
const named = (child) => filter.children.filter(({ name }) => name === child).map((part) => stringAttribute(part, NAME, "name"));
|
|
319
|
+
if (named("action").includes("android.intent.action.MAIN") && named("category").includes("android.intent.category.LAUNCHER") && !launchers.includes(component)) launchers.push(component);
|
|
320
|
+
if (!named("action").includes("android.intent.action.VIEW")) continue;
|
|
321
|
+
for (const data of filter.children) {
|
|
322
|
+
if (data.name !== "data") continue;
|
|
323
|
+
const scheme = stringAttribute(data, SCHEME, "scheme");
|
|
324
|
+
if (scheme === null) continue;
|
|
325
|
+
urlSchemes.set(component, [...urlSchemes.get(component) ?? [], scheme]);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (element.name !== "meta-data") continue;
|
|
331
|
+
metaDataOf(element, metaData);
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
packageName: packageValue?.type === "string" ? packageValue.value : null,
|
|
335
|
+
versionName: attributeOf(manifest, VERSION_NAME, "versionName"),
|
|
336
|
+
versionCode: versionCode?.type === "int" ? versionCode.value : null,
|
|
337
|
+
metaData,
|
|
338
|
+
launchers,
|
|
339
|
+
urlSchemes,
|
|
340
|
+
componentMetaData
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
/** How deep a plist nests: an Info.plist nests a few levels. */
|
|
344
|
+
var MAX_DEPTH = 64;
|
|
345
|
+
var corrupt = () => new NativeArtifactError("UNREADABLE", "The app's Info.plist is corrupt.");
|
|
346
|
+
var view$2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
347
|
+
/** A big-endian unsigned integer of `size` bytes. */
|
|
348
|
+
var uintAt = (bytes, offset, size) => {
|
|
349
|
+
let value = 0;
|
|
350
|
+
for (let i = 0; i < size; i += 1) value = value * 256 + bytes[offset + i];
|
|
351
|
+
return value;
|
|
352
|
+
};
|
|
353
|
+
/** A binary property list (`bplist00`), as Xcode writes an app's Info.plist. */
|
|
354
|
+
var parseBinaryPlist = (bytes) => {
|
|
355
|
+
if (bytes.byteLength < 40) throw corrupt();
|
|
356
|
+
const trailer = bytes.byteLength - 32;
|
|
357
|
+
const offsetSize = bytes[trailer + 6];
|
|
358
|
+
const refSize = bytes[trailer + 7];
|
|
359
|
+
const objectCount = uintAt(bytes, trailer + 8, 8);
|
|
360
|
+
const top = uintAt(bytes, trailer + 16, 8);
|
|
361
|
+
const tableOffset = uintAt(bytes, trailer + 24, 8);
|
|
362
|
+
if (offsetSize < 1 || offsetSize > 8 || refSize < 1 || refSize > 8 || objectCount < 1 || top >= objectCount || tableOffset < 8 || tableOffset + objectCount * offsetSize > trailer) throw corrupt();
|
|
363
|
+
const data = view$2(bytes);
|
|
364
|
+
const seen = /* @__PURE__ */ new Set();
|
|
365
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
366
|
+
let budget = 2 * bytes.byteLength + 4096;
|
|
367
|
+
const spend = (units) => {
|
|
368
|
+
budget -= units;
|
|
369
|
+
if (budget < 0) throw corrupt();
|
|
370
|
+
};
|
|
371
|
+
const parse = (ref) => {
|
|
372
|
+
if (ref >= objectCount) throw corrupt();
|
|
373
|
+
const offset = uintAt(bytes, tableOffset + ref * offsetSize, offsetSize);
|
|
374
|
+
if (offset < 8 || offset >= tableOffset) throw corrupt();
|
|
375
|
+
const done = parsed.get(offset);
|
|
376
|
+
if (done !== void 0) return done;
|
|
377
|
+
if (seen.has(offset) || seen.size > MAX_DEPTH) throw corrupt();
|
|
378
|
+
const value = parseObject(offset);
|
|
379
|
+
parsed.set(offset, value);
|
|
380
|
+
return value;
|
|
381
|
+
};
|
|
382
|
+
const parseObject = (offset) => {
|
|
383
|
+
const marker = bytes[offset];
|
|
384
|
+
const kind = marker >> 4;
|
|
385
|
+
const info = marker & 15;
|
|
386
|
+
/** `count` units of `unit` bytes from `start`, which must fit the objects. */
|
|
387
|
+
const fits = (start, count, unit) => {
|
|
388
|
+
if (start + count * unit > tableOffset) throw corrupt();
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* A length in the marker, or in the integer object after it, and where
|
|
392
|
+
* its `unit`-byte items start, all of which must fit the objects.
|
|
393
|
+
*/
|
|
394
|
+
const lengthAt = (unit) => {
|
|
395
|
+
let length = info;
|
|
396
|
+
let start = offset + 1;
|
|
397
|
+
if (info === 15) {
|
|
398
|
+
const sizeMarker = bytes[offset + 1];
|
|
399
|
+
if (sizeMarker >> 4 !== 1 || (sizeMarker & 15) > 3) throw corrupt();
|
|
400
|
+
const size = 1 << (sizeMarker & 15);
|
|
401
|
+
fits(offset + 2, size, 1);
|
|
402
|
+
length = uintAt(bytes, offset + 2, size);
|
|
403
|
+
start = offset + 2 + size;
|
|
404
|
+
}
|
|
405
|
+
fits(start, length, unit);
|
|
406
|
+
spend(length + 1);
|
|
407
|
+
return [length, start];
|
|
408
|
+
};
|
|
409
|
+
switch (kind) {
|
|
410
|
+
case 0: return info === 9 ? true : info === 8 ? false : null;
|
|
411
|
+
case 1: {
|
|
412
|
+
if (info > 3) throw corrupt();
|
|
413
|
+
const size = 1 << info;
|
|
414
|
+
fits(offset + 1, size, 1);
|
|
415
|
+
return size === 8 ? Number(data.getBigInt64(offset + 1, false)) : uintAt(bytes, offset + 1, size);
|
|
416
|
+
}
|
|
417
|
+
case 2:
|
|
418
|
+
if (info !== 2 && info !== 3) throw corrupt();
|
|
419
|
+
fits(offset + 1, 1 << info, 1);
|
|
420
|
+
return info === 2 ? data.getFloat32(offset + 1, false) : data.getFloat64(offset + 1, false);
|
|
421
|
+
case 3:
|
|
422
|
+
fits(offset + 1, 8, 1);
|
|
423
|
+
return data.getFloat64(offset + 1, false);
|
|
424
|
+
case 4: {
|
|
425
|
+
const [length, start] = lengthAt(1);
|
|
426
|
+
return bytes.slice(start, start + length);
|
|
427
|
+
}
|
|
428
|
+
case 5: {
|
|
429
|
+
const [length, start] = lengthAt(1);
|
|
430
|
+
return new TextDecoder("latin1").decode(bytes.subarray(start, start + length));
|
|
431
|
+
}
|
|
432
|
+
case 6: {
|
|
433
|
+
const [length, start] = lengthAt(2);
|
|
434
|
+
let text = "";
|
|
435
|
+
for (let i = 0; i < length; i += 1) text += String.fromCharCode(data.getUint16(start + i * 2, false));
|
|
436
|
+
return text;
|
|
437
|
+
}
|
|
438
|
+
case 8:
|
|
439
|
+
if (info > 7) throw corrupt();
|
|
440
|
+
fits(offset + 1, info + 1, 1);
|
|
441
|
+
return uintAt(bytes, offset + 1, info + 1);
|
|
442
|
+
case 10:
|
|
443
|
+
case 12: {
|
|
444
|
+
const [length, start] = lengthAt(refSize);
|
|
445
|
+
seen.add(offset);
|
|
446
|
+
const items = [];
|
|
447
|
+
for (let i = 0; i < length; i += 1) items.push(parse(uintAt(bytes, start + i * refSize, refSize)));
|
|
448
|
+
seen.delete(offset);
|
|
449
|
+
return items;
|
|
450
|
+
}
|
|
451
|
+
case 13: {
|
|
452
|
+
const [length, start] = lengthAt(2 * refSize);
|
|
453
|
+
seen.add(offset);
|
|
454
|
+
const dict = Object.create(null);
|
|
455
|
+
for (let i = 0; i < length; i += 1) {
|
|
456
|
+
const key = parse(uintAt(bytes, start + i * refSize, refSize));
|
|
457
|
+
const value = parse(uintAt(bytes, start + (length + i) * refSize, refSize));
|
|
458
|
+
if (typeof key !== "string") throw corrupt();
|
|
459
|
+
dict[key] = value;
|
|
460
|
+
}
|
|
461
|
+
seen.delete(offset);
|
|
462
|
+
return dict;
|
|
463
|
+
}
|
|
464
|
+
default: throw corrupt();
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
return parse(top);
|
|
468
|
+
};
|
|
469
|
+
var ENTITIES = {
|
|
470
|
+
amp: "&",
|
|
471
|
+
lt: "<",
|
|
472
|
+
gt: ">",
|
|
473
|
+
quot: "\"",
|
|
474
|
+
apos: "'"
|
|
475
|
+
};
|
|
476
|
+
var decodeEntities = (text) => text.replace(/&(#x[0-9a-f]+|#\d+|\w+);/giu, (whole, entity) => {
|
|
477
|
+
if (entity[0] === "#") {
|
|
478
|
+
const code = entity[1] === "x" || entity[1] === "X" ? Number.parseInt(entity.slice(2), 16) : Number.parseInt(entity.slice(1), 10);
|
|
479
|
+
if (code > 1114111) throw corrupt();
|
|
480
|
+
return String.fromCodePoint(code);
|
|
481
|
+
}
|
|
482
|
+
return ENTITIES[entity] ?? whole;
|
|
483
|
+
});
|
|
484
|
+
/**
|
|
485
|
+
* `text` without each `open`, what follows it, and its `close`. A scan, because
|
|
486
|
+
* a regular expression retries from every `open` that never closes, which on a
|
|
487
|
+
* crafted file takes minutes.
|
|
488
|
+
*/
|
|
489
|
+
var withoutSpans = (text, open, close) => {
|
|
490
|
+
let kept = "";
|
|
491
|
+
let position = 0;
|
|
492
|
+
for (;;) {
|
|
493
|
+
const start = text.indexOf(open, position);
|
|
494
|
+
const end = start === -1 ? -1 : text.indexOf(close, start + open.length);
|
|
495
|
+
if (end === -1) return kept + text.slice(position);
|
|
496
|
+
kept += text.slice(position, start);
|
|
497
|
+
position = end + close.length;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
/** An XML property list, as a provisioning profile holds one. */
|
|
501
|
+
var parseXmlPlist = (text) => {
|
|
502
|
+
const tokens = withoutSpans(withoutSpans(text, "<!--", "-->"), "<?", "?>").replace(/<!DOCTYPE[^<>]*>/giu, "").split(/(<[^<>]+>)/u);
|
|
503
|
+
let i = 0;
|
|
504
|
+
const nextTag = () => {
|
|
505
|
+
while (i < tokens.length) {
|
|
506
|
+
const token = tokens[i++];
|
|
507
|
+
if (token.startsWith("<")) return token;
|
|
508
|
+
if (token.trim() !== "") throw corrupt();
|
|
509
|
+
}
|
|
510
|
+
throw corrupt();
|
|
511
|
+
};
|
|
512
|
+
const textUntil = (close) => {
|
|
513
|
+
let value = "";
|
|
514
|
+
while (i < tokens.length && tokens[i] !== close) value += tokens[i++];
|
|
515
|
+
if (tokens[i++] !== close) throw corrupt();
|
|
516
|
+
return decodeEntities(value);
|
|
517
|
+
};
|
|
518
|
+
let depth = 0;
|
|
519
|
+
const parseValue = (tag) => {
|
|
520
|
+
if (depth > MAX_DEPTH) throw corrupt();
|
|
521
|
+
const name = /^<\s*([\w]+)/u.exec(tag)?.[1];
|
|
522
|
+
const empty = tag.endsWith("/>");
|
|
523
|
+
switch (name) {
|
|
524
|
+
case "string": return empty ? "" : textUntil("</string>");
|
|
525
|
+
case "integer": return Number(textUntil("</integer>"));
|
|
526
|
+
case "real": return Number(textUntil("</real>"));
|
|
527
|
+
case "true": return true;
|
|
528
|
+
case "false": return false;
|
|
529
|
+
case "date": return textUntil("</date>");
|
|
530
|
+
case "data": return textUntil("</data>").replace(/\s+/gu, "");
|
|
531
|
+
case "array": {
|
|
532
|
+
const items = [];
|
|
533
|
+
if (empty) return items;
|
|
534
|
+
depth += 1;
|
|
535
|
+
for (let next = nextTag(); next !== "</array>"; next = nextTag()) items.push(parseValue(next));
|
|
536
|
+
depth -= 1;
|
|
537
|
+
return items;
|
|
538
|
+
}
|
|
539
|
+
case "dict": {
|
|
540
|
+
const dict = Object.create(null);
|
|
541
|
+
if (empty) return dict;
|
|
542
|
+
depth += 1;
|
|
543
|
+
for (let next = nextTag(); next !== "</dict>"; next = nextTag()) {
|
|
544
|
+
if (next !== "<key>") throw corrupt();
|
|
545
|
+
const key = textUntil("</key>");
|
|
546
|
+
dict[key] = parseValue(nextTag());
|
|
547
|
+
}
|
|
548
|
+
depth -= 1;
|
|
549
|
+
return dict;
|
|
550
|
+
}
|
|
551
|
+
default: throw corrupt();
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
let tag = nextTag();
|
|
555
|
+
if (/^<plist\b/u.test(tag)) tag = nextTag();
|
|
556
|
+
return parseValue(tag);
|
|
557
|
+
};
|
|
558
|
+
/** A property list, binary or XML, as a JavaScript value. */
|
|
559
|
+
var parsePlist = (bytes) => {
|
|
560
|
+
if (new TextDecoder().decode(bytes.subarray(0, 8)) === "bplist00") return parseBinaryPlist(bytes);
|
|
561
|
+
return parseXmlPlist(new TextDecoder().decode(bytes));
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* What a sandbox build is, wherever it is built or read: `sandbox: true` on a
|
|
565
|
+
* `nativeBuild` scheme adds a native layer to the app, which a normal build
|
|
566
|
+
* never compiles.
|
|
567
|
+
*/
|
|
568
|
+
/**
|
|
569
|
+
* The literal the sandbox layer's code holds, in `ios/HotUpdater/Sandbox` and
|
|
570
|
+
* `android/src/sandbox`: reading an artifact's strings finds it. Its length
|
|
571
|
+
* is its own among the lengths those reads keep.
|
|
572
|
+
*/
|
|
573
|
+
var SANDBOX_CODE_MARKER = "HOT_UPDATER_SANDBOX_NATIVE_LAYER";
|
|
574
|
+
/** The Info.plist key an iOS sandbox build declares itself with. */
|
|
575
|
+
var SANDBOX_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX";
|
|
576
|
+
/**
|
|
577
|
+
* The Info.plist key that records the URL scheme an iOS sandbox build
|
|
578
|
+
* registers in its `SANDBOX_URL_TYPE_NAME` URL type: the build reads its own
|
|
579
|
+
* scheme from it, and a later patch knows which scheme is the sandbox's.
|
|
580
|
+
*/
|
|
581
|
+
var SANDBOX_URL_SCHEME_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX_URL_SCHEME";
|
|
582
|
+
var URL_SCHEME_SYNTAX = /^[a-z][a-z0-9+.-]*$/;
|
|
583
|
+
/**
|
|
584
|
+
* Whether a value is a URL scheme in lower-case ASCII, as written: what a
|
|
585
|
+
* build records, read before any lower-casing.
|
|
586
|
+
*/
|
|
587
|
+
var isRecordedUrlSchemeSyntax = (value) => typeof value === "string" && URL_SCHEME_SYNTAX.test(value);
|
|
588
|
+
/**
|
|
589
|
+
* The URL scheme an iOS sandbox build registers, by one rule its patch, its
|
|
590
|
+
* reader, and its own code apply alike. `recorded` is the Info.plist's
|
|
591
|
+
* `SANDBOX_URL_SCHEME_INFO_PLIST_KEY`, undefined when the key is absent, and
|
|
592
|
+
* `namedTypes` its URL types named `SANDBOX_URL_TYPE_NAME`.
|
|
593
|
+
* - Absent: a prerelease's build, which recorded none. Undefined: the caller
|
|
594
|
+
* reads it the way that build was read.
|
|
595
|
+
* - Present: a scheme in lower-case ASCII, as written, that the one URL type
|
|
596
|
+
* of the name holds alone. Anything else is null, with no fallback.
|
|
597
|
+
*/
|
|
598
|
+
var recordedSandboxUrlScheme = (recorded, namedTypes) => {
|
|
599
|
+
if (recorded === void 0) return void 0;
|
|
600
|
+
if (!isRecordedUrlSchemeSyntax(recorded) || namedTypes.length !== 1) return null;
|
|
601
|
+
const schemes = namedTypes[0]?.CFBundleURLSchemes;
|
|
602
|
+
return Array.isArray(schemes) && schemes.length === 1 && schemes[0] === recorded ? recorded : null;
|
|
603
|
+
};
|
|
604
|
+
/** The `<meta-data>` an Android sandbox build declares itself with. */
|
|
605
|
+
var SANDBOX_META_DATA = "com.hotupdater.SANDBOX";
|
|
606
|
+
/** The activity that takes an Android sandbox build's launcher entry and links. */
|
|
607
|
+
var SANDBOX_ACTIVITY = "com.hotupdater.HotUpdaterSandboxActivity";
|
|
608
|
+
/** The `applicationIdSuffix` an Android sandbox build appends. */
|
|
609
|
+
var SANDBOX_APPLICATION_ID_SUFFIX = ".sandbox";
|
|
610
|
+
/**
|
|
611
|
+
* The `CFBundleURLName` of the URL type an iOS sandbox build registers its URL
|
|
612
|
+
* scheme with, which the build reads its own scheme from.
|
|
613
|
+
*/
|
|
614
|
+
var SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
|
|
615
|
+
/**
|
|
616
|
+
* The `<meta-data>` of `SANDBOX_ACTIVITY` that names the URL scheme an Android
|
|
617
|
+
* sandbox build registers, which the build reads its own scheme from.
|
|
618
|
+
*/
|
|
619
|
+
var SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
|
|
620
|
+
var SANDBOX_URL_SCHEME_PREFIX = "hu-sandbox-";
|
|
621
|
+
/**
|
|
622
|
+
* The URL scheme a sandbox build registers when its scheme sets none, derived
|
|
623
|
+
* from the app's ID: the app's own scheme would ask which app to open beside
|
|
624
|
+
* the store app.
|
|
625
|
+
*/
|
|
626
|
+
var sandboxUrlSchemeOf = (appId) => `${SANDBOX_URL_SCHEME_PREFIX}${appId.toLowerCase().replace(/[^a-z0-9]+/gu, "-")}`;
|
|
627
|
+
/**
|
|
628
|
+
* Whether a URL scheme has the prefix of the derived one: how an artifact built
|
|
629
|
+
* before the URL scheme could be set is read, which registered no other.
|
|
630
|
+
*/
|
|
631
|
+
var isSandboxUrlScheme = (scheme) => scheme.toLowerCase().startsWith(SANDBOX_URL_SCHEME_PREFIX);
|
|
632
|
+
var CONFIGURED_URL_SCHEME = /^[a-z][a-z0-9+.-]{0,63}$/u;
|
|
633
|
+
var RESERVED_URL_SCHEMES = /* @__PURE__ */ new Set([
|
|
634
|
+
"http",
|
|
635
|
+
"https",
|
|
636
|
+
"file",
|
|
637
|
+
"data",
|
|
638
|
+
"javascript",
|
|
639
|
+
"true",
|
|
640
|
+
"false"
|
|
641
|
+
]);
|
|
642
|
+
/**
|
|
643
|
+
* Whether `sandbox: { urlScheme }` can name a URL scheme: lower case, a letter
|
|
644
|
+
* then up to 63 letters, digits, `+`, `.` or `-`, none the system or a browser
|
|
645
|
+
* owns, and neither `true` nor `false`, which Android's manifest can't hold as
|
|
646
|
+
* a string.
|
|
647
|
+
*/
|
|
648
|
+
var isConfigurableSandboxUrlScheme = (urlScheme) => CONFIGURED_URL_SCHEME.test(urlScheme) && !RESERVED_URL_SCHEMES.has(urlScheme);
|
|
649
|
+
/**
|
|
650
|
+
* The link a preview QR holds. `urlScheme` is the one the sandbox build
|
|
651
|
+
* registered; without it, the one derived from `appId`, the scheme's
|
|
652
|
+
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
653
|
+
* `.sandbox` suffix.
|
|
654
|
+
*/
|
|
655
|
+
var createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash, platform }) => {
|
|
656
|
+
assertCanonicalChannelName(channel);
|
|
657
|
+
if (platform !== void 0 && !PREVIEW_LINK_PLATFORMS.has(platform)) throw new Error(`A preview link's platform is ios or android, not ${platform}.`);
|
|
658
|
+
const link = `${(urlScheme ?? sandboxUrlSchemeOf(appId)).toLowerCase()}://hot-updater/preview?channel=${encodeURIComponent(channel)}&fingerprint=${encodeURIComponent(fingerprintHash)}`;
|
|
659
|
+
return platform === void 0 ? link : `${link}&platform=${platform}`;
|
|
660
|
+
};
|
|
661
|
+
/** Any URL scheme: which app's it is, the app that opens the link decides. */
|
|
662
|
+
var PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu;
|
|
663
|
+
/**
|
|
664
|
+
* A URL scheme in ASCII alone: case folding lets `/iu` match `K` (Kelvin) or
|
|
665
|
+
* `ſ` as a letter.
|
|
666
|
+
*/
|
|
667
|
+
var ASCII_URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/;
|
|
668
|
+
var MAX_FINGERPRINT_LENGTH = 256;
|
|
669
|
+
var PREVIEW_LINK_PLATFORMS = /* @__PURE__ */ new Set(["ios", "android"]);
|
|
670
|
+
/**
|
|
671
|
+
* What a preview link says, or null for anything else: another shape, a
|
|
672
|
+
* repeated or missing parameter, or a channel no release can target. It takes
|
|
673
|
+
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
674
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
675
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
676
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
677
|
+
*/
|
|
678
|
+
var parsePreviewLink = (link) => {
|
|
679
|
+
const match = PREVIEW_LINK.exec(link);
|
|
680
|
+
if (match === null || !ASCII_URL_SCHEME.test(match[1])) return null;
|
|
681
|
+
const parameters = /* @__PURE__ */ new Map();
|
|
682
|
+
for (const parameter of match[2].split("&")) {
|
|
683
|
+
const separator = parameter.indexOf("=");
|
|
684
|
+
if (separator === -1) return null;
|
|
685
|
+
const name = parameter.slice(0, separator);
|
|
686
|
+
if (parameters.has(name)) return null;
|
|
687
|
+
let value;
|
|
688
|
+
try {
|
|
689
|
+
value = decodeURIComponent(parameter.slice(separator + 1));
|
|
690
|
+
} catch {
|
|
691
|
+
return null;
|
|
692
|
+
}
|
|
693
|
+
parameters.set(name, value);
|
|
694
|
+
}
|
|
695
|
+
const channel = parameters.get("channel");
|
|
696
|
+
const fingerprintHash = parameters.get("fingerprint");
|
|
697
|
+
if (channel === void 0 || fingerprintHash === void 0 || fingerprintHash.length === 0 || fingerprintHash.length > MAX_FINGERPRINT_LENGTH) return null;
|
|
698
|
+
try {
|
|
699
|
+
assertCanonicalChannelName(channel);
|
|
700
|
+
} catch {
|
|
701
|
+
return null;
|
|
702
|
+
}
|
|
703
|
+
const platform = parameters.get("platform");
|
|
704
|
+
return {
|
|
705
|
+
urlScheme: match[1].toLowerCase(),
|
|
706
|
+
channel,
|
|
707
|
+
fingerprintHash,
|
|
708
|
+
...platform !== void 0 && PREVIEW_LINK_PLATFORMS.has(platform) ? { platform } : {}
|
|
709
|
+
};
|
|
710
|
+
};
|
|
711
|
+
var view$1 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
712
|
+
/** Bytes that are all ASCII, as text; null otherwise. */
|
|
713
|
+
var asciiOf = (bytes) => {
|
|
714
|
+
let text = "";
|
|
715
|
+
for (const byte of bytes) {
|
|
716
|
+
if (byte === 0 || byte >= 128) return null;
|
|
717
|
+
text += String.fromCharCode(byte);
|
|
718
|
+
}
|
|
719
|
+
return text;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* The string constants of a dex file with one of `lengths`, from its string
|
|
723
|
+
* pool: every string literal the app's code holds, each one whole. R8
|
|
724
|
+
* renames and inlines classes, but never drops a literal the code returns,
|
|
725
|
+
* so the pool still holds a value the native SDK compiled in.
|
|
726
|
+
*/
|
|
727
|
+
var readDexStrings = (dex, lengths) => {
|
|
728
|
+
const data = view$1(dex);
|
|
729
|
+
if (dex.byteLength < 112 || asciiOf(dex.subarray(0, 3)) !== "dex" || dex[3] !== 10) throw new NativeArtifactError("UNREADABLE", "A dex file is corrupt.");
|
|
730
|
+
const count = data.getUint32(56, true);
|
|
731
|
+
const idsOffset = data.getUint32(60, true);
|
|
732
|
+
if (idsOffset + count * 4 > dex.byteLength) throw new NativeArtifactError("UNREADABLE", "A dex file is corrupt.");
|
|
733
|
+
const strings = [];
|
|
734
|
+
const read = /* @__PURE__ */ new Set();
|
|
735
|
+
for (let i = 0; i < count; i += 1) {
|
|
736
|
+
let offset = data.getUint32(idsOffset + i * 4, true);
|
|
737
|
+
if (read.has(offset)) continue;
|
|
738
|
+
read.add(offset);
|
|
739
|
+
let utf16Length = 0;
|
|
740
|
+
for (let shift = 0; offset < dex.byteLength; shift += 7) {
|
|
741
|
+
const byte = dex[offset++];
|
|
742
|
+
utf16Length |= (byte & 127) << shift;
|
|
743
|
+
if ((byte & 128) === 0 || shift > 28) break;
|
|
744
|
+
}
|
|
745
|
+
if (!lengths.has(utf16Length)) continue;
|
|
746
|
+
const end = offset + utf16Length;
|
|
747
|
+
if (end >= dex.byteLength || dex[end] !== 0) continue;
|
|
748
|
+
const text = asciiOf(dex.subarray(offset, end));
|
|
749
|
+
if (text !== null) strings.push(text);
|
|
750
|
+
}
|
|
751
|
+
return strings;
|
|
752
|
+
};
|
|
753
|
+
var MH_MAGIC = 4277009102;
|
|
754
|
+
var MH_MAGIC_64 = 4277009103;
|
|
755
|
+
var FAT_MAGIC = 3405691582;
|
|
756
|
+
var FAT_MAGIC_64 = 3405691583;
|
|
757
|
+
var LC_SEGMENT = 1;
|
|
758
|
+
var LC_SEGMENT_64 = 25;
|
|
759
|
+
var CPU_TYPE_ARM64 = 16777228;
|
|
760
|
+
var nameAt = (bytes, offset) => {
|
|
761
|
+
let name = "";
|
|
762
|
+
for (let i = offset; i < offset + 16 && bytes[i] !== 0; i += 1) name += String.fromCharCode(bytes[i]);
|
|
763
|
+
return name;
|
|
764
|
+
};
|
|
765
|
+
/** The slice of a universal binary to read: arm64's, else the first. */
|
|
766
|
+
var sliceOf = async (read) => {
|
|
767
|
+
const head = await read(0, 4096);
|
|
768
|
+
if (head.byteLength < 8) return null;
|
|
769
|
+
const data = view$1(head);
|
|
770
|
+
const magic = data.getUint32(0, false);
|
|
771
|
+
if (magic !== FAT_MAGIC && magic !== FAT_MAGIC_64) return 0;
|
|
772
|
+
const count = data.getUint32(4, false);
|
|
773
|
+
const size = magic === FAT_MAGIC ? 20 : 32;
|
|
774
|
+
let first = null;
|
|
775
|
+
for (let i = 0; i < count && 8 + (i + 1) * size <= head.byteLength; i += 1) {
|
|
776
|
+
const at = 8 + i * size;
|
|
777
|
+
const offset = magic === FAT_MAGIC ? data.getUint32(at + 8, false) : Number(data.getBigUint64(at + 8, false));
|
|
778
|
+
if (data.getUint32(at, false) === CPU_TYPE_ARM64) return offset;
|
|
779
|
+
first ??= offset;
|
|
780
|
+
}
|
|
781
|
+
return first;
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* The C string literals of a Mach-O binary with one of `lengths`, from its
|
|
785
|
+
* `__TEXT,__cstring` section, each one whole: the literals an Objective-C or
|
|
786
|
+
* Swift source compiled in. A universal binary is read by its arm64 slice.
|
|
787
|
+
* A file that is no Mach-O binary holds none.
|
|
788
|
+
*/
|
|
789
|
+
var readMachOStrings = async (read, lengths) => {
|
|
790
|
+
const base = await sliceOf(read);
|
|
791
|
+
if (base === null) return [];
|
|
792
|
+
const header = await read(base, base + 32);
|
|
793
|
+
if (header.byteLength < 28) return [];
|
|
794
|
+
const data = view$1(header);
|
|
795
|
+
const magic = data.getUint32(0, true);
|
|
796
|
+
if (magic !== MH_MAGIC && magic !== MH_MAGIC_64) return [];
|
|
797
|
+
const is64 = magic === MH_MAGIC_64;
|
|
798
|
+
const headerSize = is64 ? 32 : 28;
|
|
799
|
+
const commandCount = data.getUint32(16, true);
|
|
800
|
+
const commandsSize = data.getUint32(20, true);
|
|
801
|
+
const commands = await read(base + headerSize, base + headerSize + commandsSize);
|
|
802
|
+
const cmds = view$1(commands);
|
|
803
|
+
let section = null;
|
|
804
|
+
for (let i = 0, at = 0; i < commandCount && at + 8 <= commands.byteLength && section === null; i += 1) {
|
|
805
|
+
const cmd = cmds.getUint32(at, true);
|
|
806
|
+
const cmdSize = cmds.getUint32(at + 4, true);
|
|
807
|
+
if (cmdSize < 8) break;
|
|
808
|
+
if ((cmd === LC_SEGMENT_64 || cmd === LC_SEGMENT) && nameAt(commands, at + 8) === "__TEXT") {
|
|
809
|
+
const sectionCount = cmds.getUint32(at + (is64 ? 64 : 48), true);
|
|
810
|
+
const first = at + (is64 ? 72 : 56);
|
|
811
|
+
const sectionSize = is64 ? 80 : 68;
|
|
812
|
+
for (let s = 0; s < sectionCount; s += 1) {
|
|
813
|
+
const sec = first + s * sectionSize;
|
|
814
|
+
if (sec + sectionSize > commands.byteLength) break;
|
|
815
|
+
if (nameAt(commands, sec) !== "__cstring") continue;
|
|
816
|
+
section = is64 ? {
|
|
817
|
+
size: Number(cmds.getBigUint64(sec + 40, true)),
|
|
818
|
+
offset: cmds.getUint32(sec + 48, true)
|
|
819
|
+
} : {
|
|
820
|
+
size: cmds.getUint32(sec + 36, true),
|
|
821
|
+
offset: cmds.getUint32(sec + 40, true)
|
|
822
|
+
};
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
at += cmdSize;
|
|
827
|
+
}
|
|
828
|
+
if (section === null || section.size === 0) return [];
|
|
829
|
+
const cstrings = await read(base + section.offset, base + section.offset + section.size);
|
|
830
|
+
const strings = [];
|
|
831
|
+
for (let start = 0; start < cstrings.byteLength;) {
|
|
832
|
+
let end = cstrings.indexOf(0, start);
|
|
833
|
+
if (end === -1) end = cstrings.byteLength;
|
|
834
|
+
if (lengths.has(end - start)) {
|
|
835
|
+
const text = asciiOf(cstrings.subarray(start, end));
|
|
836
|
+
if (text !== null) strings.push(text);
|
|
837
|
+
}
|
|
838
|
+
start = end + 1;
|
|
839
|
+
}
|
|
840
|
+
return strings;
|
|
841
|
+
};
|
|
842
|
+
var EOCD_SIGNATURE = 101010256;
|
|
843
|
+
var ZIP64_EOCD_LOCATOR_SIGNATURE = 117853008;
|
|
844
|
+
var ZIP64_EOCD_SIGNATURE = 101075792;
|
|
845
|
+
var CENTRAL_HEADER_SIGNATURE = 33639248;
|
|
846
|
+
var LOCAL_HEADER_SIGNATURE = 67324752;
|
|
847
|
+
var ZIP64_EXTRA_ID = 1;
|
|
848
|
+
var UINT32_MAX = 4294967295;
|
|
849
|
+
/** The end-of-central-directory record and the longest comment after it. */
|
|
850
|
+
var EOCD_SEARCH_LENGTH = 65557;
|
|
851
|
+
/** How much compressed data one read takes. */
|
|
852
|
+
var READ_CHUNK = 1048576;
|
|
853
|
+
var MiB$2 = 1048576;
|
|
854
|
+
/**
|
|
855
|
+
* What an archive may hold before it is refused as no artifact: an upload is
|
|
856
|
+
* untrusted, so a crafted directory or entry (a zip bomb) stops here, not
|
|
857
|
+
* after filling memory.
|
|
858
|
+
*/
|
|
859
|
+
var ZIP_LIMITS = {
|
|
860
|
+
directoryBytes: 64 * MiB$2,
|
|
861
|
+
entries: 5e5,
|
|
862
|
+
entryBytes: 1024 * MiB$2
|
|
863
|
+
};
|
|
864
|
+
var UNIX_HOST = 3;
|
|
865
|
+
var S_IFMT = 61440;
|
|
866
|
+
var S_IFLNK = 40960;
|
|
867
|
+
var view = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
868
|
+
var notZip = () => new NativeArtifactError("UNREADABLE", "The file is not a zip archive, as an .ipa, .aab or .apk is.");
|
|
869
|
+
var u64 = (data, offset) => Number(data.getBigUint64(offset, true));
|
|
870
|
+
/** The central directory's offset and size, from its end record (ZIP64 too). */
|
|
871
|
+
var centralDirectoryOf = async (source) => {
|
|
872
|
+
const start = Math.max(0, source.size - EOCD_SEARCH_LENGTH);
|
|
873
|
+
const tail = await source.read(start, source.size - start);
|
|
874
|
+
const data = view(tail);
|
|
875
|
+
for (let i = tail.length - 22; i >= 0; i -= 1) {
|
|
876
|
+
if (data.getUint32(i, true) !== EOCD_SIGNATURE) continue;
|
|
877
|
+
let size = data.getUint32(i + 12, true);
|
|
878
|
+
let offset = data.getUint32(i + 16, true);
|
|
879
|
+
if (offset === UINT32_MAX || size === UINT32_MAX) {
|
|
880
|
+
const locator = i - 20;
|
|
881
|
+
if (locator < 0 || data.getUint32(locator, true) !== ZIP64_EOCD_LOCATOR_SIGNATURE) throw notZip();
|
|
882
|
+
const record = view(await source.read(u64(data, locator + 8), 56));
|
|
883
|
+
if (record.byteLength < 56 || record.getUint32(0, true) !== ZIP64_EOCD_SIGNATURE) throw notZip();
|
|
884
|
+
size = u64(record, 40);
|
|
885
|
+
offset = u64(record, 48);
|
|
886
|
+
}
|
|
887
|
+
if (offset + size > source.size) throw notZip();
|
|
888
|
+
return {
|
|
889
|
+
offset,
|
|
890
|
+
size
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
throw notZip();
|
|
894
|
+
};
|
|
895
|
+
/** Every entry of a zip archive, reading only its central directory. */
|
|
896
|
+
var readZipDirectory = async (source) => {
|
|
897
|
+
const { offset, size } = await centralDirectoryOf(source);
|
|
898
|
+
if (size > ZIP_LIMITS.directoryBytes) throw new NativeArtifactError("UNREADABLE", "The archive's directory is larger than any artifact's.");
|
|
899
|
+
const directory = await source.read(offset, size);
|
|
900
|
+
const data = view(directory);
|
|
901
|
+
const decoder = new TextDecoder();
|
|
902
|
+
const entries = [];
|
|
903
|
+
for (let i = 0; i + 46 <= directory.length;) {
|
|
904
|
+
if (data.getUint32(i, true) !== CENTRAL_HEADER_SIGNATURE) break;
|
|
905
|
+
if (entries.length >= ZIP_LIMITS.entries) throw new NativeArtifactError("UNREADABLE", "The archive holds more entries than any artifact.");
|
|
906
|
+
const madeBy = data.getUint16(i + 4, true);
|
|
907
|
+
const externalAttributes = data.getUint32(i + 38, true);
|
|
908
|
+
const method = data.getUint16(i + 10, true);
|
|
909
|
+
let compressedSize = data.getUint32(i + 20, true);
|
|
910
|
+
let uncompressedSize = data.getUint32(i + 24, true);
|
|
911
|
+
const nameLength = data.getUint16(i + 28, true);
|
|
912
|
+
const extraLength = data.getUint16(i + 30, true);
|
|
913
|
+
const commentLength = data.getUint16(i + 32, true);
|
|
914
|
+
let localHeaderOffset = data.getUint32(i + 42, true);
|
|
915
|
+
const nameStart = i + 46;
|
|
916
|
+
const name = decoder.decode(directory.subarray(nameStart, nameStart + nameLength));
|
|
917
|
+
const extraStart = nameStart + nameLength;
|
|
918
|
+
for (let j = extraStart; j + 4 <= extraStart + extraLength;) {
|
|
919
|
+
const id = data.getUint16(j, true);
|
|
920
|
+
const length = data.getUint16(j + 2, true);
|
|
921
|
+
if (id === ZIP64_EXTRA_ID) {
|
|
922
|
+
let k = j + 4;
|
|
923
|
+
if (uncompressedSize === UINT32_MAX) {
|
|
924
|
+
uncompressedSize = u64(data, k);
|
|
925
|
+
k += 8;
|
|
926
|
+
}
|
|
927
|
+
if (compressedSize === UINT32_MAX) {
|
|
928
|
+
compressedSize = u64(data, k);
|
|
929
|
+
k += 8;
|
|
930
|
+
}
|
|
931
|
+
if (localHeaderOffset === UINT32_MAX) localHeaderOffset = u64(data, k);
|
|
932
|
+
}
|
|
933
|
+
j += 4 + length;
|
|
934
|
+
}
|
|
935
|
+
const segments = name.split("/");
|
|
936
|
+
entries.push({
|
|
937
|
+
name,
|
|
938
|
+
unsafe: name.startsWith("/") || /^[A-Za-z]:/u.test(name) || name.includes("\\") || name.includes("\0") || segments.includes(".."),
|
|
939
|
+
symlink: madeBy >> 8 === UNIX_HOST && (externalAttributes >>> 16 & S_IFMT) === S_IFLNK,
|
|
940
|
+
method,
|
|
941
|
+
compressedSize,
|
|
942
|
+
uncompressedSize,
|
|
943
|
+
localHeaderOffset
|
|
944
|
+
});
|
|
945
|
+
i = extraStart + extraLength + commentLength;
|
|
946
|
+
}
|
|
947
|
+
return entries;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* The one entry an artifact's reader takes by `name`: a symbolic link, or a
|
|
951
|
+
* name the archive holds twice, which could hand the reader other bytes
|
|
952
|
+
* than an installer reads, is refused. Unsafe names match nothing.
|
|
953
|
+
*/
|
|
954
|
+
var findZipEntry = (entries, match) => {
|
|
955
|
+
const test = typeof match === "string" ? (name) => name === match : match;
|
|
956
|
+
const found = entries.filter(({ name, unsafe }) => !unsafe && test(name));
|
|
957
|
+
for (const entry of found) assertReadable(entry);
|
|
958
|
+
if (typeof match === "string" && found.length > 1) throw new NativeArtifactError("UNREADABLE", `The archive holds ${match} more than once.`);
|
|
959
|
+
return found[0];
|
|
960
|
+
};
|
|
961
|
+
/** Every safe entry `match` takes, each a file the reader may read. */
|
|
962
|
+
var filterZipEntries = (entries, match) => {
|
|
963
|
+
const found = entries.filter(({ name, unsafe }) => !unsafe && match(name));
|
|
964
|
+
for (const entry of found) assertReadable(entry);
|
|
965
|
+
return found;
|
|
966
|
+
};
|
|
967
|
+
var assertReadable = (entry) => {
|
|
968
|
+
if (entry.symlink) throw new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is a symbolic link, not a file.`);
|
|
969
|
+
};
|
|
970
|
+
var tooLarge = (entry, limit) => new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is larger than ${Math.round(limit / MiB$2)} MB, more than any artifact's.`);
|
|
971
|
+
/** Where an entry's data starts, past its local header. */
|
|
972
|
+
var dataOffsetOf = async (source, entry) => {
|
|
973
|
+
const local = view(await source.read(entry.localHeaderOffset, 30));
|
|
974
|
+
if (local.byteLength < 30 || local.getUint32(0, true) !== LOCAL_HEADER_SIGNATURE) throw new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is corrupt.`);
|
|
975
|
+
return entry.localHeaderOffset + 30 + local.getUint16(26, true) + local.getUint16(28, true);
|
|
976
|
+
};
|
|
977
|
+
/**
|
|
978
|
+
* An entry's uncompressed bytes as a stream, read from the source a chunk at
|
|
979
|
+
* a time, so a large entry is never held whole.
|
|
980
|
+
*/
|
|
981
|
+
var openZipEntry = async (source, entry, { maxBytes = ZIP_LIMITS.entryBytes } = {}) => {
|
|
982
|
+
assertReadable(entry);
|
|
983
|
+
if (entry.unsafe) throw new NativeArtifactError("UNREADABLE", `The archive's entry ${JSON.stringify(entry.name)} has a name no artifact holds.`);
|
|
984
|
+
if (entry.uncompressedSize > maxBytes) throw tooLarge(entry, maxBytes);
|
|
985
|
+
if (entry.method !== 0 && entry.method !== 8) throw new NativeArtifactError("UNREADABLE", `The archive stores ${entry.name} with an unsupported compression method (${entry.method}).`);
|
|
986
|
+
const start = await dataOffsetOf(source, entry);
|
|
987
|
+
const end = start + entry.compressedSize;
|
|
988
|
+
let position = start;
|
|
989
|
+
const compressed = new ReadableStream({ async pull(controller) {
|
|
990
|
+
if (position >= end) {
|
|
991
|
+
controller.close();
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
const chunk = await source.read(position, Math.min(READ_CHUNK, end - position));
|
|
995
|
+
if (chunk.byteLength === 0) {
|
|
996
|
+
controller.error(new NativeArtifactError("UNREADABLE", `The archive ends inside ${entry.name}.`));
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
position += chunk.byteLength;
|
|
1000
|
+
controller.enqueue(chunk);
|
|
1001
|
+
} });
|
|
1002
|
+
const inflated = entry.method === 0 ? compressed : compressed.pipeThrough(new DecompressionStream("deflate-raw"));
|
|
1003
|
+
const limit = Math.min(entry.uncompressedSize, maxBytes);
|
|
1004
|
+
let produced = 0;
|
|
1005
|
+
return inflated.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
1006
|
+
produced += chunk.byteLength;
|
|
1007
|
+
if (produced > limit) {
|
|
1008
|
+
controller.error(new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} inflates past the size it declares.`));
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
controller.enqueue(chunk);
|
|
1012
|
+
} }));
|
|
1013
|
+
};
|
|
1014
|
+
/**
|
|
1015
|
+
* The uncompressed bytes in `[start, end)` of an entry, which stops
|
|
1016
|
+
* inflating once it has them: a Mach-O header without the rest of the
|
|
1017
|
+
* binary.
|
|
1018
|
+
*/
|
|
1019
|
+
var readZipEntryRange = async (source, entry, start, end, budget) => {
|
|
1020
|
+
const length = Math.max(0, Math.min(end, entry.uncompressedSize) - start);
|
|
1021
|
+
if (budget !== void 0 && start + length > budget.remaining) throw new NativeArtifactError("UNREADABLE", "The artifact inflates to more than any artifact's.");
|
|
1022
|
+
const out = new Uint8Array(length);
|
|
1023
|
+
if (length === 0) return out;
|
|
1024
|
+
const reader = (await openZipEntry(source, entry)).getReader();
|
|
1025
|
+
let position = 0;
|
|
1026
|
+
let written = 0;
|
|
1027
|
+
try {
|
|
1028
|
+
while (written < length) {
|
|
1029
|
+
if (budget !== void 0 && Date.now() > budget.deadline) throw new NativeArtifactError("UNREADABLE", "Reading the artifact took too long.");
|
|
1030
|
+
const { done, value } = await reader.read();
|
|
1031
|
+
if (done) break;
|
|
1032
|
+
if (budget !== void 0) budget.remaining -= value.byteLength;
|
|
1033
|
+
const from = Math.max(start - position, 0);
|
|
1034
|
+
const to = Math.min(start + length - position, value.byteLength);
|
|
1035
|
+
if (from < to) {
|
|
1036
|
+
out.set(value.subarray(from, to), position + from - start);
|
|
1037
|
+
written += to - from;
|
|
1038
|
+
}
|
|
1039
|
+
position += value.byteLength;
|
|
1040
|
+
}
|
|
1041
|
+
} catch (error) {
|
|
1042
|
+
throw error instanceof NativeArtifactError ? error : new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} can't be decompressed: ${error instanceof Error ? error.message : String(error)}.`);
|
|
1043
|
+
} finally {
|
|
1044
|
+
await reader.cancel().catch(() => {});
|
|
1045
|
+
}
|
|
1046
|
+
return written === length ? out : out.subarray(0, written);
|
|
1047
|
+
};
|
|
1048
|
+
/** An entry's uncompressed bytes, refused past `maxBytes`. */
|
|
1049
|
+
var readZipEntry = (source, entry, maxBytes, budget) => {
|
|
1050
|
+
if (entry.uncompressedSize > maxBytes) throw tooLarge(entry, maxBytes);
|
|
1051
|
+
return readZipEntryRange(source, entry, 0, entry.uncompressedSize, budget);
|
|
1052
|
+
};
|
|
1053
|
+
var MiB$1 = 1048576;
|
|
1054
|
+
/** The most a manifest or an Info.plist holds. */
|
|
1055
|
+
var METADATA_BYTES$1 = 16 * MiB$1;
|
|
1056
|
+
/** The most one dex file holds. */
|
|
1057
|
+
var DEX_BYTES = 256 * MiB$1;
|
|
1058
|
+
/** The most reading one artifact inflates, across every entry it reads. */
|
|
1059
|
+
var READ_BUDGET_BYTES$1 = 2048 * MiB$1;
|
|
1060
|
+
/** How long reading one artifact may take. */
|
|
1061
|
+
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
1062
|
+
/** Where each kind of artifact packs its built-in bundle. */
|
|
1063
|
+
var builtInBundlePathOf = (kind, appDirectory = kind === "app" ? "<App>.app/" : "Payload/<App>.app/") => kind === "aab" ? "base/assets/index.android.bundle" : kind === "apk" ? "assets/index.android.bundle" : `${appDirectory}main.jsbundle`;
|
|
1064
|
+
/** The kind of artifact a file name names, or null. */
|
|
1065
|
+
var nativeArtifactKindOf = (fileName) => {
|
|
1066
|
+
if (/\.app\.zip$/iu.test(fileName)) return "app";
|
|
1067
|
+
const extension = /\.([^./\\]+)$/u.exec(fileName)?.[1]?.toLowerCase();
|
|
1068
|
+
return extension === "ipa" || extension === "aab" || extension === "apk" ? extension : null;
|
|
1069
|
+
};
|
|
1070
|
+
var UUID_LENGTH = 36;
|
|
1071
|
+
var SHA256_HEX = /^[0-9a-f]{64}$/u;
|
|
1072
|
+
var LENGTHS = /* @__PURE__ */ new Set([
|
|
1073
|
+
UUID_LENGTH,
|
|
1074
|
+
64,
|
|
1075
|
+
32
|
|
1076
|
+
]);
|
|
1077
|
+
var unique = (values) => [...new Set(values)].sort();
|
|
1078
|
+
var candidatesOf = (strings) => {
|
|
1079
|
+
const all = [...strings];
|
|
1080
|
+
return {
|
|
1081
|
+
minBundleIds: unique(all.filter(isUUIDv7)),
|
|
1082
|
+
fingerprints: unique(all.filter((value) => SHA256_HEX.test(value)))
|
|
1083
|
+
};
|
|
1084
|
+
};
|
|
1085
|
+
var literalOf = (value, what) => {
|
|
1086
|
+
if (value === null || value === void 0) return null;
|
|
1087
|
+
if (value.type === "string") return value.value;
|
|
1088
|
+
if (value.type === "int") return String(value.value);
|
|
1089
|
+
return { unreadable: value.type === "reference" ? `${what} is a resource reference (${value.name ?? `@0x${value.id.toString(16)}`}), not a literal` : `${what} is not a string` };
|
|
1090
|
+
};
|
|
1091
|
+
/**
|
|
1092
|
+
* The channel an Android app reports from its `com.hotupdater.CHANNEL`
|
|
1093
|
+
* meta-data, as the SDK reads it (`NativeConfigUtils`): the value as a
|
|
1094
|
+
* string, and none when it is empty, which the SDK reports as `production`.
|
|
1095
|
+
*/
|
|
1096
|
+
var androidChannelOf = (value) => {
|
|
1097
|
+
if (value === void 0) return null;
|
|
1098
|
+
if (value.type === "boolean") return String(value.value);
|
|
1099
|
+
const channel = literalOf(value, "The com.hotupdater.CHANNEL meta-data");
|
|
1100
|
+
return channel === "" ? null : channel;
|
|
1101
|
+
};
|
|
1102
|
+
var readAndroid = async (source, kind, entries, budget) => {
|
|
1103
|
+
const manifestEntry = findZipEntry(entries, kind === "aab" ? "base/manifest/AndroidManifest.xml" : "AndroidManifest.xml");
|
|
1104
|
+
if (manifestEntry === void 0) throw new NativeArtifactError("UNREADABLE", `The ${kind === "aab" ? ".aab has no base/manifest/AndroidManifest.xml" : ".apk has no AndroidManifest.xml"}.`);
|
|
1105
|
+
const manifestBytes = await readZipEntry(source, manifestEntry, METADATA_BYTES$1, budget);
|
|
1106
|
+
const manifest = readAndroidManifest(kind === "aab" ? parseProtoManifest(manifestBytes) : parseBinaryManifest(manifestBytes));
|
|
1107
|
+
const strings = [];
|
|
1108
|
+
const dexes = filterZipEntries(entries, (name) => kind === "aab" ? /^base\/dex\/classes\d*\.dex$/u.test(name) : /^classes\d*\.dex$/u.test(name));
|
|
1109
|
+
for (const entry of dexes) strings.push(...readDexStrings(await readZipEntry(source, entry, DEX_BYTES, budget), LENGTHS));
|
|
1110
|
+
const { minBundleIds, fingerprints } = candidatesOf(strings);
|
|
1111
|
+
const bundle = findZipEntry(entries, builtInBundlePathOf(kind));
|
|
1112
|
+
return {
|
|
1113
|
+
platform: "android",
|
|
1114
|
+
kind,
|
|
1115
|
+
appId: manifest.packageName,
|
|
1116
|
+
appVersion: literalOf(manifest.versionName, "versionName"),
|
|
1117
|
+
buildNumber: manifest.versionCode === null ? null : String(manifest.versionCode),
|
|
1118
|
+
channel: androidChannelOf(manifest.metaData.get("com.hotupdater.CHANNEL")),
|
|
1119
|
+
minBundleIdCandidates: minBundleIds,
|
|
1120
|
+
fingerprintCandidates: fingerprints,
|
|
1121
|
+
sandbox: {
|
|
1122
|
+
code: strings.includes(SANDBOX_CODE_MARKER),
|
|
1123
|
+
declared: manifest.metaData.has(SANDBOX_META_DATA)
|
|
1124
|
+
},
|
|
1125
|
+
entry: {
|
|
1126
|
+
launchers: manifest.launchers,
|
|
1127
|
+
sandboxUrlScheme: androidSandboxUrlScheme(manifest)
|
|
1128
|
+
},
|
|
1129
|
+
builtInBundle: bundle === void 0 ? null : {
|
|
1130
|
+
path: bundle.name,
|
|
1131
|
+
byteSize: bundle.uncompressedSize
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
};
|
|
1135
|
+
/**
|
|
1136
|
+
* The URL scheme an Android sandbox build registers, or null: the one its
|
|
1137
|
+
* activity's `SANDBOX_URL_SCHEME_META_DATA` names, when the activity's `VIEW`
|
|
1138
|
+
* filters take it too. An artifact built before the meta-data takes the one
|
|
1139
|
+
* with the derived scheme's prefix.
|
|
1140
|
+
*/
|
|
1141
|
+
var androidSandboxUrlScheme = (manifest) => {
|
|
1142
|
+
const schemes = manifest.urlSchemes.get("com.hotupdater.HotUpdaterSandboxActivity") ?? [];
|
|
1143
|
+
const declared = manifest.componentMetaData.get(SANDBOX_ACTIVITY)?.get(SANDBOX_URL_SCHEME_META_DATA);
|
|
1144
|
+
if (declared === void 0) return schemes.find(isSandboxUrlScheme) ?? null;
|
|
1145
|
+
if (declared.type !== "string") return null;
|
|
1146
|
+
return schemes.includes(declared.value) ? declared.value : null;
|
|
1147
|
+
};
|
|
1148
|
+
/**
|
|
1149
|
+
* The sandbox URL scheme of an Info.plist, or null: the one
|
|
1150
|
+
* `SANDBOX_URL_SCHEME_INFO_PLIST_KEY` records, by `recordedSandboxUrlScheme`'s
|
|
1151
|
+
* rule. A prerelease's artifact, with no key, gives its named URL type's one
|
|
1152
|
+
* scheme, or, with no named type, one with the derived scheme's prefix.
|
|
1153
|
+
*/
|
|
1154
|
+
var sandboxUrlSchemeIn = (info) => {
|
|
1155
|
+
const types = info["CFBundleURLTypes"];
|
|
1156
|
+
if (!Array.isArray(types)) return null;
|
|
1157
|
+
const schemesOf = (type) => {
|
|
1158
|
+
const schemes = type?.CFBundleURLSchemes;
|
|
1159
|
+
return Array.isArray(schemes) ? schemes.filter((scheme) => typeof scheme === "string") : [];
|
|
1160
|
+
};
|
|
1161
|
+
const named = types.filter((type) => type?.CFBundleURLName === SANDBOX_URL_TYPE_NAME);
|
|
1162
|
+
const recorded = recordedSandboxUrlScheme("HOT_UPDATER_SANDBOX_URL_SCHEME" in info ? info[SANDBOX_URL_SCHEME_INFO_PLIST_KEY] : void 0, named);
|
|
1163
|
+
if (recorded !== void 0) return recorded;
|
|
1164
|
+
if (named.length > 1) return null;
|
|
1165
|
+
if (named.length === 1) {
|
|
1166
|
+
const schemes = schemesOf(named[0]);
|
|
1167
|
+
return schemes.length === 1 ? schemes[0] : null;
|
|
1168
|
+
}
|
|
1169
|
+
return types.flatMap(schemesOf).find(isSandboxUrlScheme) ?? null;
|
|
1170
|
+
};
|
|
1171
|
+
var stringValue = (value) => typeof value === "string" && value !== "" ? value : null;
|
|
1172
|
+
var readIos = async (source, kind, entries, budget) => {
|
|
1173
|
+
const infoPlist = kind === "ipa" ? /^Payload\/[^/]+\.app\/Info\.plist$/u : /^[^/]+\.app\/Info\.plist$/u;
|
|
1174
|
+
const plistEntry = findZipEntry(entries, (name) => infoPlist.test(name));
|
|
1175
|
+
if (plistEntry === void 0) throw new NativeArtifactError("UNREADABLE", kind === "ipa" ? "The .ipa has no Payload/<App>.app/Info.plist." : "The .app.zip has no <App>.app/Info.plist at its root.");
|
|
1176
|
+
const appDirectory = plistEntry.name.slice(0, -10);
|
|
1177
|
+
const plist = parsePlist(await readZipEntry(source, plistEntry, METADATA_BYTES$1, budget));
|
|
1178
|
+
if (plist === null || typeof plist !== "object" || Array.isArray(plist)) throw new NativeArtifactError("UNREADABLE", "The app's Info.plist is not a dictionary.");
|
|
1179
|
+
const info = plist;
|
|
1180
|
+
const machO = (entry) => readMachOStrings((start, end) => readZipEntryRange(source, entry, start, end, budget), LENGTHS);
|
|
1181
|
+
const frameworks = filterZipEntries(entries, (name) => {
|
|
1182
|
+
const match = new RegExp(`^${appDirectory.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}Frameworks/([^/]+)\\.framework/([^/]+)$`, "u").exec(name);
|
|
1183
|
+
return match !== null && match[1] === match[2];
|
|
1184
|
+
});
|
|
1185
|
+
const sdk = frameworks.find(({ name }) => name.endsWith("/HotUpdater"));
|
|
1186
|
+
const executable = stringValue(info["CFBundleExecutable"]);
|
|
1187
|
+
const executableEntry = executable === null ? void 0 : findZipEntry(entries, `${appDirectory}${executable}`);
|
|
1188
|
+
let strings = sdk === void 0 ? [] : await machO(sdk);
|
|
1189
|
+
if (!strings.some(isUUIDv7) && executableEntry !== void 0) strings = await machO(executableEntry);
|
|
1190
|
+
if (!strings.some(isUUIDv7)) {
|
|
1191
|
+
for (const framework of frameworks) if (framework !== sdk) strings.push(...await machO(framework));
|
|
1192
|
+
}
|
|
1193
|
+
const { minBundleIds, fingerprints } = candidatesOf(strings);
|
|
1194
|
+
const bundle = findZipEntry(entries, builtInBundlePathOf(kind, appDirectory));
|
|
1195
|
+
const channel = info["HOT_UPDATER_CHANNEL"];
|
|
1196
|
+
return {
|
|
1197
|
+
platform: "ios",
|
|
1198
|
+
kind,
|
|
1199
|
+
appId: stringValue(info["CFBundleIdentifier"]),
|
|
1200
|
+
appVersion: stringValue(info["CFBundleShortVersionString"]),
|
|
1201
|
+
buildNumber: stringValue(info["CFBundleVersion"]),
|
|
1202
|
+
channel: channel === void 0 || channel === "" ? null : typeof channel === "string" ? channel : { unreadable: "HOT_UPDATER_CHANNEL is not a string" },
|
|
1203
|
+
minBundleIdCandidates: minBundleIds,
|
|
1204
|
+
fingerprintCandidates: fingerprints,
|
|
1205
|
+
sandbox: {
|
|
1206
|
+
code: strings.includes(SANDBOX_CODE_MARKER),
|
|
1207
|
+
declared: info[SANDBOX_INFO_PLIST_KEY] !== void 0
|
|
1208
|
+
},
|
|
1209
|
+
entry: {
|
|
1210
|
+
launchers: [],
|
|
1211
|
+
sandboxUrlScheme: sandboxUrlSchemeIn(info)
|
|
1212
|
+
},
|
|
1213
|
+
builtInBundle: bundle === void 0 ? null : {
|
|
1214
|
+
path: bundle.name,
|
|
1215
|
+
byteSize: bundle.uncompressedSize
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
/**
|
|
1220
|
+
* Reads a store artifact (`.ipa`, `.aab` or `.apk`) by its file name's
|
|
1221
|
+
* extension: what its app reports at runtime, and its built-in bundle. It
|
|
1222
|
+
* reads the archive's directory, the manifest or Info.plist, and the app's
|
|
1223
|
+
* code, but not the built-in bundle, so a large artifact is never held
|
|
1224
|
+
* whole. Whether the result can be imported is `checkNativeArtifact`'s.
|
|
1225
|
+
*/
|
|
1226
|
+
var readNativeArtifact = async (source, fileName, { timeoutMs = DEFAULT_TIMEOUT_MS } = {}) => {
|
|
1227
|
+
const kind = nativeArtifactKindOf(fileName);
|
|
1228
|
+
if (kind === null) throw new NativeArtifactError("UNSUPPORTED_FILE", `${fileName} is not an .ipa, .aab, .apk or a simulator .app. Import the artifact of a release build.`);
|
|
1229
|
+
const budget = {
|
|
1230
|
+
remaining: READ_BUDGET_BYTES$1,
|
|
1231
|
+
deadline: Date.now() + timeoutMs
|
|
1232
|
+
};
|
|
1233
|
+
const timed = {
|
|
1234
|
+
size: source.size,
|
|
1235
|
+
read(offset, length) {
|
|
1236
|
+
if (Date.now() > budget.deadline) return Promise.reject(new NativeArtifactError("UNREADABLE", "Reading the artifact took too long."));
|
|
1237
|
+
return source.read(offset, length);
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
try {
|
|
1241
|
+
const entries = await readZipDirectory(timed);
|
|
1242
|
+
return await (kind === "ipa" || kind === "app" ? readIos(timed, kind, entries, budget) : readAndroid(timed, kind, entries, budget));
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
if (error instanceof NativeArtifactError) throw error;
|
|
1245
|
+
throw new NativeArtifactError("UNREADABLE", `The artifact is malformed: ${error instanceof Error ? error.message : String(error)}.`);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
/** The channel an app without a default channel reports. */
|
|
1249
|
+
var DEFAULT_CHANNEL = "production";
|
|
1250
|
+
/**
|
|
1251
|
+
* Why an artifact can't register as what it is: the sandbox layer must be
|
|
1252
|
+
* whole or absent, and a sandbox build must have the URL scheme its links
|
|
1253
|
+
* open and the launcher its screen takes. A sandbox build registers on any
|
|
1254
|
+
* channel, as any build does.
|
|
1255
|
+
*/
|
|
1256
|
+
var sandboxArtifactProblem = ({ kind, platform, sandbox, entry }) => {
|
|
1257
|
+
const declaration = platform === "ios" ? "Info.plist key" : "manifest meta-data";
|
|
1258
|
+
if (sandbox.code !== sandbox.declared) return {
|
|
1259
|
+
code: "SANDBOX_MISMATCH",
|
|
1260
|
+
message: sandbox.code ? `The .${kind} has the sandbox layer's code, but no sandbox ${declaration}.\nBuild it again with hot-updater native-build.` : `The .${kind} has a sandbox ${declaration}, but not the sandbox layer's code.\nBuild it again with hot-updater native-build.`
|
|
1261
|
+
};
|
|
1262
|
+
if (sandbox.code && entry.sandboxUrlScheme === null) return {
|
|
1263
|
+
code: "SANDBOX_MISMATCH",
|
|
1264
|
+
message: `The .${kind} is a sandbox build with no sandbox URL scheme, so no link can open it.\nBuild it again with hot-updater native-build.`
|
|
1265
|
+
};
|
|
1266
|
+
if (sandbox.code && platform === "android" && (entry.launchers.length !== 1 || entry.launchers[0] !== "com.hotupdater.HotUpdaterSandboxActivity")) return {
|
|
1267
|
+
code: "SANDBOX_MISMATCH",
|
|
1268
|
+
message: `The .${kind} is a sandbox build, but its launcher is ${entry.launchers.join(", ") || "missing"}.\nBuild it again with hot-updater native-build.`
|
|
1269
|
+
};
|
|
1270
|
+
return null;
|
|
1271
|
+
};
|
|
1272
|
+
var isUnreadable = (value) => typeof value === "object" && value !== null && "unreadable" in value;
|
|
1273
|
+
/**
|
|
1274
|
+
* Whether a read artifact can be imported as a native build, whose built-in
|
|
1275
|
+
* bundle OTAs patch from, and what it registers as. It refuses an artifact
|
|
1276
|
+
* that ships no built-in bundle, such as a debug build, which loads its
|
|
1277
|
+
* JavaScript from Metro, one built without the native SDK's build step (no MIN_BUNDLE_ID), and
|
|
1278
|
+
* one the project's update strategy can't place: no fingerprint under the
|
|
1279
|
+
* fingerprint strategy, or no app version a device compares under the
|
|
1280
|
+
* appVersion strategy. With `appIds`, the identifiers the project's
|
|
1281
|
+
* `nativeBuild` schemes name, it warns about an artifact of another app.
|
|
1282
|
+
*/
|
|
1283
|
+
var checkNativeArtifact = (info, { updateStrategy, appIds = [], channel: channelOverride }) => {
|
|
1284
|
+
const problems = [];
|
|
1285
|
+
const warnings = [];
|
|
1286
|
+
const refuse = (code, message) => problems.push({
|
|
1287
|
+
code,
|
|
1288
|
+
message
|
|
1289
|
+
});
|
|
1290
|
+
if (info.builtInBundle === null) refuse("NO_BUILT_IN_BUNDLE", `The .${info.kind} has no ${builtInBundlePathOf(info.kind)}, so it ships no built-in bundle to patch from. A debug build loads its JavaScript from Metro, and a release build packs it there unless the project renames its bundle. Import a release build.`);
|
|
1291
|
+
const [minBundleId, ...otherMinBundleIds] = info.minBundleIdCandidates;
|
|
1292
|
+
if (minBundleId === void 0) refuse("NO_MIN_BUNDLE_ID", "The app's code holds no MIN_BUNDLE_ID: it was built without @hot-updater/react-native, or with a version of it that doesn't compile MIN_BUNDLE_ID in. Rebuild it with the @hot-updater/react-native this project uses.");
|
|
1293
|
+
else if (otherMinBundleIds.length > 0) refuse("AMBIGUOUS_MIN_BUNDLE_ID", `The app's code holds several UUIDv7 strings (${info.minBundleIdCandidates.join(", ")}), so which is MIN_BUNDLE_ID can't be told.`);
|
|
1294
|
+
let fingerprintHash = null;
|
|
1295
|
+
let appVersion = null;
|
|
1296
|
+
if (updateStrategy === "fingerprint") {
|
|
1297
|
+
const [fingerprint, ...others] = info.fingerprintCandidates;
|
|
1298
|
+
if (fingerprint === void 0) refuse("NO_FINGERPRINT", "The app's code holds no fingerprint, but hot-updater.config.ts updates by fingerprint: it was built without fingerprint.json, or with a @hot-updater/react-native that doesn't compile the fingerprint in, so its app can't check for fingerprint updates.");
|
|
1299
|
+
else if (others.length > 0) refuse("AMBIGUOUS_FINGERPRINT", `The app's code holds several SHA-256 strings (${info.fingerprintCandidates.join(", ")}), so which is its fingerprint can't be told.`);
|
|
1300
|
+
else fingerprintHash = fingerprint;
|
|
1301
|
+
} else if (info.appVersion === null) refuse("NO_APP_VERSION", `The app has no ${info.platform === "ios" ? "CFBundleShortVersionString" : "versionName"}, which the appVersion strategy updates by.`);
|
|
1302
|
+
else if (isUnreadable(info.appVersion)) refuse("NO_APP_VERSION", `The app's ${info.appVersion.unreadable}.`);
|
|
1303
|
+
else if (canonicalizeAppVersion(info.appVersion) === null) refuse("INVALID_SCOPE", `The app version ${info.appVersion} holds no version a device compares, such as 1.4.0, so no appVersion update targets it.`);
|
|
1304
|
+
else appVersion = info.appVersion;
|
|
1305
|
+
let channel = DEFAULT_CHANNEL;
|
|
1306
|
+
if (channelOverride !== void 0) {
|
|
1307
|
+
channel = channelOverride;
|
|
1308
|
+
try {
|
|
1309
|
+
encodeChannelKey(channel);
|
|
1310
|
+
} catch (error) {
|
|
1311
|
+
refuse("INVALID_SCOPE", `The channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
|
|
1312
|
+
}
|
|
1313
|
+
} else if (isUnreadable(info.channel)) refuse("INVALID_SCOPE", `${info.channel.unreadable}, so the channel its app reports can't be read: name it with --channel.`);
|
|
1314
|
+
else if (info.channel !== null) {
|
|
1315
|
+
channel = info.channel;
|
|
1316
|
+
try {
|
|
1317
|
+
encodeChannelKey(channel);
|
|
1318
|
+
} catch (error) {
|
|
1319
|
+
refuse("INVALID_SCOPE", `The app's channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
const sandboxProblem = sandboxArtifactProblem(info);
|
|
1323
|
+
if (sandboxProblem !== null) problems.push(sandboxProblem);
|
|
1324
|
+
if (appIds.length > 0 && info.appId !== null && !appIds.includes(info.appId)) warnings.push({
|
|
1325
|
+
code: "APP_ID_MISMATCH",
|
|
1326
|
+
message: `The app is ${info.appId}, which no ${info.platform} scheme in nativeBuild names (${appIds.join(", ")}): check that it is this project's build.`
|
|
1327
|
+
});
|
|
1328
|
+
if (problems.length > 0 || minBundleId === void 0) return {
|
|
1329
|
+
ok: false,
|
|
1330
|
+
problems,
|
|
1331
|
+
warnings
|
|
1332
|
+
};
|
|
1333
|
+
return {
|
|
1334
|
+
ok: true,
|
|
1335
|
+
warnings,
|
|
1336
|
+
build: {
|
|
1337
|
+
platform: info.platform,
|
|
1338
|
+
kind: info.kind,
|
|
1339
|
+
appId: info.appId,
|
|
1340
|
+
buildNumber: info.buildNumber,
|
|
1341
|
+
minBundleId,
|
|
1342
|
+
channel,
|
|
1343
|
+
fingerprintHash,
|
|
1344
|
+
appVersion,
|
|
1345
|
+
nativeAppVersion: typeof info.appVersion === "string" && info.appVersion.trim() ? info.appVersion : null,
|
|
1346
|
+
builtInBundlePath: info.builtInBundle.path,
|
|
1347
|
+
sandbox: info.sandbox.code,
|
|
1348
|
+
sandboxUrlScheme: info.sandbox.code ? info.entry.sandboxUrlScheme : null
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* The refusal of an artifact whose built-in bundle is already registered:
|
|
1354
|
+
* the registry takes a MIN_BUNDLE_ID once.
|
|
1355
|
+
*/
|
|
1356
|
+
var alreadyImportedProblem = (minBundleId, nativeBuildId) => ({
|
|
1357
|
+
code: "ALREADY_IMPORTED",
|
|
1358
|
+
...nativeBuildId === null ? {} : { nativeBuildId },
|
|
1359
|
+
message: nativeBuildId === null ? `The built-in bundle ${minBundleId} is already registered, as a bundle that is no native build's.` : `This build is already registered as native build ${nativeBuildId} (built-in bundle ${minBundleId}).`
|
|
1360
|
+
});
|
|
1361
|
+
var MiB = 1048576;
|
|
1362
|
+
/** The most an app's Info.plist or a provisioning profile holds here. */
|
|
1363
|
+
var METADATA_BYTES = 1 * MiB;
|
|
1364
|
+
/** The most reading what an install needs inflates, across every entry. */
|
|
1365
|
+
var READ_BUDGET_BYTES = 8 * MiB;
|
|
1366
|
+
/** How long reading what an install needs may take. */
|
|
1367
|
+
var READ_TIMEOUT_MS = 3e4;
|
|
1368
|
+
/** The extensions an app may carry, each with a profile to read. */
|
|
1369
|
+
var MAX_NESTED_PROFILES = 16;
|
|
1370
|
+
var APP_INFO_PLIST = /^Payload\/[^/]+\.app\/Info\.plist$/u;
|
|
1371
|
+
/**
|
|
1372
|
+
* What installs with the app and must list the device too: not a Watch app's
|
|
1373
|
+
* profile, which lists watches and installs on one.
|
|
1374
|
+
*/
|
|
1375
|
+
var NESTED_PROFILE = /^Payload\/[^/]+\.app\/(?:PlugIns|Extensions|AppClips)\/[^/]+\.(?:appex|app)\/embedded\.mobileprovision$/u;
|
|
1376
|
+
/** A device's UDID: 40 hex digits, or 8 and 16 joined by a hyphen. */
|
|
1377
|
+
var UDID = /^(?:[0-9a-f]{40}|[0-9a-f]{8}-[0-9a-f]{16})$/iu;
|
|
1378
|
+
/**
|
|
1379
|
+
* The form two UDIDs compare in, or null for text that isn't one. Apple writes
|
|
1380
|
+
* them in either case, and App Store Connect takes the device's own.
|
|
1381
|
+
*/
|
|
1382
|
+
var normalizeIosUdid = (value) => {
|
|
1383
|
+
const trimmed = value.trim();
|
|
1384
|
+
return UDID.test(trimmed) ? trimmed.toLowerCase() : null;
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* The bytes from `<?xml` through `</plist>`, or null without both: a CMS
|
|
1388
|
+
* message, as a provisioning profile and a Profile Service answer are, holds
|
|
1389
|
+
* its plist as plain text among binary bytes.
|
|
1390
|
+
*/
|
|
1391
|
+
var sliceEmbeddedPlist = (bytes) => {
|
|
1392
|
+
const text = new TextDecoder("latin1").decode(bytes);
|
|
1393
|
+
const start = text.indexOf("<?xml");
|
|
1394
|
+
if (start === -1) return null;
|
|
1395
|
+
const end = text.indexOf("</plist>", start);
|
|
1396
|
+
return end === -1 ? null : bytes.subarray(start, end + 8);
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* The UDID in a Profile Service answer's body, or null when it has no one
|
|
1400
|
+
* well-formed UDID. It only finds the text: nothing here verifies the signature
|
|
1401
|
+
* around it, so nothing automated may trust the result.
|
|
1402
|
+
*/
|
|
1403
|
+
var readProfileServiceUdid = (body) => {
|
|
1404
|
+
const plist = sliceEmbeddedPlist(body);
|
|
1405
|
+
if (plist === null) return null;
|
|
1406
|
+
const matches = [...new TextDecoder().decode(plist).matchAll(/<key>\s*UDID\s*<\/key>\s*<string>([^<]*)<\/string>/gu)];
|
|
1407
|
+
if (matches.length !== 1) return null;
|
|
1408
|
+
const udid = matches[0][1].trim();
|
|
1409
|
+
return normalizeIosUdid(udid) === null ? null : udid;
|
|
1410
|
+
};
|
|
1411
|
+
var unreadable = (message) => new NativeArtifactError("UNREADABLE", message);
|
|
1412
|
+
var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Uint8Array);
|
|
1413
|
+
var readProfile = (bytes, name) => {
|
|
1414
|
+
const plistBytes = sliceEmbeddedPlist(bytes);
|
|
1415
|
+
if (plistBytes === null) throw unreadable(`The archive's ${name} holds no property list.`);
|
|
1416
|
+
const plist = parsePlist(plistBytes);
|
|
1417
|
+
if (!isDict(plist)) throw unreadable(`The archive's ${name} is corrupt.`);
|
|
1418
|
+
const listed = plist["ProvisionedDevices"];
|
|
1419
|
+
if (listed !== void 0 && !Array.isArray(listed)) throw unreadable(`The archive's ${name} is corrupt.`);
|
|
1420
|
+
const devices = listed?.map((device) => {
|
|
1421
|
+
if (typeof device !== "string") throw unreadable(`The archive's ${name} is corrupt.`);
|
|
1422
|
+
return device.trim().toLowerCase();
|
|
1423
|
+
});
|
|
1424
|
+
const expiration = plist["ExpirationDate"];
|
|
1425
|
+
const expiresAtMs = typeof expiration === "string" ? Date.parse(expiration) : null;
|
|
1426
|
+
if (expiresAtMs !== null && Number.isNaN(expiresAtMs)) throw unreadable(`The archive's ${name} is corrupt.`);
|
|
1427
|
+
const entitlements = plist["Entitlements"];
|
|
1428
|
+
const applicationId = isDict(entitlements) ? entitlements["application-identifier"] : void 0;
|
|
1429
|
+
const bundleId = typeof applicationId === "string" ? applicationId.slice(applicationId.indexOf(".") + 1) : null;
|
|
1430
|
+
const teams = plist["TeamIdentifier"];
|
|
1431
|
+
const team = Array.isArray(teams) ? teams[0] : void 0;
|
|
1432
|
+
const uuid = plist["UUID"];
|
|
1433
|
+
return {
|
|
1434
|
+
allDevices: plist["ProvisionsAllDevices"] === true,
|
|
1435
|
+
devices: devices === void 0 ? null : new Set(devices),
|
|
1436
|
+
getTaskAllow: isDict(entitlements) && entitlements["get-task-allow"] === true,
|
|
1437
|
+
expiresAtMs,
|
|
1438
|
+
bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId,
|
|
1439
|
+
applicationIdentifier: typeof applicationId === "string" ? applicationId : null,
|
|
1440
|
+
teamId: typeof team === "string" && team !== "" ? team : null,
|
|
1441
|
+
xcodeManaged: plist["IsXcodeManaged"] === true,
|
|
1442
|
+
uuid: typeof uuid === "string" && uuid !== "" ? uuid : null
|
|
1443
|
+
};
|
|
1444
|
+
};
|
|
1445
|
+
var distributionOf = (profile) => {
|
|
1446
|
+
if (profile === null) return "store";
|
|
1447
|
+
if (profile.allDevices) return "enterprise";
|
|
1448
|
+
if (profile.devices === null) return "store";
|
|
1449
|
+
return profile.getTaskAllow ? "development" : "ad-hoc";
|
|
1450
|
+
};
|
|
1451
|
+
/**
|
|
1452
|
+
* What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
|
|
1453
|
+
* around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
|
|
1454
|
+
* no signature. Throws `NativeArtifactError` for one it can't read.
|
|
1455
|
+
*/
|
|
1456
|
+
var readProvisioningProfile = (bytes) => {
|
|
1457
|
+
const profile = readProfile(bytes, "provisioning profile");
|
|
1458
|
+
return {
|
|
1459
|
+
uuid: profile.uuid,
|
|
1460
|
+
distribution: distributionOf(profile),
|
|
1461
|
+
teamId: profile.teamId,
|
|
1462
|
+
applicationIdentifier: profile.applicationIdentifier,
|
|
1463
|
+
xcodeManaged: profile.xcodeManaged,
|
|
1464
|
+
devices: [...profile.devices ?? []].sort(),
|
|
1465
|
+
expiresAtMs: profile.expiresAtMs
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1469
|
+
* What an `.ipa` installs as, reading only its directory, its app's Info.plist
|
|
1470
|
+
* and its provisioning profiles: a few requests of a remote file, whatever its
|
|
1471
|
+
* size. The `.ipa` is untrusted, and each part is bounded before it is read.
|
|
1472
|
+
* Throws `NativeArtifactError` for one it can't read.
|
|
1473
|
+
*/
|
|
1474
|
+
var readIpaInstallInfo = async (source) => {
|
|
1475
|
+
const entries = await readZipDirectory(source);
|
|
1476
|
+
const infoPlists = filterZipEntries(entries, (name) => APP_INFO_PLIST.test(name));
|
|
1477
|
+
const infoEntry = infoPlists[0];
|
|
1478
|
+
if (infoEntry === void 0 || infoPlists.length > 1) throw unreadable("The .ipa has no one Payload/<App>.app/Info.plist.");
|
|
1479
|
+
const budget = {
|
|
1480
|
+
remaining: READ_BUDGET_BYTES,
|
|
1481
|
+
deadline: Date.now() + READ_TIMEOUT_MS
|
|
1482
|
+
};
|
|
1483
|
+
const read = (entry) => readZipEntry(source, entry, METADATA_BYTES, budget);
|
|
1484
|
+
const info = parsePlist(await read(infoEntry));
|
|
1485
|
+
if (!isDict(info)) throw unreadable("The app's Info.plist is corrupt.");
|
|
1486
|
+
const bundleId = info["CFBundleIdentifier"];
|
|
1487
|
+
const bundleVersion = info["CFBundleVersion"];
|
|
1488
|
+
if (typeof bundleId !== "string" || bundleId === "") throw unreadable("The app's Info.plist has no CFBundleIdentifier.");
|
|
1489
|
+
if (typeof bundleVersion !== "string" || bundleVersion === "") throw unreadable("The app's Info.plist has no CFBundleVersion.");
|
|
1490
|
+
const displayName = info["CFBundleDisplayName"];
|
|
1491
|
+
const bundleName = info["CFBundleName"];
|
|
1492
|
+
const title = typeof displayName === "string" && displayName !== "" ? displayName : typeof bundleName === "string" && bundleName !== "" ? bundleName : bundleId;
|
|
1493
|
+
const appDirectory = infoEntry.name.slice(0, -10);
|
|
1494
|
+
const profileEntry = findZipEntry(entries, `${appDirectory}embedded.mobileprovision`);
|
|
1495
|
+
const nestedEntries = filterZipEntries(entries, (name) => name.startsWith(appDirectory) && NESTED_PROFILE.test(name));
|
|
1496
|
+
if (nestedEntries.length > MAX_NESTED_PROFILES) throw unreadable(`The app has more than ${MAX_NESTED_PROFILES} extensions with profiles.`);
|
|
1497
|
+
const profile = profileEntry === void 0 ? null : readProfile(await read(profileEntry), profileEntry.name);
|
|
1498
|
+
const nested = [];
|
|
1499
|
+
for (const entry of nestedEntries) nested.push(readProfile(await read(entry), entry.name));
|
|
1500
|
+
const distribution = distributionOf(profile);
|
|
1501
|
+
const profiles = profile === null ? nested : [profile, ...nested];
|
|
1502
|
+
const listDevices = distribution === "ad-hoc" || distribution === "development";
|
|
1503
|
+
const lists = profiles.flatMap(({ allDevices, devices }) => allDevices ? [] : [devices ?? /* @__PURE__ */ new Set()]);
|
|
1504
|
+
const expiries = profiles.flatMap(({ expiresAtMs }) => expiresAtMs === null ? [] : [expiresAtMs]);
|
|
1505
|
+
return {
|
|
1506
|
+
bundleId,
|
|
1507
|
+
bundleVersion,
|
|
1508
|
+
title,
|
|
1509
|
+
distribution,
|
|
1510
|
+
devices: listDevices ? [...lists[0] ?? []].filter((udid) => lists.every((list) => list.has(udid))).sort() : [],
|
|
1511
|
+
expiresAtMs: expiries.length === 0 ? null : Math.min(...expiries),
|
|
1512
|
+
profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])],
|
|
1513
|
+
teamId: profile?.teamId ?? null
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1516
|
+
//#endregion
|
|
1517
|
+
export { NativeArtifactError, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxUrlSchemeOf };
|