mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-25 19:11:53 -05:00
Remove unidentified-script user agent when running the API proxy server
This commit is contained in:
@@ -17,6 +17,21 @@ export function addUserAgent(...useragent: string[]) {
|
||||
additional_useragents.push(...useragent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used by cli/nso/http-server.ts.
|
||||
* This command is intended to be run automatically and doesn't make any requests itself, so this function removes
|
||||
* the unidentified-script user agent string.
|
||||
*/
|
||||
export function addCliFeatureUserAgent(...useragent: string[]) {
|
||||
if (additional_useragents[0] === 'nxapi-cli' && additional_useragents[1] === 'unidentified-script') {
|
||||
additional_useragents.splice(1, 1, ...useragent);
|
||||
} else if (additional_useragents[0] === 'nxapi-cli') {
|
||||
additional_useragents.splice(1, 0, ...useragent);
|
||||
} else {
|
||||
additional_useragents.splice(0, 0, ...useragent);
|
||||
}
|
||||
}
|
||||
|
||||
let warned_no_useragent = false;
|
||||
|
||||
export function getUserAgent(additional = getAdditionalUserAgents()) {
|
||||
|
||||
Reference in New Issue
Block a user