mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-04-30 10:22:42 +08:00
make dpd.js https aware
This commit is contained in:
committed by
Jeff Cross
parent
6b2e505d80
commit
6299d39bc9
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
if (!window._dpd) window._dpd = {};
|
if (!window._dpd) window._dpd = {};
|
||||||
|
|
||||||
var root = window.location.origin;
|
var root = window.location.protocol + '//' + window.location.hostname;
|
||||||
|
if (window.location.port !== '') {
|
||||||
|
root += ':' + window.location.port;
|
||||||
|
}
|
||||||
|
|
||||||
var consoleLog = (typeof console !== 'undefined') && console.log;
|
var consoleLog = (typeof console !== 'undefined') && console.log;
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ ClientLib.prototype.handle = function (ctx, next) {
|
|||||||
ctx.res.setHeader('Content-Type', 'text/javascript');
|
ctx.res.setHeader('Content-Type', 'text/javascript');
|
||||||
var lib = resource.clientLib;
|
var lib = resource.clientLib;
|
||||||
|
|
||||||
var host = ctx.req.headers.host;
|
|
||||||
if (lib) lib = lib.replace('var root = window.location.origin;', 'var root = "http://' + host + '";');
|
|
||||||
|
|
||||||
ctx.res.write(lib);
|
ctx.res.write(lib);
|
||||||
resource.generate(ctx.res, function() {
|
resource.generate(ctx.res, function() {
|
||||||
ctx.res.end();
|
ctx.res.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user