Updated to 1.2.20
This commit is contained in:
parent
b062dd7d06
commit
48081603ba
4 changed files with 157 additions and 21 deletions
66
index.php
66
index.php
|
@ -31,6 +31,9 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>TeaSpeak-Web</title>
|
<title>TeaSpeak-Web</title>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(!isset($CLIENT) || !$CLIENT) {
|
||||||
|
?>
|
||||||
<link rel="stylesheet" href="css/scroll.css" type="text/css">
|
<link rel="stylesheet" href="css/scroll.css" type="text/css">
|
||||||
<link rel="stylesheet" href="css/ts/tab.css" type="text/css">
|
<link rel="stylesheet" href="css/ts/tab.css" type="text/css">
|
||||||
<link rel="stylesheet" href="css/ts/chat.css" type="text/css">
|
<link rel="stylesheet" href="css/ts/chat.css" type="text/css">
|
||||||
|
@ -44,7 +47,7 @@
|
||||||
<link rel="stylesheet" href="css/control_bar.css" type="text/css">
|
<link rel="stylesheet" href="css/control_bar.css" type="text/css">
|
||||||
<link rel="stylesheet" href="css/context_menu.css" type="text/css">
|
<link rel="stylesheet" href="css/context_menu.css" type="text/css">
|
||||||
<link rel="stylesheet" href="vendor/bbcode/xbbcode.css" type="text/css">
|
<link rel="stylesheet" href="vendor/bbcode/xbbcode.css" type="text/css">
|
||||||
|
<?php } ?>
|
||||||
<!-- https://localhost:9987/?forward_url=http%3A%2F%2Flocalhost%3A63344%2FWeb-Client%2Findex.php%3F_ijt%3D82b1uhmnh0a5l1n35nnjps5eid%26loader_ignore_age%3D1%26connect_default_host%3Dlocalhost%26default_connect_type%3Dforum%26default_connect_url%3Dtrue%26default_connect_type%3Dteamspeak%26default_connect_url%3Dlocalhost%253A9987 -->
|
<!-- https://localhost:9987/?forward_url=http%3A%2F%2Flocalhost%3A63344%2FWeb-Client%2Findex.php%3F_ijt%3D82b1uhmnh0a5l1n35nnjps5eid%26loader_ignore_age%3D1%26connect_default_host%3Dlocalhost%26default_connect_type%3Dforum%26default_connect_url%3Dtrue%26default_connect_type%3Dteamspeak%26default_connect_url%3Dlocalhost%253A9987 -->
|
||||||
<!-- PHP generated properies -->
|
<!-- PHP generated properies -->
|
||||||
<!-- localhost:63342/TeaSpeak-Web/index.php?_ijt=o48hmliefjoa8cer8v7mpl98pj&connect_default_host=192.168.43.141 -->
|
<!-- localhost:63342/TeaSpeak-Web/index.php?_ijt=o48hmliefjoa8cer8v7mpl98pj&connect_default_host=192.168.43.141 -->
|
||||||
|
@ -226,18 +229,69 @@
|
||||||
<div id="templates"></div>
|
<div id="templates"></div>
|
||||||
<div id="music-test"></div>
|
<div id="music-test"></div>
|
||||||
<div style="height: 100px"></div>
|
<div style="height: 100px"></div>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
/**
|
||||||
|
* @param path {string}
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
function load_script0(path) {
|
||||||
|
if(window.require !== undefined) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
console.log("load via node %o %o", resolve, reject);
|
||||||
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
|
ipcRenderer.send("load-file", "loaded-file-" + path, path);
|
||||||
|
ipcRenderer.once("loaded-file-" + path, (event, data) => {
|
||||||
|
if(data === '404') {
|
||||||
|
reject('script missing');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tag = document.createElement("script");
|
||||||
|
tag.type = "text\/javascript";
|
||||||
|
document.getElementById("scripts").appendChild(tag);
|
||||||
|
tag.src = URL.createObjectURL(new Blob([decodeURIComponent(data)], {type: "text/javascript"}));
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else { //Normal web browser load
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
console.log("load via web %o %o", resolve, reject);
|
||||||
|
const tag = document.createElement("script");
|
||||||
|
tag.type = "text\/javascript";
|
||||||
|
tag.onerror = error => {
|
||||||
|
console.log(error);
|
||||||
|
tag.remove();
|
||||||
|
reject(error);
|
||||||
|
};
|
||||||
|
tag.onload = () => resolve();
|
||||||
|
document.getElementById("scripts").appendChild(tag);
|
||||||
|
tag.src = path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(window.require !== undefined) {
|
||||||
|
module.paths.push("/home/wolverindev/Development-WebApp/")
|
||||||
|
window.$ = require("jquery");
|
||||||
|
} else {
|
||||||
|
load_script0("vendor/jquery/jquery.min.js");
|
||||||
|
}
|
||||||
|
load_script0("load.js");
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<footer>
|
<footer>
|
||||||
<div class="container" style="display: flex; flex-direction: row; align-content: space-between;">
|
<div class="container" style="display: flex; flex-direction: row; align-content: space-between;">
|
||||||
<div style="align-self: center; position: fixed; left: 5px;">Open source on <a href="https://github.com/TeaSpeak/TeaSpeak-Web" style="display: inline-block; position: relative">github.com</a></div>
|
<div style="align-self: center; position: fixed; left: 5px;">Open source on <a href="https://github.com/TeaSpeak/TeaSpeak-Web" style="display: inline-block; position: relative">github.com</a></div>
|
||||||
<div style="align-self: center;">TeaSpeak Web client by WolverinDEV</div>
|
<div style="align-self: center;">TeaSpeak Web client by WolverinDEV</div>
|
||||||
<div style="align-self: center; position: fixed; right: 5px;">
|
<div style="align-self: center; position: fixed; right: 5px;">
|
||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
if(logged_in()) {
|
if(logged_in()) {
|
||||||
?> <a href="<?php echo authPath() . "auth.php?type=logout"; ?>">logout</a> <?php
|
echo '<a href="' . authPath() . '"auth.php?type=logout>logout</a>';
|
||||||
} else {
|
} else {
|
||||||
?> <a href="<?php echo authPath() . "login.php"; ?>">Login</a> via the TeaSpeak forum. <?php
|
echo '<a href="' . authPath() . '"login.php>Login</a> via the TeaSpeak forum.';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
20
js/load.ts
20
js/load.ts
|
@ -36,8 +36,9 @@ namespace app {
|
||||||
};
|
};
|
||||||
|
|
||||||
Module['onAbort'] = message => {
|
Module['onAbort'] = message => {
|
||||||
Module['onAbort'] = undefined;
|
//Module['onAbort'] = undefined;
|
||||||
displayCriticalError("Could not load webassembly files!<br>Message: <code>" + message + "</code>", false);
|
//displayCriticalError("Could not load webassembly files!<br>Message: <code>" + message + "</code>", false);
|
||||||
|
Module['onRuntimeInitialized'](); //FIXME! Just a bridge
|
||||||
};
|
};
|
||||||
|
|
||||||
Module['locateFile'] = file => {
|
Module['locateFile'] = file => {
|
||||||
|
@ -93,18 +94,7 @@ function loadScript(path: string | string[]) : Promise<Boolean> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return new Promise<Boolean>((resolve, reject) => {
|
return load_script0(path);
|
||||||
const tag = document.createElement("script");
|
|
||||||
tag.type = "text\/javascript";
|
|
||||||
tag.onerror = error => {
|
|
||||||
console.log(error);
|
|
||||||
tag.remove();
|
|
||||||
reject(error);
|
|
||||||
};
|
|
||||||
tag.onload = () => resolve();
|
|
||||||
document.getElementById("scripts").appendChild(tag);
|
|
||||||
tag.src = path;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +231,7 @@ function displayCriticalError(message: string, closeable: boolean = true) {
|
||||||
|
|
||||||
function loadTemplates() {
|
function loadTemplates() {
|
||||||
//Load the templates
|
//Load the templates
|
||||||
$.ajax("templates.html", {
|
$.ajax("http://localhost/home/TeaSpeak/TeaSpeak/Web-Client/templates.html", {
|
||||||
cache: false, //Change this when in release mode
|
cache: false, //Change this when in release mode
|
||||||
}).then((element, status) => {
|
}).then((element, status) => {
|
||||||
let node = document.createElement("html");
|
let node = document.createElement("html");
|
||||||
|
|
|
@ -187,6 +187,7 @@ interface Window {
|
||||||
readonly webkitOfflineAudioContext: typeof webkitOfflineAudioContext;
|
readonly webkitOfflineAudioContext: typeof webkitOfflineAudioContext;
|
||||||
readonly RTCPeerConnection: typeof RTCPeerConnection;
|
readonly RTCPeerConnection: typeof RTCPeerConnection;
|
||||||
readonly Pointer_stringify: any;
|
readonly Pointer_stringify: any;
|
||||||
|
require(id: string): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Navigator {
|
interface Navigator {
|
||||||
|
|
91
loader/files.php
Normal file
91
loader/files.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$APP_FILE_LIST = [ ];
|
||||||
|
$APP_FILE_ROOT = [
|
||||||
|
"js" => "../js/",
|
||||||
|
"css" => "../css/",
|
||||||
|
"vendor" => "../"
|
||||||
|
];
|
||||||
|
|
||||||
|
function list_dir($base_dir, $match = null, &$results = array(), $dir = "") {
|
||||||
|
$files = scandir($base_dir . $dir);
|
||||||
|
|
||||||
|
foreach($files as $key => $value){
|
||||||
|
$path = $base_dir.$dir.DIRECTORY_SEPARATOR.$value;
|
||||||
|
if(!is_dir($path)) {
|
||||||
|
if(!$match || preg_match($match, $path))
|
||||||
|
$results[] = ($dir ? $dir.DIRECTORY_SEPARATOR : "").$value;
|
||||||
|
} else if($value != "." && $value != "..") {
|
||||||
|
list_dir($base_dir, $match, $results, ($dir ? $dir.DIRECTORY_SEPARATOR : "").$value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function files_css() {
|
||||||
|
global $APP_FILE_ROOT;
|
||||||
|
return list_dir($APP_FILE_ROOT["css"], "/.*\.css$/");
|
||||||
|
}
|
||||||
|
|
||||||
|
function files_js() {
|
||||||
|
global $APP_FILE_ROOT;
|
||||||
|
return list_dir($APP_FILE_ROOT["js"], "/.*\.js$/");
|
||||||
|
}
|
||||||
|
|
||||||
|
function vendor() {
|
||||||
|
return ["vendor/jquery/jquery.min.js", "vendor/bbcode/xbbcode.js", "vendor/jsrender/jsrender.min.js", "asm/generated/TeaWeb-Identity.js"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function fdump($name) {
|
||||||
|
$file = fopen($name, "r") or die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"error" => "missing file (" . $name . ")"
|
||||||
|
]));
|
||||||
|
|
||||||
|
echo (fread($file, filesize($name)));
|
||||||
|
fclose($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log("XXX: ");
|
||||||
|
if($_GET["type"] === "files") {
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
header("info-version: 1");
|
||||||
|
foreach(files_js() as $file) {
|
||||||
|
echo $file . "\t" . sha1_file($APP_FILE_ROOT["js"] . DIRECTORY_SEPARATOR . $file) . "\n";
|
||||||
|
}
|
||||||
|
foreach(files_css() as $file) {
|
||||||
|
echo $file . "\t" . sha1_file($APP_FILE_ROOT["css"] . DIRECTORY_SEPARATOR . $file) . "\n";
|
||||||
|
}
|
||||||
|
foreach(vendor() as $file) {
|
||||||
|
echo $file . "\t" . sha1_file($APP_FILE_ROOT["vendor"] . DIRECTORY_SEPARATOR . $file) . "\n";
|
||||||
|
}
|
||||||
|
echo "main\t".sha1("main");
|
||||||
|
die;
|
||||||
|
} else if($_GET["type"] === "file") {
|
||||||
|
error_log("XXX: " . $_GET["name"]);
|
||||||
|
if($_GET["name"] == "main") {
|
||||||
|
global $CLIENT;
|
||||||
|
$CLIENT = true;
|
||||||
|
include("../index.php");
|
||||||
|
} else {
|
||||||
|
foreach(files_css() as $file) {
|
||||||
|
if($file == $_GET["name"]) {
|
||||||
|
fdump($APP_FILE_ROOT["css"] . $_GET["name"]); //FIXME test path!
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach(files_js() as $file) {
|
||||||
|
if($file == $_GET["name"]) {
|
||||||
|
fdump($APP_FILE_ROOT["js"] . $_GET["name"]); //FIXME test path!
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fdump('../' . $_GET["name"]); //FIXME remove this!
|
||||||
|
}
|
||||||
|
die();
|
||||||
|
} else die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"error" => "invalid action!"
|
||||||
|
]));
|
Loading…
Add table
Reference in a new issue