@abtnode/core 1.16.45-beta-20250618-073451-6e48fb62 → 1.16.45-beta-20250620-082630-c0c76051

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.
@@ -741,6 +741,7 @@ const decompressCertificates = async (source, dest) => {
741
741
 
742
742
  const joinCertDownUrl = (baseUrl, name) => joinURL(baseUrl, '/certs', name);
743
743
 
744
+ const getDummyCertDownloadUrl = (baseUrl) => joinCertDownUrl(baseUrl, 'dummy.tar.gz');
744
745
  const getIpEchoCertDownloadUrl = (baseUrl) => joinCertDownUrl(baseUrl, 'ip-abtnet-io.tar.gz');
745
746
  const getDidDomainCertDownloadUrl = (baseUrl) => joinCertDownUrl(baseUrl, 'did-abtnet-io.tar.gz');
746
747
  const getDownloadCertBaseUrl = (info) =>
@@ -853,6 +854,7 @@ module.exports = function getRouterHelpers({
853
854
  const ipWildcardDomain = get(info, 'routing.ipWildcardDomain', '');
854
855
  const didDomain = info.didDomain;
855
856
  const certDownloadAddress = getDownloadCertBaseUrl(info);
857
+
856
858
  if (!https || !certDownloadAddress) {
857
859
  return;
858
860
  }
@@ -877,6 +879,21 @@ module.exports = function getRouterHelpers({
877
879
  };
878
880
 
879
881
  const certBaseUrl = getDownloadCertBaseUrl(info);
882
+
883
+ if (!info.routing.enableDefaultServer && certBaseUrl) {
884
+ // update dummy certificate if not enable default server
885
+ // if update failed, it will not affect the normal certificate update
886
+ let dummyCertUrl;
887
+ try {
888
+ dummyCertUrl = getDummyCertDownloadUrl(certBaseUrl);
889
+ await ensureDomainCert('abtnode_dummy', dummyCertUrl);
890
+
891
+ logger.info('update dummy certificate success');
892
+ } catch (error) {
893
+ logger.error('update dummy certificate failed', { error, dummyCertUrl });
894
+ }
895
+ }
896
+
880
897
  await Promise.all([
881
898
  ensureDomainCert(ipWildcardDomain, getIpEchoCertDownloadUrl(certBaseUrl)),
882
899
  ensureDomainCert(`*.${didDomain}`, getDidDomainCertDownloadUrl(certBaseUrl)),
@@ -14,6 +14,7 @@ const {
14
14
  GATEWAY_RATE_LIMIT,
15
15
  GATEWAY_RATE_LIMIT_GLOBAL,
16
16
  GATEWAY_RATE_LIMIT_METHODS,
17
+ DOMAIN_FOR_IP_SITE,
17
18
  } = require('@abtnode/constant');
18
19
  const { BLOCKLET_UI_INTERFACES, BLOCKLET_MODES } = require('@blocklet/constant');
19
20
 
@@ -70,10 +71,35 @@ const expandSites = (sites = []) => {
70
71
  return result;
71
72
  };
72
73
 
74
+ const isDefaultSite = (domain) => DOMAIN_FOR_DEFAULT_SITE === domain;
75
+
76
+ const isIpSite = (domain) => [DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP].includes(domain);
77
+ // const isIpSite = (domain) => DOMAIN_FOR_IP_SITE === domain;
78
+
79
+ const filterSites = ({ sites, enableDefaultServer, enableIpServer }) => {
80
+ let result = cloneDeep(sites);
81
+
82
+ if (!enableDefaultServer) {
83
+ result = result.filter((x) => !isDefaultSite(x.domain));
84
+ logger.info('disable default server');
85
+ }
86
+
87
+ if (!enableIpServer) {
88
+ result = result.filter((x) => !isIpSite(x.domain));
89
+ logger.info('disable ip site');
90
+ }
91
+
92
+ return result;
93
+ };
94
+
73
95
  const getRoutingTable = ({ sites, nodeInfo }) => {
96
+ const enableDefaultServer = nodeInfo.routing.enableDefaultServer ?? false;
97
+ const enableIpServer = nodeInfo.routing.enableIpServer ?? false;
98
+
74
99
  // eslint-disable-next-line no-use-before-define
75
100
  let routingTable = Router.formatSites(sites);
76
101
  routingTable = expandSites(routingTable);
102
+ routingTable = filterSites({ sites: routingTable, enableDefaultServer, enableIpServer });
77
103
 
78
104
  // put ipWildcardDomain to last, to let blockletDomain match first
79
105
  // e.g.
@@ -194,6 +220,8 @@ class Router {
194
220
  wafPolicy,
195
221
  cacheEnabled: isGatewayCacheEnabled(nodeInfo),
196
222
  wafDisabledBlocklets,
223
+ enableDefaultServer: nodeInfo.routing.enableDefaultServer ?? false,
224
+ enableIpServer: nodeInfo.routing.enableIpServer ?? false,
197
225
  });
198
226
  }
199
227
 
@@ -410,5 +438,6 @@ Router.flattenSitesToRules = (sites = [], info = {}) => {
410
438
 
411
439
  Router._expandSites = expandSites; // eslint-disable-line no-underscore-dangle
412
440
  Router._getRoutingTable = getRoutingTable; // eslint-disable-line no-underscore-dangle
441
+ Router._filterSites = filterSites; // eslint-disable-line no-underscore-dangle
413
442
 
414
443
  module.exports = Router;
package/lib/util/index.js CHANGED
@@ -225,11 +225,13 @@ const getBaseUrls = async (node, ips) => {
225
225
  const adminPath = normalizePathPrefix(info.routing.adminPath);
226
226
  const tmpHttpPort = getPort(httpPort, DEFAULT_HTTP_PORT);
227
227
 
228
- const httpUrls = availableIps.map((ip) => {
229
- return {
230
- url: `http://${ip}${tmpHttpPort}${adminPath}`,
231
- };
232
- });
228
+ const httpUrls = info.routing.enableIpServer
229
+ ? availableIps.map((ip) => {
230
+ return {
231
+ url: `http://${ip}${tmpHttpPort}${adminPath}`,
232
+ };
233
+ })
234
+ : [];
233
235
 
234
236
  if (ipWildcardDomain) {
235
237
  const site = sites.find((c) => (c.domainAliases || []).find((item) => item.value === ipWildcardDomain));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.45-beta-20250618-073451-6e48fb62",
6
+ "version": "1.16.45-beta-20250620-082630-c0c76051",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,22 +19,22 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@abtnode/analytics": "1.16.45-beta-20250618-073451-6e48fb62",
23
- "@abtnode/auth": "1.16.45-beta-20250618-073451-6e48fb62",
24
- "@abtnode/certificate-manager": "1.16.45-beta-20250618-073451-6e48fb62",
25
- "@abtnode/client": "1.16.45-beta-20250618-073451-6e48fb62",
26
- "@abtnode/constant": "1.16.45-beta-20250618-073451-6e48fb62",
27
- "@abtnode/cron": "1.16.45-beta-20250618-073451-6e48fb62",
28
- "@abtnode/db-cache": "1.16.45-beta-20250618-073451-6e48fb62",
29
- "@abtnode/docker-utils": "1.16.45-beta-20250618-073451-6e48fb62",
30
- "@abtnode/logger": "1.16.45-beta-20250618-073451-6e48fb62",
31
- "@abtnode/models": "1.16.45-beta-20250618-073451-6e48fb62",
32
- "@abtnode/queue": "1.16.45-beta-20250618-073451-6e48fb62",
33
- "@abtnode/rbac": "1.16.45-beta-20250618-073451-6e48fb62",
34
- "@abtnode/router-provider": "1.16.45-beta-20250618-073451-6e48fb62",
35
- "@abtnode/static-server": "1.16.45-beta-20250618-073451-6e48fb62",
36
- "@abtnode/timemachine": "1.16.45-beta-20250618-073451-6e48fb62",
37
- "@abtnode/util": "1.16.45-beta-20250618-073451-6e48fb62",
22
+ "@abtnode/analytics": "1.16.45-beta-20250620-082630-c0c76051",
23
+ "@abtnode/auth": "1.16.45-beta-20250620-082630-c0c76051",
24
+ "@abtnode/certificate-manager": "1.16.45-beta-20250620-082630-c0c76051",
25
+ "@abtnode/client": "1.16.45-beta-20250620-082630-c0c76051",
26
+ "@abtnode/constant": "1.16.45-beta-20250620-082630-c0c76051",
27
+ "@abtnode/cron": "1.16.45-beta-20250620-082630-c0c76051",
28
+ "@abtnode/db-cache": "1.16.45-beta-20250620-082630-c0c76051",
29
+ "@abtnode/docker-utils": "1.16.45-beta-20250620-082630-c0c76051",
30
+ "@abtnode/logger": "1.16.45-beta-20250620-082630-c0c76051",
31
+ "@abtnode/models": "1.16.45-beta-20250620-082630-c0c76051",
32
+ "@abtnode/queue": "1.16.45-beta-20250620-082630-c0c76051",
33
+ "@abtnode/rbac": "1.16.45-beta-20250620-082630-c0c76051",
34
+ "@abtnode/router-provider": "1.16.45-beta-20250620-082630-c0c76051",
35
+ "@abtnode/static-server": "1.16.45-beta-20250620-082630-c0c76051",
36
+ "@abtnode/timemachine": "1.16.45-beta-20250620-082630-c0c76051",
37
+ "@abtnode/util": "1.16.45-beta-20250620-082630-c0c76051",
38
38
  "@arcblock/did": "1.20.14",
39
39
  "@arcblock/did-auth": "1.20.14",
40
40
  "@arcblock/did-ext": "1.20.14",
@@ -45,14 +45,14 @@
45
45
  "@arcblock/pm2-events": "^0.0.5",
46
46
  "@arcblock/validator": "1.20.14",
47
47
  "@arcblock/vc": "1.20.14",
48
- "@blocklet/constant": "1.16.45-beta-20250618-073451-6e48fb62",
48
+ "@blocklet/constant": "1.16.45-beta-20250620-082630-c0c76051",
49
49
  "@blocklet/did-space-js": "^1.0.62",
50
- "@blocklet/env": "1.16.45-beta-20250618-073451-6e48fb62",
50
+ "@blocklet/env": "1.16.45-beta-20250620-082630-c0c76051",
51
51
  "@blocklet/error": "^0.2.5",
52
- "@blocklet/meta": "1.16.45-beta-20250618-073451-6e48fb62",
53
- "@blocklet/resolver": "1.16.45-beta-20250618-073451-6e48fb62",
54
- "@blocklet/sdk": "1.16.45-beta-20250618-073451-6e48fb62",
55
- "@blocklet/store": "1.16.45-beta-20250618-073451-6e48fb62",
52
+ "@blocklet/meta": "1.16.45-beta-20250620-082630-c0c76051",
53
+ "@blocklet/resolver": "1.16.45-beta-20250620-082630-c0c76051",
54
+ "@blocklet/sdk": "1.16.45-beta-20250620-082630-c0c76051",
55
+ "@blocklet/store": "1.16.45-beta-20250620-082630-c0c76051",
56
56
  "@blocklet/theme": "^2.13.70",
57
57
  "@fidm/x509": "^1.2.1",
58
58
  "@ocap/mcrypto": "1.20.14",
@@ -116,5 +116,5 @@
116
116
  "jest": "^29.7.0",
117
117
  "unzipper": "^0.10.11"
118
118
  },
119
- "gitHead": "afbde3291aeb63211f12b73b6c8cf5dc422cbf7f"
119
+ "gitHead": "70151f84be54392ce491a1f40976e533286d06b8"
120
120
  }