@abtnode/blocklet-services 1.16.41-beta-20250318-012955-51b0ae39 → 1.16.41-beta-20250319-034744-5c62f533
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/libs/connect/session.js +23 -12
- package/api/libs/open-graph/index.js +21 -11
- package/api/libs/open-graph/template.js +42 -2
- package/api/routes/user.js +51 -13
- package/api/services/auth/connect/receive-transfer-app-owner.js +15 -3
- package/api/services/auth/connect/rotate-key-pair.js +1 -1
- package/api/util/attach-shared-utils.js +1 -1
- package/dist/assets/{ArrowDropDown-qWbq0JMo.js → ArrowDropDown-ydRfHJ2x.js} +1 -1
- package/dist/assets/{CheckCircle-B3DI9-8u.js → CheckCircle-DgSwRUf8.js} +1 -1
- package/dist/assets/{ChevronLeft-QmS7XZ0_.js → ChevronLeft-CqDoHwdJ.js} +1 -1
- package/dist/assets/{ChevronRight-C-wVLPcS.js → ChevronRight-Bpkf9aqI.js} +1 -1
- package/dist/assets/{DeleteOutline-DMkWy6Ct.js → DeleteOutline-D4DYIaUj.js} +1 -1
- package/dist/assets/{Done-DMtnp3P-.js → Done-B8c93MpP.js} +1 -1
- package/dist/assets/{Download-BBNJo00y.js → Download-DANYdeZR.js} +1 -1
- package/dist/assets/{Error-H665t4TD.js → Error-wKO1hXtU.js} +1 -1
- package/dist/assets/{ExpandLess-DBi9UnX8.js → ExpandLess-BqrBuxL9.js} +1 -1
- package/dist/assets/{Google-Dmn0CqqC.js → Google-CBPWeaVC.js} +4 -4
- package/dist/assets/{InfoOutlined-A0h5OX7J.js → InfoOutlined-HP5LuELQ.js} +1 -1
- package/dist/assets/{Launch-Ca2Avd-H.js → Launch-XvyEoGhF.js} +1 -1
- package/dist/assets/{LaunchOutlined-LqfRJ-HK.js → LaunchOutlined-BfbVRiJT.js} +1 -1
- package/dist/assets/{MoreHoriz-I4HIq7xK.js → MoreHoriz-Cv3BqpRU.js} +1 -1
- package/dist/assets/{PlayArrow-ByDKBx4g.js → PlayArrow-DI84Lay5.js} +1 -1
- package/dist/assets/{ViewList-CHv7QZAz.js → ViewList-DLzG9ldE.js} +1 -1
- package/dist/assets/{access-control-CWfdDjGm.js → access-control-DyHt8ppX.js} +1 -1
- package/dist/assets/{actions-BlT0cxUG.js → actions-CBPbCBQc.js} +1 -1
- package/dist/assets/add-component-core-DOdhiJes.js +765 -0
- package/dist/assets/add-resource-CGPM0kPR.js +1 -0
- package/dist/assets/{addon-CY_qIvTD.js → addon-bbJfiLal.js} +1 -1
- package/dist/assets/{analytics-DjXhSquU.js → analytics-BRjS4mY-.js} +28 -28
- package/dist/assets/api-CvDkueg1.js +1 -0
- package/dist/assets/ar-A7PXaQSB.js +3 -0
- package/dist/assets/{audit-logs-f63v6qb6.js → audit-logs-D1W37Cj4.js} +1 -1
- package/dist/assets/{base32-BFbPN3_B.js → base32-gJJTbpiB.js} +1 -1
- package/dist/assets/{branding-M3jcBXbn.js → branding-DR3Jnq-d.js} +2 -2
- package/dist/assets/{bundle-avatar-CV6DwAbG.js → bundle-avatar-Eqwd2qUG.js} +1 -1
- package/dist/assets/{button-CobAXYnZ.js → button-BqyvGZC-.js} +1 -1
- package/dist/assets/{click-to-copy-4DAi5FNW.js → click-to-copy-Dc16fHKA.js} +1 -1
- package/dist/assets/{complete-BV8Jki_A.js → complete-BzSPyjUA.js} +1 -1
- package/dist/assets/{component-CHjmE2X3.js → component--_f-xKi7.js} +1 -1
- package/dist/assets/{config-AQxF4UXZ.js → config-BDpdqYom.js} +1 -1
- package/dist/assets/{config-D26mW5ts.js → config-C3tQWDAE.js} +1 -1
- package/dist/assets/config-navigation-BrXS6Zm4.js +29 -0
- package/dist/assets/{config-space-CEfS-edx.js → config-space-BZu4nd7t.js} +1 -1
- package/dist/assets/{confirm-AquAQGjx.js → confirm-CCmbVvGp.js} +1 -1
- package/dist/assets/{connect-C3HOcFE4.js → connect-Bgm2clKz.js} +1 -1
- package/dist/assets/{connect-BUUxpeii.js → connect-C1EdscR7.js} +1 -1
- package/dist/assets/{connect-to-DIh1QUDe.js → connect-to-CAjdR1Vi.js} +1 -1
- package/dist/assets/{dashboard-CgU5vYTc.js → dashboard-C2dbiNOp.js} +3 -3
- package/dist/assets/de-DQLOqs4x.js +3 -0
- package/dist/assets/{delete-confirm-3NLpiaw3.js → delete-confirm-CVo1ye7X.js} +1 -1
- package/dist/assets/{did-address-BOFBaeCw.js → did-address-DIKoCoBp.js} +1 -1
- package/dist/assets/{domain-By_3gkYk.js → domain-BQkRhwGe.js} +1 -1
- package/dist/assets/{domain-action-card-3cxCJSVs.js → domain-action-card-Dlgq4rsm.js} +1 -1
- package/dist/assets/domains-DaOwHgX-.js +1 -0
- package/dist/assets/{email-CIF4NKca.js → email-BHF0jLjs.js} +1 -1
- package/dist/assets/es-Wyib4tkS.js +3 -0
- package/dist/assets/{exchange-passport-CzS1Xb1d.js → exchange-passport-C6TpmUyM.js} +1 -1
- package/dist/assets/{form-text-input-BAXS_3xu.js → form-text-input-C8x5debf.js} +1 -1
- package/dist/assets/fr-CTdi8lPh.js +3 -0
- package/dist/assets/{fuel-mq0wsfbI.js → fuel-DQMzXBHQ.js} +1 -1
- package/dist/assets/{fullpage-Bo8SoEA1.js → fullpage-kiX9qo3H.js} +1 -1
- package/dist/assets/{get-safe-url-RpxfbZMw.js → get-safe-url-BvS0hy8W.js} +1 -1
- package/dist/assets/{get-safe-url-zNlUtfl-.js → get-safe-url-CXJBjnNj.js} +1 -1
- package/dist/assets/hi-Dk3MVpw6.js +1 -0
- package/dist/assets/{home-D5_68Jum.js → home-CfRR-l78.js} +1 -1
- package/dist/assets/id-BqyOVEFD.js +3 -0
- package/dist/assets/{iframe-Dg-K9tKI.js → iframe-C0FAfo1V.js} +1 -1
- package/dist/assets/{index-BNbCkJGk.js → index-BL64rJ3g.js} +1 -1
- package/dist/assets/{index-B1eW_9jO.js → index-BVjGveR4.js} +1 -1
- package/dist/assets/{index-9xLdpFIQ.js → index-BsMTGy4m.js} +1 -1
- package/dist/assets/{index-CE2_NNHG.js → index-Bv_udrJr.js} +1 -1
- package/dist/assets/index-CYdNDqQ1.js +104 -0
- package/dist/assets/{index-BQaClmdg.js → index-CmyG8bip.js} +1 -1
- package/dist/assets/{index-C564BFHJ.js → index-D2qwAqco.js} +1 -1
- package/dist/assets/{index-CT7JoARP.js → index-D5rqbUOM.js} +1 -1
- package/dist/assets/{index-DNXaKH5L.js → index-D8WxMgot.js} +3 -3
- package/dist/assets/index-DJJGXGi6.js +137 -0
- package/dist/assets/{index-D_zMGAKU.js → index-DQKEK30u.js} +1 -1
- package/dist/assets/{index-BYV52_OZ.js → index-Dal_0cM6.js} +1 -1
- package/dist/assets/{index-DxEhSAq4.js → index-Db8S8FOW.js} +1 -1
- package/dist/assets/{index-BkWaMAY7.js → index-DojJOk-8.js} +1 -1
- package/dist/assets/index-Dv43WFu_.js +220 -0
- package/dist/assets/{index-CosUPggW.js → index-Hc4fe8tE.js} +1 -1
- package/dist/assets/{index-S_LbRHmk.js → index-KP4WZslk.js} +1 -1
- package/dist/assets/{invitation-BXtb5O-j.js → invitation-CDtK_Uyv.js} +1 -1
- package/dist/assets/{invite-WH242mWa.js → invite-DSQnWK9o.js} +1 -1
- package/dist/assets/{issue-passport-B4E8dvwf.js → issue-passport-Bb_7kKPQ.js} +1 -1
- package/dist/assets/{item-CBVHWk6p.js → item-C1U0HVPR.js} +1 -1
- package/dist/assets/ja-BIiN349J.js +3 -0
- package/dist/assets/ko-D9z_sjE3.js +3 -0
- package/dist/assets/{layout-DfSNPKMl.js → layout-Bkn9nC3f.js} +1 -1
- package/dist/assets/{list-CENIOVAm.js → list-BIXoIHH2.js} +2 -1
- package/dist/assets/localization-Cf41fenL.js +1 -0
- package/dist/assets/{log-BXebsTbr.js → log-CuiY798z.js} +1 -1
- package/dist/assets/{login-Ocw0I3pN.js → login-Ds2aHi-M.js} +1 -1
- package/dist/assets/{login-oauth-callback-BRNb2ryy.js → login-oauth-callback-DAKHXtVv.js} +1 -1
- package/dist/assets/{logo-uploader-BbLU5__c.js → logo-uploader-DQCS5qZW.js} +3 -3
- package/dist/assets/{lost-passport-AqXyVK_F.js → lost-passport-DdbK0_Yc.js} +1 -1
- package/dist/assets/{omit-BySqlv7K.js → omit-DVwO9e3E.js} +1 -1
- package/dist/assets/{open-window-Cd4yc8mA.js → open-window-yeboX1Ru.js} +1 -1
- package/dist/assets/overview-DFNGZZos.js +12 -0
- package/dist/assets/{page-header-5sm-cgQK.js → page-header-DyeTxe1U.js} +1 -1
- package/dist/assets/{permission-DQCYXQUJ.js → permission-ZvUR5Tj-.js} +1 -1
- package/dist/assets/{preferences-CGAPawRw.js → preferences-Dx29Tgc2.js} +1 -1
- package/dist/assets/{profile-embed-CsLOY-3P.js → profile-embed-C_yYlnVt.js} +1 -1
- package/dist/assets/pt-DbNy95wU.js +1 -0
- package/dist/assets/publish-resource-CPSJ7Gd2.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CIox0WsN.js → react-beautiful-dnd.esm-DcDZ_Ghe.js} +1 -1
- package/dist/assets/{relative-time-CRrl1gSW.js → relative-time-xM8Zc84I.js} +1 -1
- package/dist/assets/ru-BEliZjDL.js +1 -0
- package/dist/assets/sdk-CVa22Xgm.js +1 -0
- package/dist/assets/{session-D7wR69VL.js → session-CD9NaM-v.js} +1 -1
- package/dist/assets/setup-CkUck5w6.js +19 -0
- package/dist/assets/{start-CAAERMvb.js → start-CRCAeTDI.js} +1 -1
- package/dist/assets/{status-DnvDsTz6.js → status-D8ugfvVU.js} +1 -1
- package/dist/assets/{step-actions-LZ6_MGpe.js → step-actions-C83ykph7.js} +1 -1
- package/dist/assets/{studio-Ccy_TWjv.js → studio-Cb_GlvSi.js} +1 -1
- package/dist/assets/{switch-control-BsVebsZm.js → switch-control-CJ1duVKM.js} +1 -1
- package/dist/assets/th-KPXdcBJ0.js +1 -0
- package/dist/assets/{traffic-BHL1S-qx.js → traffic-DjeUj5sV.js} +1 -1
- package/dist/assets/{transfer-Cnv8HjKE.js → transfer-B_MO7Mf7.js} +1 -1
- package/dist/assets/{unsubscribe-BviNUKwm.js → unsubscribe-ajBobtwD.js} +1 -1
- package/dist/assets/{useAsync-CDzQ0uN6.js → useAsync-D2OhgEkV.js} +1 -1
- package/dist/assets/{useAsyncRetry-CcF3e_P6.js → useAsyncRetry-CEJwVPZ6.js} +1 -1
- package/dist/assets/{useLocalStorage-CCDYY4Oj.js → useLocalStorage-CtbpqE0c.js} +1 -1
- package/dist/assets/{user-center-D0D8fiVb.js → user-center-D62gRjAl.js} +1 -1
- package/dist/assets/{util-B7dUkIpg.js → util-CohOBosL.js} +1 -1
- package/dist/assets/{util-pKcd70El.js → util-CzgwETtC.js} +1 -1
- package/dist/assets/{vendor-arcblock-BmGcldk1.js → vendor-arcblock-E5QJEgSK.js} +71 -71
- package/dist/assets/{vendor-hooks-DbRTDIFw.js → vendor-hooks-CYyfK9g3.js} +1 -1
- package/dist/assets/{vendor-utils-DJ1bmiuG.js → vendor-utils-CbeKtci8.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-4bCiyPYS.js → vendor-ux-did-connect-D75Zatzm.js} +44 -44
- package/dist/assets/vi-ChkGdSKU.js +1 -0
- package/dist/assets/wrap-locale-lZatlhee.js +1 -0
- package/dist/assets/zh-DDAGRLEd.js +4 -0
- package/dist/assets/zh-tw-DIWT2k6_.js +3 -0
- package/dist/images/banner.png +0 -0
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +28 -28
- package/dist/assets/add-component-core-CkafMVNq.js +0 -765
- package/dist/assets/add-resource-B6yfNhfJ.js +0 -1
- package/dist/assets/api-D2GjOmnt.js +0 -1
- package/dist/assets/ar-B77PsiKa.js +0 -3
- package/dist/assets/cloneDeep-SKWOTeUJ.js +0 -1
- package/dist/assets/config-navigation-CWecd6yU.js +0 -26
- package/dist/assets/de-DxPd91kE.js +0 -3
- package/dist/assets/domains-UcV83Tm2.js +0 -1
- package/dist/assets/es-BLYV0NxM.js +0 -3
- package/dist/assets/fr-CKRgIc8I.js +0 -3
- package/dist/assets/hi-C7aBkqb5.js +0 -1
- package/dist/assets/id-CCxzaFVu.js +0 -3
- package/dist/assets/index-Bgf07DdH.js +0 -220
- package/dist/assets/index-CeZInncP.js +0 -144
- package/dist/assets/index-DXodzmv1.js +0 -104
- package/dist/assets/ja-CtW6nj42.js +0 -3
- package/dist/assets/ko-DnLZZMTR.js +0 -3
- package/dist/assets/localization-Dp5KNtVj.js +0 -1
- package/dist/assets/overview-3qBN9FRv.js +0 -12
- package/dist/assets/pt-Do2DB7RU.js +0 -1
- package/dist/assets/publish-resource-CAFJkTLS.js +0 -1
- package/dist/assets/ru-DLPypCUz.js +0 -1
- package/dist/assets/sdk-CrU7nlFr.js +0 -1
- package/dist/assets/setup-JUlzHBjh.js +0 -19
- package/dist/assets/th-BgGjupIV.js +0 -1
- package/dist/assets/vi-Bye_bkKy.js +0 -1
- package/dist/assets/wrap-locale-h-Rh8AV-.js +0 -1
- package/dist/assets/zh-Dr6QyOeU.js +0 -4
- package/dist/assets/zh-tw-3LQ5YEkc.js +0 -3
|
@@ -51,7 +51,7 @@ const logger = require('../logger')('connect');
|
|
|
51
51
|
const { createTokenFn, getDidConnectVersion } = require('../../util');
|
|
52
52
|
const { transferPassport, PASSPORT_VC_TYPES } = require('../auth/utils');
|
|
53
53
|
const { migrateAccount, declareAccount } = require('../../services/oauth');
|
|
54
|
-
const { getKycClaims, verifyKycClaims, getPassportVc,
|
|
54
|
+
const { getKycClaims, verifyKycClaims, getPassportVc, getProfileItems } = require('../kyc');
|
|
55
55
|
const { getTrustedIssuers, getFederatedTrustedIssuers } = require('../../util/blocklet-utils');
|
|
56
56
|
const {
|
|
57
57
|
getUserAvatarUrl,
|
|
@@ -146,10 +146,26 @@ const validateRole = async ({ role, securityConfig, locale, node, teamDid }) =>
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
-
const checkAppOwner = ({ role, blocklet, userDid, locale = 'en' }) => {
|
|
150
|
-
if (role
|
|
151
|
-
|
|
149
|
+
const checkAppOwner = async ({ node, role, blocklet, userDid, locale = 'en' }) => {
|
|
150
|
+
if (role !== ROLES.OWNER) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!blocklet.settings.initialized) {
|
|
155
|
+
return;
|
|
152
156
|
}
|
|
157
|
+
|
|
158
|
+
// Blocklet owner may have migrated from managed to external
|
|
159
|
+
const user = await node.getUser({
|
|
160
|
+
teamDid: blocklet.meta.did,
|
|
161
|
+
user: { did: blocklet.settings.owner.did },
|
|
162
|
+
options: { enableConnectedAccount: true },
|
|
163
|
+
});
|
|
164
|
+
if (user.connectedAccounts.some((x) => x.did === userDid)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
throw new Error(messages.notAppOwner[locale]);
|
|
153
169
|
};
|
|
154
170
|
|
|
155
171
|
/**
|
|
@@ -282,10 +298,7 @@ module.exports = {
|
|
|
282
298
|
}
|
|
283
299
|
|
|
284
300
|
if (user) {
|
|
285
|
-
|
|
286
|
-
if (user.url || !isProfileUrlSupported(request.context.didwallet)) {
|
|
287
|
-
delete claims.profile;
|
|
288
|
-
}
|
|
301
|
+
delete claims.profile;
|
|
289
302
|
|
|
290
303
|
// HACK: 确保用户在尝试登录时,就将 avatar 进行一次 fix (base64 -> bn-url)
|
|
291
304
|
if (user.avatar) {
|
|
@@ -458,8 +471,7 @@ module.exports = {
|
|
|
458
471
|
// Get role
|
|
459
472
|
const role = await getRoleFromVC({ vc, node, locale, blocklet, teamDid, sourceAppPid });
|
|
460
473
|
await validateRole({ role, securityConfig: accessPolicyConfig, locale, node, teamDid });
|
|
461
|
-
|
|
462
|
-
checkAppOwner({ role, blocklet, userDid, locale });
|
|
474
|
+
await checkAppOwner({ node, role, blocklet, userDid, locale });
|
|
463
475
|
|
|
464
476
|
if (blocklet.settings?.purpose !== 'e2e') {
|
|
465
477
|
// do not allow non-exist user to login as owner/admin
|
|
@@ -974,8 +986,7 @@ module.exports = {
|
|
|
974
986
|
// Get role
|
|
975
987
|
const role = await getRoleFromVC({ vc, node, locale, blocklet, teamDid, sourceAppPid });
|
|
976
988
|
await validateRole({ role, securityConfig: accessPolicyConfig, locale, node, teamDid });
|
|
977
|
-
|
|
978
|
-
checkAppOwner({ role, blocklet, userDid, locale });
|
|
989
|
+
await checkAppOwner({ node, role, blocklet, userDid, locale });
|
|
979
990
|
|
|
980
991
|
// Recreate passport with correct role
|
|
981
992
|
passport = vc ? createUserPassport(vc, { role }) : null;
|
|
@@ -18,7 +18,7 @@ const { getTemplate } = require('./template');
|
|
|
18
18
|
const { getCacheFilePath } = require('../image');
|
|
19
19
|
const emoji = require('./emoji');
|
|
20
20
|
|
|
21
|
-
const TEMPLATES = ['default', 'section', 'cover'];
|
|
21
|
+
const TEMPLATES = ['default', 'section', 'cover', 'banner'];
|
|
22
22
|
const MAX_TITLE_LENGTH = 128;
|
|
23
23
|
const MAX_DESCRIPTION_LENGTH = 512;
|
|
24
24
|
const MAX_IMAGE_SIZE = 5 * 1024 * 1024;
|
|
@@ -69,7 +69,11 @@ const schema = Joi.object({
|
|
|
69
69
|
// customize logo
|
|
70
70
|
logo: Joi.string()
|
|
71
71
|
.uri({ scheme: ['https'] })
|
|
72
|
-
.
|
|
72
|
+
.when('template', {
|
|
73
|
+
is: 'banner',
|
|
74
|
+
then: Joi.required(),
|
|
75
|
+
otherwise: Joi.optional().default(''),
|
|
76
|
+
}),
|
|
73
77
|
logoRounded: Joi.string().allow('0', '1').optional(),
|
|
74
78
|
|
|
75
79
|
// custom emoji
|
|
@@ -110,13 +114,19 @@ const getOgImage = ({ input, info, cacheDir, format, tmpDir }) => {
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
value.logoRounded = value.logoRounded === '1';
|
|
113
|
-
value.
|
|
114
|
-
info.appUrl,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (value.template === 'banner') {
|
|
118
|
+
value.background = joinURL(info.appUrl, WELLKNOWN_SERVICE_PATH_PREFIX, '/static/images/banner.png');
|
|
119
|
+
} else {
|
|
120
|
+
value.background = joinURL(
|
|
121
|
+
info.appUrl,
|
|
122
|
+
WELLKNOWN_SERVICE_PATH_PREFIX,
|
|
123
|
+
`/blocklet/og-image?imageFilter=resize&w=1200&h=630&hash=${info.ogImageHash || ''}`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
118
126
|
|
|
119
|
-
const
|
|
127
|
+
const width = value.template === 'banner' ? 1280 : 1200;
|
|
128
|
+
const height = value.template === 'banner' ? 441 : 630;
|
|
129
|
+
const params = { ...value, width, height, color, format };
|
|
120
130
|
const cacheKey = md5(stringify(params));
|
|
121
131
|
const nocache = input.nocache === '1';
|
|
122
132
|
const destPath = getCacheFilePath(cacheDir, `${cacheKey}.${format}`);
|
|
@@ -166,7 +176,7 @@ const convertExternalImage = (url, dest, height) => {
|
|
|
166
176
|
},
|
|
167
177
|
(res) => {
|
|
168
178
|
if (res.statusCode && res.statusCode >= 400) {
|
|
169
|
-
reject(new CustomError(400, `unexpected external image status: ${res.statusCode}`));
|
|
179
|
+
reject(new CustomError(400, `unexpected external image status: ${res.statusCode} ${url}`));
|
|
170
180
|
return;
|
|
171
181
|
}
|
|
172
182
|
|
|
@@ -207,8 +217,8 @@ const convertExternalImage = (url, dest, height) => {
|
|
|
207
217
|
});
|
|
208
218
|
};
|
|
209
219
|
|
|
210
|
-
const getCachedExternalImage = (cacheKey
|
|
211
|
-
return `http://127.0.0.1:${
|
|
220
|
+
const getCachedExternalImage = (cacheKey) => {
|
|
221
|
+
return `http://127.0.0.1:${process.env.ABT_NODE_SERVICE_PORT}/open-graph/${cacheKey.slice(0, 2)}/${cacheKey.slice(2)}.png`;
|
|
212
222
|
};
|
|
213
223
|
|
|
214
224
|
const cacheTasks = {};
|
|
@@ -83,9 +83,9 @@ const getSectionTemplate = (
|
|
|
83
83
|
{ width, height, logo, logoRounded, background, color, title, description, section },
|
|
84
84
|
fn
|
|
85
85
|
) => {
|
|
86
|
-
return fn
|
|
86
|
+
return fn`<div
|
|
87
87
|
style="
|
|
88
|
-
width: ${width};
|
|
88
|
+
width: ${width}px;
|
|
89
89
|
height: ${height}px;
|
|
90
90
|
background-image: url(${background});
|
|
91
91
|
background-size: cover;
|
|
@@ -200,6 +200,43 @@ const getCoverTemplate = ({ width, height, logo, logoRounded, color, title, desc
|
|
|
200
200
|
</div>`;
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
+
const getBannerTemplate = ({ width, height, color, logo, logoRounded, background, title }, fn) => {
|
|
204
|
+
const textColor = getTextColor(color.start);
|
|
205
|
+
return fn`<div
|
|
206
|
+
style="
|
|
207
|
+
width: ${width}px;
|
|
208
|
+
height: ${height}px;
|
|
209
|
+
background-image: url(${background});
|
|
210
|
+
background-size: cover;
|
|
211
|
+
background-position: center;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: row;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
align-items: center;
|
|
216
|
+
position: relative;
|
|
217
|
+
"
|
|
218
|
+
>
|
|
219
|
+
<img
|
|
220
|
+
src="${logo}"
|
|
221
|
+
height="150"
|
|
222
|
+
width="150"
|
|
223
|
+
style="height: 150px; width: 150px; ${logoRounded ? 'border-radius: 50%;' : ''} margin-right: 48px"
|
|
224
|
+
/>
|
|
225
|
+
<h2
|
|
226
|
+
style="
|
|
227
|
+
font-size: 72px;
|
|
228
|
+
color: ${textColor};
|
|
229
|
+
font-weight: 500;
|
|
230
|
+
font-family: Arial, sans-serif;
|
|
231
|
+
text-align: left;
|
|
232
|
+
line-clamp: 1;
|
|
233
|
+
"
|
|
234
|
+
>
|
|
235
|
+
${title}
|
|
236
|
+
</h2>
|
|
237
|
+
</div>`;
|
|
238
|
+
};
|
|
239
|
+
|
|
203
240
|
const getTemplate = async (params) => {
|
|
204
241
|
// eslint-disable-next-line import/no-unresolved
|
|
205
242
|
const { html } = await import('satori-html');
|
|
@@ -214,6 +251,9 @@ const getTemplate = async (params) => {
|
|
|
214
251
|
if (params.template === 'cover') {
|
|
215
252
|
return getCoverTemplate(params, fn);
|
|
216
253
|
}
|
|
254
|
+
if (params.template === 'banner') {
|
|
255
|
+
return getBannerTemplate(params, fn);
|
|
256
|
+
}
|
|
217
257
|
|
|
218
258
|
throw new Error('Invalid open graph template');
|
|
219
259
|
};
|
package/api/routes/user.js
CHANGED
|
@@ -443,6 +443,15 @@ const webhookSetSchema = Joi.object({
|
|
|
443
443
|
url: Joi.string().uri().required(),
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
+
const addressSchema = Joi.object({
|
|
447
|
+
country: Joi.string().trim().allow('').max(50).optional(),
|
|
448
|
+
province: Joi.string().trim().allow('').max(50).optional(),
|
|
449
|
+
city: Joi.string().trim().allow('').max(50).optional(),
|
|
450
|
+
postalCode: Joi.string().allow('').trim().max(20).optional(),
|
|
451
|
+
line1: Joi.string().allow('').trim().max(200).optional(),
|
|
452
|
+
line2: Joi.string().allow('').trim().max(200).optional(),
|
|
453
|
+
});
|
|
454
|
+
|
|
446
455
|
const profileSetSchema = Joi.object({
|
|
447
456
|
locale: Joi.string().optional(),
|
|
448
457
|
email: Joi.string().email().optional(),
|
|
@@ -456,9 +465,9 @@ const profileSetSchema = Joi.object({
|
|
|
456
465
|
phoneNumber: Joi.string().optional(),
|
|
457
466
|
country: Joi.string().optional(),
|
|
458
467
|
}).optional(),
|
|
459
|
-
bio: Joi.string().max(200).optional(),
|
|
460
|
-
timezone: Joi.string().optional(),
|
|
461
|
-
location: Joi.string().optional(),
|
|
468
|
+
bio: Joi.string().allow('').max(200).optional(),
|
|
469
|
+
timezone: Joi.string().allow('').optional(),
|
|
470
|
+
location: Joi.string().allow('').optional(),
|
|
462
471
|
status: Joi.object({
|
|
463
472
|
label: Joi.string().optional(),
|
|
464
473
|
icon: Joi.string().optional(),
|
|
@@ -480,6 +489,7 @@ const profileSetSchema = Joi.object({
|
|
|
480
489
|
)
|
|
481
490
|
.optional(),
|
|
482
491
|
}).optional(),
|
|
492
|
+
address: addressSchema.optional(),
|
|
483
493
|
});
|
|
484
494
|
|
|
485
495
|
const spaceGatewaySchema = Joi.object({
|
|
@@ -836,18 +846,38 @@ module.exports = {
|
|
|
836
846
|
}
|
|
837
847
|
|
|
838
848
|
const { blocklet } = req;
|
|
839
|
-
const { metadata } = value;
|
|
840
|
-
const _metadata = omit(metadata, ['email']);
|
|
849
|
+
const { metadata, address } = value;
|
|
841
850
|
const teamDid = blocklet.appPid;
|
|
851
|
+
|
|
852
|
+
// 构建更新对象,只包含有值的字段
|
|
853
|
+
const updateData = {
|
|
854
|
+
did: req.user.did,
|
|
855
|
+
...omitBy(value, (x) => !x),
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
// 只有当 metadata 存在时才添加到更新对象中
|
|
859
|
+
if (metadata) {
|
|
860
|
+
const _metadata = omit(metadata, ['email']);
|
|
861
|
+
updateData.metadata = _metadata;
|
|
862
|
+
|
|
863
|
+
// 处理 email 和 phone
|
|
864
|
+
if (metadata.email) {
|
|
865
|
+
updateData.email = metadata.email;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
if (metadata.phone?.phoneNumber) {
|
|
869
|
+
updateData.phone = metadata.phone.phoneNumber;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// 只有当 address 存在时才添加到更新对象中
|
|
874
|
+
if (address) {
|
|
875
|
+
updateData.address = address;
|
|
876
|
+
}
|
|
877
|
+
|
|
842
878
|
const user = await node.updateUser({
|
|
843
879
|
teamDid,
|
|
844
|
-
user:
|
|
845
|
-
did: req.user.did,
|
|
846
|
-
...omitBy(value, (x) => !x),
|
|
847
|
-
metadata: _metadata,
|
|
848
|
-
...(metadata?.email ? { email: metadata.email } : {}),
|
|
849
|
-
...(metadata?.phone?.phoneNumber ? { phone: metadata.phone.phoneNumber } : {}),
|
|
850
|
-
},
|
|
880
|
+
user: updateData,
|
|
851
881
|
});
|
|
852
882
|
if (!user || !user?.approved) {
|
|
853
883
|
res.status(404).send({ error: 'User not found' });
|
|
@@ -868,6 +898,7 @@ module.exports = {
|
|
|
868
898
|
'emailVerified',
|
|
869
899
|
'phoneVerified',
|
|
870
900
|
'metadata',
|
|
901
|
+
'address',
|
|
871
902
|
])
|
|
872
903
|
);
|
|
873
904
|
}
|
|
@@ -925,7 +956,14 @@ module.exports = {
|
|
|
925
956
|
if (user.avatar) {
|
|
926
957
|
user.avatar = getUserAvatarUrl(user.avatar, blocklet);
|
|
927
958
|
}
|
|
928
|
-
|
|
959
|
+
let returnFields = ['avatar', 'did', 'fullName', 'sourceAppPid', 'createdAt', 'email', 'phone', 'metadata'];
|
|
960
|
+
|
|
961
|
+
// 如果是自己查询,可以返回 address
|
|
962
|
+
const reqUser = req.user;
|
|
963
|
+
if (reqUser?.did === user.did) {
|
|
964
|
+
returnFields = returnFields.concat(['address']);
|
|
965
|
+
}
|
|
966
|
+
res.json(pick(user, returnFields));
|
|
929
967
|
});
|
|
930
968
|
|
|
931
969
|
// 支持用户更新 DID Space 信息
|
|
@@ -362,12 +362,24 @@ module.exports = function createRoutes(node, _, createSessionToken) {
|
|
|
362
362
|
|
|
363
363
|
// restart blocklet (not use queue)
|
|
364
364
|
node
|
|
365
|
-
.stopBlocklet({ did: appPid })
|
|
365
|
+
.stopBlocklet({ did: appPid, updateStatus: false })
|
|
366
366
|
.then(() => {
|
|
367
|
-
return node.startBlocklet({ did: appPid });
|
|
367
|
+
return node.startBlocklet({ did: appPid, checkHealthImmediately: true, throwOnError: true, atomic: true });
|
|
368
|
+
})
|
|
369
|
+
.then((doc) => {
|
|
370
|
+
logger.info('restart blocklet success after transfer ownership', { appPid });
|
|
371
|
+
return node.createAuditLog(
|
|
372
|
+
{
|
|
373
|
+
action: 'restartBlocklet',
|
|
374
|
+
args: { did: appPid },
|
|
375
|
+
context: formatContext(req),
|
|
376
|
+
result: doc,
|
|
377
|
+
},
|
|
378
|
+
node
|
|
379
|
+
);
|
|
368
380
|
})
|
|
369
381
|
.catch((error) => {
|
|
370
|
-
logger.error('restart blocklet failed', { appPid, error });
|
|
382
|
+
logger.error('restart blocklet failed after transfer ownership', { appPid, error });
|
|
371
383
|
});
|
|
372
384
|
|
|
373
385
|
await sleep(3000);
|
|
@@ -192,7 +192,7 @@ module.exports = ({ node, req, options }) => {
|
|
|
192
192
|
await req.ensureUser({ token });
|
|
193
193
|
|
|
194
194
|
if (req.user) {
|
|
195
|
-
res.cookie('login_token', token, { maxAge: 60 * 60 * 1000 });
|
|
195
|
+
res.cookie('login_token', token, { maxAge: 24 * 60 * 60 * 1000, secure: true, sameSite: 'lax' });
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as e,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as e,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var r={},o=e;Object.defineProperty(r,"__esModule",{value:!0});var u=r.default=void 0,i=o(a()),p=t;u=r.default=(0,i.default)((0,p.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(a()),l=t;u=e.default=(0,i.default)((0,l.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,f=o(a()),i=t;u=e.default=(0,f.default)((0,i.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeft");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(a()),v=t;u=e.default=(0,i.default)((0,v.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as t,j as r}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as t,j as r}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},u=t;Object.defineProperty(e,"__esModule",{value:!0});var o=e.default=void 0,i=u(a()),l=r;o=e.default=(0,i.default)((0,l.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline");export{o as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(a()),l=t;u=e.default=(0,i.default)((0,l.jsx)("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as a}from"./vendor-mui-core-O22FPGM4.js";import{r as t}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as a}from"./vendor-mui-core-O22FPGM4.js";import{r as t}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,d=o(t()),i=a;u=e.default=(0,d.default)((0,i.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as e,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as e,j as t}from"./vendor-mui-core-O22FPGM4.js";import{r as a}from"./vendor-ux-did-connect-D75Zatzm.js";var r={},o=e;Object.defineProperty(r,"__esModule",{value:!0});var u=r.default=void 0,i=o(a()),s=t;u=r.default=(0,i.default)((0,s.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as a}from"./vendor-mui-core-O22FPGM4.js";import{r as t}from"./vendor-ux-did-connect-
|
|
1
|
+
import{a1 as r,j as a}from"./vendor-mui-core-O22FPGM4.js";import{r as t}from"./vendor-ux-did-connect-D75Zatzm.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var s=e.default=void 0,u=o(t()),d=a;s=e.default=(0,u.default)((0,d.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");export{s as d};
|