Compare commits

..

2 Commits

68 changed files with 4737 additions and 5966 deletions

1
.gitignore vendored
View File

@ -2,7 +2,6 @@
.idea/
node_modules/
.sass-cache/
.npm/
/auth/certs/
/auth/js/auth.js.map

4
.npmrc
View File

@ -1,4 +0,0 @@
audit=false
fund=false
update-notifier=false
package-lock=true

View File

@ -19,7 +19,8 @@ stages:
jobs:
include:
- stage: compile
script: "./scripts/travis/build.sh --enable-release --enable-debug || travis_terminate 1;"
# script: "./scripts/travis/build.sh --enable-release --enable-debug || travis_terminate 1;"
script: "./scripts/travis/build.sh --enable-release || travis_terminate 1;"
deploy:
- provider: script
@ -28,12 +29,12 @@ deploy:
skip_cleanup: true
on:
branch: develop
# - provider: script
# cleanup: false
# skip_cleanup: true
# script: "bash scripts/travis/deploy_docker.sh development"
# on:
# branch: develop
- provider: script
cleanup: false
skip_cleanup: true
script: "bash scripts/travis/deploy_docker.sh development"
on:
branch: develop
- provider: script
script: "bash scripts/travis/deploy_server.sh production"
cleanup: false
@ -46,9 +47,9 @@ deploy:
script: "bash scripts/travis/deploy_github.sh"
on:
branch: master
# - provider: script
# cleanup: false
# skip_cleanup: true
# script: "bash scripts/travis/deploy_docker.sh release"
# on:
# branch: master
- provider: script
cleanup: false
skip_cleanup: true
script: "bash scripts/travis/deploy_docker.sh release"
on:
branch: master

View File

@ -1,89 +0,0 @@
when:
event: [push, deployment, manual, cron]
labels:
platform: linux/amd64
variables:
- &node_image 'node:14-bullseye'
- &buildx_image 'woodpeckerci/plugin-docker-buildx:2.2.1'
- &platforms 'linux/amd64'
- &dockerfile 'docker/Dockerfile.ci'
steps:
prepare-npm:
image: *node_image
secrets:
- npmconf
commands:
- git config --add safe.directory '*'
- if [ "$${NPMCONF:-}" != "" ]; then echo "$${NPMCONF}" >> "$${HOME}/.npmrc"; fi
- npm ci
- npx browserslist@latest --update-db
build-npm:
image: *node_image
commands:
- bash ./scripts/build.sh web dev
build-docker-next:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: [next, "next-${CI_COMMIT_SHA:0:8}"]
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
event: push
build-docker-branch:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: ["${CI_COMMIT_BRANCH}", "${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}"]
when:
event: [push, manual]
build-docker-tag:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: [latest, "${CI_COMMIT_TAG}", "tag-${CI_COMMIT_SHA:0:8}"]
when:
event: [tag]

View File

@ -4,12 +4,14 @@ export default api => {
[
"@babel/preset-env",
{
"corejs": {"version": '3.33', "proposals": false},
"corejs": {"version": 3},
"useBuiltIns": "usage",
"targets": {
"edge": "111",
"firefox": "100",
"chrome": "109"
"edge": "17",
"firefox": "60",
"chrome": "67",
"safari": "11.1",
"ie": "11"
}
}
]

2
client-api/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
#My local environment to deploy the files directly
environment/

314
client-api/api.php Normal file
View File

@ -0,0 +1,314 @@
<?php
/**
* Created by PhpStorm.
* User: WolverinDEV
* Date: 04.10.18
* Time: 16:42
*/
$UI_BASE_PATH = "ui-files/";
$CLIENT_BASE_PATH = "files/";
function errorExit($message) {
http_response_code(400);
die(json_encode([
"success" => false,
"msg" => $message
]));
}
function verifyPostSecret() {
if(!isset($_POST["secret"])) {
errorExit("Missing required information!");
}
$require_secret = file_get_contents(".deploy_secret");
if($require_secret === false || strlen($require_secret) == 0) {
errorExit("Server missing secret!");
}
if(!is_string($_POST["secret"])) {
errorExit("Invalid secret!");
}
if(strcmp(trim($require_secret), trim($_POST["secret"])) !== 0) {
errorExit("Secret does not match!");
}
}
function handleRequest() {
if(isset($_GET) && isset($_GET["type"])) {
if ($_GET["type"] == "update-info") {
global $CLIENT_BASE_PATH;
$raw_versions = file_get_contents($CLIENT_BASE_PATH . "/version.json");
if($raw_versions === false) {
errorExit("Missing file!");
}
$versions = json_decode($raw_versions, true);
$versions["success"] = true;
die(json_encode($versions));
}
else if ($_GET["type"] == "update-download") {
global $CLIENT_BASE_PATH;
$path = $CLIENT_BASE_PATH . $_GET["channel"] . DIRECTORY_SEPARATOR . $_GET["version"] . DIRECTORY_SEPARATOR;
$raw_release_info = file_get_contents($path . "info.json");
if($raw_release_info === false) {
errorExit("missing info file (version and/or channel missing. Path was " . $path . ")");
}
$release_info = json_decode($raw_release_info);
foreach($release_info as $platform) {
if($platform->platform != $_GET["platform"]) continue;
if($platform->arch != $_GET["arch"]) continue;
http_response_code(200);
header("Cache-Control: public"); // needed for internet explorer
header("Content-Type: application/binary");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($path . $platform->update));
header("Content-Disposition: attachment; filename=update.tar.gz");
header("info-version: 1");
readfile($path . $platform->update);
die();
}
errorExit("Missing platform, arch or file");
}
else if ($_GET["type"] == "ui-info") {
global $UI_BASE_PATH;
$version_info = file_get_contents($UI_BASE_PATH . "info.json");
if($version_info === false) $version_info = array();
else $version_info = json_decode($version_info, true);
$info = array();
$info["success"] = true;
$info["versions"] = array();
foreach($version_info as $channel => $data) {
if(!isset($data["latest"])) continue;
$channel_info = [
"timestamp" => $data["latest"]["timestamp"],
"version" => $data["latest"]["version"],
"git-ref" => $data["latest"]["git-ref"],
"channel" => $channel,
"required_client" => $data["latest"]["required_client"]
];
array_push($info["versions"], $channel_info);
}
die(json_encode($info));
} else if ($_GET["type"] == "ui-download") {
global $UI_BASE_PATH;
if(!isset($_GET["channel"]) || !isset($_GET["version"]))
errorExit("missing required parameters");
if($_GET["version"] !== "latest" && !isset($_GET["git-ref"]))
errorExit("missing required parameters");
$version_info = file_get_contents($UI_BASE_PATH . "info.json");
if($version_info === false) $version_info = array();
else $version_info = json_decode($version_info, true);
$channel_data = $version_info[$_GET["channel"]];
if(!isset($channel_data))
errorExit("channel unknown");
$ui_pack = false;
if($_GET["version"] === "latest") {
$ui_pack = $channel_data["latest"];
} else {
foreach ($channel_data["history"] as $entry) {
if($entry["version"] == $_GET["version"] && $entry["git-ref"] == $_GET["git-ref"]) {
$ui_pack = $entry;
break;
}
}
}
if($ui_pack === false)
errorExit("missing version");
header("Cache-Control: public"); // needed for internet explorer
header("Content-Type: application/binary");
header("Content-Transfer-Encoding: Binary");
header("Content-Disposition: attachment; filename=ui.tar.gz");
header("info-version: 1");
header("x-ui-timestamp: " . $ui_pack["timestamp"]);
header("x-ui-version: " . $ui_pack["version"]);
header("x-ui-git-ref: " . $ui_pack["git-ref"]);
header("x-ui-required_client: " . $ui_pack["required_client"]);
$read = readfile($ui_pack["file"]);
header("Content-Length:" . $read);
if($read === false) errorExit("internal error: Failed to read file!");
die();
}
}
else if($_POST["type"] == "deploy-build") {
global $CLIENT_BASE_PATH;
if(!isset($_POST["version"]) || !isset($_POST["platform"]) || !isset($_POST["arch"]) || !isset($_POST["update_suffix"]) || !isset($_POST["installer_suffix"])) {
errorExit("Missing required information!");
}
verifyPostSecret();
if(!isset($_FILES["update"])) {
errorExit("Missing update file");
}
if($_FILES["update"]["error"] !== UPLOAD_ERR_OK) {
errorExit("Upload for update failed!");
}
if(!isset($_FILES["installer"])) {
errorExit("Missing installer file");
}
if($_FILES["installer"]["error"] !== UPLOAD_ERR_OK) {
errorExit("Upload for installer failed!");
}
$json_version = json_decode($_POST["version"], true);
$version = $json_version["major"] . "." . $json_version["minor"] . "." . $json_version["patch"] . ($json_version["build"] > 0 ? "-" . $json_version["build"] : "");
$path = $CLIENT_BASE_PATH . DIRECTORY_SEPARATOR . $_POST["channel"] . DIRECTORY_SEPARATOR . $version . DIRECTORY_SEPARATOR;
exec("mkdir -p " . $path);
//mkdir($path, 777, true);
$filename_update = "TeaClient-" . $_POST["platform"] . "_" . $_POST["arch"] . "." . $_POST["update_suffix"];
$filename_install = "TeaClient-" . $_POST["platform"] . "_" . $_POST["arch"] . "." . $_POST["installer_suffix"];
{
$version_info = file_get_contents($path . "info.json");
if($version_info === false) {
$version_info = array();
} else {
$version_info = json_decode($version_info, true);
if($version_info === false) {
errorExit("Failed to decode old versions info file");
}
}
for($index = 0; $index < count($version_info); $index++) {
if($version_info[$index]["platform"] == $_POST["platform"] && $version_info[$index]["arch"] == $_POST["arch"]) {
array_splice($version_info, $index, 1);
break;
}
}
$info = array();
$info["platform"] = $_POST["platform"];
$info["arch"] = $_POST["arch"];
$info["update"] = $filename_update;
$info["install"] = $filename_install;
array_push($version_info, $info);
file_put_contents($path . "info.json", json_encode($version_info));
}
{
$filename = $CLIENT_BASE_PATH . DIRECTORY_SEPARATOR . "version.json";
$indexes = file_get_contents($filename);
if($indexes === false) {
$indexes = array();
} else {
$indexes = json_decode($indexes, true);
if($indexes === false) {
errorExit("Failed to decode old latest versions info file");
}
}
$index = &$indexes[$_POST["channel"]];
if(!isset($index)) {
$index = array();
}
for($idx = 0; $idx < count($index); $idx++) {
if($index[$idx]["platform"] == $_POST["platform"] && $index[$idx]["arch"] == $_POST["arch"]) {
array_splice($index, $idx, 1);
break;
}
}
$info = array();
$info["platform"] = $_POST["platform"];
$info["arch"] = $_POST["arch"];
$info["version"] = $json_version;
array_push($index, $info);
file_put_contents($filename, json_encode($indexes));
}
move_uploaded_file($_FILES["installer"]["tmp_name"],$path . $filename_install);
move_uploaded_file($_FILES["update"]["tmp_name"],$path . $filename_update);
die(json_encode([
"success" => true
]));
}
else if($_POST["type"] == "deploy-ui-build") {
global $UI_BASE_PATH;
if(!isset($_POST["channel"]) || !isset($_POST["version"]) || !isset($_POST["git_ref"]) || !isset($_POST["required_client"])) {
errorExit("Missing required information!");
}
verifyPostSecret();
$path = $UI_BASE_PATH . DIRECTORY_SEPARATOR;
$channeled_path = $UI_BASE_PATH . DIRECTORY_SEPARATOR . $_POST["channel"];
$filename = "TeaClientUI-" . $_POST["version"] . "_" . $_POST["git_ref"] . ".tar.gz";
exec("mkdir -p " . $path);
exec("mkdir -p " . $channeled_path);
{
$info = file_get_contents($path . "info.json");
if($info === false) {
$info = array();
} else {
$info = json_decode($info, true);
if($info === false) {
errorExit("failed to decode old info file");
}
}
$channel_info = &$info[$_POST["channel"]];
if(!$channel_info) {
$channel_info = array();
}
$entry = [
"timestamp" => time(),
"file" => $channeled_path . DIRECTORY_SEPARATOR . $filename,
"version" => $_POST["version"],
"git-ref" => $_POST["git_ref"],
"required_client" => $_POST["required_client"]
];
$channel_info["latest"] = $entry;
if(!$channel_info["history"]) $channel_info["history"] = array();
array_push($channel_info["history"], $entry);
file_put_contents($path . "info.json", json_encode($info));
}
move_uploaded_file($_FILES["file"]["tmp_name"],$channeled_path . DIRECTORY_SEPARATOR . $filename);
die(json_encode([
"success" => true
]));
}
else die(json_encode([
"success" => false,
"error" => "invalid action!"
]));
}
handleRequest();

8
client/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
app/**/*.css
app/**/*.css.map
app/**/*.js
app/**/*.js.map
declarations/
generated/

31
client/app/AppMain.scss Normal file
View File

@ -0,0 +1,31 @@
:global {
html, body {
border: 0;
margin: 0;
}
.app-container {
right: 0;
left: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
position: absolute;
display: flex;
justify-content: stretch;
.app {
width: 100%;
height: 100%;
margin: 0;
display: flex; flex-direction: column; resize: both;
}
}
footer {
display: none!important;
}
}

View File

@ -0,0 +1,4 @@
window.__native_client_init_shared(__webpack_require__);
import "../AppMain.scss";
import "tc-shared/entry-points/MainApp";

View File

@ -0,0 +1,2 @@
window.__native_client_init_shared(__webpack_require__);
import "tc-shared/entry-points/ModalWindow";

7
client/app/external.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
interface Window {
__native_client_init_hook: () => void;
__native_client_init_shared: (webpackRequire: any) => void;
}
declare const __teaclient_preview_notice: any;
declare const __teaclient_preview_error: any;

View File

@ -0,0 +1,30 @@
html, body {
border: 0;
margin: 0;
}
.app-container {
right: 0;
left: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
position: absolute;
display: flex;
justify-content: stretch;
}
.app-container .app {
width: 100%;
height: 100%;
margin: 0;
display: flex;
flex-direction: column;
resize: both;
}
footer {
display: none !important;
}
/*# sourceMappingURL=main.css.map */

View File

@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["main.scss"],"names":[],"mappings":"AAAA;EACC;EACA;;;AAGD;EACC;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;EAEA;EAAe;EAAwB;;;AAIzC;EACC","file":"main.css"}

23
client/generate_packed.sh Normal file
View 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

View File

@ -0,0 +1,6 @@
{
"source_files": [
"../js/**/*.ts"
],
"target_file": "../declarations/exports.d.ts"
}

View File

@ -0,0 +1,12 @@
/* general web project config */
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
},
"include": [
"../declarations/imports_*.d.ts",
"../js/**/*.ts"
]
}

View 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"
]
}

View File

@ -1,17 +0,0 @@
FROM nginx:mainline-alpine
COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/entrypoint.sh /
RUN apk update --no-cache && apk upgrade --no-cache \
&& apk add --no-cache openssl tzdata \
&& mkdir -p /var/www/TeaWeb /etc/ssl/certs \
&& chmod +x /entrypoint.sh
ENV TZ="Europe/Berlin"
EXPOSE 80 443
ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,2 +0,0 @@
FROM reg.c1.datenclown.at/teaspeak/web-base:latest
COPY ./dist/ /var/www/TeaWeb/

View File

@ -1,36 +0,0 @@
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 default_server ssl http2;
server_name _;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ecdh_curve secp384r1;
ssl_certificate /etc/ssl/certs/tea_bundle.crt;
ssl_certificate_key /etc/ssl/certs/tea.key;
ssl_session_cache shared:MozSSL:10m;
ssl_session_timeout 1d;
ssl_prefer_server_ciphers on;
location / {
root /var/www/TeaWeb;
index index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
gzip off;
}

View File

@ -1,29 +0,0 @@
#!/usr/bin/env sh
set -e
gen_self_signed() {
echo "[WRN] No certificates found, generating self signed cert with key"
openssl req -x509 -nodes -days 1780 -newkey rsa:4096 \
-keyout /etc/ssl/certs/tea.key \
-out /etc/ssl/certs/tea_bundle.crt \
-subj "/C=DE/ST=Berlin/L=Germany/O=TeaSpeak/OU=TeaWeb/CN=localhost/emailAddress=noreply@teaspeak.de"
}
gen_diffie_hellman() {
echo "[INF] No Diffie-Hellman pem found, generating new with 2048 byte"
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
}
if [ "$1" = "nginx" ]; then
if [ ! -f /etc/ssl/certs/tea.key ] && [ ! -f /etc/ssl/certs/tea_bundle.crt ]; then
gen_self_signed
elif [ ! -f /etc/ssl/certs/tea.key ] || [ ! -f /etc/ssl/certs/tea_bundle.crt ]; then
echo "[ERR] Only found a key or crt-bundle file but both files are REQUIRED!"
exit 1
fi
if [ ! -f /etc/ssl/certs/dhparam.pem ]; then
gen_diffie_hellman
fi
fi
exec "$@"

View File

@ -1,32 +0,0 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
server_tokens off;
keepalive_timeout 75;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

View File

@ -24,7 +24,7 @@ export { };
if(__build.target === "client") {
/* do this so we don't get a react dev tools warning within the client */
if(!('__REACT_DEVTOOLS_GLOBAL_HOOK__' in window)) {
(window as Window).__REACT_DEVTOOLS_GLOBAL_HOOK__ = {};
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {};
}
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () {};

View File

@ -51,6 +51,18 @@ loader.register_task(loader.Stage.SETUP, {
priority: 10
});
/* test if we're getting loaded within a TeaClient preview window */
loader.register_task(loader.Stage.SETUP, {
name: "TeaClient tester",
function: async () => {
if(typeof __teaclient_preview_notice !== "undefined" && typeof __teaclient_preview_error !== "undefined") {
loader.critical_error("Why you're opening TeaWeb within the TeaSpeak client?!");
throw "we're already a TeaClient!";
}
},
priority: 100
});
export default class implements ApplicationLoader {
execute() {
loader.execute_managed(true);

View File

@ -2,6 +2,27 @@ import * as loader from "../loader/loader";
import {Stage} from "../loader/loader";
import {detect as detectBrowser} from "detect-browser";
loader.register_task(Stage.SETUP, {
name: "app init",
function: async () => {
/* TeaClient */
if(window.require || window.__native_client_init_hook) {
if(__build.target !== "client") {
loader.critical_error("App seems not to be compiled for the client.", "This app has been compiled for " + __build.target);
return;
}
window.__native_client_init_hook();
} else {
if(__build.target !== "web") {
loader.critical_error("App seems not to be compiled for the web.", "This app has been compiled for " + __build.target);
return;
}
}
},
priority: 1000
});
loader.register_task(Stage.SETUP, {
name: __build.target === "web" ? "outdated browser checker" : "outdated renderer tester",
function: async () => {

View File

@ -9,6 +9,7 @@
<meta name="og:description" content="The TeaSpeak Web client is a in the browser running client for the VoIP communication software TeaSpeak." />
<meta name="og:url" content="https://web.teaspeak.de/">
<% /* TODO: Put in an appropriate image <meta name="og:image" content="https://www.whatsapp.com/img/whatsapp-promo.png"> */ %>
<% /* Using an absolute path here since the manifest.json works only with such. */ %>
<% /* <link rel="manifest" href="/manifest.json"> */ %>
@ -26,6 +27,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer async src="https://www.googletagmanager.com/gtag/js?id=UA-113151733-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-113151733-4');
</script>
<link rel="preload" as="image" href="<%= require("./images/initial-sequence.gif") %>">
<link rel="preload" as="image" href="<%= require("./images/bowl.png") %>">
<% /* We don't preload the bowl since it's only a div background */ %>

7016
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,74 +17,74 @@
"author": "TeaSpeak (WolverinDEV)",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/core": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@google-cloud/translate": "^5.3.0",
"@svgr/webpack": "^5.5.0",
"@types/dompurify": "^2.4.0",
"@types/ejs": "^3.1.5",
"@types/emscripten": "^1.39.10",
"@types/fs-extra": "^8.1.5",
"@types/dompurify": "^2.0.1",
"@types/ejs": "^3.0.2",
"@types/emoji-mart": "^3.0.2",
"@types/emscripten": "^1.38.0",
"@types/fs-extra": "^8.0.1",
"@types/html-minifier": "^3.5.3",
"@types/jquery": "^3.5.27",
"@types/jquery": "^3.3.34",
"@types/jsrender": "^1.0.5",
"@types/lodash": "^4.14.201",
"@types/lodash": "^4.14.149",
"@types/moment": "^2.13.0",
"@types/node": "^12.20.55",
"@types/react": "^16.14.51",
"@types/react-color": "^3.0.10",
"@types/react-dom": "^16.9.22",
"@types/react-grid-layout": "^1.3.5",
"@types/remarkable": "^1.7.6",
"@types/sdp-transform": "^2.4.9",
"@types/sha256": "^0.2.2",
"@types/twemoji": "^12.1.2",
"@types/node": "^12.7.2",
"@types/react-color": "^3.0.4",
"@types/react-dom": "^16.9.5",
"@types/react-grid-layout": "^1.1.1",
"@types/remarkable": "^1.7.4",
"@types/sdp-transform": "^2.4.4",
"@types/sha256": "^0.2.0",
"@types/twemoji": "^12.1.1",
"@types/websocket": "0.0.40",
"@types/xml-parser": "^1.2.33",
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
"autoprefixer": "^10.4.16",
"babel-loader": "^8.3.0",
"circular-dependency-plugin": "^5.2.2",
"clean-css": "^4.2.4",
"@types/xml-parser": "^1.2.29",
"@wasm-tool/wasm-pack-plugin": "^1.3.1",
"autoprefixer": "^10.2.5",
"babel-loader": "^8.1.0",
"circular-dependency-plugin": "^5.2.0",
"clean-css": "^4.2.1",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^8.1.1",
"copy-webpack-plugin": "^8.0.0",
"css-loader": "^3.6.0",
"css-minimizer-webpack-plugin": "^1.3.0",
"exports-loader": "^0.7.0",
"fast-xml-parser": "^3.21.1",
"file-loader": "^6.2.0",
"fast-xml-parser": "^3.17.4",
"file-loader": "^6.0.0",
"fs-extra": "latest",
"gulp": "^4.0.2",
"html-loader": "^1.3.2",
"html-loader": "^1.0.0",
"html-minifier": "^4.0.0",
"html-webpack-inline-source-plugin": "0.0.10",
"html-webpack-plugin": "^5.5.3",
"html-webpack-plugin": "^5.3.1",
"inline-chunks-html-webpack-plugin": "^1.3.1",
"mime-types": "^2.1.35",
"mini-css-extract-plugin": "^1.6.2",
"mkdirp": "^0.5.6",
"mime-types": "^2.1.24",
"mini-css-extract-plugin": "^1.3.9",
"mkdirp": "^0.5.1",
"node-sass": "^4.14.1",
"postcss": "^8.4.31",
"postcss-loader": "^5.3.0",
"potpack": "^1.0.2",
"raw-loader": "^4.0.2",
"postcss": "^8.3.0",
"postcss-loader": "^5.2.0",
"potpack": "^1.0.1",
"raw-loader": "^4.0.0",
"sass": "1.22.10",
"sass-loader": "^8.0.2",
"sha256": "^0.2.0",
"style-loader": "^1.3.0",
"style-loader": "^1.1.3",
"svg-inline-loader": "^0.8.2",
"terser": "^4.8.1",
"terser": "^4.2.1",
"terser-webpack-plugin": "4.2.3",
"ts-loader": "^8.4.0",
"ts-loader": "^6.2.2",
"tsd": "^0.13.1",
"typescript": "^4.9.5",
"typescript": "^4.2",
"url-loader": "^4.1.1",
"wabt": "1.0.13",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^3.11.3",
"wabt": "^1.0.13",
"webpack": "^5.26.1",
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "^3.11.2",
"webpack-svg-sprite-generator": "^5.0.4",
"zip-webpack-plugin": "^4.0.1"
},
@ -97,35 +97,33 @@
},
"homepage": "https://www.teaspeak.de",
"dependencies": {
"@emoji-mart/data": "^1.1.2",
"@emoji-mart/react": "^1.1.1",
"@types/crypto-js": "^4.2.1",
"@types/crypto-js": "^4.0.1",
"broadcastchannel-polyfill": "^1.0.1",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"crypto-js": "^4.2.0",
"detect-browser": "^5.3.0",
"dompurify": "^2.4.7",
"emoji-mart": "^5.5.2",
"emoji-regex": "^9.2.2",
"highlight.js": "^10.7.3",
"ip-regex": "^4.3.0",
"jquery": "^3.7.1",
"jsrender": "^1.0.13",
"moment": "^2.29.4",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-grid-layout": "^1.4.3",
"react-player": "^2.13.0",
"crypto-js": "^4.0.0",
"detect-browser": "^5.2.0",
"dompurify": "^2.2.8",
"emoji-mart": "git+https://github.com/WolverinDEV/emoji-mart.git",
"emoji-regex": "^9.0.0",
"highlight.js": "^10.1.1",
"ip-regex": "^4.2.0",
"jquery": "^3.5.1",
"jsrender": "^1.0.7",
"moment": "^2.24.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-grid-layout": "^1.2.2",
"react-player": "^2.5.0",
"remarkable": "^2.0.1",
"resize-observer-polyfill": "git+https://github.com/albancreton/resize-observer-polyfill.git#patch-1",
"sdp-transform": "^2.14.1",
"sdp-transform": "^2.14.0",
"simple-jsonp-promise": "^1.1.0",
"stream-browserify": "^3.0.0",
"twemoji": "^13.1.1",
"twemoji": "^13.0.0",
"url-knife": "^3.1.3",
"webcrypto-liner": "^1.4.2",
"webpack-manifest-plugin": "^3.2.0",
"webcrypto-liner": "^1.2.4",
"webpack-manifest-plugin": "^3.1.0",
"webrtc-adapter": "^7.5.1"
}
}

0
scripts/build.sh Executable file → Normal file
View File

0
scripts/build_declarations.sh Executable file → Normal file
View File

View File

@ -1,46 +0,0 @@
#!/bin/bash
SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
BASEPATH="$(realpath "${SCRIPTPATH}/../")"
NPM_DIR="${BASEPATH}/.npm"
if [[ ! -d "${NPM_DIR}" ]]; then
mkdir "${NPM_DIR}" || exit 1
fi
if [[ "${BUILDINDOCKER:-}" != "yes" ]]; then
if docker -v | grep -qi "podman"; then
is_podman='yes'
fi
docker run --rm --workdir "/work" -v "${BASEPATH}:/work" -e is_podman="${is_podman:-no}" -e BUILDINDOCKER=yes -e npm_config_cache=/work/.npm node:14-bullseye /bin/bash -c 'chmod +x /work/scripts/build_in_docker.sh && /work/scripts/build_in_docker.sh'
exit
fi
## in docker
echo "adding secure git dir"
git config --global --add safe.directory '*'
echo "running chmods"
find "${BASEPATH}" -iname "*.sh" -exec chmod +x {} +
echo "Cleaning up old files"
"${BASEPATH}/scripts/cleanup.sh" full >/dev/null 2>&1 || exit 1
echo "Installing npm packages"
npm i || exit 1
echo "Updating browser list"
npx browserslist@latest --update-db || exit 1
echo "running build"
"${BASEPATH}/scripts/build.sh" web rel
if [[ "${is_podman}" != 'yes' ]]; then
echo "fixing perms"
chown -R 1000:1000 /work
else
echo "in podman, not fixing perms"
fi

0
scripts/cleanup.sh Executable file → Normal file
View File

View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Example usage: ./scripts/deploy_ui_files.sh http://dev.clientapi.teaspeak.de/api.php test 1.1.0
cd "$(dirname "$0")" || { echo "failed to enter base directory"; exit 1; }
source "./helper.sh"
if [[ "$#" -ne 3 ]]; then
echo "Illegal number of parameters (url | channel | required version)"
exit 1
fi
# shellcheck disable=SC2154
if [[ "${teaclient_deploy_secret}" == "" ]]; then
echo "Missing deploy secret!"
exit 1
fi
package_file=$(find_release_package "client" "release")
if [[ $? -ne 0 ]]; then
echo "$package_file"
exit 1
fi
# We require a .tar.gz file and not a zip file.
# So we're extracting the contents and tar.gz ing them
temp_dir=$(mktemp -d)
unzip "$package_file" -d "$temp_dir/raw/"
if [[ $? -ne 0 ]]; then
rm -r "$temp_dir" &>/dev/null
echo "Failed to unpack package."
exit 1
fi
echo "Generating .tar.gz file from $package_file"
package_file="$temp_dir/$(basename -s ".zip" "$package_file").tar.gz"
tar --use-compress-program="gzip -9" -C "$temp_dir/raw/" -c . -cf "$package_file";
if [[ $? -ne 0 ]]; then
rm -r "$temp_dir"
echo "Failed to package package."
exit 1
fi
git_hash=$(git_version "short-tag")
application_version=$(project_version)
echo "Deploying $package_file."
echo "Hash: ${git_hash}, Version: ${application_version}, Target channel: $2."
upload_result=$(curl \
-k \
-X POST \
-F "required_client=$3" \
-F "type=deploy-ui-build" \
-F "channel=$2" \
-F "version=$application_version" \
-F "git_ref=$git_hash" \
-F "secret=${teaclient_deploy_secret}" \
-F "file=@$package_file" \
"$1"
)
rm -r "$temp_dir"
echo "Server upload result: $upload_result"
success=$(echo "${upload_result}" | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
if [[ ! "${success}" == "True" ]]; then
error_message=$(echo "${upload_result}" | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null);
echo "Failed to deploy build: ${error_message}"
exit 1
else
echo "Build successfully deployed!"
exit 0
fi

0
scripts/helper.sh Executable file → Normal file
View File

View File

@ -1,11 +0,0 @@
#!/bin/bash
SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
BASEPATH="$(realpath "${SCRIPTPATH}/../")"
echo "adding secure git dir"
git config --global --add safe.directory '*'
echo "running chmods"
find "${BASEPATH}" -iname "*.sh" -exec chmod +x {} +

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
install_sys_deps() {
# shellcheck disable=SC2207
curl_version=($(curl --version 2>/dev/null))
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "> Missing curl. Please install it."
exit 1
fi
echo "> Found curl ${curl_version[1]}"
}
install_node() {
node_version=$(node --version 2>/dev/null)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "> Missing node. We can't currently install it automatically."
echo "> Please download the latest version here: https://nodejs.org/en/download/"
exit 1
else
echo "> Found node $node_version"
fi
npm_version=$(npm --version 2>/dev/null)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "> Missing npm. Please ensure you've correctly installed node."
echo "> You may need to add npm manually to your PATH variable."
exit 1
else
echo "> Found npm $npm_version"
fi
}
install_sys_deps
install_node

View File

@ -1,28 +0,0 @@
#!/bin/bash
SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
BASEPATH="$(realpath "${SCRIPTPATH}/../")"
NPM_DIR="${BASEPATH}/.npm"
if [[ ! -d "${NPM_DIR}" ]]; then
mkdir "${NPM_DIR}" || exit 1
fi
if docker -v | grep -qi "podman"; then
is_podman='yes'
fi
function run() {
docker run --rm --workdir "/work" -v "${BASEPATH}:/work" -e is_podman="${is_podman:-no}" -e BUILDINDOCKER=yes -e npm_config_cache=/work/.npm ${opts:-} node:14-bullseye ${@}
}
opts="-it" run /bin/bash -c 'bash /work/scripts/in_docker_prep.sh && bash'
if [[ "${is_podman}" != 'yes' ]]; then
echo "fixing perms"
run /bin/bash -c 'chown -R 1000:1000 /work'
else
echo "in podman, not fixing perms"
fi

177
scripts/travis/build.sh Normal file
View File

@ -0,0 +1,177 @@
#!/bin/bash
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
source ./scripts/travis/properties.sh
build_verbose=0
build_release=1
build_debug=0
function print_help() {
echo "Possible arguments:"
echo " --verbose=[yes|no] | Enable verbose build output (Default: $build_verbose)"
echo " --enable-release=[yes|no] | Enable release build (Default: $build_release)"
echo " --enable-debug=[yes|no] | Enable debug build (Default: $build_debug)"
}
function parse_arguments() {
# Preprocess the help parameter
for argument in "$@"; do
if [[ "$argument" = "--help" ]] || [[ "$argument" = "-h" ]]; then
print_help
exit 1
fi
done
shopt -s nocasematch
for argument in "$@"; do
echo "Argument: $argument"
if [[ "$argument" =~ ^--verbose(=(y|1)?[[:alnum:]]*$)?$ ]]; then
build_verbose=0
if [[ -z "${BASH_REMATCH[1]}" ]] || [[ -n "${BASH_REMATCH[2]}" ]]; then
build_verbose=1
fi
if [[ ${build_verbose} ]]; then
echo "Enabled verbose output"
fi
elif [[ "$argument" =~ ^--enable-release(=(y|1)?[[:alnum:]]*$)?$ ]]; then
build_release=0
if [[ -z "${BASH_REMATCH[1]}" ]] || [[ -n "${BASH_REMATCH[2]}" ]]; then
build_release=1
fi
if [[ ${build_release} ]]; then
echo "Enabled release build!"
fi
elif [[ "$argument" =~ ^--enable-debug(=(y|1)?[[:alnum:]]*$)?$ ]]; then
build_debug=0
if [[ -z "${BASH_REMATCH[1]}" ]] || [[ -n "${BASH_REMATCH[2]}" ]]; then
build_debug=1
fi
if [[ ${build_debug} ]]; then
echo "Enabled debug build!"
fi
fi
done
}
function execute() {
time_begin=$(date +%s%N)
echo "> Executing step: $1" >> "${LOG_FILE}"
echo -e "\e[32m> Executing step: $1\e[0m"
#Execute the command
for command in "${@:3}"; do
echo "$> $command" >> "${LOG_FILE}"
if [[ ${build_verbose} -gt 0 ]]; then
echo "$> $command"
fi
error=""
if [[ ${build_verbose} -gt 0 ]]; then
if [[ -f ${LOG_FILE}.tmp ]]; then
rm "${LOG_FILE}.tmp"
fi
${command} |& tee "${LOG_FILE}.tmp" | grep -E '^[^(/\S*/libstdc++.so\S*: no version information available)].*'
error_code=${PIPESTATUS[0]}
error=$(cat "${LOG_FILE}.tmp")
cat "${LOG_FILE}.tmp" >> "${LOG_FILE}"
rm "${LOG_FILE}.tmp"
else
error=$(${command} 2>&1)
error_code=$?
echo "$error" >> "${LOG_FILE}"
fi
if [[ ${error_code} -ne 0 ]]; then
break
fi
done
#Log the result
time_end=$(date +%s%N)
time_needed=$((time_end - time_begin))
time_needed_ms=$((time_needed / 1000000))
step_color="\e[32m"
[[ ${error_code} -ne 0 ]] && step_color="\e[31m"
echo "$step_color> Step took ${time_needed_ms}ms" >> ${LOG_FILE}
echo -e "$step_color> Step took ${time_needed_ms}ms\e[0m"
if [[ ${error_code} -ne 0 ]]; then
handle_failure ${error_code} "$2"
fi
error=""
}
function handle_failure() {
# We cut of the nasty "node: /usr/lib/libstdc++.so.6: no version information available (required by node)" message
echo "--------------------------- [ERROR] ---------------------------"
echo "We've encountered an fatal error, which isn't recoverable!"
echo " Aborting build process!"
echo ""
echo "Exit code : $1"
echo "Error message: ${*:2}"
if [[ ${build_verbose} -eq 0 ]] && [[ "$error" != "" ]]; then
echo "Command log : (lookup \"${LOG_FILE}\" for detailed output!)"
echo "$error"
fi
echo "--------------------------- [ERROR] ---------------------------"
exit 1
}
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
error=""
LOG_FILE="$(pwd)/$LOG_FILE"
if [[ ! -d $(dirname "${LOG_FILE}") ]]; then
mkdir -p "$(dirname "${LOG_FILE}")"
fi
if [[ $# -eq 0 ]]; then
echo "Executing build scripts with no arguments"
else
echo "Executing build scripts with arguments: $* ($#)"
fi
if [[ "$1" == "bash" ]]; then
bash
exit 0
fi
parse_arguments "${@:1}"
if [[ -e "$LOG_FILE" ]]; then
rm "$LOG_FILE"
fi
echo "---------- Setup ----------"
chmod +x ./scripts/install_dependencies.sh
source ./scripts/install_dependencies.sh
echo "---------- Web client ----------"
function execute_build_release() {
execute \
"Building release package" \
"Failed to build release" \
"./scripts/build.sh web release"
}
function execute_build_debug() {
execute \
"Building debug package" \
"Failed to build debug" \
"./scripts/build.sh web dev"
}
chmod +x ./scripts/build.sh
if [[ ${build_release} ]]; then
execute_build_release
fi
if [[ ${build_debug} ]]; then
execute_build_debug
fi
exit 0

View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
source ./scripts/travis/properties.sh
source ./scripts/helper.sh
git_rev=$(git_version "short-tag")
if [[ "$1" == "release" ]]; then
echo "Releasing $git_rev as release"
rolling_tag="latest"
elif [[ "$1" == "development" ]]; then
echo "Releasing $git_rev as beta release"
rolling_tag="beta"
else
echo "Invalid release mode"
exit 1
fi
# We're only using the release packages even on the development branch
zip_file=$(find_release_package "web" "release")
[[ $? -ne "$zip_file" ]] && {
echo "TeaWeb release package does not exists ($zip_file)"
exit 1
}
git clone https://github.com/TeaSpeak/TeaDocker.git auto-build/teadocker || {
echo "Failed to clone the TeaDocker project"
exit 1
}
cp "$zip_file" auto-build/teadocker/web/TeaWeb-release.zip || {
echo "Failed to copy Docker webclient files to the docker files build context"
exit 1
}
docker build -f auto-build/teadocker/web/travis.Dockerfile --build-arg WEB_VERSION="$git_rev" --build-arg WEB_ZIP=TeaWeb-release.zip -t teaspeak/web:"$rolling_tag" auto-build/teadocker/web || {
echo "Failed to build dockerfile"
exit 1
}
docker tag teaspeak/web:"$rolling_tag" teaspeak/web:"$git_rev" || {
echo "Failed to tag docker release"
exit 1
}
docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" || {
echo "Failed to login to docker hub"
exit 1
}
docker push teaspeak/web || {
echo "Failed to push new teaspeak/web tags"
exit 1
}
docker logout # &> /dev/null
exit 0

View File

@ -0,0 +1,92 @@
#!/usr/bin/env bash
cd "$(dirname "$0")/../../" || {
echo "Failed to enter base dir"
exit 1
}
source ./scripts/travis/properties.sh
source ./scripts/helper.sh
if [[ -z "${GIT_AUTHTOKEN}" ]]; then
echo "GIT_AUTHTOKEN isn't set. Don't deploying build!"
exit 0
fi
git_release_executable="/tmp/git-release"
install_git_release() {
if [[ -x "${git_release_executable}" ]]; then
# File already available. No need to install it.
return 0
fi
if [[ ! -f ${git_release_executable} ]]; then
echo "Downloading github-release-linux (1.2.4)"
if [[ -f /tmp/git-release.gz ]]; then
rm /tmp/git-release.gz
fi
wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O /tmp/git-release.gz -q
[[ $? -eq 0 ]] || {
echo "Failed to download github-release-linux"
exit 1
}
gunzip /tmp/git-release.gz
_exit_code=$?
[[ $_exit_code -eq 0 ]] || {
echo "Failed to unzip github-release-linux"
exit 1
}
chmod +x /tmp/git-release
echo "Download of github-release-linux (1.2.4) finished"
else
chmod +x ${git_release_executable}
fi
if [[ ! -x ${git_release_executable} ]]; then
echo "git-release isn't executable"
exit 1
fi
}
install_git_release
git_versions_tag=$(git_version "short-tag")
echo "Deploying $git_versions_tag ($(git_version "long-tag")) to GitHub."
echo "Generating release tag"
${git_release_executable} release \
--repo "TeaWeb" \
--owner "TeaSpeak" \
--token "${GIT_AUTHTOKEN}" \
--title "Travis auto build $git_versions_tag" \
--tag "$git_versions_tag" \
--description "This is a auto build release from travis"
[[ $? -eq 0 ]] || {
echo "Failed to generate git release"
exit 1
}
upload_package() {
local package_file
package_file=$(find_release_package "web" "$1")
if [[ $? -eq 0 ]]; then
echo "Uploading $1 package ($package_file)"
${git_release_executable} upload \
--repo "TeaWeb" \
--owner "TeaSpeak" \
--token "${GIT_AUTHTOKEN}" \
--tag "$git_versions_tag" \
--file "$package_file" \
--name "$(basename "$package_file")"
echo "Successfully uploaded $1 package"
else
echo "Skipping $1 package upload: $package_file"
fi
}
# upload_package "development"
upload_package "release"
exit 0

View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
if [[ -z "$1" ]]; then
echo "Missing deploy channel"
exit 1
fi
cd "$(dirname "$0")/../../" || {
echo "Failed to enter base dir"
exit 1
}
source ./scripts/travis/properties.sh
source ./scripts/helper.sh
if [[ -z "${SSH_KEY}" ]]; then
echo "Missing environment variable SSH_KEY. Please set it before using this script!"
exit 1
fi
echo "${SSH_KEY}" | base64 --decode > /tmp/sftp_key
chmod 600 /tmp/sftp_key
[[ $? -ne 0 ]] && {
echo "Failed to write SSH key"
exit 1
}
package_file=$(find_release_package "web" "release")
if [[ $? -ne 0 ]]; then
echo "$package_file"
exit 1
fi
upload_name=$(basename "$package_file")
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev rm "tmp-upload/*.zip" # Cleanup the old files
_exit_code=$?
[[ $_exit_code -ne 0 ]] && {
echo "Failed to delete the old .zip files ($_exit_code)"
}
sftp -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev << EOF
put $package_file tmp-upload/$upload_name
EOF
_exit_code=$?
[[ $_exit_code -ne 0 ]] && {
echo "Failed to upload the .zip file ($_exit_code)"
exit 1
}
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev "./unpack.sh $1 tmp-upload/$upload_name"
exit $?

View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
LOG_FILE="auto-build/logs/build.log"
PACKAGES_DIRECTORY="auto-build/packages/"

0
shared/generate_declarations.sh Executable file → Normal file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -107,12 +107,12 @@ export class BookmarkManager {
connectOnStartup: false,
connectProfile: "default",
displayName: "Our LanPart<",
displayName: "Official TeaSpeak - Test server",
parentEntry: undefined,
previousEntry: undefined,
serverAddress: "tea.lp.kle.li",
serverAddress: "ts.teaspeak.de",
serverPasswordHash: undefined,
defaultChannel: undefined,

View File

@ -89,7 +89,7 @@ export class AbstractKeyBoard implements KeyBoardBackend {
return;
}
this.registeredKeyHooks.remove(hook as RegisteredKeyHook);
this.registeredKeyHooks.remove(hook);
}
registerListener(listener: (event: KeyEvent) => void) {

View File

@ -16,10 +16,10 @@ import { getAudioBackend } from "tc-shared/audio/Player";
const kSdpCompressionMode = 1;
declare global {
// interface RTCIceCandidate {
// /* Firefox has this */
// address: string;
// }
interface RTCIceCandidate {
/* Firefox has this */
address: string | undefined;
}
interface HTMLCanvasElement {
captureStream(framed: number) : MediaStream;
@ -583,6 +583,7 @@ export class RTCConnection {
this.peer.onicegatheringstatechange = undefined;
this.peer.onnegotiationneeded = undefined;
this.peer.onsignalingstatechange = undefined;
this.peer.onstatsended = undefined;
this.peer.ontrack = undefined;
this.peer.close();
@ -895,7 +896,7 @@ export class RTCConnection {
this.peer = new RTCPeerConnection({
bundlePolicy: "max-bundle",
rtcpMuxPolicy: "require",
iceServers: [{ urls: ["stun:turn.lp.kle.li:3478"] }]
iceServers: [{ urls: ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"] }]
});
if(this.audioSupport) {
@ -927,7 +928,7 @@ export class RTCConnection {
}
this.peer.onicecandidate = event => this.handleLocalIceCandidate(event.candidate);
this.peer.onicecandidateerror = event => this.handleIceCandidateError(event as RTCPeerConnectionIceErrorEvent);
this.peer.onicecandidateerror = event => this.handleIceCandidateError(event);
this.peer.oniceconnectionstatechange = () => this.handleIceConnectionStateChanged();
this.peer.onicegatheringstatechange = () => this.handleIceGatheringStateChanged();
@ -1129,10 +1130,10 @@ export class RTCConnection {
private handleIceCandidateError(event: RTCPeerConnectionIceErrorEvent) {
if(this.peer.iceGatheringState === "gathering") {
logWarn(LogCategory.WEBRTC, tr("Received error while gathering the ice candidates: %d/%s for %s (url: %s)"),
event.errorCode, event.errorText, event.address, event.url);
event.errorCode, event.errorText, event.hostCandidate, event.url);
} else {
logTrace(LogCategory.WEBRTC, tr("Ice candidate %s (%s) errored: %d/%s"),
event.url, event.address, event.errorCode, event.errorText);
event.url, event.hostCandidate, event.errorCode, event.errorText);
}
}
private handleIceConnectionStateChanged() {

View File

@ -107,6 +107,7 @@ export class RemoteRTPVideoTrack extends RemoteRTPTrack {
track.onended = () => logTrace(LogCategory.VIDEO, "Track %d ended", ssrc);
track.onmute = () => logTrace(LogCategory.VIDEO, "Track %d muted", ssrc);
track.onunmute = () => logTrace(LogCategory.VIDEO, "Track %d unmuted", ssrc);
track.onisolationchange = () => logTrace(LogCategory.VIDEO, "Track %d isolation changed", ssrc);
}
getMediaStream() : MediaStream {

View File

@ -173,7 +173,7 @@ export class OwnAvatarStorage {
const hasher = crypto.algo.MD5.create();
await target.stream().pipeTo(new WritableStream({
write(data) {
hasher.update(crypto.lib.WordArray.create(Array.from(data)));
hasher.update(crypto.lib.WordArray.create(data));
}
}));

View File

@ -82,8 +82,8 @@ export async function requestMediaStream(deviceId: string | undefined, groupId:
}
export async function queryMediaPermissions(type: MediaStreamType, changeListener?: (value: PermissionState) => void) : Promise<PermissionState> {
if('permissions' in navigator && 'query' in navigator.permissions) {
try {
// @ts-ignore needed, as firefox doesn't allow microphone or camera, caught using the catch below
const result = await navigator.permissions.query({ name: type === "audio" ? "microphone" : "camera" });
if(changeListener) {
result.addEventListener("change", () => {
@ -92,12 +92,9 @@ export async function queryMediaPermissions(type: MediaStreamType, changeListene
}
return result.state;
} catch (error) {
// Firefox doesn't support querying for the camera / microphone permission, so return undetermined status
if (error instanceof TypeError) {
return "prompt";
}
logWarn(LogCategory.GENERAL, tr("Failed to query for %s permissions: %s"), type, error);
}
}
return "prompt";
}

View File

@ -73,6 +73,9 @@ declare global {
name: string,
version: string
};
mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
}
interface ObjectConstructor {

View File

@ -364,7 +364,7 @@ export class Settings {
static readonly KEY_I18N_DEFAULT_REPOSITORY: ValuedRegistryKey<string> = {
key: "i18n.default_repository",
valueType: "string",
defaultValue: "i18n/"
defaultValue: "https://web.teaspeak.de/i18n/"
};
/* Default client states */
@ -408,12 +408,12 @@ export class Settings {
static readonly KEY_FLAG_CONNECT_DEFAULT: ValuedRegistryKey<boolean> = {
key: "connect_default",
valueType: "boolean",
defaultValue: true
defaultValue: false
};
static readonly KEY_CONNECT_ADDRESS: ValuedRegistryKey<string> = {
key: "connect_address",
valueType: "string",
defaultValue: "tea.lp.kle.li"
defaultValue: undefined
};
static readonly KEY_CONNECT_PROFILE: ValuedRegistryKey<string> = {
key: "connect_profile",
@ -448,7 +448,7 @@ export class Settings {
static readonly KEY_CONNECT_NO_DNSPROXY: ValuedRegistryKey<boolean> = {
key: "connect_no_dnsproxy",
defaultValue: true,
defaultValue: false,
valueType: "boolean",
};

View File

@ -44,7 +44,7 @@ const useInviteLink = (linkId: string): LocalInviteInfo => {
const callback = () => setValue(localInviteCache[linkId].status);
(localInviteCallbacks[linkId] || (localInviteCallbacks[linkId] = [])).push(callback);
return () => { localInviteCallbacks[linkId]?.remove(callback); }
return () => localInviteCallbacks[linkId]?.remove(callback);
}, [linkId]);
return value;

View File

@ -928,7 +928,7 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
return ClientType.CLIENT_UNDEFINED;
}
} else {
switch (this.properties.client_type_exact as ClientType) {
switch(this.properties.client_type_exact) {
case 0:
return ClientType.CLIENT_VOICE;
@ -943,7 +943,7 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
case 5:
return ClientType.CLIENT_TEASPEAK;
// @ts-ignore
case 2:
/* 2 is the internal client type which should never be visible for the target user */
default:

View File

@ -61,8 +61,7 @@ class ConnectController {
private validateNickname: boolean;
private validateAddress: boolean;
constructor(uiVariables: UiVariableProvider<ConnectUiVariables>) {
7
constructor(uiVariables: UiVariableProvider<ConnectUiVariables>) {7
this.uiEvents = new Registry<ConnectUiEvents>();
this.uiEvents.enableDebug("modal-connect");
@ -72,7 +71,7 @@ class ConnectController {
this.validateNickname = false;
this.validateAddress = false;
this.defaultAddress = "tea.lp.kle.li";
this.defaultAddress = "ts.teaspeak.de";
this.historyShown = settings.getValue(Settings.KEY_CONNECT_SHOW_HISTORY);
this.currentAddress = settings.getValue(Settings.KEY_CONNECT_ADDRESS);

View File

@ -2,15 +2,13 @@ import * as React from "react";
import {useEffect, useRef, useState} from "react";
import {Registry} from "tc-shared/events";
import '!style-loader!css-loader!emoji-mart/css/emoji-mart.css'
import {Picker, emojiIndex} from 'emoji-mart'
import {settings, Settings} from "tc-shared/settings";
import {Translatable} from "tc-shared/ui/react-elements/i18n";
import Picker from '@emoji-mart/react'
import data from '@emoji-mart/data'
import { Emoji, init } from "emoji-mart";
init({ data })
import {getTwenmojiHashFromNativeEmoji} from "tc-shared/text/bbcode/EmojiUtil";
import {BaseEmoji} from "emoji-mart";
import {useGlobalSetting} from "tc-shared/ui/react-elements/Helper";
const cssStyle = require("./ChatBox.scss");
@ -30,7 +28,15 @@ interface ChatBoxEvents {
}
const LastUsedEmoji = () => {
return <img key={"fallback"} alt={""} src={"img/smiley.png"} />;
const settingValue = useGlobalSetting(Settings.KEY_CHAT_LAST_USED_EMOJI);
const lastEmoji: BaseEmoji = (emojiIndex.emojis[settingValue] || emojiIndex.emojis["joy"]) as any;
if(!lastEmoji?.native) {
return <img key={"fallback"} alt={""} src={"img/smiley-smile.svg"} />;
}
return (
<img draggable={false} src={"https://twemoji.maxcdn.com/v/12.1.2/72x72/" + getTwenmojiHashFromNativeEmoji(lastEmoji.native) + ".png"} alt={lastEmoji.native} className={cssStyle.emoji} />
)
}
const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
@ -70,21 +76,22 @@ const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
<div className={cssStyle.picker} style={{ display: shown ? undefined : "none" }}>
{!shown ? undefined :
<Picker
data={data}
key={"picker"}
set={"native"}
noCountryFlags={true}
set={"twitter"}
theme={"light"}
showPreview={true}
title={""}
skinTonePosition={"none"}
showSkinTones={true}
useButton={false}
native={false}
onEmojiSelect={(emoji: any) => {
onSelect={(emoji: any) => {
if(enabled) {
settings.setValue(Settings.KEY_CHAT_LAST_USED_EMOJI, emoji.id as string);
props.events.fire("action_insert_text", { text: emoji.native, focus: true });
}
}}
/>
}
</div>
</div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,27 +8,14 @@
"declaration": true,
"emitDeclarationOnly": true,
"esModuleInterop": true,
"skipLibCheck": true,
"baseUrl": "../../",
"paths": {
"tc-shared/*": [
"shared/js/*"
],
"tc-loader": [
"loader/exports/loader.d.ts"
],
"svg-sprites/*": [
"shared/svg-sprites/*"
],
"vendor/xbbcode/*": [
"vendor/xbbcode/src/*"
],
"tc-events": [
"vendor/TeaEventBus/src/index.ts"
],
"tc-services": [
"vendor/TeaClientServices/src/index.ts"
]
"tc-shared/*": ["shared/js/*"],
"tc-loader": ["loader/exports/loader.d.ts"],
"svg-sprites/*": ["shared/svg-sprites/*"],
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"],
"tc-events": ["vendor/TeaEventBus/src/index.ts"],
"tc-services": ["vendor/TeaClientServices/src/index.ts"]
}
},
"exclude": [

View File

@ -6,7 +6,6 @@
"sourceMap": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"skipLibCheck": true,
"plugins": [ /* ttypescript */
{
"transform": "../../tools/trgen/ttsc_transformer.js",

0
tools/build_trgen.sh Executable file → Normal file
View File

View File

@ -1,14 +1,13 @@
{
"compilerOptions": {
"baseUrl": ".",
"skipLibCheck": true,
"moduleResolution": "node",
"module": "commonjs",
"lib": [
"es6"
],
"lib": ["es6"],
"typeRoots": [],
"types": [],
"esModuleInterop": true
},
"files": [

View File

@ -4,21 +4,20 @@
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"lib": [
"es6",
"dom"
],
"lib": ["es6", "dom"],
"removeComments": false,
"esModuleInterop": true,
"skipLibCheck": true
"esModuleInterop": true
},
"include": [
"webpack.config.ts",
"webpack-client.config.ts",
"webpack-web.config.ts",
"webpack/build-definitions.d.ts",
"webpack/HtmlWebpackInlineSource.ts",
"webpack/WatLoader.ts",
"webpack/ManifestPlugin.ts",
"babel.config.ts",
"postcss.config.ts",
"file.ts"

View File

@ -5,35 +5,19 @@
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"lib": [
"ES7",
"dom",
"dom.iterable"
],
"lib": ["ES7", "dom", "dom.iterable"],
"removeComments": true, /* we dont really need them within the target files */
"jsx": "react",
"esModuleInterop": true,
"baseUrl": ".",
"skipLibCheck": true,
"paths": {
"tc-shared/*": [
"shared/js/*"
],
"tc-loader": [
"loader/exports/loader.d.ts"
],
"tc-events": [
"vendor/TeaEventBus/src/index.ts"
],
"tc-services": [
"vendor/TeaClientServices/src/index.ts"
],
"svg-sprites/*": [
"shared/svg-sprites/*"
],
"vendor/xbbcode/*": [
"vendor/xbbcode/src/*"
]
"tc-shared/*": ["shared/js/*"],
"tc-loader": ["loader/exports/loader.d.ts"],
"tc-events": ["vendor/TeaEventBus/src/index.ts"],
"tc-services": ["vendor/TeaClientServices/src/index.ts"],
"svg-sprites/*": ["shared/svg-sprites/*"],
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"]
}
},
"exclude": [

View File

@ -26,20 +26,6 @@ class LocalhostResolver implements DNSResolveMethod {
}
class FakeResolver implements DNSResolveMethod {
name(): string {
return "fake resolver";
}
async resolve(address: DNSAddress): Promise<DNSAddress | undefined> {
return {
hostname: "tea.lp.kle.li",
port: address.port
}
}
}
class IPResolveMethod implements DNSResolveMethod {
readonly v6: boolean;
@ -323,7 +309,6 @@ class TeaSpeakDNSResolve {
}
}
const kResolverFake = new FakeResolver();
const kResolverLocalhost = new LocalhostResolver();
const kResolverIpV4 = new IPResolveMethod(false);
@ -342,9 +327,7 @@ export async function resolveTeaSpeakServerAddress(address: DNSAddress, _options
const resolver = new TeaSpeakDNSResolve(address);
resolver.registerResolver(kResolverFake);
resolver.registerResolver(kResolverLocalhost, kResolverFake);
resolver.registerResolver(kResolverLocalhost);
resolver.registerResolver(resolverSrvTS, kResolverLocalhost);
resolver.registerResolver(resolverSrvTS3, kResolverLocalhost);

27
webpack-client.config.ts Normal file
View File

@ -0,0 +1,27 @@
import * as path from "path";
import * as config_base from "./webpack.config";
export = env => config_base.config(env, "client").then(config => {
Object.assign(config.entry, {
"main-app": ["./client/app/entry-points/AppMain.ts"],
"modal-external": ["./client/app/entry-points/ModalWindow.ts"]
});
Object.assign(config.resolve.alias, {
"tc-shared": path.resolve(__dirname, "shared/js"),
});
if(!Array.isArray(config.externals)) {
throw "invalid config";
}
config.externals.push(({ context, request }, callback) => {
if (request.startsWith("tc-backend/")) {
return callback(null, `window["backend-loader"].require("${request}")`);
}
callback(undefined, undefined);
});
return Promise.resolve(config);
});

View File

@ -46,9 +46,9 @@ const generateLocalBuildInfo = async (target: string): Promise<LocalBuildInfo> =
{
const gitRevision = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
if(gitRevision.indexOf("/") === -1) {
info.gitVersion = (gitRevision || "00000000").substring(0, 8);
info.gitVersion = (gitRevision || "00000000").substr(0, 8);
} else {
info.gitVersion = fs.readFileSync(path.join(__dirname, ".git", gitRevision.substring(5).trim())).toString().substring(0, 8);
info.gitVersion = fs.readFileSync(path.join(__dirname, ".git", gitRevision.substr(5).trim())).toString().substr(0, 8);
}
try {