From 98c8d7086fed20785aa1854a2ecd204decddab3e Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 9 Jun 2021 18:43:31 +0530 Subject: [PATCH] include instance version in Env --- lib/env.js | 3 +++ server.js | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/env.js b/lib/env.js index 06169297e..99f8c1d2b 100644 --- a/lib/env.js +++ b/lib/env.js @@ -10,6 +10,7 @@ const Core = require("./commands/core"); const Quota = require("./commands/quota"); const Util = require("./common-util"); +const Package = require("../package.json"); var canonicalizeOrigin = function (s) { if (typeof(s) === 'undefined') { return; } @@ -18,6 +19,8 @@ var canonicalizeOrigin = function (s) { module.exports.create = function (config) { const Env = { + version: Package.version, + httpUnsafeOrigin: canonicalizeOrigin(config.httpUnsafeOrigin), httpSafeOrigin: canonicalizeOrigin(config.httpSafeOrigin), removeDonateButton: config.removeDonateButton, diff --git a/server.js b/server.js index 653319e99..72779c5f5 100644 --- a/server.js +++ b/server.js @@ -4,7 +4,6 @@ var Express = require('express'); var Http = require('http'); var Fs = require('fs'); -var Package = require('./package.json'); var Path = require("path"); var nThen = require("nthen"); var Util = require("./lib/common-util"); @@ -243,7 +242,7 @@ var serveConfig = makeRouteCache(function (host) { 'var obj = ' + JSON.stringify({ requireConf: { waitSeconds: 600, - urlArgs: 'ver=' + Package.version + cacheString(), + urlArgs: 'ver=' + Env.version + cacheString(), }, removeDonateButton: (Env.removeDonateButton === true), allowSubscriptions: (Env.allowSubscriptions === true),