[server] host from args

This commit is contained in:
2018-03-29 15:04:30 +03:00
parent c8448b7848
commit c603753226
10 changed files with 42 additions and 18 deletions

View File

@@ -31,9 +31,9 @@ class Init {
private static function getHost():String {
#if flash
var url = Lib.current.loaderInfo.url;
var r:EReg = ~/((app|https?):\/\/?[-_\w\d\.]+(:\d+)?)\/?/;
if (r.match(url) && !(r.matched(2) == "app")) {
return r.matched(1);
var r:EReg = ~/(app|https?):\/\/?([-_\w\d\.]+)(:\d+)?\/?/;
if (r.match(url) && !(r.matched(1) == "app")) {
return r.matched(2);
} else {
return "localhost";
}