mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
fixed plugin css files for relative path
This commit is contained in:
@@ -2,6 +2,7 @@ var fs = require('fs'),
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
async = require('async'),
|
async = require('async'),
|
||||||
winston = require('winston'),
|
winston = require('winston'),
|
||||||
|
nconf = require('nconf'),
|
||||||
eventEmitter = require('events').EventEmitter,
|
eventEmitter = require('events').EventEmitter,
|
||||||
db = require('./database');
|
db = require('./database');
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,12 @@ var nconf = require('nconf'),
|
|||||||
|
|
||||||
// Static Assets
|
// Static Assets
|
||||||
app.get('/plugins/:id/*', function(req, res) {
|
app.get('/plugins/:id/*', function(req, res) {
|
||||||
var relPath = req._parsedUrl.pathname.replace('/plugins/' + req.params.id, '');
|
|
||||||
|
var relPath = req._parsedUrl.pathname.replace(nconf.get('relative_path') + '/plugins/' + req.params.id, '');
|
||||||
|
|
||||||
if (plugins.staticDirs[req.params.id]) {
|
if (plugins.staticDirs[req.params.id]) {
|
||||||
var fullPath = path.join(plugins.staticDirs[req.params.id], relPath);
|
var fullPath = path.join(plugins.staticDirs[req.params.id], relPath);
|
||||||
|
|
||||||
fs.exists(fullPath, function(exists) {
|
fs.exists(fullPath, function(exists) {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
res.sendfile(fullPath, {
|
res.sendfile(fullPath, {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ if(nconf.get('ssl')) {
|
|||||||
}],
|
}],
|
||||||
templateValues = {
|
templateValues = {
|
||||||
cssSrc: meta.config['theme:src'] || nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
cssSrc: meta.config['theme:src'] || nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
||||||
pluginCSS: plugins.cssFiles.map(function(file) { return { path: file + (meta.config['cache-buster'] ? '?v=' + meta.config['cache-buster'] : '') }; }),
|
pluginCSS: plugins.cssFiles.map(function(file) { return { path: '/nodebb'+file + (meta.config['cache-buster'] ? '?v=' + meta.config['cache-buster'] : '') }; }),
|
||||||
title: meta.config.title || '',
|
title: meta.config.title || '',
|
||||||
description: meta.config.description || '',
|
description: meta.config.description || '',
|
||||||
'brand:logo': meta.config['brand:logo'] || '',
|
'brand:logo': meta.config['brand:logo'] || '',
|
||||||
|
|||||||
Reference in New Issue
Block a user