fix(core): fixed announce url issue

This commit is contained in:
OldHawk
2018-01-21 15:23:40 +08:00
parent afc3cce920
commit 915992909a
5 changed files with 18 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ module.exports = {
* value to false, then console.log info is not output
* @setDefaultValueOnIndex: set app.domain and announce.url on renderer index
* if false, app.domain and announce.url used these config settings value
* if true, app.domain and announce.url used req.app.get('domain') || req.headers.host
* if true, app.domain and announce.url req.headers.host
* if web server used proxyPass setting, this should set to false
*/
app: {

View File

@@ -1,6 +1,7 @@
'use strict';
var path = require('path'),
_ = require('lodash'),
config = require(path.resolve('./config/config'));
/**
@@ -76,28 +77,30 @@ exports.renderNotFound = function (req, res) {
* @returns {*}
*/
function getSafeMeanTorrentConfig(cfg) {
var newCfg = _.cloneDeep(cfg);
//ignore backup settings
cfg.backup = undefined;
newCfg.backup = undefined;
//ignore ircAnnounce settings
cfg.ircAnnounce = undefined;
newCfg.ircAnnounce = undefined;
//ignore password settings
cfg.password = undefined;
newCfg.password = undefined;
//ignore trace settings
cfg.trace = undefined;
newCfg.trace = undefined;
//ignore tmdbConfig.key settings
cfg.tmdbConfig.key = undefined;
newCfg.tmdbConfig.key = undefined;
//ignore trace config settings
cfg.trace = undefined;
newCfg.trace = undefined;
//ignore serverNotice settings
cfg.serverNotice = undefined;
newCfg.serverNotice = undefined;
return cfg;
return newCfg;
}
/**
@@ -110,7 +113,8 @@ function setMeanTorrentConfigDefaultValue(req, res, cfg) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
var baseUrl = httpTransport + req.headers.host;
console.log(baseUrl);
cfg.app.domain = baseUrl;
}

View File

@@ -213,7 +213,7 @@ exports.update = function (req, res) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
var baseUrl = httpTransport + req.headers.host;
res.render(path.resolve('modules/invitations/server/templates/invite-sign-up-email'), {
to_email: req.query.to_email,
name: req.user.displayName,
@@ -332,7 +332,7 @@ exports.sendOfficial = function (req, res) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
var baseUrl = httpTransport + req.headers.host;
res.render(path.resolve('modules/invitations/server/templates/invite-sign-up-email'), {
to_email: req.body.email,
name: req.user.displayName,

View File

@@ -71,7 +71,7 @@ exports.signup = function (req, res) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
var baseUrl = httpTransport + req.headers.host;
res.render(path.resolve('modules/users/server/templates/sign-up-active-email'), {
name: user.displayName,
appName: config.app.title,

View File

@@ -81,7 +81,7 @@ exports.forgot = function (req, res, next) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
var baseUrl = httpTransport + req.headers.host;
res.render(path.resolve('modules/users/server/templates/reset-password-email'), {
name: user.displayName,
appName: config.app.title,