forkattu lähteestä coolaj86/goldilocks.js
		
	fixed inconsistency in "admin" domain definition
This commit is contained in:
		
							vanhempi
							
								
									810d0a8e90
								
							
						
					
					
						commit
						be1a60d2e7
					
				@ -1,3 +1,12 @@
 | 
			
		||||
var adminDomains = [
 | 
			
		||||
  'localhost.alpha.daplie.me'
 | 
			
		||||
, 'localhost.admin.daplie.me'
 | 
			
		||||
, 'alpha.localhost.daplie.me'
 | 
			
		||||
, 'admin.localhost.daplie.me'
 | 
			
		||||
, 'localhost.daplie.invalid'
 | 
			
		||||
];
 | 
			
		||||
module.exports.adminDomains = adminDomains;
 | 
			
		||||
 | 
			
		||||
module.exports.create = function (deps, conf) {
 | 
			
		||||
  'use strict';
 | 
			
		||||
 | 
			
		||||
@ -43,20 +52,14 @@ module.exports.create = function (deps, conf) {
 | 
			
		||||
      */
 | 
			
		||||
    ]
 | 
			
		||||
  };
 | 
			
		||||
  opts.sites.push({
 | 
			
		||||
    // greenlock: {}
 | 
			
		||||
    $id: 'localhost.alpha.daplie.me'
 | 
			
		||||
  , paths: [
 | 
			
		||||
      { $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
 | 
			
		||||
    , { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
 | 
			
		||||
    ]
 | 
			
		||||
  });
 | 
			
		||||
  opts.sites.push({
 | 
			
		||||
    $id: 'localhost.daplie.invalid'
 | 
			
		||||
  , paths: [
 | 
			
		||||
      { $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
 | 
			
		||||
    , { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
 | 
			
		||||
    ]
 | 
			
		||||
  adminDomains.forEach(function (id) {
 | 
			
		||||
    opts.sites.push({
 | 
			
		||||
      $id: id
 | 
			
		||||
    , paths: [
 | 
			
		||||
        { $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
 | 
			
		||||
      , { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  var app = require('../app.js')(deps, conf, opts);
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,7 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
 | 
			
		||||
      var result = {};
 | 
			
		||||
 | 
			
		||||
      lines.slice(1).forEach(function (line) {
 | 
			
		||||
        var match = /(.*)\s*:\s*(.*)/.exec(line);
 | 
			
		||||
        var match = /([^:]*?)\s*:\s*(.*)/.exec(line);
 | 
			
		||||
        if (match) {
 | 
			
		||||
          result[match[1].toLowerCase()] = match[2];
 | 
			
		||||
        } else {
 | 
			
		||||
@ -186,8 +186,9 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
 | 
			
		||||
 | 
			
		||||
  var adminServer;
 | 
			
		||||
  function checkAdmin(conn, opts, headers) {
 | 
			
		||||
    var admin = adminDomains.some(function (re) {
 | 
			
		||||
      return re.test(headers.host);
 | 
			
		||||
    var host = separatePort(headers.host).host;
 | 
			
		||||
    var admin = require('./admin').adminDomains.some(function (domain) {
 | 
			
		||||
      return host === domain;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    if (admin) {
 | 
			
		||||
 | 
			
		||||
		Ladataan…
	
	
			
			x
			
			
		
	
		Viittaa uudesa ongelmassa
	
	Block a user