@abtnode/core 1.17.8-beta-20260205-074433-9d1114cf → 1.17.8

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.
@@ -15,6 +15,7 @@ const {
15
15
  GATEWAY_RATE_LIMIT_GLOBAL,
16
16
  GATEWAY_RATE_LIMIT_METHODS,
17
17
  DOMAIN_FOR_IP_SITE,
18
+ WELLKNOWN_PATH_PREFIX,
18
19
  } = require('@abtnode/constant');
19
20
  const { BLOCKLET_UI_INTERFACES, BLOCKLET_MODES } = require('@blocklet/constant');
20
21
 
@@ -40,14 +41,19 @@ const expandSites = (sites = []) => {
40
41
 
41
42
  tmpSite.domain = domain;
42
43
 
43
- // For nft-domain-forwarding with metadata, replace all rules with a single redirect rule
44
+ // For nft-domain-forwarding with metadata, replace rules but preserve ACME challenge for certificate issuance
44
45
  if (
45
46
  typeof domainAlias === 'object' &&
46
47
  domainAlias.type === 'nft-domain-forwarding' &&
47
48
  domainAlias.metadata?.targetUrl
48
49
  ) {
49
50
  const { targetUrl, statusCode = 301, preservePath = true, preserveQuery = true } = domainAlias.metadata;
51
+ // Keep existing wellknown rules (/.well-known/*) for ACME challenge and other services
52
+ const wellknownRules = (tmpSite.rules || []).filter((rule) =>
53
+ rule.from?.pathPrefix?.startsWith(WELLKNOWN_PATH_PREFIX)
54
+ );
50
55
  tmpSite.rules = [
56
+ ...wellknownRules,
51
57
  {
52
58
  id: 'domain-forwarding',
53
59
  from: { pathPrefix: '/', groupPathPrefix: '/' },
@@ -348,7 +348,20 @@ class RouterManager extends EventEmitter {
348
348
  const newSite = await states.site.findOne({ id });
349
349
  await attachRuntimeDomainAliases({ sites: newSite, context, node: states.node });
350
350
 
351
- const did = getDidFromDomainGroupName(doc.domain);
351
+ const did = getDidFromDomainGroupName(newSite.domain);
352
+
353
+ // Issue certificate for the updated domain alias
354
+ if (issueCert) {
355
+ logger.info('try to issue cert for updated alias', { domain, id });
356
+ this.issueCert({ did, siteId: id, site: newSite, domain, inBlockletSetup, type })
357
+ .then(() => {
358
+ logger.info('try to issue cert done', { domain, id });
359
+ })
360
+ .catch((error) => {
361
+ logger.error('try to issue cert failed', { error, domain, id });
362
+ });
363
+ }
364
+
352
365
  this.emit(EVENTS.UPDATE_DOMAIN_ALIAS, did);
353
366
  return newSite;
354
367
  }
@@ -394,7 +407,7 @@ class RouterManager extends EventEmitter {
394
407
 
395
408
  if (issueCert) {
396
409
  logger.info('try to issue cert', { domain, id });
397
- this.issueCert({ did, siteId: id, site: doc, domain, inBlockletSetup })
410
+ this.issueCert({ did, siteId: id, site: doc, domain, inBlockletSetup, type })
398
411
  .then(() => {
399
412
  logger.info('try to issue cert done', { domain, id });
400
413
  })
@@ -705,15 +718,19 @@ class RouterManager extends EventEmitter {
705
718
  }
706
719
  }
707
720
 
708
- async issueCert({ did, siteId, site, domain, inBlockletSetup = false }) {
721
+ async issueCert({ did, siteId, site, domain, inBlockletSetup = false, type }) {
709
722
  const didDomain = site.domainAliases.find((x) => isDidDomain(x.value));
710
723
  const [dnsValue, cert] = await Promise.all([
711
724
  this.checkDomainDNS(domain, didDomain?.value),
712
725
  this.getHttpsCert({ domain }),
713
726
  ]);
714
727
 
728
+ // For nft-domain-forwarding, skip CNAME check since these domains use A records pointing directly to server IP
729
+ const requireCnameMatch = type !== 'nft-domain-forwarding';
730
+
715
731
  // 自定义域名如果 DNS 未解析成功 或 CNAME 不匹配 或 已配置证书,则不自动颁发证书
716
- const shouldSkipCertIssue = isCustomDomain(domain) && (!dnsValue.isDnsResolved || !dnsValue.isCnameMatch || !!cert);
732
+ const shouldSkipCertIssue =
733
+ isCustomDomain(domain) && (!dnsValue.isDnsResolved || (requireCnameMatch && !dnsValue.isCnameMatch) || !!cert);
717
734
 
718
735
  if (shouldSkipCertIssue) {
719
736
  const reasonFn = () => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.17.8-beta-20260205-074433-9d1114cf",
6
+ "version": "1.17.8",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -17,19 +17,19 @@
17
17
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@abtnode/analytics": "1.17.8-beta-20260205-074433-9d1114cf",
21
- "@abtnode/auth": "1.17.8-beta-20260205-074433-9d1114cf",
22
- "@abtnode/certificate-manager": "1.17.8-beta-20260205-074433-9d1114cf",
23
- "@abtnode/constant": "1.17.8-beta-20260205-074433-9d1114cf",
24
- "@abtnode/cron": "1.17.8-beta-20260205-074433-9d1114cf",
25
- "@abtnode/db-cache": "1.17.8-beta-20260205-074433-9d1114cf",
26
- "@abtnode/docker-utils": "1.17.8-beta-20260205-074433-9d1114cf",
27
- "@abtnode/logger": "1.17.8-beta-20260205-074433-9d1114cf",
28
- "@abtnode/models": "1.17.8-beta-20260205-074433-9d1114cf",
29
- "@abtnode/queue": "1.17.8-beta-20260205-074433-9d1114cf",
30
- "@abtnode/rbac": "1.17.8-beta-20260205-074433-9d1114cf",
31
- "@abtnode/router-provider": "1.17.8-beta-20260205-074433-9d1114cf",
32
- "@abtnode/util": "1.17.8-beta-20260205-074433-9d1114cf",
20
+ "@abtnode/analytics": "1.17.8",
21
+ "@abtnode/auth": "1.17.8",
22
+ "@abtnode/certificate-manager": "1.17.8",
23
+ "@abtnode/constant": "1.17.8",
24
+ "@abtnode/cron": "1.17.8",
25
+ "@abtnode/db-cache": "1.17.8",
26
+ "@abtnode/docker-utils": "1.17.8",
27
+ "@abtnode/logger": "1.17.8",
28
+ "@abtnode/models": "1.17.8",
29
+ "@abtnode/queue": "1.17.8",
30
+ "@abtnode/rbac": "1.17.8",
31
+ "@abtnode/router-provider": "1.17.8",
32
+ "@abtnode/util": "1.17.8",
33
33
  "@arcblock/did": "1.29.3",
34
34
  "@arcblock/did-connect-js": "1.29.3",
35
35
  "@arcblock/did-ext": "1.29.3",
@@ -40,15 +40,15 @@
40
40
  "@arcblock/pm2-events": "^0.0.5",
41
41
  "@arcblock/validator": "1.29.3",
42
42
  "@arcblock/vc": "1.29.3",
43
- "@blocklet/constant": "1.17.8-beta-20260205-074433-9d1114cf",
43
+ "@blocklet/constant": "1.17.8",
44
44
  "@blocklet/did-space-js": "^1.2.15",
45
- "@blocklet/env": "1.17.8-beta-20260205-074433-9d1114cf",
45
+ "@blocklet/env": "1.17.8",
46
46
  "@blocklet/error": "^0.3.5",
47
- "@blocklet/meta": "1.17.8-beta-20260205-074433-9d1114cf",
48
- "@blocklet/resolver": "1.17.8-beta-20260205-074433-9d1114cf",
49
- "@blocklet/sdk": "1.17.8-beta-20260205-074433-9d1114cf",
50
- "@blocklet/server-js": "1.17.8-beta-20260205-074433-9d1114cf",
51
- "@blocklet/store": "1.17.8-beta-20260205-074433-9d1114cf",
47
+ "@blocklet/meta": "1.17.8",
48
+ "@blocklet/resolver": "1.17.8",
49
+ "@blocklet/sdk": "1.17.8",
50
+ "@blocklet/server-js": "1.17.8",
51
+ "@blocklet/store": "1.17.8",
52
52
  "@blocklet/theme": "^3.5.0",
53
53
  "@fidm/x509": "^1.2.1",
54
54
  "@ocap/mcrypto": "1.29.3",
@@ -113,5 +113,5 @@
113
113
  "express": "^4.18.2",
114
114
  "unzipper": "^0.10.11"
115
115
  },
116
- "gitHead": "a1dbb1178294cdef519edc931ac51682dc853916"
116
+ "gitHead": "565d1f907979ae79559d155249110befbb39d2d7"
117
117
  }