mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	fix: get version directly from package.json
This commit is contained in:
		| @@ -1,17 +1,16 @@ | |||||||
| 'use strict'; | 'use strict'; | ||||||
|  |  | ||||||
| const nconf = require('nconf'); |  | ||||||
| const { CookieJar } = require('tough-cookie'); | const { CookieJar } = require('tough-cookie'); | ||||||
| const fetchCookie = require('fetch-cookie').default; | const fetchCookie = require('fetch-cookie').default; | ||||||
|  | const { version } = require('../package.json'); | ||||||
|  |  | ||||||
| exports.jar = function () { | exports.jar = function () { | ||||||
| 	return new CookieJar(); | 	return new CookieJar(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | const userAgent = `NodeBB/${version.split('.').shift()}.x`; | ||||||
|  |  | ||||||
| // Initialize fetch - somewhat hacky, but it's required for globalDispatcher to be available | // 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 } = {}) { | async function call(url, method, { body, timeout, jar, ...config } = {}) { | ||||||
| 	let fetchImpl = fetch; | 	let fetchImpl = fetch; | ||||||
| 	if (jar) { | 	if (jar) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user