include instance version in Env

pull/1/head
ansuz 4 years ago
parent 87a52b67f5
commit 98c8d7086f

@ -10,6 +10,7 @@ const Core = require("./commands/core");
const Quota = require("./commands/quota"); const Quota = require("./commands/quota");
const Util = require("./common-util"); const Util = require("./common-util");
const Package = require("../package.json");
var canonicalizeOrigin = function (s) { var canonicalizeOrigin = function (s) {
if (typeof(s) === 'undefined') { return; } if (typeof(s) === 'undefined') { return; }
@ -18,6 +19,8 @@ var canonicalizeOrigin = function (s) {
module.exports.create = function (config) { module.exports.create = function (config) {
const Env = { const Env = {
version: Package.version,
httpUnsafeOrigin: canonicalizeOrigin(config.httpUnsafeOrigin), httpUnsafeOrigin: canonicalizeOrigin(config.httpUnsafeOrigin),
httpSafeOrigin: canonicalizeOrigin(config.httpSafeOrigin), httpSafeOrigin: canonicalizeOrigin(config.httpSafeOrigin),
removeDonateButton: config.removeDonateButton, removeDonateButton: config.removeDonateButton,

@ -4,7 +4,6 @@
var Express = require('express'); var Express = require('express');
var Http = require('http'); var Http = require('http');
var Fs = require('fs'); var Fs = require('fs');
var Package = require('./package.json');
var Path = require("path"); var Path = require("path");
var nThen = require("nthen"); var nThen = require("nthen");
var Util = require("./lib/common-util"); var Util = require("./lib/common-util");
@ -243,7 +242,7 @@ var serveConfig = makeRouteCache(function (host) {
'var obj = ' + JSON.stringify({ 'var obj = ' + JSON.stringify({
requireConf: { requireConf: {
waitSeconds: 600, waitSeconds: 600,
urlArgs: 'ver=' + Package.version + cacheString(), urlArgs: 'ver=' + Env.version + cacheString(),
}, },
removeDonateButton: (Env.removeDonateButton === true), removeDonateButton: (Env.removeDonateButton === true),
allowSubscriptions: (Env.allowSubscriptions === true), allowSubscriptions: (Env.allowSubscriptions === true),

Loading…
Cancel
Save