@abtnode/blocklet-services 1.16.41-beta-20250325-054737-39c060ca → 1.16.41-beta-20250329-232306-53c45e3b
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/api/emails/_components/actions.js +9 -0
- package/api/emails/{components → _components}/article.js +1 -1
- package/api/emails/{components → _components}/asset.js +2 -2
- package/api/emails/{components → _components}/attachments.js +15 -13
- package/api/emails/{components → _components}/compose.js +2 -2
- package/api/emails/_components/content.js +15 -0
- package/api/emails/{components → _components}/footer.js +1 -1
- package/api/emails/{components → _components}/powered-by.js +1 -1
- package/api/emails/{components → _components}/token.js +2 -2
- package/api/emails/{components → _components}/transaction.js +1 -1
- package/api/emails/{pages → _templates}/notification.js +10 -10
- package/api/emails/_templates/verify-code-body.js +49 -0
- package/api/emails/_templates/verify-code.js +37 -0
- package/api/index.js +59 -71
- package/api/libs/auth/utils.js +20 -1
- package/api/libs/connect/session.js +55 -3
- package/api/libs/email.js +48 -16
- package/api/middlewares/body-parser.js +10 -0
- package/api/routes/blocklet.js +17 -4
- package/api/routes/federated.js +36 -13
- package/api/routes/mcp.js +87 -0
- package/api/routes/user-session.js +16 -1
- package/api/routes/user.js +442 -40
- package/api/services/auth/connect/issue-passport.js +4 -3
- package/api/services/auth/connect/receive-transfer-app-owner.js +17 -1
- package/api/services/auth/connect/verify-destroy.js +20 -0
- package/api/services/auth/connect/verify-elevated.js +20 -0
- package/api/services/auth/index.js +0 -2
- package/api/services/auth/session.js +1 -1
- package/api/services/kyc/index.js +1 -1
- package/api/services/mcp/server.js +37 -0
- package/api/services/notification/queue.js +5 -4
- package/api/services/studio/index.js +4 -0
- package/api/util/federated.js +16 -0
- package/dist/assets/{ArrowDropDown-BZ7nr-4O.js → ArrowDropDown-odHjNJIs.js} +1 -1
- package/dist/assets/{CheckCircle-V33X02sL.js → CheckCircle-BqOSvJMp.js} +1 -1
- package/dist/assets/{ChevronLeft-BhAwkTPM.js → ChevronLeft-Dv7rlUf5.js} +1 -1
- package/dist/assets/{ChevronRight-BFn5n61K.js → ChevronRight-CWeJn1iz.js} +1 -1
- package/dist/assets/{Community-CJcr3sxm.js → Community-CMFBTMi_.js} +1 -1
- package/dist/assets/{DeleteOutline-CI9d5QQr.js → DeleteOutline-Cr-TyrUV.js} +1 -1
- package/dist/assets/{Done-CvHaNROm.js → Done-C1TA1wbA.js} +1 -1
- package/dist/assets/{Download-CA6PpJRL.js → Download-DxhnUTM_.js} +1 -1
- package/dist/assets/{EditIcon-d_J6X2-M.js → EditIcon-Bgmg6UE0.js} +1 -1
- package/dist/assets/{Email-Cv_Ltuyk.js → Email-BphlAPta.js} +1 -1
- package/dist/assets/{Error-CkH40x6R.js → Error-pXXvJFxN.js} +1 -1
- package/dist/assets/{ExpandLess-DPn_CrO1.js → ExpandLess-Dc_dI20M.js} +1 -1
- package/dist/assets/{Google-cBME17GZ.js → Google-DNUuYFIA.js} +1 -1
- package/dist/assets/{Holiday-DtecZXIQ.js → Holiday-DKefG3Bb.js} +1 -1
- package/dist/assets/{InfoOutlined-DNOhP8aN.js → InfoOutlined-CEUhR4DY.js} +1 -1
- package/dist/assets/{Launch-DR5uY37Q.js → Launch-BUTOr3cR.js} +1 -1
- package/dist/assets/{LaunchOutlined-DzKl31aT.js → LaunchOutlined-QHq-RUJt.js} +1 -1
- package/dist/assets/{Location-CdiPklKa.js → Location-BuaxMxu4.js} +1 -1
- package/dist/assets/{LockIcon-CzTeIv2K.js → LockIcon-CQ1tExIY.js} +1 -1
- package/dist/assets/{Meeting-DQYhfakU.js → Meeting-Cs60QtvP.js} +1 -1
- package/dist/assets/{MoreHoriz-DvRtrl2X.js → MoreHoriz-D1SOL47a.js} +1 -1
- package/dist/assets/{OffSick-DwG4gWQF.js → OffSick-DinPaelp.js} +1 -1
- package/dist/assets/{Phone-CETYuRms.js → Phone-BmouKMyi.js} +1 -1
- package/dist/assets/{PlayArrow-B_DkcrSm.js → PlayArrow-D7cGSxeN.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-CJiBom-M.js → QuestionMarkCircle-Dt9XJWEe.js} +1 -1
- package/dist/assets/{ServerLogo-Ow_B_zvr.js → ServerLogo-B33ZRE5q.js} +1 -1
- package/dist/assets/{Timezone-BX4VhFOS.js → Timezone-CyMhRxlx.js} +1 -1
- package/dist/assets/{ViewList-CVmPM3e1.js → ViewList-vu1qOJ6P.js} +1 -1
- package/dist/assets/{WorkingRemotely-DIBVduhu.js → WorkingRemotely-BP_VIHeM.js} +1 -1
- package/dist/assets/access-control-CpxcJItK.js +14 -0
- package/dist/assets/{actions-DqC3kJCr.js → actions-4oGfCMlR.js} +1 -1
- package/dist/assets/add-component-core-CE0nArG4.js +761 -0
- package/dist/assets/add-resource-BYM4JwzE.js +1 -0
- package/dist/assets/{addon-BUKk8W1Q.js → addon-B9bb2bvM.js} +1 -1
- package/dist/assets/analytics-BXLe73MI.js +11 -0
- package/dist/assets/api-D9Yi7Zdr.js +1 -0
- package/dist/assets/appearance-DX7SoW1u.js +1 -0
- package/dist/assets/ar-2k9jaPIk.js +3 -0
- package/dist/assets/{audit-logs-CzmQ7awq.js → audit-logs-D8H5E0fC.js} +3 -3
- package/dist/assets/{base32-CwsOMJzz.js → base32-BNpDT-6Q.js} +1 -1
- package/dist/assets/{branding-COlKYnkW.js → branding-BW1rhy8d.js} +2 -2
- package/dist/assets/bundle-avatar-DHwmIozH.js +1 -0
- package/dist/assets/button-CNnuiac8.js +1 -0
- package/dist/assets/{click-to-copy-BF_uUMNm.js → click-to-copy-B0HMuCN_.js} +1 -1
- package/dist/assets/complete-BNf0-iqY.js +45 -0
- package/dist/assets/{component-D_dh8l-k.js → component-1r0VSsqq.js} +2 -2
- package/dist/assets/{config-D7fEb50y.js → config-BeD5_8kr.js} +2 -2
- package/dist/assets/config-CqHmZdZv.js +1 -0
- package/dist/assets/{config-navigation-D8XsruhL.js → config-navigation-DtN0_qFZ.js} +3 -3
- package/dist/assets/{config-space-BsNunj5H.js → config-space-DlwZewcm.js} +1 -1
- package/dist/assets/{confirm-SUs_DctB.js → confirm-DmMN-34s.js} +2 -2
- package/dist/assets/connect-BfSOEYV-.js +1 -0
- package/dist/assets/{connect-B1JNOfKg.js → connect-CC9dcVMV.js} +1 -1
- package/dist/assets/{connect-to-D_r9o9e2.js → connect-to-CzffwD9G.js} +1 -1
- package/dist/assets/{content-layout-BQE-NWxj.js → content-layout-7vu3yv_f.js} +1 -1
- package/dist/assets/dashboard-C_Q4TjPa.js +216 -0
- package/dist/assets/de-B9cLhykn.js +3 -0
- package/dist/assets/{delete-confirm-CIzTutM8.js → delete-confirm-BTaU_6Kx.js} +1 -1
- package/dist/assets/did-address-BC-0j4Pt.js +1 -0
- package/dist/assets/{domain-Cs9dCGZy.js → domain-CLMRXecU.js} +1 -1
- package/dist/assets/{domain-action-card-CmEjTVIf.js → domain-action-card-DwQ7Q8wY.js} +2 -2
- package/dist/assets/domains-DF7TtN5q.js +1 -0
- package/dist/assets/{email-DcW8pu9K.js → email-mj0bVFDS.js} +2 -2
- package/dist/assets/es-BoQohonz.js +3 -0
- package/dist/assets/{exchange-passport-SiIAETh-.js → exchange-passport--DeUPzbW.js} +1 -1
- package/dist/assets/form-text-input-BYF6lVnE.js +11 -0
- package/dist/assets/fr-doSYAOrt.js +3 -0
- package/dist/assets/{fuel-BkpixTuh.js → fuel-D-kOZuF6.js} +1 -1
- package/dist/assets/{fullpage-BK45P92Z.js → fullpage-DO8Hcbkl.js} +1 -1
- package/dist/assets/{get-safe-url-BPBKhLNl.js → get-safe-url-BKl2A9x2.js} +1 -1
- package/dist/assets/{get-safe-url-D5pnveC6.js → get-safe-url-QFq5JNoE.js} +1 -1
- package/dist/assets/hi-B_BwhpD8.js +1 -0
- package/dist/assets/{home-qm_lBtgD.js → home-CpnMpXiw.js} +1 -1
- package/dist/assets/id-BgYIZCvk.js +3 -0
- package/dist/assets/{iframe-MARzuPzd.js → iframe-B9mCpo4I.js} +1 -1
- package/dist/assets/{index-ZhFE0VPc.js → index-79U1RPaq.js} +1 -1
- package/dist/assets/{index-RkynV8Hy.js → index-B4Q2DAdn.js} +11 -11
- package/dist/assets/index-BJ2lJo7L.js +346 -0
- package/dist/assets/{index-De6c2gZ_.js → index-BMSA5TdD.js} +1 -1
- package/dist/assets/{index-DkVrxjpZ.js → index-BVOYP6aR.js} +2 -2
- package/dist/assets/{index-MSp2Bfol.js → index-BZvVDfZ4.js} +1 -1
- package/dist/assets/index-BsUr7wGb.js +104 -0
- package/dist/assets/index-C44fECmB.js +138 -0
- package/dist/assets/{index-BRMrRxju.js → index-CGK3FEjY.js} +2 -2
- package/dist/assets/{index-DQKEK30u.js → index-CJCg9yIK.js} +1 -1
- package/dist/assets/index-CmKAznDh.js +109 -0
- package/dist/assets/{index-CjVqsxIQ.js → index-Ct7s2LPI.js} +17 -17
- package/dist/assets/{index-BwhP13EW.js → index-DQ_RzIwU.js} +2 -2
- package/dist/assets/{index-BhEkFtB1.js → index-D_wVtHmh.js} +1 -1
- package/dist/assets/{index-BJQAwe5r.js → index-DqC2o5PB.js} +1 -1
- package/dist/assets/index-DyTFEgKr.js +1 -0
- package/dist/assets/index-eCY24sH9.js +137 -0
- package/dist/assets/{index-9twdGxCF.js → index-fWGZM-oP.js} +1 -1
- package/dist/assets/index-gTQQ3SoE.js +290 -0
- package/dist/assets/index-gcSQTx25.js +1 -0
- package/dist/assets/{index-D9S8aCU6.js → index-m8CaSxXx.js} +1 -1
- package/dist/assets/{index-CcooKt06.js → index-u-lA6P_E.js} +1 -1
- package/dist/assets/invitation-B8Qx_pFq.js +176 -0
- package/dist/assets/invite-BBaF_vyc.js +1 -0
- package/dist/assets/{issue-passport-UNdxuvTV.js → issue-passport-DC-ly7xg.js} +1 -1
- package/dist/assets/{item-vIB3V7Bi.js → item-BSGXym2I.js} +1 -1
- package/dist/assets/ja-FMMLI8YD.js +3 -0
- package/dist/assets/ko-C0kmRXYE.js +3 -0
- package/dist/assets/{launch-result-message-irP4_5v3.js → launch-result-message-ByEG8r_7.js} +1 -1
- package/dist/assets/{layout-C6s5HhIK.js → layout-BqhTD729.js} +1 -1
- package/dist/assets/list-BHs8uNT5.js +200 -0
- package/dist/assets/{list-header-s-ciXcTm.js → list-header-BmTDmRY0.js} +1 -1
- package/dist/assets/localization-daPAWMzR.js +1 -0
- package/dist/assets/{log-lc82BnEg.js → log-o_Cadt8j.js} +7 -7
- package/dist/assets/{login-BMWayJcu.js → login-BQozrLDm.js} +1 -1
- package/dist/assets/{login-oauth-callback-CNErXZTB.js → login-oauth-callback-D7lIww1c.js} +1 -1
- package/dist/assets/{logo-uploader-CEXNuQSC.js → logo-uploader-CUQ3aWZJ.js} +3 -3
- package/dist/assets/{lost-passport-CvNrb0v1.js → lost-passport-DkETH2Lu.js} +3 -3
- package/dist/assets/{omit-DVwO9e3E.js → omit-DZNQhOf-.js} +1 -1
- package/dist/assets/{open-window-B6eFUa8p.js → open-window-BOl-kTC2.js} +1 -1
- package/dist/assets/{overview-mT5IG7r5.js → overview-Bxm05EH6.js} +1 -1
- package/dist/assets/{page-header-B4LQuuxg.js → page-header-Dm1v9v5q.js} +1 -1
- package/dist/assets/{permission-C4cBxu8K.js → permission-B5jnw9r2.js} +1 -1
- package/dist/assets/{preferences-tDE3WRRj.js → preferences-uri2RXdB.js} +1 -1
- package/dist/assets/profile-embed-DnIQcD-H.js +1 -0
- package/dist/assets/pt-C2UJZK-O.js +1 -0
- package/dist/assets/publish-resource-V53U1NNv.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-BnCmTyEw.js → react-beautiful-dnd.esm-B9MfX9Xl.js} +4 -4
- package/dist/assets/{relative-time-W13XZ7qT.js → relative-time-RQnsWZQc.js} +1 -1
- package/dist/assets/ru-DDA5s4-r.js +1 -0
- package/dist/assets/sdk-BKSsfgrc.js +1 -0
- package/dist/assets/{session-D0E4yKh1.js → session-6ZeN-aF2.js} +1 -1
- package/dist/assets/{setup-vmtHxx8b.js → setup-7Gq9K_8k.js} +3 -3
- package/dist/assets/{shorten-label-CYUVOsQQ.js → shorten-label-DkFTGSoy.js} +1 -1
- package/dist/assets/simple-select-CqakAZFe.js +1 -0
- package/dist/assets/{slicedToArray-W0RilTJp.js → slicedToArray-BuQur6Mi.js} +2 -2
- package/dist/assets/{start-B6iWRYkb.js → start-BSUY3DBl.js} +1 -1
- package/dist/assets/{status-CBD3RDbA.js → status-C52-BFuY.js} +1 -1
- package/dist/assets/{step-actions-D1bVdqNc.js → step-actions-CA74dwgt.js} +1 -1
- package/dist/assets/{studio-CI-t_7sU.js → studio-CAnZfyBM.js} +1 -1
- package/dist/assets/{switch-control-BqINsLim.js → switch-control-BBlLGjaH.js} +1 -1
- package/dist/assets/th-DmqOUn4C.js +1 -0
- package/dist/assets/{traffic-kGqrk2bv.js → traffic-CJDIGmp5.js} +3 -3
- package/dist/assets/{transfer-ii7u2wA5.js → transfer-cG2e24sz.js} +1 -1
- package/dist/assets/{unsubscribe-DvsPQr2X.js → unsubscribe-afXXIHEf.js} +1 -1
- package/dist/assets/{use-mobile-CVbqh2Dx.js → use-mobile-CUT5hy9q.js} +1 -1
- package/dist/assets/{useAsync-D2OhgEkV.js → useAsync-DM8qaMe4.js} +1 -1
- package/dist/assets/{useAsyncRetry-Dju2R4r6.js → useAsyncRetry-B7SbzXVI.js} +2 -2
- package/dist/assets/{useLocalStorage-B4mjl5_Q.js → useLocalStorage-Dd4pybDP.js} +1 -1
- package/dist/assets/user-center-T8Xw464s.js +67 -0
- package/dist/assets/{util-CVH97CBw.js → util-C_BCTHfw.js} +1 -1
- package/dist/assets/{util-BT3jBHtZ.js → util-YyWTpLT7.js} +1 -1
- package/dist/assets/vendor-arcblock-DvaaLvvM.js +2361 -0
- package/dist/assets/{vendor-hooks-CYyfK9g3.js → vendor-hooks-sw5wvnca.js} +2 -2
- package/dist/assets/vendor-mui-core-DxqV1NVn.js +266 -0
- package/dist/assets/{vendor-mui-x-BTReKX4-.js → vendor-mui-x-BjL1xCkk.js} +1 -1
- package/dist/assets/{vendor-utils-CbeKtci8.js → vendor-utils-DR57WNxP.js} +7 -7
- package/dist/assets/{vendor-ux-did-connect-Dg7MsmIi.js → vendor-ux-did-connect-Bciw9Ypu.js} +57 -53
- package/dist/assets/vi-Cf__CtPD.js +1 -0
- package/dist/assets/wrap-locale-CX50Vz0w.js +1 -0
- package/dist/assets/zh-NXspK2yu.js +4 -0
- package/dist/assets/zh-tw-DYYDVX5I.js +3 -0
- package/dist/index.html +6 -6
- package/dist/service-worker.js +2 -2
- package/package.json +41 -36
- package/api/emails/components/actions.js +0 -9
- package/api/emails/components/content.js +0 -15
- package/dist/assets/ExternalIssuerIcon-BLzCUF1d.js +0 -1
- package/dist/assets/access-control-Dk5vBHfS.js +0 -13
- package/dist/assets/add-component-core-DAx5yIIg.js +0 -765
- package/dist/assets/add-resource-DkZqrFbC.js +0 -1
- package/dist/assets/analytics-BpEvUU_V.js +0 -11
- package/dist/assets/api-CvDkueg1.js +0 -1
- package/dist/assets/ar-CVfYi9he.js +0 -3
- package/dist/assets/bundle-avatar-mGTppfmO.js +0 -1
- package/dist/assets/button-Bp47Zc1i.js +0 -1
- package/dist/assets/complete-BGei1NKc.js +0 -45
- package/dist/assets/config-C4ca73g2.js +0 -1
- package/dist/assets/connect-CHnKwaTE.js +0 -1
- package/dist/assets/dashboard-CcevSjZB.js +0 -218
- package/dist/assets/de-B4s5NdlK.js +0 -3
- package/dist/assets/did-address-DnGQ03FF.js +0 -1
- package/dist/assets/domains-ByJLKnQ7.js +0 -1
- package/dist/assets/es-C48Qrhnr.js +0 -3
- package/dist/assets/form-text-input-B4Ezw4UV.js +0 -11
- package/dist/assets/fr-C_zb-sN3.js +0 -3
- package/dist/assets/hi-Bd1v0vAT.js +0 -1
- package/dist/assets/id-CAHN8LyN.js +0 -3
- package/dist/assets/index-2hZd332d.js +0 -138
- package/dist/assets/index-BMxUr1Yy.js +0 -346
- package/dist/assets/index-BSEtdOzl.js +0 -134
- package/dist/assets/index-BvH3rra0.js +0 -1
- package/dist/assets/index-C482NgPS.js +0 -104
- package/dist/assets/index-CZIXrPaX.js +0 -109
- package/dist/assets/index-CqnBzijY.js +0 -137
- package/dist/assets/index-mdmh1Xx6.js +0 -1
- package/dist/assets/invitation-ehDH3V7F.js +0 -176
- package/dist/assets/invite-BVZfCzI6.js +0 -1
- package/dist/assets/ja-DTJzPeZ-.js +0 -3
- package/dist/assets/ko--y3FSpCf.js +0 -3
- package/dist/assets/list-DS45KBMo.js +0 -195
- package/dist/assets/localization-BAzVJOkA.js +0 -1
- package/dist/assets/login-bg-CBktcoss.jpg +0 -0
- package/dist/assets/profile-embed-CNrAUity.js +0 -1
- package/dist/assets/pt-vs00P-F0.js +0 -1
- package/dist/assets/publish-resource-ApDQigSb.js +0 -1
- package/dist/assets/ru-CMsriCRQ.js +0 -1
- package/dist/assets/sdk-CdntdIAz.js +0 -1
- package/dist/assets/simple-select-CI23fC_x.js +0 -1
- package/dist/assets/th-_91ROtZM.js +0 -1
- package/dist/assets/user-center-Bi7zYk4z.js +0 -79
- package/dist/assets/vendor-arcblock-CCyyB91P.js +0 -2361
- package/dist/assets/vendor-mui-core-DSM7ZGuY.js +0 -266
- package/dist/assets/vi-BAo1CsMy.js +0 -1
- package/dist/assets/wrap-locale-BMEB19si.js +0 -1
- package/dist/assets/zh-8LRwh-dv.js +0 -4
- package/dist/assets/zh-tw-C8jGxySi.js +0 -3
- /package/api/emails/{components → _components}/copyright.js +0 -0
- /package/api/emails/{components → _components}/dapp.js +0 -0
- /package/api/emails/{components → _components}/header.js +0 -0
- /package/api/emails/{components → _components}/layout.js +0 -0
- /package/api/emails/{libs → _libs}/chain.js +0 -0
- /package/api/emails/{libs → _libs}/config.js +0 -0
- /package/api/emails/{libs → _libs}/constant.js +0 -0
- /package/api/emails/{libs → _libs}/explorer-url.js +0 -0
- /package/api/emails/{libs → _libs}/func.js +0 -0
- /package/api/emails/{libs → _libs}/highlight.js +0 -0
- /package/api/emails/{libs → _libs}/style.js +0 -0
- /package/api/emails/{libs → _libs}/util.js +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const components_1 = require("@react-email/components");
|
|
5
|
+
const style_1 = require("../_libs/style");
|
|
6
|
+
function Actions({ actions, }) {
|
|
7
|
+
return actions.length > 0 ? ((0, jsx_runtime_1.jsx)(components_1.Section, { style: style_1.actionsStyle, children: actions.map((item, index) => ((0, jsx_runtime_1.jsx)(components_1.Button, { href: item.link, target: "_blank", style: Object.assign(Object.assign({}, style_1.actionStyle), { padding: '6px 12px' }), children: item.title || item.name }, index))) })) : null;
|
|
8
|
+
}
|
|
9
|
+
exports.default = Actions;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const components_1 = require("@react-email/components");
|
|
5
|
-
const chain_1 = require("../
|
|
5
|
+
const chain_1 = require("../_libs/chain");
|
|
6
6
|
function Article({ data, }) {
|
|
7
7
|
const host = (0, chain_1.getUrlHost)(data.url);
|
|
8
8
|
return ((0, jsx_runtime_1.jsxs)("a", { href: data.url, target: "_blank", style: {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const components_1 = require("@react-email/components");
|
|
5
|
-
const chain_1 = require("../
|
|
6
|
-
const style_1 = require("../
|
|
5
|
+
const chain_1 = require("../_libs/chain");
|
|
6
|
+
const style_1 = require("../_libs/style");
|
|
7
7
|
function Asset({ locale, data, }) {
|
|
8
8
|
const title = { zh: '接收', en: 'Received' }[locale] || 'Received';
|
|
9
9
|
const chainHost = (0, chain_1.getUrlHost)(data.chainHost) || (0, chain_1.getChainHost)(data.chainId);
|
|
@@ -11,42 +11,44 @@ const compose_1 = __importDefault(require("./compose"));
|
|
|
11
11
|
const transaction_1 = __importDefault(require("./transaction"));
|
|
12
12
|
const dapp_1 = __importDefault(require("./dapp"));
|
|
13
13
|
const article_1 = __importDefault(require("./article"));
|
|
14
|
-
const style_1 = require("../
|
|
14
|
+
const style_1 = require("../_libs/style");
|
|
15
15
|
function Attachments({ locale, severity = 'normal', attachments = [], }) {
|
|
16
|
-
const attachmentList = attachments
|
|
16
|
+
const attachmentList = attachments
|
|
17
|
+
.map((item, index) => {
|
|
17
18
|
switch (item.type) {
|
|
18
19
|
case 'text':
|
|
19
20
|
return item.data.type === 'plain' ? ((0, jsx_runtime_1.jsx)(components_1.Text, { style: {
|
|
20
21
|
color: item.data.color || 'initial',
|
|
21
22
|
fontSize: { small: '12px', normal: '14px', large: '16px' }[item.data.size || 'normal'],
|
|
22
23
|
whiteSpace: 'pre-line!important',
|
|
23
|
-
}, children: item.data.text })) : null;
|
|
24
|
+
}, children: item.data.text }, `${item.type}-${index}`)) : null;
|
|
24
25
|
case 'image':
|
|
25
26
|
return ((0, jsx_runtime_1.jsx)(components_1.Img, { src: item.data.url, alt: item.data.alt, style: {
|
|
26
27
|
width: '100%',
|
|
27
28
|
height: '150px',
|
|
28
29
|
objectFit: 'contain',
|
|
29
30
|
objectPosition: 'left center',
|
|
30
|
-
} }));
|
|
31
|
+
} }, `${item.type}-${index}`));
|
|
31
32
|
case 'token':
|
|
32
|
-
return (0, jsx_runtime_1.jsx)(token_1.default, { data: item.data, locale: locale });
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(token_1.default, { data: item.data, locale: locale }, `${item.type}-${index}`);
|
|
33
34
|
case 'transaction':
|
|
34
|
-
return (0, jsx_runtime_1.jsx)(transaction_1.default, { data: item.data, locale: locale });
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(transaction_1.default, { data: item.data, locale: locale }, `${item.type}-${index}`);
|
|
35
36
|
case 'dapp':
|
|
36
|
-
return (0, jsx_runtime_1.jsx)(dapp_1.default, { data: item.data });
|
|
37
|
+
return (0, jsx_runtime_1.jsx)(dapp_1.default, { data: item.data }, `${item.type}-${index}`);
|
|
37
38
|
case 'link':
|
|
38
|
-
return (0, jsx_runtime_1.jsx)(article_1.default, { data: item.data });
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(article_1.default, { data: item.data }, `${item.type}-${index}`);
|
|
39
40
|
case 'divider':
|
|
40
|
-
return (0, jsx_runtime_1.jsx)(components_1.Hr, {});
|
|
41
|
+
return (0, jsx_runtime_1.jsx)(components_1.Hr, {}, `${item.type}-${index}`);
|
|
41
42
|
case 'vc':
|
|
42
43
|
case 'asset':
|
|
43
|
-
return (0, jsx_runtime_1.jsx)(asset_1.default, { data: item.data, locale: locale });
|
|
44
|
+
return (0, jsx_runtime_1.jsx)(asset_1.default, { data: item.data, locale: locale }, `${item.type}-${index}`);
|
|
44
45
|
case 'section':
|
|
45
|
-
return (0, jsx_runtime_1.jsx)(compose_1.default, { data: item.fields });
|
|
46
|
+
return (0, jsx_runtime_1.jsx)(compose_1.default, { data: item.fields }, `${item.type}-${index}`);
|
|
46
47
|
default:
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
49
|
-
})
|
|
50
|
-
|
|
50
|
+
})
|
|
51
|
+
.filter(Boolean);
|
|
52
|
+
return attachmentList.length > 0 ? ((0, jsx_runtime_1.jsx)(components_1.Section, { style: Object.assign(Object.assign({}, style_1.attachmentsStyle), { borderColor: style_1.severityColorMap[severity] || style_1.severityColorMap.normal }), children: attachmentList })) : null;
|
|
51
53
|
}
|
|
52
54
|
exports.default = Attachments;
|
|
@@ -12,10 +12,10 @@ function Compose({ data }) {
|
|
|
12
12
|
const firstCol = data[i];
|
|
13
13
|
const secondCol = data[i + 1];
|
|
14
14
|
if (firstCol && secondCol) {
|
|
15
|
-
content.push((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data, style: { whiteSpace: 'nowrap' } }) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: secondCol.data, style: { wordBreak: 'break-all' } }) })] }));
|
|
15
|
+
content.push((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data, style: { whiteSpace: 'nowrap' } }) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: secondCol.data, style: { wordBreak: 'break-all' } }) })] }, i));
|
|
16
16
|
}
|
|
17
17
|
else if (firstCol) {
|
|
18
|
-
content.push((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data }) }) }));
|
|
18
|
+
content.push((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data }) }) }, i));
|
|
19
19
|
}
|
|
20
20
|
i += 2;
|
|
21
21
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const components_1 = require("@react-email/components");
|
|
8
|
+
const attachments_1 = __importDefault(require("./attachments"));
|
|
9
|
+
const actions_1 = __importDefault(require("./actions"));
|
|
10
|
+
const highlight_1 = require("../_libs/highlight");
|
|
11
|
+
const style_1 = require("../_libs/style");
|
|
12
|
+
function Content({ title, content, attachments = [], actions = [], style = {}, locale, raw = false, severity = 'normal', body = null, }) {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Section, { style: style, children: [title ? (0, jsx_runtime_1.jsx)(components_1.Heading, { style: style_1.h1Style, children: title }) : null, content ? ((0, jsx_runtime_1.jsx)(components_1.Text, { className: "content", style: { whiteSpace: 'pre-line!important' }, dangerouslySetInnerHTML: { __html: raw ? content : (0, highlight_1.toClickableSpan)(content) } })) : null, body, (0, jsx_runtime_1.jsx)(attachments_1.default, { severity: severity, attachments: attachments, locale: locale }), (0, jsx_runtime_1.jsx)(actions_1.default, { actions: actions })] }));
|
|
14
|
+
}
|
|
15
|
+
exports.default = Content;
|
|
@@ -10,7 +10,7 @@ const components_1 = require("@react-email/components");
|
|
|
10
10
|
const constant_1 = require("@abtnode/constant");
|
|
11
11
|
const copyright_1 = __importDefault(require("./copyright"));
|
|
12
12
|
const powered_by_1 = __importDefault(require("./powered-by"));
|
|
13
|
-
const style_1 = require("../
|
|
13
|
+
const style_1 = require("../_libs/style");
|
|
14
14
|
function Footer({ showLogo = false, showCopyright = false, showBlocklet = true, appInfo, locale = 'en', unsubscribeToken, userInfo, poweredBy, }) {
|
|
15
15
|
const userInfoName = (userInfo === null || userInfo === void 0 ? void 0 : userInfo.fullName) || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email);
|
|
16
16
|
const userInfoDescription = userInfo === null || userInfo === void 0 ? void 0 : userInfo.did;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const components_1 = require("@react-email/components");
|
|
5
|
-
const style_1 = require("../
|
|
5
|
+
const style_1 = require("../_libs/style");
|
|
6
6
|
function PoweredBy(props) {
|
|
7
7
|
const content = props.url ? ((0, jsx_runtime_1.jsx)(components_1.Link, { href: props.url, target: "_blank", style: Object.assign(Object.assign({}, style_1.linkStyle), { color: '#898989' }), children: props.name })) : (props.name);
|
|
8
8
|
return ((0, jsx_runtime_1.jsxs)(components_1.Text, { style: {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const components_1 = require("@react-email/components");
|
|
5
|
-
const chain_1 = require("../
|
|
6
|
-
const style_1 = require("../
|
|
5
|
+
const chain_1 = require("../_libs/chain");
|
|
6
|
+
const style_1 = require("../_libs/style");
|
|
7
7
|
function Token({ locale, data, }) {
|
|
8
8
|
const showAddress = data.address.slice(0, 4) + '...' + data.address.slice(-4);
|
|
9
9
|
const from = { zh: '来自', en: 'from' }[locale] || 'from';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const chain_1 = require("../
|
|
4
|
+
const chain_1 = require("../_libs/chain");
|
|
5
5
|
function Transaction({ locale, data, }) {
|
|
6
6
|
const chainHost = (0, chain_1.getChainHost)(data.chainId);
|
|
7
7
|
const url = `https://${chainHost}/explorer/txs/${data.hash}`;
|
|
@@ -6,16 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.NotificationEmail = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const components_1 = require("@react-email/components");
|
|
9
|
-
const footer_1 = __importDefault(require("../
|
|
10
|
-
const content_1 = __importDefault(require("../
|
|
11
|
-
const layout_1 = __importDefault(require("../
|
|
12
|
-
const header_1 = __importDefault(require("../
|
|
13
|
-
const NotificationEmail = ({ title, body = '', raw = false, // do not convert body to clickable span
|
|
14
|
-
subject, attachments = [], actions = [], appInfo, locale = 'en', severity = 'normal', unsubscribeToken, userInfo, poweredBy, }) => {
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(layout_1.default, { mainStyle: main, subject: subject, children: [(0, jsx_runtime_1.jsx)(components_1.Preview, { children: subject }), (0, jsx_runtime_1.jsx)(header_1.default, { appInfo: appInfo }), (0, jsx_runtime_1.jsx)(content_1.default, { style: container, title: title, content: body, attachments: attachments, actions: actions, locale: locale, severity: severity, raw: raw }), (0, jsx_runtime_1.jsx)(footer_1.default, { showCopyright: false, poweredBy: poweredBy, showBlocklet: true, appInfo: appInfo, locale: locale, unsubscribeToken: unsubscribeToken, userInfo: userInfo })] }));
|
|
16
|
-
};
|
|
17
|
-
exports.NotificationEmail = NotificationEmail;
|
|
18
|
-
exports.default = exports.NotificationEmail;
|
|
9
|
+
const footer_1 = __importDefault(require("../_components/footer"));
|
|
10
|
+
const content_1 = __importDefault(require("../_components/content"));
|
|
11
|
+
const layout_1 = __importDefault(require("../_components/layout"));
|
|
12
|
+
const header_1 = __importDefault(require("../_components/header"));
|
|
19
13
|
const fontFamily = 'HelveticaNeue,Helvetica,Arial,sans-serif';
|
|
20
14
|
const main = {
|
|
21
15
|
fontFamily,
|
|
@@ -25,3 +19,9 @@ const container = {
|
|
|
25
19
|
backgroundColor: '#ffffff',
|
|
26
20
|
padding: '5px 50px 30px 60px',
|
|
27
21
|
};
|
|
22
|
+
const NotificationEmail = ({ title, body = '', raw = false, // do not convert body to clickable span
|
|
23
|
+
subject, attachments = [], actions = [], appInfo, locale = 'en', severity = 'normal', unsubscribeToken, userInfo, poweredBy, }) => {
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(layout_1.default, { mainStyle: main, subject: subject, children: [(0, jsx_runtime_1.jsx)(components_1.Preview, { children: subject }), (0, jsx_runtime_1.jsx)(header_1.default, { appInfo: appInfo }), (0, jsx_runtime_1.jsx)(content_1.default, { style: container, title: title, content: body, attachments: attachments, actions: actions, locale: locale, severity: severity, raw: raw }), (0, jsx_runtime_1.jsx)(footer_1.default, { showCopyright: false, poweredBy: poweredBy, showBlocklet: true, appInfo: appInfo, locale: locale, unsubscribeToken: unsubscribeToken, userInfo: userInfo })] }));
|
|
25
|
+
};
|
|
26
|
+
exports.NotificationEmail = NotificationEmail;
|
|
27
|
+
exports.default = exports.NotificationEmail;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VerifyCodeBody = VerifyCodeBody;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const components_1 = require("@react-email/components");
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const constant_1 = require("@abtnode/constant");
|
|
11
|
+
const actions_1 = __importDefault(require("../_components/actions"));
|
|
12
|
+
// HACK: 只是短暂为了兼容现有 launcher 转发逻辑
|
|
13
|
+
function VerifyCodeBody({ appName, locale = 'en', code, magicLink, }) {
|
|
14
|
+
const translations = {
|
|
15
|
+
en: {
|
|
16
|
+
title: `Login to ${appName}`,
|
|
17
|
+
followConfirmation: `Thank you for signing up for ${appName}. To confirm your account, please follow the button below.`,
|
|
18
|
+
confirmButton: 'Confirm account',
|
|
19
|
+
useConfirmLink: 'If Confirm Button does not work, please use the link below.',
|
|
20
|
+
orEnterCode: `Or enter the following code in the application: `,
|
|
21
|
+
followEnterCode: `Thank you for signing up for ${appName}. To confirm your account, please enter the following code in the application`,
|
|
22
|
+
codeExpiresIn: `This code expires in ${constant_1.VERIFY_CODE_TTL / 60 / 1000} minutes.`,
|
|
23
|
+
doNotShareCodeTitle: 'Do NOT share this code with anyone.',
|
|
24
|
+
doNotShareCode: "Only enter this code on the official application's website. If someone asks for this code, it could be a scam.",
|
|
25
|
+
},
|
|
26
|
+
zh: {
|
|
27
|
+
title: `登录 ${appName}`,
|
|
28
|
+
followConfirmation: `感谢您注册 ${appName},请点击以下按钮确认您的账户。`,
|
|
29
|
+
confirmButton: '确认账户',
|
|
30
|
+
useConfirmLink: '如果确认按钮无法工作,请使用以下链接。',
|
|
31
|
+
orEnterCode: `或者在应用中输入以下代码:`,
|
|
32
|
+
followEnterCode: `感谢您注册 ${appName},请在应用中输入以下代码确认您的账户。`,
|
|
33
|
+
codeExpiresIn: `此代码将在${constant_1.VERIFY_CODE_TTL / 60 / 1000}分钟内过期。`,
|
|
34
|
+
doNotShareCodeTitle: '请勿将此代码分享给任何人。',
|
|
35
|
+
doNotShareCode: '请仅在官方应用的网站上输入此代码。如果有人要求提供此代码,这可能是一个骗局。',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const translation = translations[locale] || translations.en;
|
|
39
|
+
if (code && magicLink) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.followConfirmation }), (0, jsx_runtime_1.jsx)(actions_1.default, { actions: [{ title: translation.confirmButton, link: magicLink }] }), (0, jsx_runtime_1.jsx)(components_1.Hr, {}), (0, jsx_runtime_1.jsxs)(components_1.Text, { children: [translation.orEnterCode, (0, jsx_runtime_1.jsx)("strong", { children: code })] }), (0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.codeExpiresIn }), (0, jsx_runtime_1.jsxs)(components_1.Text, { children: [(0, jsx_runtime_1.jsx)("strong", { children: translation.doNotShareCodeTitle }), " ", translation.doNotShareCode] })] }));
|
|
41
|
+
}
|
|
42
|
+
if (magicLink) {
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.followConfirmation }), (0, jsx_runtime_1.jsx)(actions_1.default, { actions: [{ title: translation.confirmButton, link: magicLink }] }), (0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.useConfirmLink }), (0, jsx_runtime_1.jsx)(components_1.Link, { href: magicLink, children: magicLink })] }));
|
|
44
|
+
}
|
|
45
|
+
if (code) {
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.followEnterCode }), (0, jsx_runtime_1.jsx)(components_1.Heading, { style: { textAlign: 'center' }, children: code }), (0, jsx_runtime_1.jsx)(components_1.Text, { children: translation.codeExpiresIn }), (0, jsx_runtime_1.jsxs)(components_1.Text, { children: [(0, jsx_runtime_1.jsx)("strong", { children: translation.doNotShareCodeTitle }), " ", translation.doNotShareCode] })] }));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = VerifyCodeBody;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VerifyCodeEmail = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const components_1 = require("@react-email/components");
|
|
9
|
+
const footer_1 = __importDefault(require("../_components/footer"));
|
|
10
|
+
const content_1 = __importDefault(require("../_components/content"));
|
|
11
|
+
const layout_1 = __importDefault(require("../_components/layout"));
|
|
12
|
+
const header_1 = __importDefault(require("../_components/header"));
|
|
13
|
+
const verify_code_body_1 = __importDefault(require("./verify-code-body"));
|
|
14
|
+
const fontFamily = 'HelveticaNeue,Helvetica,Arial,sans-serif';
|
|
15
|
+
const main = {
|
|
16
|
+
fontFamily,
|
|
17
|
+
};
|
|
18
|
+
const container = {
|
|
19
|
+
margin: '20px auto',
|
|
20
|
+
backgroundColor: '#ffffff',
|
|
21
|
+
padding: '5px 50px 30px 60px',
|
|
22
|
+
};
|
|
23
|
+
const VerifyCodeEmail = ({ code, magicLink, appInfo, locale = 'en', userInfo, poweredBy, }) => {
|
|
24
|
+
const translations = {
|
|
25
|
+
en: {
|
|
26
|
+
title: `Login to ${appInfo.title}`,
|
|
27
|
+
},
|
|
28
|
+
zh: {
|
|
29
|
+
title: `登录 ${appInfo.title}`,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const translation = translations[locale] || translations.en;
|
|
33
|
+
const subject = `[${appInfo.title}] ${translation.title}`;
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(layout_1.default, { mainStyle: main, subject: subject, children: [(0, jsx_runtime_1.jsx)(components_1.Preview, { children: subject }), (0, jsx_runtime_1.jsx)(header_1.default, { appInfo: appInfo }), (0, jsx_runtime_1.jsx)(content_1.default, { style: container, locale: locale, title: translation.title, body: (0, jsx_runtime_1.jsx)(verify_code_body_1.default, { locale: locale, code: code, magicLink: magicLink, appName: appInfo.title }) }), (0, jsx_runtime_1.jsx)(footer_1.default, { showCopyright: false, poweredBy: poweredBy, showBlocklet: true, appInfo: appInfo, locale: locale, userInfo: userInfo })] }));
|
|
35
|
+
};
|
|
36
|
+
exports.VerifyCodeEmail = VerifyCodeEmail;
|
|
37
|
+
exports.default = exports.VerifyCodeEmail;
|
package/api/index.js
CHANGED
|
@@ -8,13 +8,12 @@ const onProxyRes = require('on-headers');
|
|
|
8
8
|
require('express-async-errors');
|
|
9
9
|
const cors = require('cors');
|
|
10
10
|
const cookieParser = require('cookie-parser');
|
|
11
|
-
const bodyParser = require('body-parser');
|
|
12
11
|
const httpProxy = require('@arcblock/http-proxy');
|
|
13
12
|
const { minimatch } = require('minimatch');
|
|
14
13
|
const helmet = require('helmet');
|
|
15
14
|
const isUrl = require('is-url');
|
|
16
15
|
|
|
17
|
-
const { WELLKNOWN_SERVICE_PATH_PREFIX, EVENTS
|
|
16
|
+
const { WELLKNOWN_SERVICE_PATH_PREFIX, EVENTS } = require('@abtnode/constant');
|
|
18
17
|
const {
|
|
19
18
|
BlockletEvents,
|
|
20
19
|
BlockletInternalEvents,
|
|
@@ -81,7 +80,9 @@ const checkBlocklet = require('./middlewares/check-blocklet');
|
|
|
81
80
|
const proxyToDaemon = require('./middlewares/proxy-to-daemon');
|
|
82
81
|
const attachSharedUtils = require('./util/attach-shared-utils');
|
|
83
82
|
const createMediaRoutes = require('./routes/media');
|
|
83
|
+
const createMCPRoutes = require('./routes/mcp');
|
|
84
84
|
const ensureBlocklet = require('./middlewares/ensure-blocklet');
|
|
85
|
+
const bodyParser = require('./middlewares/body-parser');
|
|
85
86
|
|
|
86
87
|
const agent = new http.Agent({ maxSockets: Number.MAX_VALUE });
|
|
87
88
|
|
|
@@ -143,10 +144,6 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
143
144
|
// eslint-disable-next-line no-unused-vars
|
|
144
145
|
proxy.on('proxyReq', (proxyReq, req, res) => {
|
|
145
146
|
req.proxyReqStart = Date.now();
|
|
146
|
-
if (req.rawBody) {
|
|
147
|
-
// Since we already consumed request stream, we need to write req.rawBody to proxy request here
|
|
148
|
-
proxyReq.write(req.rawBody);
|
|
149
|
-
}
|
|
150
147
|
});
|
|
151
148
|
const SECURITY_HEADER_MAP = {
|
|
152
149
|
contentSecurityPolicy: 'content-security-policy',
|
|
@@ -286,6 +283,7 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
286
283
|
!req.path.startsWith(`${WELLKNOWN_SERVICE_PATH_PREFIX}/studio`) &&
|
|
287
284
|
req.path.startsWith(WELLKNOWN_SERVICE_PATH_PREFIX)
|
|
288
285
|
) {
|
|
286
|
+
const iconifyDomains = ['https://*.simplesvg.com', 'https://*.iconify.design', 'https://*.unisvg.com'];
|
|
289
287
|
const whitelist = {
|
|
290
288
|
// required for nft display and blocklet discover
|
|
291
289
|
official: [
|
|
@@ -301,15 +299,7 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
301
299
|
system: ['https://*.did.abtnet.io', 'https://*.ip.abtnet.io', 'https://*.slp.abtnet.io'],
|
|
302
300
|
|
|
303
301
|
// required for icon request and display
|
|
304
|
-
thirdParty: [
|
|
305
|
-
'https://*.simplesvg.com',
|
|
306
|
-
'https://*.iconify.design',
|
|
307
|
-
'https://*.unisvg.com',
|
|
308
|
-
'https://js.stripe.com',
|
|
309
|
-
'https://ipapi.co',
|
|
310
|
-
'https://js.stripe.com',
|
|
311
|
-
'https://ipapi.co',
|
|
312
|
-
],
|
|
302
|
+
thirdParty: ['https://js.stripe.com', 'https://ipapi.co', ...iconifyDomains],
|
|
313
303
|
};
|
|
314
304
|
|
|
315
305
|
// server level dynamic domains
|
|
@@ -360,7 +350,7 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
360
350
|
directives: {
|
|
361
351
|
defaultSrc: ["'self'"],
|
|
362
352
|
baseUri: ["'self'"],
|
|
363
|
-
scriptSrc: ["'self'",
|
|
353
|
+
scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'", 'https://unpkg.com'].filter(Boolean),
|
|
364
354
|
styleSrc: ["'self'", "'unsafe-inline'", 'https:'],
|
|
365
355
|
imgSrc: [
|
|
366
356
|
"'self'",
|
|
@@ -369,7 +359,10 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
369
359
|
'https://cdnjs.cloudflare.com',
|
|
370
360
|
...whitelist.spaces,
|
|
371
361
|
...whitelist.official,
|
|
362
|
+
...iconifyDomains,
|
|
372
363
|
].filter(Boolean),
|
|
364
|
+
// 支持 google 字体
|
|
365
|
+
fontSrc: ['self', 'https://fonts.gstatic.com'],
|
|
373
366
|
connectSrc: uniq(
|
|
374
367
|
[
|
|
375
368
|
"'self'",
|
|
@@ -442,7 +435,6 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
442
435
|
|
|
443
436
|
// Http server
|
|
444
437
|
const server = express();
|
|
445
|
-
const maxUploadSize = Number(process.env.MAX_UPLOAD_FILE_SIZE) || MAX_UPLOAD_FILE_SIZE;
|
|
446
438
|
|
|
447
439
|
// A simple websocket router
|
|
448
440
|
const wsRoutingRules = [];
|
|
@@ -457,17 +449,6 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
457
449
|
|
|
458
450
|
server.use(cookieParser());
|
|
459
451
|
|
|
460
|
-
// https://flaviocopes.com/express-get-raw-body/
|
|
461
|
-
// Side effects: this will double the memory consumption
|
|
462
|
-
// Required because we need to do reverse proxy to upstream blocklets
|
|
463
|
-
const verify = (req, res, buf) => {
|
|
464
|
-
req.rawBody = buf;
|
|
465
|
-
};
|
|
466
|
-
server.use(bodyParser.json({ limit: `${maxUploadSize}mb`, verify }));
|
|
467
|
-
server.use(bodyParser.urlencoded({ extended: true, limit: `${maxUploadSize}mb`, verify }));
|
|
468
|
-
|
|
469
|
-
// NOTE: will be overwrite by Blocklet Server in production
|
|
470
|
-
|
|
471
452
|
// Shared util functions on current request
|
|
472
453
|
server.use((req, res, next) => {
|
|
473
454
|
// NOTICE: 增加了 req 上的公用函数,比如 req.getBlocklet
|
|
@@ -613,6 +594,48 @@ self.blocklet = {
|
|
|
613
594
|
/* istanbul ignore if */
|
|
614
595
|
setupAccessLogger(server, isProduction ? getAccessLogStream() : undefined, true);
|
|
615
596
|
|
|
597
|
+
// Auth: login token and user info
|
|
598
|
+
server.use(authMiddlewares.sessionBearerToken);
|
|
599
|
+
server.use(authMiddlewares.userInfo);
|
|
600
|
+
|
|
601
|
+
// API: gql
|
|
602
|
+
[
|
|
603
|
+
'/api/gql',
|
|
604
|
+
'/api/project/:did/:projectId/:type/upload',
|
|
605
|
+
'/api/project/:did/:projectId/:releaseId/download/:file',
|
|
606
|
+
].forEach((pathname) => {
|
|
607
|
+
server.use(
|
|
608
|
+
`${WELLKNOWN_SERVICE_PATH_PREFIX}${pathname}`,
|
|
609
|
+
async (req, res, next) => {
|
|
610
|
+
let info;
|
|
611
|
+
try {
|
|
612
|
+
info = await req.getBlockletInfo();
|
|
613
|
+
} catch (_) {
|
|
614
|
+
//
|
|
615
|
+
}
|
|
616
|
+
req.tenantMode = info?.tenantMode || BLOCKLET_TENANT_MODES.SINGLE;
|
|
617
|
+
if (req.tenantMode === BLOCKLET_TENANT_MODES.MULTIPLE || pathname === '/api/gql') {
|
|
618
|
+
checkGuestPermission(req, res, next);
|
|
619
|
+
} else {
|
|
620
|
+
checkMemberPermission(req, res, next);
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
proxyToDaemon({ proxy, node })
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
[
|
|
628
|
+
'/api/preferences',
|
|
629
|
+
'/api/theme',
|
|
630
|
+
'/api/uploads',
|
|
631
|
+
// 将上传 logo 代理给 daemon 完成
|
|
632
|
+
'/blocklet/logo/upload/:logoType/:did',
|
|
633
|
+
// media 相关处理代理到 daemon 中进行处理
|
|
634
|
+
'/api/media/upload/**',
|
|
635
|
+
].forEach((pathname) => {
|
|
636
|
+
server.use(`${WELLKNOWN_SERVICE_PATH_PREFIX}${pathname}`, checkMemberPermission, proxyToDaemon({ proxy, node }));
|
|
637
|
+
});
|
|
638
|
+
|
|
616
639
|
// Static assets
|
|
617
640
|
StaticService.attachStaticResources({
|
|
618
641
|
app: server,
|
|
@@ -625,6 +648,9 @@ self.blocklet = {
|
|
|
625
648
|
],
|
|
626
649
|
});
|
|
627
650
|
|
|
651
|
+
// This must come after all proxied requests that begins with WELLKNOWN_SERVICE_PATH_PREFIX
|
|
652
|
+
server.use(WELLKNOWN_SERVICE_PATH_PREFIX, bodyParser);
|
|
653
|
+
|
|
628
654
|
// Studio service
|
|
629
655
|
StudioService.init(server, node);
|
|
630
656
|
|
|
@@ -641,10 +667,6 @@ self.blocklet = {
|
|
|
641
667
|
// API: auth: before auth middleware
|
|
642
668
|
authRoutes.createSessionRoutes.init(server, node);
|
|
643
669
|
|
|
644
|
-
// Middleware: auth info
|
|
645
|
-
server.use(authMiddlewares.sessionBearerToken);
|
|
646
|
-
server.use(authMiddlewares.userInfo);
|
|
647
|
-
|
|
648
670
|
// Analytics
|
|
649
671
|
AnalyticService.init({ app: server, node });
|
|
650
672
|
|
|
@@ -663,6 +685,9 @@ self.blocklet = {
|
|
|
663
685
|
// media
|
|
664
686
|
createMediaRoutes.init(server, node, options);
|
|
665
687
|
|
|
688
|
+
// MCP Service
|
|
689
|
+
createMCPRoutes.init(server, node);
|
|
690
|
+
|
|
666
691
|
// API: auth
|
|
667
692
|
createOAuthRoutes.init(server, node, options);
|
|
668
693
|
createFederatedRoutes.init(server, node, options);
|
|
@@ -675,45 +700,8 @@ self.blocklet = {
|
|
|
675
700
|
createConnectRelayRoutes.init(server, node, options, wsRouter);
|
|
676
701
|
authRoutes.attachDidAuthHandlers(server);
|
|
677
702
|
authRoutes.createPassportRoutes.init(server, node);
|
|
678
|
-
authRoutes.createPasskeyRoutes.init(server
|
|
679
|
-
authRoutes.createCommonRoutes.init(server
|
|
680
|
-
|
|
681
|
-
// API: gql
|
|
682
|
-
[
|
|
683
|
-
'/api/gql',
|
|
684
|
-
'/api/project/:did/:projectId/:type/upload',
|
|
685
|
-
'/api/project/:did/:projectId/:releaseId/download/:file',
|
|
686
|
-
].forEach((pathname) => {
|
|
687
|
-
server.use(
|
|
688
|
-
`${WELLKNOWN_SERVICE_PATH_PREFIX}${pathname}`,
|
|
689
|
-
async (req, res, next) => {
|
|
690
|
-
let info;
|
|
691
|
-
try {
|
|
692
|
-
info = await req.getBlockletInfo();
|
|
693
|
-
} catch (_) {
|
|
694
|
-
//
|
|
695
|
-
}
|
|
696
|
-
req.tenantMode = info?.tenantMode || BLOCKLET_TENANT_MODES.SINGLE;
|
|
697
|
-
if (req.tenantMode === BLOCKLET_TENANT_MODES.MULTIPLE || pathname === '/api/gql') {
|
|
698
|
-
checkGuestPermission(req, res, next);
|
|
699
|
-
} else {
|
|
700
|
-
checkMemberPermission(req, res, next);
|
|
701
|
-
}
|
|
702
|
-
},
|
|
703
|
-
proxyToDaemon({ proxy, node })
|
|
704
|
-
);
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
[
|
|
708
|
-
'/api/preferences',
|
|
709
|
-
'/api/uploads',
|
|
710
|
-
// 将上传 logo 代理给 daemon 完成
|
|
711
|
-
'/blocklet/logo/upload/:logoType/:did',
|
|
712
|
-
// media 相关处理代理到 daemon 中进行处理
|
|
713
|
-
'/api/media/upload/**',
|
|
714
|
-
].forEach((pathname) => {
|
|
715
|
-
server.use(`${WELLKNOWN_SERVICE_PATH_PREFIX}${pathname}`, checkMemberPermission, proxyToDaemon({ proxy, node }));
|
|
716
|
-
});
|
|
703
|
+
authRoutes.createPasskeyRoutes.init(server);
|
|
704
|
+
authRoutes.createCommonRoutes.init(server);
|
|
717
705
|
|
|
718
706
|
// API: dns resolver
|
|
719
707
|
createDnsResolver.init(server);
|
package/api/libs/auth/utils.js
CHANGED
|
@@ -9,6 +9,7 @@ const pick = require('lodash/pick');
|
|
|
9
9
|
const uniq = require('lodash/uniq');
|
|
10
10
|
const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
11
11
|
|
|
12
|
+
const { PASSPORT_LOG_ACTION, PASSPORT_ISSUE_ACTION } = require('@abtnode/constant');
|
|
12
13
|
const { sendToUser } = require('../notification');
|
|
13
14
|
|
|
14
15
|
const PASSPORT_VC_TYPES = [VC_TYPE_GENERAL_PASSPORT, VC_TYPE_NODE_PASSPORT];
|
|
@@ -62,11 +63,11 @@ async function transferPassport(fromUser, toUser, { req, teamDid, node, nodeInfo
|
|
|
62
63
|
data: {
|
|
63
64
|
credential: vc,
|
|
64
65
|
tag: x.name,
|
|
65
|
-
display: x.display,
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
|
+
|
|
70
71
|
const insertPassportList = attachments.map((item, index) => {
|
|
71
72
|
return {
|
|
72
73
|
...createUserPassport(item.data.credential, { role: item.data.tag, display: item.data.display }),
|
|
@@ -119,6 +120,24 @@ async function transferPassport(fromUser, toUser, { req, teamDid, node, nodeInfo
|
|
|
119
120
|
},
|
|
120
121
|
});
|
|
121
122
|
}
|
|
123
|
+
|
|
124
|
+
await Promise.all(
|
|
125
|
+
insertPassportList.map((item) => {
|
|
126
|
+
return node.createPassportLog(
|
|
127
|
+
teamDid,
|
|
128
|
+
{
|
|
129
|
+
passportId: item.id,
|
|
130
|
+
action: PASSPORT_LOG_ACTION.ISSUE,
|
|
131
|
+
operatorDid: fromUser.did,
|
|
132
|
+
metadata: {
|
|
133
|
+
action: PASSPORT_ISSUE_ACTION.ISSUE_ON_TRANSFER,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
req
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
);
|
|
140
|
+
|
|
122
141
|
if (revokePassport) {
|
|
123
142
|
const revokePendingList = waitPassportList
|
|
124
143
|
.filter((item) => item.id)
|