diff --git a/.eslintignore b/.eslintignore index ce3a35817..c910a612f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ node_modules -lib/static +lib/web/static +lib/web/ui/ coverage/ -lib/GUI/ wiki/ diff --git a/Gruntfile.js b/Gruntfile.js index 9425a3bc5..332c2862d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,7 +4,7 @@ module.exports = function(grunt) { browserify: { dist: { files: { - 'lib/static/main.js': ['lib/GUI/js/main.js'], + 'lib/static/main.js': ['lib/ui/js/main.js'], }, options: { debug: true, @@ -15,7 +15,7 @@ module.exports = function(grunt) { less: { dist: { files: { - 'lib/static/main.css': ['lib/GUI/css/main.less'], + 'lib/static/main.css': ['lib/ui/css/main.less'], }, options: { sourceMap: false, @@ -23,7 +23,7 @@ module.exports = function(grunt) { }, }, watch: { - files: ['lib/GUI/**/*'], + files: ['lib/ui/**/*'], tasks: ['default'], }, }); diff --git a/lib/index.js b/lib/index.js index f66a7d2b6..dcee454c8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,7 +6,7 @@ const compression = require('compression'); const Auth = require('./auth'); const Logger = require('./logger'); const Config = require('./config'); -const Middleware = require('./middleware'); +const Middleware = require('./web/middleware'); const Cats = require('./status-cats'); const Storage = require('./storage'); @@ -77,14 +77,14 @@ module.exports = function(config_hash) { }); } - app.use(require('./index-api')(config, auth, storage)); + app.use(require('./web/api/api')(config, auth, storage)); if (config.web && config.web.enable === false) { app.get('/', function(req, res, next) { next( Error[404]('web interface is disabled in the config file') ); }); } else { - app.use(require('./index-web')(config, auth, storage)); + app.use(require('./web/index')(config, auth, storage)); } app.get('/*', function(req, res, next) { diff --git a/lib/index-api.js b/lib/web/api/api.js similarity index 99% rename from lib/index-api.js rename to lib/web/api/api.js index 37f95a70a..46893e0c1 100644 --- a/lib/index-api.js +++ b/lib/web/api/api.js @@ -5,9 +5,9 @@ let express = require('express'); let bodyParser = require('body-parser'); let Error = require('http-errors'); let Path = require('path'); -let Middleware = require('./middleware'); -let Notify = require('./notify'); -let Utils = require('./utils'); +let Middleware = require('../middleware'); +let Notify = require('../../notify'); +let Utils = require('../../utils'); let expect_json = Middleware.expect_json; let match = Middleware.match; let media = Middleware.media; diff --git a/lib/index-web.js b/lib/web/index.js similarity index 97% rename from lib/index-web.js rename to lib/web/index.js index 4a3a101af..e2c7364cd 100644 --- a/lib/index-web.js +++ b/lib/web/index.js @@ -7,9 +7,9 @@ let express = require('express'); let fs = require('fs'); let Handlebars = require('handlebars'); let renderReadme = require('render-readme'); -let Search = require('./search'); +let Search = require('../search'); let Middleware = require('./middleware'); -let Utils = require('./utils'); +let Utils = require('../utils'); let match = Middleware.match; let validate_name = Middleware.validate_name; let validate_pkg = Middleware.validate_package; @@ -37,12 +37,12 @@ module.exports = function(config, auth, storage) { Search.configureStorage(storage); - Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./GUI/entry.hbs'), 'utf8')); + Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./ui/entry.hbs'), 'utf8')); let template; if (config.web && config.web.template) { template = Handlebars.compile(fs.readFileSync(config.web.template, 'utf8')); } else { - template = Handlebars.compile(fs.readFileSync(require.resolve('./GUI/index.hbs'), 'utf8')); + template = Handlebars.compile(fs.readFileSync(require.resolve('./ui/index.hbs'), 'utf8')); } app.get('/', function(req, res, next) { let base = Utils.combineBaseUrl(Utils.getWebProtocol(req), req.get('host'), config.url_prefix); diff --git a/lib/middleware.js b/lib/web/middleware.js similarity index 98% rename from lib/middleware.js rename to lib/web/middleware.js index cfc6a0537..5644a151d 100644 --- a/lib/middleware.js +++ b/lib/web/middleware.js @@ -4,8 +4,8 @@ const crypto = require('crypto'); const Error = require('http-errors'); -const utils = require('./utils'); -const Logger = require('./logger'); +const utils = require('../utils'); +const Logger = require('../logger'); module.exports.match = function match(regexp) { return function(req, res, next, value, name) { diff --git a/lib/static/ajax.gif b/lib/web/static/ajax.gif similarity index 100% rename from lib/static/ajax.gif rename to lib/web/static/ajax.gif diff --git a/lib/static/favicon.ico b/lib/web/static/favicon.ico similarity index 100% rename from lib/static/favicon.ico rename to lib/web/static/favicon.ico diff --git a/lib/static/favicon.png b/lib/web/static/favicon.png similarity index 100% rename from lib/static/favicon.png rename to lib/web/static/favicon.png diff --git a/lib/static/fontello.eot b/lib/web/static/fontello.eot similarity index 100% rename from lib/static/fontello.eot rename to lib/web/static/fontello.eot diff --git a/lib/static/fontello.svg b/lib/web/static/fontello.svg similarity index 100% rename from lib/static/fontello.svg rename to lib/web/static/fontello.svg diff --git a/lib/static/fontello.ttf b/lib/web/static/fontello.ttf similarity index 100% rename from lib/static/fontello.ttf rename to lib/web/static/fontello.ttf diff --git a/lib/static/fontello.woff b/lib/web/static/fontello.woff similarity index 100% rename from lib/static/fontello.woff rename to lib/web/static/fontello.woff diff --git a/lib/static/jquery.min.js b/lib/web/static/jquery.min.js similarity index 100% rename from lib/static/jquery.min.js rename to lib/web/static/jquery.min.js diff --git a/lib/static/logo-sm.png b/lib/web/static/logo-sm.png similarity index 100% rename from lib/static/logo-sm.png rename to lib/web/static/logo-sm.png diff --git a/lib/static/logo.png b/lib/web/static/logo.png similarity index 100% rename from lib/static/logo.png rename to lib/web/static/logo.png diff --git a/lib/static/main.css b/lib/web/static/main.css similarity index 99% rename from lib/static/main.css rename to lib/web/static/main.css index 9682dad0d..0a3365618 100644 --- a/lib/static/main.css +++ b/lib/web/static/main.css @@ -7166,8 +7166,8 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev