MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / getUserAgent

Function getUserAgent

js/server_functions.js:211–226  ·  view source on GitHub ↗

* Gets the preferred `User-Agent` * @returns {string} `User-Agent` to be used

()

Source from the content-addressed store, hash-verified

209 * @returns {string} `User-Agent` to be used
210 */
211function getUserAgent () {
212 const defaultUserAgent = `Mozilla/5.0 (Node.js ${Number(process.version.match(/^v(\d+\.\d+)/)[1])}) MagicMirror/${global.version}`;
213
214 if (typeof global.config === "undefined") {
215 return defaultUserAgent;
216 }
217
218 switch (typeof global.config.userAgent) {
219 case "function":
220 return global.config.userAgent();
221 case "string":
222 return global.config.userAgent;
223 default:
224 return defaultUserAgent;
225 }
226}
227
228/**
229 * Gets environment variables needed in the browser.

Callers 3

getHeadersToSendFunction · 0.85
getRequestOptionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected