@binance/common 2.3.8 → 2.3.10
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/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -558,6 +558,9 @@ function replaceWebsocketStreamsPlaceholders(str, variables) {
|
|
|
558
558
|
* @returns {string} A formatted user agent string including package details, Node.js version, platform, and architecture.
|
|
559
559
|
*/
|
|
560
560
|
function buildUserAgent(packageName, packageVersion) {
|
|
561
|
+
const BINANCE_ENV_VAR_USER_AGENT_REGEX = /^binance-cli\/[A-Za-z0-9._-]+ \([^;()]+; [^;()]+; [^;()]+\)$/;
|
|
562
|
+
const overriddenUserAgent = process.env["BINANCE_CONNECTOR_JS_USER_AGENT"]?.trim();
|
|
563
|
+
if (overriddenUserAgent && BINANCE_ENV_VAR_USER_AGENT_REGEX.test(overriddenUserAgent)) return overriddenUserAgent;
|
|
561
564
|
return `${packageName}/${packageVersion} (Node.js/${process.version}; ${(0, os.platform)()}; ${(0, os.arch)()})`;
|
|
562
565
|
}
|
|
563
566
|
/**
|