aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/JsApi.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2021-02-10 05:03:56 +0300
committerRblSb <msrblsb@gmail.com>2021-02-10 05:03:56 +0300
commit5b4d9c6257f7563ef685ab383037906355fbf054 (patch)
treefcedd11a16df8d77aee1f157311fd0381b80eafd /src/client/JsApi.hx
parent71d2415a7992c7142200656857ecee3512b238a4 (diff)
Api: getLocalIp / getGlobalIp
Diffstat (limited to 'src/client/JsApi.hx')
-rw-r--r--src/client/JsApi.hx14
1 files changed, 13 insertions, 1 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});
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage