Https handling
This commit is contained in:
		| @@ -65,7 +65,13 @@ if __name__ == "__main__": | |||||||
| 		, "beat" | 		, "beat" | ||||||
| 		, "-l" | 		, "-l" | ||||||
| 		, "info" | 		, "info" | ||||||
| 	]).communicate() | 	]) | ||||||
|  |  | ||||||
|  | 	import logging | ||||||
|  | 	logging.basicConfig( | ||||||
|  | 		filename = os.path.join( config["Paths"]["Log"], "access.log" ) | ||||||
|  | 		, level = logging.DEBUG | ||||||
|  | 	) | ||||||
|  |  | ||||||
| 	WebAPI( | 	WebAPI( | ||||||
| 		jsCache = config["Paths"]["Cache"] | 		jsCache = config["Paths"]["Cache"] | ||||||
|   | |||||||
| @@ -10,7 +10,10 @@ | |||||||
| 	var IE = Boolean( document[ "all" ] ); | 	var IE = Boolean( document[ "all" ] ); | ||||||
| 	var ALLOWED_ORIGINS = window[ "allowed_origins" ] || []; | 	var ALLOWED_ORIGINS = window[ "allowed_origins" ] || []; | ||||||
|  |  | ||||||
|  | 	var SECURE_HTTP = window.location.href.match( /^https:\/\// ); | ||||||
|  |  | ||||||
| 	ns[ NS_EXPORT ]( EX_READONLY_GETTER, "debug", debug ); | 	ns[ NS_EXPORT ]( EX_READONLY_GETTER, "debug", debug ); | ||||||
| 	ns[ NS_EXPORT ]( EX_CONST, "IE", IE ); | 	ns[ NS_EXPORT ]( EX_CONST, "IE", IE ); | ||||||
| 	ns[ NS_EXPORT ]( EX_CONST, "ALLOWED_ORIGINS", ALLOWED_ORIGINS ); | 	ns[ NS_EXPORT ]( EX_CONST, "ALLOWED_ORIGINS", ALLOWED_ORIGINS ); | ||||||
|  | 	ns[ NS_EXPORT ]( EX_CONST, "SECURE_HTTP", SECURE_HTTP ); | ||||||
| })(); | })(); | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| (function(){ | (function(){ | ||||||
| 	var ns = __namespace( "System.utils" ); | 	var ns = __namespace( "System.utils" ); | ||||||
|  | 	var Global = __import( "System.Global" ); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	// Get prop from obj if obj.<prop> is <type> | 	// Get prop from obj if obj.<prop> is <type> | ||||||
| 	var objGetProp = function ( obj, prop, type ) | 	var objGetProp = function ( obj, prop, type ) | ||||||
| @@ -35,7 +37,28 @@ | |||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	var SiteProto = function( path ) | ||||||
|  | 	{ | ||||||
|  | 		if( path.match( /^https?:\/\// ) ) | ||||||
|  | 		{ | ||||||
|  | 			if( Global.SECURE_HTTP ) | ||||||
|  | 			{ | ||||||
|  | 				return path.replace( /^http:\/\//, "https://" ); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				return path.replace( /^https:\/\//, "http://" ); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			return "http" + ( Global.SECURE_HTTP ? "s" : "" ) + "://" + path;; | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| 	ns[ NS_EXPORT ]( EX_FUNC, "objGetProp", objGetProp ); | 	ns[ NS_EXPORT ]( EX_FUNC, "objGetProp", objGetProp ); | ||||||
| 	ns[ NS_EXPORT ]( EX_FUNC, "objSearch", objSearch ); | 	ns[ NS_EXPORT ]( EX_FUNC, "objSearch", objSearch ); | ||||||
| 	ns[ NS_EXPORT ]( EX_FUNC, "objMap", objMap ); | 	ns[ NS_EXPORT ]( EX_FUNC, "objMap", objMap ); | ||||||
|  |  | ||||||
|  | 	ns[ NS_EXPORT ]( EX_FUNC, "siteProto", SiteProto ); | ||||||
| })(); | })(); | ||||||
|   | |||||||
| @@ -6,3 +6,6 @@ System.Global.debug; | |||||||
|  |  | ||||||
| /** @type {Boolean} */ | /** @type {Boolean} */ | ||||||
| System.Global.IE; | System.Global.IE; | ||||||
|  |  | ||||||
|  | /** @type {Boolean} */ | ||||||
|  | System.Global.SECURE_HTTP; | ||||||
|   | |||||||
| @@ -7,3 +7,5 @@ System.utils.objGetProp; | |||||||
| System.utils.objSearch; | System.utils.objSearch; | ||||||
| /** @type {Function} */ | /** @type {Function} */ | ||||||
| System.utils.objMap; | System.utils.objMap; | ||||||
|  | /** @type {Function} */ | ||||||
|  | System.utils.siteProto; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user