![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/keeview_app/html/ |
Upload File : |
window.androidHost = { getFirebaseMessages: () => EncodingClass.string.fromVariable([]), getButtonsQueue: () => EncodingClass.string.fromVariable([]), getCallbackList: () => EncodingClass.string.fromVariable([]), getParamsList: () => EncodingClass.string.fromVariable([]), setUrl: (url) => {location.href = url;}, getTaskList: () => "", getDeviceToken: () => "" }; const mobileHost = Object.freeze(function () { var rv = {}; var callbackQueue = { count: 0 }; rv.backToHome = function (androidHost) { return function () { androidHost.backToHome(); } } (androidHost); rv.exit = function (androidHost) { return function () { androidHost.exit(); } } (androidHost); var statusHook = { status: "running", queue: [] }; rv.setStatusHook = function (statusHookQueue) { return function (func) { var i, n; if (func === undefined) return { result: false, message: "undefined function" }; if (func === null) return { result: false, message: "null function" }; if (!EncodingClass.type.isFunction(func)) return { result: false, message: "invalid function" }; n = statusHookQueue.length; for (i = 0; i < n; i++) { if (statusHookQueue[i] === func) return { result: false, message: "already hooked" }; } statusHookQueue.push(func); return { result: true, message: "success" } } } (statusHook.queue); rv.unhookStatusHook = function (statusHookQueue) { return function (func) { var i, j, n, ok = false; if (func === undefined) return false; if (func === null) return false; if (!EncodingClass.type.isFunction(func)) return false; n = statusHookQueue.length; for (i = 0; i < n; i++) { if (statusHookQueue[i] === func) { ok = true; for (j = i + 1; j < n; j++) { statusHookQueue[j - 1] = statusHookQueue[j]; } statusHookQueue.pop(); break; } } return ok; } } (statusHook.queue); var messageHook = { queue: [] } rv.setCloudMessageHook = function (messageHookQueue) { return function (func) { var i, n; if (func === undefined) return { result: false, message: "undefined function" }; if (func === null) return { result: false, message: "null function" }; if (!EncodingClass.type.isFunction(func)) return { result: false, message: "invalid function" }; n = messageHookQueue.length; for (i = 0; i < n; i++) { if (messageHookQueue[i] === func) return { result: false, message: "already hooked" }; } messageHookQueue.push(func); return { result: true, message: "success" }; } } (messageHook.queue); rv.unHookCloudMessageHook = function (messageHookQueue) { return function (func) { var i, j, n, ok = false; if (func === undefined) return false; if (func === null) return false; if (!EncodingClass.type.isFunction(func)) return false; n = messageHookQueue.length; for (i = 0; i < n; i++) { if (messageHookQueue[i] === func) { ok = true; for (j = i + 1; j < n; j++) { messageHookQueue[j - 1] = messageHookQueue[j]; } messageHookQueue.pop(); break; } } return ok; } } (messageHook.queue); var buttonHook = { queue: [] }; var setKeyHook = function (androidHost, buttonHook) { return function () { var i, j, marked = []; var s; for (i = 0; i < buttonHook.queue.length; i++) { for (j = 0; j < buttonHook.queue[i].list.length; j++) { s = buttonHook.queue[i].list[j]; if (s == "back") { marked[s] = true; }; } } androidHost.setKeyHook(JSON.stringify(Object.keys(marked))); } } (androidHost, buttonHook); rv.setButtonHook = function (setKeyHook, buttonHookQueue) { return function (buttonList, func) { var i, n; if (func === undefined) return { result: false, message: "undefined function" }; if (func === null) return { result: false, message: "null function" }; if (!EncodingClass.type.isFunction(func)) return { result: false, message: "invalid function" }; if (EncodingClass.type.isString(buttonList)) buttonList = [buttonList]; if (!EncodingClass.type.isArray(buttonList)) return { result: false, message: "invalid button list" }; n = buttonHookQueue.length; for (i = 0; i < n; i++) { if (buttonHookQueue[i].func === func) return { result: false, message: "already hooked" }; } buttonHookQueue.push({ list: EncodingClass.string.duplicate(buttonList), func: func }); setKeyHook(); return { result: true, message: "success" }; }; } (setKeyHook, buttonHook.queue); rv.unHookButtonHook = function (setKeyHook, buttonHookQueue) { return function (func) { var i, j, n, ok = false, changed = false; if (func === undefined) return false; if (func === null) return false; if (!EncodingClass.type.isFunction(func)) return false; n = buttonHookQueue.length; for (i = 0; i < n; i++) { if (buttonHookQueue[i].func === func) { ok = true; for (j = i + 1; j < n; j++) { buttonHookQueue[j - 1] = messageHookQueue[j]; } buttonHookQueue.pop(); changed = true; break; } } if (changed) setKeyHook(); return ok; }; } (setKeyHook, buttonHook.queue); var taskHook = { queue: [] }; rv.setTaskHook = function (taskHookQueue) { return function (func) { var i, n; if (func === undefined) return { result: false, message: "undefined function" }; if (func === null) return { result: false, message: "null function" }; if (!EncodingClass.type.isFunction(func)) return { result: false, message: "invalid function" }; n = taskHookQueue.length; for (i = 0; i < n; i++) { if (taskHookQueue[i] === func) return { result: false, message: "already hooked" }; } taskHookQueue.push(func); return { result: true, message: "success" }; }; } (taskHook.queue); rv.unHookTaskHook = function (taskHookQueue) { return function (func) { var i, j, n, ok = false; if (func === undefined) return false; if (func === null) return false; if (!EncodingClass.type.isFunction(func)) return false; n = taskHookQueue.length; for (i = 0; i < n; i++) { if (taskHookQueue[i] === func) { ok = true; for (j = i + 1; j < n; j++) { taskHookQueue[j - 1] = taskHookQueue[j]; } taskHookQueue.pop(); break; } } return ok; } } (taskHook.queue); var locationHook = { lastReceivedLocation: null, queue: [], firstcall: 0, successed: 0 }; rv.getLocation = function (locationHook, androidHost, locationHookQueue) { return function (func) { var i, n, now; if (func === undefined) return { result: false, message: "undefined function" }; if (func === null) return { result: false, message: "null function" }; if (!EncodingClass.type.isFunction(func)) return { result: false, message: "invalid function" }; now = (new Date()).getTime(); if ((locationHook.firstcall > 0) && (locationHook.firstcall + 15000 < now) && (locationHook.successed == 0)) { setTimeout(function (func) { return function () { try { func(null); } catch (e) { console.error(e); } } } (func), 10); } else { n = locationHookQueue.length; for (i = 0; i < n; i++) { if (locationHookQueue[i] === func) return { result: false, message: "already called" }; } locationHookQueue.push(func); if (locationHook.firstcall == 0) { locationHook.firstcall = now; } } return androidHost.requestLocation(); }; } (locationHook, androidHost, locationHook.queue); rv.getLocationWithPermission = function (mobileHost) { return function (func) { if (mobileHost.checkLocationPermission()) return mobileHost.getLocation(func); mobileHost.requestLocationPermission(function (mobileHost, func) { return function (result) { if (result) mobileHost.getLocation(func); } } (mobileHost, func)); } } (rv); Object.defineProperty(rv, "lastReceivedLocation", { get: function (locationHook) { return function () { if (locationHook.lastReceivedLocation == null) return null; return EncodingClass.string.duplicate(locationHook.lastReceivedLocation); } } (locationHook) }); var hookTrigger = function (androidHost, mobileHost, statusHook, messageHook, buttonHook, taskHook, locationHook, callbackQueue) { return function () { var status; var i, j, s, keys, temp; var now = (new Date()).getTime(); if (statusHook.queue.length > 0) { status = androidHost.getAppStatus(); if (status != statusHook.status) { statusHook.status = status; for (i = 0; i < statusHook.queue.length; i++) { try { statusHook.queue[i](status); } catch (e) { console.error(e); mobileHost.unhookStatusHook(statusHook.queue[i]); } } } } var messages = EncodingClass.string.toVariable(androidHost.getFirebaseMessages()); if (messages.length > 0) { console.log(messages); for (i = 0; i < messages.length; i++) { keys = Object.keys(messages[i].data); for (j = 0; j < keys.length; j++) { s = messages[i].data[keys[j]]; try { messages[i].data[keys[j]] = JSON.parse(s); } catch (e) { messages[i].data[keys[j]] = s; } } messages[i].time = new Date(messages[i].time * 1000); console.log(messages[i]); } for (i = 0; i < messageHook.queue.length; i++) { for (j = 0; j < messages.length; j++) { try { messageHook.queue[i](messages[j]); } catch (e) { console.error(e); mobileHost.unHookCloudMessageHook(messageHook.queue[i]); i--; break; } } } } var buttons = EncodingClass.string.toVariable(androidHost.getButtonsQueue()); if (buttons.length > 0) { for (i = 0; i < buttons.length; i++) { var event = { cancel: false } switch (buttons[i]) { case 4: event.button = "back"; break; default: break; } if (event.button === undefined) continue; for (j = buttonHook.queue.length - 1; j >= 0; j--) { if (buttonHook.queue[j].list.indexOf(event.button) >= 0) { try { buttonHook.queue[j].func(event); if (event.cancel) break; } catch (e) { console.error(e); mobileHost.unHookButtonHook(buttonHook.queue[j].func); } } } if (!event.cancel) { switch (buttons[i]) { case 4: androidHost.exit(); break; } } } } var tList = androidHost.getTaskList(); if (tList != "") { tList = EncodingClass.string.toVariable(tList); for (i = 0; i < tList.length; i++) { keys = Object.keys(tList[i]); for (j = 0; j < keys.length; j++) { temp = tList[i][keys[j]]; try { tList[i][keys[j]] = JSON.parse(temp); } catch (e) { tList[i][keys[j]] = temp; } } for (j = 0; j < taskHook.queue.length; j++) { try { temp = EncodingClass.string.duplicate(tList[i]); taskHook.queue[j](temp); } catch (e) { console.error(e); } } } } var cList = EncodingClass.string.toVariable(androidHost.getCallbackList()); for (i = 0; i < cList.length; i++) { var index = cList[i].index; var content = cList[i].content; if (content != "") { content = EncodingClass.string.toVariable(content); } else { content = null; } try { if (callbackQueue["a" + index] !== undefined) callbackQueue["a" + index](content); } catch (e) { console.error(e); } delete callbackQueue["a" + index]; } if (locationHook.queue.length > 0) { var r = androidHost.getLocationValue(); if (r.substr(0, 3) == "ok#") { r = EncodingClass.string.toVariable(r.substr(3)); if (r.time !== undefined) r.time = new Date(r.time * 1000); } else if (r == "null#") { r = null; } else { // notready# r = undefined; } if (r !== undefined) { var h = []; if (locationHook.successed == 0) locationHook.successed = now; locationHook.lastReceivedLocation = r; while (locationHook.queue.length > 0) { h.push(locationHook.queue.shift()); } for (i = 0; i < h.length; i++) { try { h[i](EncodingClass.string.duplicate(r)); } catch (e) { console.error(e); } } } if ((locationHook.firstcall > 0) && (locationHook.successed == 0) && (locationHook.firstcall + 15000 < now)) { setTimeout(function (locationHook) { return function () { var i, func; while (locationHook.queue.length > 0) { func = locationHook.queue.shift(); try { func(null); } catch (e) { console.error(e); } } } } (locationHook), 100); } } setTimeout(hookTrigger, 100); } } (androidHost, rv, statusHook, messageHook, buttonHook, taskHook, locationHook, callbackQueue); setTimeout(hookTrigger, 100); rv.getAppStatus = function (androidHost) { return function () { return androidHost.getAppStatus(); } } (androidHost); rv.getDeviceToken = function (androidHost) { return function () { return androidHost.getDeviceToken(); } } (androidHost); Object.defineProperty(rv, "parameters", { get: function (androidHost) { return function () { var s = androidHost.getParamsList(); var i, t, keys; s = EncodingClass.string.toVariable(s); keys = Object.keys(s); for (i = 0; i < keys.length; i++) { t = s[keys[i]]; try { s[keys[i]] = JSON.parse(t); } catch (e) { s[keys[i]] = t; } } return s; } } (androidHost) }); rv.navigate = function (androidHost) { return function (target) { androidHost.setUrl(target); } } (androidHost); rv.reload = function (mobileHost) { return function () { mobileHost.navigate(window.location.href); } } (rv); rv.localNotify = function (androidHost, callbackQueue) { return function (title, content, callbackfunc) { var callbackIndex; if ((callbackfunc === undefined) || (callbackfunc === null)) { callbackIndex = -1; } else if (!EncodingClass.type.isFunction(callbackfunc)) { callbackIndex = -1; } else { callbackIndex = callbackQueue.count++; callbackQueue["a" + callbackIndex] = callbackfunc; } if (EncodingClass.type.isString(content)) { androidHost.localStringNotify(title, content, callbackIndex); } else { androidHost.localObjectNotify(title, JSON.stringify(content), callbackIndex); } }; } (androidHost, callbackQueue); rv.requestPermission = function (androidHost, callbackQueue) { return function (permissions, callbackfunc) { var callbackIndex, xcallbackfunc; var i; if (EncodingClass.type.isString(permissions)) permissions = [permissions]; if (!EncodingClass.type.isArray(permissions)) return { result: false, message: "invalid permissions array type" }; for (i = 0; i < permissions.length; i++) { if (!EncodingClass.type.isString(permissions[i])) { if (!EncodingClass.type.isArray(permissions)) return { result: false, message: "permissions[" + i + "]: invalid type" }; } } if ((callbackfunc === undefined) || (callbackfunc === null)) { return { result: false, message: "invalid callbackfunc" }; } if (!EncodingClass.type.isFunction(callbackfunc)) { return { result: false, message: "invalid callbackfunc" }; } xcallbackfunc = function (callbackfunc) { return function (content) { var i; for (i = 0; i < content.length; i++) { content[i].result = (content[i].result == 0); } try { callbackfunc(content); } catch (e) { console.error(e); } } } (callbackfunc); callbackIndex = callbackQueue.count++; callbackQueue["a" + callbackIndex] = xcallbackfunc; androidHost.requestPermission(JSON.stringify({permissions: permissions, callbackIndex: callbackIndex})); return { result: true }; }; } (androidHost, callbackQueue); rv.requestLocationPermission = function (mobileHost) { return function (callbackfunc) { return mobileHost.requestPermission("android.permission.ACCESS_FINE_LOCATION", function (callbackfunc) { return function (result) { try { callbackfunc(result[0].result); } catch (e) { console.error(e); } } } (callbackfunc)); } } (rv); rv.checkLocationPermission = function (androidHost) { return function () { if (androidHost.checkPermission("android.permission.ACCESS_FINE_LOCATION")) return true; if (androidHost.checkPermission("android.permission.ACCESS_COARSE_LOCATION")) return true; return false; } } (androidHost); return rv; } ()); (function (mobileHost) { var Geolocation = function () { this.autoId = 0; this.watchCount = 0; this.watchList = {}; this.timeoutIdx = -1; }; Geolocation.prototype.getCurrentPosition = function (success, error) { var r; if (success === undefined) return; if (error === undefined) error = function () { }; var func = function (value) { try { success({coords: value, timestamp: new Date().getTime()}); } catch (e) { console.error(e); } } if (mobileHost.checkLocationPermission()) return mobileHost.getLocation(func); mobileHost.requestLocationPermission(function (result) { if (result) { mobileHost.getLocation(func); } else { try { error(value); } catch (e) { console.error(e); } } }); }; Geolocation.prototype._startWatch = function () { var self = this; function onLoop() { self.getCurrentPosition(function (result) { Object.values(this.watchList).forEach(function (callback) { callback(result); }); if (self.watchCount > 0) { clearTimeout(self.timeoutIdx); self.timeoutIdx = setTimeout(onLoop, 3000); } }, function () { }); } clearTimeout(this.timeoutIdx); this.timeoutIdx = setTimeout(onLoop, 100); }; Geolocation.prototype._stopWatch = function () { clearTimeout(this.timeoutIdx); }; Geolocation.prototype.watchPosition = function (callback) { var id = this.autoId++; if (this.watchCount === 0) { this._startWatch(); } this.watchList[id] = callback; this.watchCount++; return id; }; Geolocation.prototype.clearWatch = function (id) { if (this.watchList[id] === undefined ) return; delete this.watchList[id]; this.watchCount--; if (this.watchCount === 0) { this._stopWatch(); } }; var myGeolocation = new Geolocation(); if (navigator.geolocation) { //can not assign navigator.geolocation navigator.geolocation.getCurrentPosition = myGeolocation.getCurrentPosition.bind(myGeolocation); navigator.geolocation.watchPosition = myGeolocation.watchPosition.bind(myGeolocation); navigator.geolocation.clearWatch = myGeolocation.clearWatch.bind(myGeolocation); } else { navigator.geolocation = myGeolocation; } navigator.geolocation = new Geolocation(); })(mobileHost);