mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
Switch to assets route
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
(function (factory) {
|
(function (factory) {
|
||||||
'use strict';
|
'use strict';
|
||||||
function loadClient(language, namespace) {
|
function loadClient(language, namespace) {
|
||||||
return Promise.resolve(jQuery.getJSON(config.relative_path + '/public/language/' + language + '/' + namespace + '.json?' + config['cache-buster']));
|
return Promise.resolve(jQuery.getJSON(config.relative_path + '/assets/language/' + language + '/' + namespace + '.json?' + config['cache-buster']));
|
||||||
}
|
}
|
||||||
var warn = function () {};
|
var warn = function () {};
|
||||||
if (typeof config === 'object' && config.environment === 'development') {
|
if (typeof config === 'object' && config.environment === 'development') {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ var nconf = require('nconf');
|
|||||||
var winston = require('winston');
|
var winston = require('winston');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
|
var meta = require('../meta');
|
||||||
var controllers = require('../controllers');
|
var controllers = require('../controllers');
|
||||||
var plugins = require('../plugins');
|
var plugins = require('../plugins');
|
||||||
var user = require('../user');
|
var user = require('../user');
|
||||||
@@ -144,15 +145,15 @@ module.exports = function (app, middleware, hotswapIds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.use(middleware.privateUploads);
|
app.use(middleware.privateUploads);
|
||||||
app.use(relativePath + '/public', express.static(path.join(__dirname, '../../', 'build/public'), {
|
app.use(relativePath + '/assets', express.static(path.join(__dirname, '../../', 'build/public'), {
|
||||||
maxAge: app.enabled('cache') ? 5184000000 : 0
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
app.use(relativePath + '/api/language', function (req, res) {
|
app.use(relativePath + '/api/language', function (req, res) {
|
||||||
winston.warn('[deprecated] Accessing language files from `/api/language` is deprecated. ' +
|
winston.warn('[deprecated] Accessing language files from `/api/language` is deprecated. ' +
|
||||||
'Use `/public/language/[langCode]/[namespace].json` for prefetch paths.');
|
'Use `/assets/language/[langCode]/[namespace].json` for prefetch paths.');
|
||||||
res.redirect(relativePath + '/public/language' + req.path + '.json');
|
res.redirect(relativePath + '/assets/language' + req.path + '.json?' + meta.config['cache-buster']);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(relativePath, express.static(path.join(__dirname, '../../', 'public'), {
|
app.use(relativePath, express.static(path.join(__dirname, '../../', 'public'), {
|
||||||
|
|||||||
Reference in New Issue
Block a user