implement server offline mode (no ws)

This commit is contained in:
ansuz 2021-01-08 14:49:04 +05:30
parent d12603c50a
commit 929159a0f4
3 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ const Util = require("./common-util");
module.exports.create = function (config) {
const Env = {
OFFLINE_MODE: false,
FRESH_KEY: '',
FRESH_MODE: true,
DEV_MODE: false,
@ -117,6 +118,9 @@ module.exports.create = function (config) {
//console.log("FRESH MODE ENABLED");
Env.FRESH_KEY = +new Date();
}
// Offline mode is mostly for development. It lets us test clientside cache and offline support
if (process.env.OFFLINE) { Env.OFFLINE_MODE = true; }
}());
Env.checkCache = function (channel) {

View File

@ -38,6 +38,7 @@
"start": "node server.js",
"dev": "DEV=1 node server.js",
"fresh": "FRESH=1 node server.js",
"offline": "FRESH=1 OFFLINE=1 node server.js",
"package": "PACKAGE=1 node server.js",
"lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
"lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .",

View File

@ -313,6 +313,7 @@ nThen(function (w) {
Env.Log = _log;
config.log = _log;
if (Env.OFFLINE_MODE) { return; }
if (config.externalWebsocketURL) { return; }
require("./lib/api").create(Env);