Node.js based forum software built for the modern web
fix: set a user-agent when sending requests
Julian Lam64339e61495f
diff --git a/src/request.js b/src/request.jsindex 97590077ef..52604ef77d 100644--- a/src/request.js+++ b/src/request.js@@ -1,5 +1,6 @@'use strict';+const nconf = require('nconf');const { CookieJar } = require('tough-cookie');const fetchCookie = require('fetch-cookie').default;@@ -9,6 +10,8 @@ exports.jar = function () {// Initialize fetch - somewhat hacky, but it's required for globalDispatcher to be available+const userAgent = `NodeBB/${nconf.get('version').split('.').shift()}.x`;+async function call(url, method, { body, timeout, jar, ...config } = {}) {let fetchImpl = fetch;if (jar) {@@ -20,6 +23,7 @@ async function call(url, method, { body, timeout, jar, ...config } = {}) {method,headers: {'content-type': 'application/json',+ 'user-agent': userAgent,...config.headers,},};