aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/JsApi.hx14
-rw-r--r--src/client/Main.hx4
2 files changed, 15 insertions, 3 deletions
diff --git a/src/client/JsApi.hx b/src/client/JsApi.hx
index 66d0516..b0938f8 100644
--- a/src/client/JsApi.hx
+++ b/src/client/JsApi.hx
@@ -48,7 +48,7 @@ class JsApi {
@:expose
public static function addScriptToHead(url:String, ?onLoaded:()->Void):Void {
- var script = document.createScriptElement();
+ final script = document.createScriptElement();
script.type = "text/javascript";
script.onload = onLoaded;
script.src = url;
@@ -88,6 +88,18 @@ class JsApi {
player.changeVideoSrc(src);
}
+ /** Returns current page hostname (domain without protocol) **/
+ @:expose
+ static function getLocalIp():String {
+ return main.host;
+ }
+
+ /** Returns server global ip. **/
+ @:expose
+ static function getGlobalIp():String {
+ return main.globalIp;
+ }
+
@:expose
public static function once(type:WsEventType, func:OnceEventFunc):Void {
onceListeners.push({type: type, func: func});
diff --git a/src/client/Main.hx b/src/client/Main.hx
index ad614c5..78b3504 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -32,8 +32,8 @@ class Main {
public var forceSyncNextTick = false;
final clients:Array<Client> = [];
var pageTitle = document.title;
- final host:String;
- var globalIp = "";
+ public final host:String;
+ public var globalIp(default, null) = "";
var config:Null<Config>;
final filters:Array<{regex:EReg, replace:String}> = [];
var personal = new Client("Unknown", 0);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage