Upgraded the web client to work with the TeaClient again
This commit is contained in:
parent
13b260e369
commit
41c45a0c8a
19 changed files with 373 additions and 175 deletions
|
@ -4,10 +4,14 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-container {
|
.app-container {
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
|
27
client/declarations/exports.d.ts
vendored
27
client/declarations/exports.d.ts
vendored
|
@ -1,25 +1,6 @@
|
||||||
declare namespace native {
|
|
||||||
function client_version(): Promise<string>;
|
/* File: client/js/teaforo.ts */
|
||||||
}
|
|
||||||
declare namespace forum {
|
declare namespace forum {
|
||||||
interface UserData {
|
export function register_callback(callback: () => any);
|
||||||
session_id: string;
|
export function open();
|
||||||
username: string;
|
|
||||||
application_data: string;
|
|
||||||
application_data_sign: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare namespace audio.player {
|
|
||||||
interface Device {
|
|
||||||
device_id: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
function initialized(): boolean;
|
|
||||||
function context(): AudioContext;
|
|
||||||
function destination(): AudioNode;
|
|
||||||
function on_ready(cb: () => any): void;
|
|
||||||
function initialize(): boolean;
|
|
||||||
function available_devices(): Promise<Device[]>;
|
|
||||||
function set_device(device_id?: string): Promise<void>;
|
|
||||||
function current_device(device_id?: string): Device;
|
|
||||||
}
|
}
|
||||||
|
|
23
client/generate_packed.sh
Executable file
23
client/generate_packed.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
cd "$BASEDIR"
|
||||||
|
source ../scripts/resolve_commands.sh
|
||||||
|
|
||||||
|
if [[ ! -e declarations/imports_shared.d.ts ]]; then
|
||||||
|
echo "generate the declarations first!"
|
||||||
|
echo "Execute: /scripts/build_declarations.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -e ../shared/generated/shared.js ]]; then
|
||||||
|
echo "generate the shared packed file first!"
|
||||||
|
echo "Execute: /shared/generate_packed.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
execute_tsc -p tsconfig/tsconfig_packed.json
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build file"
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -1,11 +1,10 @@
|
||||||
import TeaForumIdentity = profiles.identities.TeaForumIdentity;
|
namespace forum {
|
||||||
|
const ipc = require("electron").ipcRenderer;
|
||||||
|
let callback_listener: (() => any)[] = [];
|
||||||
|
|
||||||
const ipc = require("electron").ipcRenderer;
|
ipc.on('teaforo-update', (event, data) => {
|
||||||
let callback_listener: (() => any)[] = [];
|
|
||||||
|
|
||||||
ipc.on('teaforo-update', (event, data: forum.UserData) => {
|
|
||||||
console.log("Got data update: %o", data);
|
console.log("Got data update: %o", data);
|
||||||
profiles.identities.set_static_identity(data ? new TeaForumIdentity(data.application_data, data.application_data_sign) : undefined);
|
profiles.identities.set_static_identity(data ? new profiles.identities.TeaForumIdentity(data.application_data, data.application_data_sign) : undefined);
|
||||||
try {
|
try {
|
||||||
for(let listener of callback_listener)
|
for(let listener of callback_listener)
|
||||||
setImmediate(listener);
|
setImmediate(listener);
|
||||||
|
@ -14,12 +13,13 @@ ipc.on('teaforo-update', (event, data: forum.UserData) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
callback_listener = [];
|
callback_listener = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
export function register_callback(callback: () => any) {
|
export function register_callback(callback: () => any) {
|
||||||
callback_listener.push(callback);
|
callback_listener.push(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function open() {
|
export function open() {
|
||||||
ipc.send("teaforo-login");
|
ipc.send("teaforo-login");
|
||||||
|
}
|
||||||
}
|
}
|
6
client/tsconfig/dtsconfig.json
Normal file
6
client/tsconfig/dtsconfig.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"source_files": [
|
||||||
|
"../js/**/*.ts"
|
||||||
|
],
|
||||||
|
"target_file": "../declarations/exports.d.ts"
|
||||||
|
}
|
12
client/tsconfig/tsconfig.json
Normal file
12
client/tsconfig/tsconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* general web project config */
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"../declarations/imports_*.d.ts",
|
||||||
|
"../js/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
14
client/tsconfig/tsconfig_packed.json
Normal file
14
client/tsconfig/tsconfig_packed.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/* packed web project config */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "none",
|
||||||
|
"outFile": "../generated/client.js",
|
||||||
|
"allowJs": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"../declarations/imports_*.d.ts",
|
||||||
|
"../js/**/*.ts",
|
||||||
|
"../../shared/generated/shared.js"
|
||||||
|
]
|
||||||
|
}
|
59
files.php
59
files.php
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* this file generates the final environment. All files have to be compiled before! */
|
/* this file generates the final environment. All files have to be compiled before! */
|
||||||
$APP_FILE_LIST = [
|
$APP_FILE_LIST_SHARED_SOURCE = [
|
||||||
/* shared part */
|
|
||||||
[ /* shared html and php files */
|
[ /* shared html and php files */
|
||||||
"type" => "html",
|
"type" => "html",
|
||||||
"search-pattern" => "/^([a-zA-Z]+)\.(html|php|json)$/",
|
"search-pattern" => "/^([a-zA-Z]+)\.(html|php|json)$/",
|
||||||
|
@ -124,9 +123,10 @@
|
||||||
|
|
||||||
"path" => "i18n/",
|
"path" => "i18n/",
|
||||||
"local-path" => "./shared/i18n/"
|
"local-path" => "./shared/i18n/"
|
||||||
],
|
]
|
||||||
|
];
|
||||||
|
|
||||||
/* vendors */
|
$APP_FILE_LIST_SHARED_VENDORS = [
|
||||||
[
|
[
|
||||||
"type" => "js",
|
"type" => "js",
|
||||||
"search-pattern" => "/.*\.js$/",
|
"search-pattern" => "/.*\.js$/",
|
||||||
|
@ -142,10 +142,11 @@
|
||||||
|
|
||||||
"path" => "vendor/",
|
"path" => "vendor/",
|
||||||
"local-path" => "./vendor/"
|
"local-path" => "./vendor/"
|
||||||
],
|
]
|
||||||
|
];
|
||||||
|
|
||||||
/* client specific */
|
$APP_FILE_LIST_CLIENT_SOURCE = [
|
||||||
[
|
[ /* client css files */
|
||||||
"client-only" => true,
|
"client-only" => true,
|
||||||
"type" => "css",
|
"type" => "css",
|
||||||
"search-pattern" => "/.*\.css$/",
|
"search-pattern" => "/.*\.css$/",
|
||||||
|
@ -154,17 +155,39 @@
|
||||||
"path" => "css/",
|
"path" => "css/",
|
||||||
"local-path" => "./client/css/"
|
"local-path" => "./client/css/"
|
||||||
],
|
],
|
||||||
[
|
[ /* client js files */
|
||||||
"client-only" => true,
|
"client-only" => true,
|
||||||
"type" => "js",
|
"type" => "js",
|
||||||
"search-pattern" => "/.*\.js/",
|
"search-pattern" => "/.*\.js/",
|
||||||
"build-target" => "dev|rel",
|
"build-target" => "dev",
|
||||||
|
|
||||||
"path" => "js/",
|
"path" => "js/",
|
||||||
"local-path" => "./client/js/"
|
"local-path" => "./client/js/"
|
||||||
],
|
],
|
||||||
|
|
||||||
/* web specific */
|
/* release specific */
|
||||||
|
[ /* web merged javascript files (shared inclusive) */
|
||||||
|
"client-only" => true,
|
||||||
|
"type" => "js",
|
||||||
|
"search-pattern" => "/.*\.js$/",
|
||||||
|
"build-target" => "rel",
|
||||||
|
|
||||||
|
"path" => "js/",
|
||||||
|
"local-path" => "./client/generated/"
|
||||||
|
],
|
||||||
|
[ /* Add the shared generated files. Exclude the shared file because we're including it already */
|
||||||
|
"client-only" => true,
|
||||||
|
"type" => "js",
|
||||||
|
"search-pattern" => "/.*\.js$/",
|
||||||
|
"search-exclude" => "/shared\.js(.map)?$/",
|
||||||
|
"build-target" => "rel",
|
||||||
|
|
||||||
|
"path" => "js/",
|
||||||
|
"local-path" => "./shared/generated/"
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$APP_FILE_LIST_WEB_SOURCE = [
|
||||||
[ /* web javascript files (development mode only) */
|
[ /* web javascript files (development mode only) */
|
||||||
"web-only" => true,
|
"web-only" => true,
|
||||||
"type" => "js",
|
"type" => "js",
|
||||||
|
@ -210,10 +233,10 @@
|
||||||
|
|
||||||
"path" => "./",
|
"path" => "./",
|
||||||
"local-path" => "./web/html/"
|
"local-path" => "./web/html/"
|
||||||
],
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$APP_FILE_LIST_WEB_TEASPEAK = [
|
||||||
/* special web.teaspeak.de only auth files */
|
/* special web.teaspeak.de only auth files */
|
||||||
[ /* login page and api */
|
[ /* login page and api */
|
||||||
"web-only" => true,
|
"web-only" => true,
|
||||||
|
@ -255,9 +278,17 @@
|
||||||
"path" => "certs/",
|
"path" => "certs/",
|
||||||
"local-path" => "./auth/certs/",
|
"local-path" => "./auth/certs/",
|
||||||
"req-parm" => ["-xf"]
|
"req-parm" => ["-xf"]
|
||||||
],
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$APP_FILE_LIST = array_merge(
|
||||||
|
$APP_FILE_LIST_SHARED_SOURCE,
|
||||||
|
$APP_FILE_LIST_SHARED_VENDORS,
|
||||||
|
$APP_FILE_LIST_CLIENT_SOURCE,
|
||||||
|
$APP_FILE_LIST_WEB_SOURCE,
|
||||||
|
$APP_FILE_LIST_WEB_TEASPEAK
|
||||||
|
);
|
||||||
|
|
||||||
function systemify_path($path) {
|
function systemify_path($path) {
|
||||||
return str_replace("/", DIRECTORY_SEPARATOR, $path);
|
return str_replace("/", DIRECTORY_SEPARATOR, $path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,11 @@ npm run dtsgen -- --config web/tsconfig/dtsconfig.json -v
|
||||||
replace_tribble web/declarations/exports.d.ts
|
replace_tribble web/declarations/exports.d.ts
|
||||||
echo "Generated web declarations"
|
echo "Generated web declarations"
|
||||||
|
|
||||||
|
#Client
|
||||||
|
npm run dtsgen -- --config client/tsconfig/dtsconfig.json -v
|
||||||
|
replace_tribble client/declarations/exports.d.ts
|
||||||
|
echo "Generated client declarations"
|
||||||
|
|
||||||
#Shared
|
#Shared
|
||||||
npm run dtsgen -- --config shared/tsconfig/dtsconfig.json -v
|
npm run dtsgen -- --config shared/tsconfig/dtsconfig.json -v
|
||||||
replace_tribble shared/declarations/exports.d.ts
|
replace_tribble shared/declarations/exports.d.ts
|
||||||
|
@ -55,3 +60,4 @@ generate_link web/declarations/exports.d.ts shared/declarations/imports_web.d.ts
|
||||||
|
|
||||||
#Last but not least the client imports
|
#Last but not least the client imports
|
||||||
generate_link shared/declarations/exports.d.ts web/declarations/imports_shared.d.ts
|
generate_link shared/declarations/exports.d.ts web/declarations/imports_shared.d.ts
|
||||||
|
generate_link shared/declarations/exports.d.ts client/declarations/imports_shared.d.ts
|
96
scripts/client_build.sh
Executable file
96
scripts/client_build.sh
Executable file
|
@ -0,0 +1,96 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source `dirname $0`/resolve_commands.sh
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
cd "$BASEDIR/../"
|
||||||
|
|
||||||
|
source_path="client-api/environment/ui-files/raw"
|
||||||
|
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "debug" ]]; then
|
||||||
|
type="development"
|
||||||
|
elif [[ "$1" == "release" ]] || [[ "$1" == "rel" ]]; then
|
||||||
|
type="release"
|
||||||
|
else
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Invalid argument count!"
|
||||||
|
else
|
||||||
|
echo "Invalid option $1"
|
||||||
|
fi
|
||||||
|
echo 'Available options are: "development" or "dev", "release" or "rel"'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating style files"
|
||||||
|
npm run compile-sass
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to generate style files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating web workers"
|
||||||
|
npm run build-worker-codec
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build web worker codec"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
npm run build-worker-pow
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build web worker pow"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Lets build some tools
|
||||||
|
#dtsgen should be already build by build_declarations.sh
|
||||||
|
./tools/build_trgen.sh
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build typescript translation generator"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Now lets build the declarations
|
||||||
|
echo "Building declarations"
|
||||||
|
./scripts/build_declarations.sh
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to generate declarations"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$type" == "release" ]]; then #Compile everything for release mode
|
||||||
|
#Compile the shared source first
|
||||||
|
echo "Building shared source"
|
||||||
|
./shared/generate_packed.sh
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build shared source"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Now compile the web client itself
|
||||||
|
echo "Building web client"
|
||||||
|
./client/generate_packed.sh
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to build web client"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ "$type" == "development" ]]; then
|
||||||
|
echo "Building shared source"
|
||||||
|
execute_ttsc -p ./shared/tsconfig/tsconfig.json
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to compile shared sources"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building client client source"
|
||||||
|
execute_ttsc -p ./client/tsconfig/tsconfig.json
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to compile web sources"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating environment"
|
||||||
|
php files.php generate client ${type}
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to generate environment"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully build!"
|
|
@ -13,7 +13,7 @@ if [[ "$#" -ne 3 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d client/environment/ui-files/ ]]; then
|
if [[ ! -d client-api/environment/ui-files/ ]]; then
|
||||||
echo "Missing UI Files"
|
echo "Missing UI Files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -331,7 +331,6 @@ $animation_length: .5s;
|
||||||
.app-container {
|
.app-container {
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 25px;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
transition: all $animation_length linear;
|
transition: all $animation_length linear;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
declare const native: any; //FIXME: Read client declarations!
|
||||||
namespace connection {
|
namespace connection {
|
||||||
export interface HandshakeIdentityHandler {
|
export interface HandshakeIdentityHandler {
|
||||||
connection: AbstractServerConnection;
|
connection: AbstractServerConnection;
|
||||||
|
|
|
@ -407,6 +407,20 @@ function displayCriticalError(message: string) {
|
||||||
/* all javascript loaders */
|
/* all javascript loaders */
|
||||||
const loader_javascript = {
|
const loader_javascript = {
|
||||||
detect_type: async () => {
|
detect_type: async () => {
|
||||||
|
if(window.require) {
|
||||||
|
const request = new Request("js/proto.js");
|
||||||
|
let file_path = request.url;
|
||||||
|
if(!file_path.startsWith("file://"))
|
||||||
|
throw "Invalid file path (" + file_path + ")";
|
||||||
|
file_path = file_path.substring(7);
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
if(fs.existsSync(file_path)) {
|
||||||
|
app.type = app.Type.CLIENT_DEBUG;
|
||||||
|
} else {
|
||||||
|
app.type = app.Type.CLIENT_RELEASE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* test if js/proto.js is available. If so we're in debug mode */
|
/* test if js/proto.js is available. If so we're in debug mode */
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
request.open('GET', 'js/proto.js', true);
|
request.open('GET', 'js/proto.js', true);
|
||||||
|
@ -427,6 +441,7 @@ const loader_javascript = {
|
||||||
};
|
};
|
||||||
request.send();
|
request.send();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
load_scripts: async () => {
|
load_scripts: async () => {
|
||||||
/*
|
/*
|
||||||
|
@ -468,7 +483,7 @@ const loader_javascript = {
|
||||||
loader.register_task(loader.Stage.JAVASCRIPT, {
|
loader.register_task(loader.Stage.JAVASCRIPT, {
|
||||||
name: "scripts release",
|
name: "scripts release",
|
||||||
priority: 20,
|
priority: 20,
|
||||||
function: loader_javascript.loadRelease
|
function: loader_javascript.load_release
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
loader.register_task(loader.Stage.JAVASCRIPT, {
|
loader.register_task(loader.Stage.JAVASCRIPT, {
|
||||||
|
@ -596,7 +611,7 @@ const loader_javascript = {
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadRelease: async () => {
|
load_release: async () => {
|
||||||
console.log("Load for release!");
|
console.log("Load for release!");
|
||||||
|
|
||||||
await loader.load_scripts([
|
await loader.load_scripts([
|
||||||
|
@ -809,24 +824,6 @@ loader.register_task(loader.Stage.INITIALIZING, {
|
||||||
priority: 50
|
priority: 50
|
||||||
});
|
});
|
||||||
|
|
||||||
window["Module"] = window["Module"] || {};
|
|
||||||
/* TeaClient */
|
|
||||||
if(window.require) {
|
|
||||||
const path = require("path");
|
|
||||||
const remote = require('electron').remote;
|
|
||||||
module.paths.push(path.join(remote.app.getAppPath(), "/modules"));
|
|
||||||
module.paths.push(path.join(path.dirname(remote.getGlobal("browser-root")), "js"));
|
|
||||||
|
|
||||||
const connector = require("renderer");
|
|
||||||
console.log(connector);
|
|
||||||
|
|
||||||
loader.register_task(loader.Stage.INITIALIZING, {
|
|
||||||
name: "teaclient initialize",
|
|
||||||
function: connector.initialize,
|
|
||||||
priority: 40
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
loader.register_task(loader.Stage.INITIALIZING, {
|
loader.register_task(loader.Stage.INITIALIZING, {
|
||||||
name: "Browser detection",
|
name: "Browser detection",
|
||||||
function: async () => {
|
function: async () => {
|
||||||
|
@ -855,9 +852,12 @@ loader.register_task(loader.Stage.INITIALIZING, {
|
||||||
name: "secure tester",
|
name: "secure tester",
|
||||||
function: async () => {
|
function: async () => {
|
||||||
/* we need https or localhost to use some things like the storage API */
|
/* we need https or localhost to use some things like the storage API */
|
||||||
if(location.protocol !== 'https:' && location.hostname !== 'localhost') {
|
if(typeof isSecureContext === "undefined")
|
||||||
|
(<any>window)["isSecureContext"] = location.protocol !== 'https:' && location.hostname !== 'localhost';
|
||||||
|
|
||||||
|
if(!isSecureContext) {
|
||||||
display_critical_load("TeaWeb cant run on unsecured sides.", "App requires to be loaded via HTTPS!");
|
display_critical_load("TeaWeb cant run on unsecured sides.", "App requires to be loaded via HTTPS!");
|
||||||
throw "App requires to be loaded via HTTPS!"
|
throw "App requires a secure context!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
priority: 20
|
priority: 20
|
||||||
|
@ -918,7 +918,25 @@ loader.register_task(loader.Stage.LOADED, {
|
||||||
priority: 20
|
priority: 20
|
||||||
});
|
});
|
||||||
|
|
||||||
const hello_world = () => {
|
|
||||||
|
window["Module"] = window["Module"] || {};
|
||||||
|
/* TeaClient */
|
||||||
|
if(window.require) {
|
||||||
|
const path = require("path");
|
||||||
|
const remote = require('electron').remote;
|
||||||
|
module.paths.push(path.join(remote.app.getAppPath(), "/modules"));
|
||||||
|
module.paths.push(path.join(path.dirname(remote.getGlobal("browser-root")), "js"));
|
||||||
|
|
||||||
|
const connector = require("renderer");
|
||||||
|
console.log(connector);
|
||||||
|
|
||||||
|
loader.register_task(loader.Stage.INITIALIZING, {
|
||||||
|
name: "teaclient initialize",
|
||||||
|
function: connector.initialize,
|
||||||
|
priority: 40
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const hello_world = () => {
|
||||||
const print_security = () => {
|
const print_security = () => {
|
||||||
{
|
{
|
||||||
const css = [
|
const css = [
|
||||||
|
@ -982,16 +1000,17 @@ const hello_world = () => {
|
||||||
console.log("%cyou'll be may interested to share them here: %chttps://github.com/TeaSpeak/TeaWeb", css, css_2);
|
console.log("%cyou'll be may interested to share them here: %chttps://github.com/TeaSpeak/TeaWeb", css, css_2);
|
||||||
console.log("%c ", display_detect);
|
console.log("%c ", display_detect);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try { /* lets try to print it as VM code :)*/
|
try { /* lets try to print it as VM code :)*/
|
||||||
let hello_world_code = hello_world.toString();
|
let hello_world_code = hello_world.toString();
|
||||||
hello_world_code = hello_world_code.substr(hello_world_code.indexOf('() => {') + 8);
|
hello_world_code = hello_world_code.substr(hello_world_code.indexOf('() => {') + 8);
|
||||||
hello_world_code = hello_world_code.substring(0, hello_world_code.lastIndexOf("}"));
|
hello_world_code = hello_world_code.substring(0, hello_world_code.lastIndexOf("}"));
|
||||||
hello_world_code = hello_world_code.replace(/(?!"\S*) {2,}(?!\S*")/g, " ").replace(/[\n\r]/g, "");
|
hello_world_code = hello_world_code.replace(/(?!"\S*) {2,}(?!\S*")/g, " ").replace(/[\n\r]/g, "");
|
||||||
eval(hello_world_code);
|
eval(hello_world_code);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
hello_world();
|
hello_world();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loader.execute().then(() => {
|
loader.execute().then(() => {
|
||||||
|
|
|
@ -23,6 +23,11 @@ function getUserMediaFunction() {
|
||||||
return (navigator as any).getUserMedia || (navigator as any).webkitGetUserMedia || (navigator as any).mozGetUserMedia;
|
return (navigator as any).getUserMedia || (navigator as any).webkitGetUserMedia || (navigator as any).mozGetUserMedia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
open_connected_question: () => Promise<boolean>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function setup_close() {
|
function setup_close() {
|
||||||
window.onbeforeunload = event => {
|
window.onbeforeunload = event => {
|
||||||
if(profiles.requires_save())
|
if(profiles.requires_save())
|
||||||
|
@ -34,23 +39,18 @@ function setup_close() {
|
||||||
if(!native_client) {
|
if(!native_client) {
|
||||||
event.returnValue = "Are you really sure?<br>You're still connected!";
|
event.returnValue = "Are you really sure?<br>You're still connected!";
|
||||||
} else {
|
} else {
|
||||||
|
if(window.open_connected_question) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.returnValue = "question";
|
event.returnValue = "question";
|
||||||
|
window.open_connected_question().then(result => {
|
||||||
|
if(result) {
|
||||||
|
window.onbeforeunload = undefined;
|
||||||
|
|
||||||
const {remote} = require('electron');
|
const {remote} = require('electron');
|
||||||
const dialog = remote.dialog;
|
|
||||||
|
|
||||||
dialog.showMessageBox(remote.getCurrentWindow(), {
|
|
||||||
type: 'question',
|
|
||||||
buttons: ['Yes', 'No'],
|
|
||||||
title: 'Confirm',
|
|
||||||
message: 'Are you really sure?\nYou\'re still connected!'
|
|
||||||
}, choice => {
|
|
||||||
if(choice === 0) {
|
|
||||||
window.onbeforeunload = undefined;
|
|
||||||
remote.getCurrentWindow().close();
|
remote.getCurrentWindow().close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else { /* we're in debugging mode */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/// <reference path="../../../declarations/imports_client.d.ts" />
|
||||||
/// <reference path="../../utils/modal.ts" />
|
/// <reference path="../../utils/modal.ts" />
|
||||||
/// <reference path="../../utils/tab.ts" />
|
/// <reference path="../../utils/tab.ts" />
|
||||||
/// <reference path="../../proto.ts" />
|
/// <reference path="../../proto.ts" />
|
||||||
|
@ -936,7 +937,6 @@ namespace Modals {
|
||||||
if (native_client) {
|
if (native_client) {
|
||||||
teaforo_tag.find(".native-teaforo-login").on('click', event => {
|
teaforo_tag.find(".native-teaforo-login").on('click', event => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const forum = require("teaforo.js");
|
|
||||||
const call = () => {
|
const call = () => {
|
||||||
if (modal.shown) {
|
if (modal.shown) {
|
||||||
display_settings(selected_profile);
|
display_settings(selected_profile);
|
||||||
|
|
|
@ -511,7 +511,7 @@ const loader_javascript = {
|
||||||
["js/WebPPTListener.js"]
|
["js/WebPPTListener.js"]
|
||||||
]);
|
]);
|
||||||
}),
|
}),
|
||||||
loadRelease: () => __awaiter(this, void 0, void 0, function* () {
|
load_release: () => __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log("Load for release!");
|
console.log("Load for release!");
|
||||||
yield loader.load_scripts([
|
yield loader.load_scripts([
|
||||||
//Load general API's
|
//Load general API's
|
||||||
|
|
1
vendor/jqueryjquery.min.js
vendored
1
vendor/jqueryjquery.min.js
vendored
|
@ -1 +0,0 @@
|
||||||
C:/Users/WolverinDEV/TeaSpeak/TeaWeb/vendor/jquery/jquery.min.js
|
|
|
@ -29,3 +29,10 @@ html, body {
|
||||||
display: flex; flex-direction: column; resize: both;
|
display: flex; flex-direction: column; resize: both;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$small_device: 650px;
|
||||||
|
@media only screen and (max-width: $small_device) {
|
||||||
|
.app-container {
|
||||||
|
bottom: 25px;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue