Compare commits
13 commits
main
...
localemoji
Author | SHA1 | Date | |
---|---|---|---|
28cdfeb205 | |||
cbb340aa8d | |||
4c5e744f62 | |||
86351e336c | |||
24c6a1e22e | |||
2a1fd11e2d | |||
063fdae679 | |||
e5551cea09 | |||
3ec3db37e0 | |||
feb564d4a0 | |||
bde4bbf5ad | |||
ef0813dd84 | |||
5b8b4d07c3 |
58 changed files with 6335 additions and 4850 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
||||||
.idea/
|
.idea/
|
||||||
node_modules/
|
node_modules/
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
.npm/
|
||||||
|
|
||||||
/auth/certs/
|
/auth/certs/
|
||||||
/auth/js/auth.js.map
|
/auth/js/auth.js.map
|
||||||
|
|
4
.npmrc
Normal file
4
.npmrc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
audit=false
|
||||||
|
fund=false
|
||||||
|
update-notifier=false
|
||||||
|
package-lock=true
|
89
.woodpecker/base.yaml
Normal file
89
.woodpecker/base.yaml
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
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 rel
|
||||||
|
|
||||||
|
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]
|
|
@ -4,14 +4,12 @@ export default api => {
|
||||||
[
|
[
|
||||||
"@babel/preset-env",
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
"corejs": {"version": 3},
|
"corejs": {"version": '3.33', "proposals": false},
|
||||||
"useBuiltIns": "usage",
|
"useBuiltIns": "usage",
|
||||||
"targets": {
|
"targets": {
|
||||||
"edge": "17",
|
"edge": "111",
|
||||||
"firefox": "60",
|
"firefox": "100",
|
||||||
"chrome": "67",
|
"chrome": "109"
|
||||||
"safari": "11.1",
|
|
||||||
"ie": "11"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
0
client/generate_packed.sh
Normal file → Executable file
0
client/generate_packed.sh
Normal file → Executable file
17
docker/Dockerfile.base
Normal file
17
docker/Dockerfile.base
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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;"]
|
19
docker/Dockerfile.ci
Normal file
19
docker/Dockerfile.ci
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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;"]
|
||||||
|
|
||||||
|
COPY ./dist/ /var/www/TeaWeb/
|
36
docker/default.conf
Normal file
36
docker/default.conf
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
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;
|
||||||
|
}
|
29
docker/entrypoint.sh
Executable file
29
docker/entrypoint.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/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 "$@"
|
32
docker/nginx.conf
Normal file
32
docker/nginx.conf
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ export {};
|
||||||
if (__build.target === "client") {
|
if (__build.target === "client") {
|
||||||
/* do this so we don't get a react dev tools warning within the client */
|
/* do this so we don't get a react dev tools warning within the client */
|
||||||
if (!('__REACT_DEVTOOLS_GLOBAL_HOOK__' in window)) {
|
if (!('__REACT_DEVTOOLS_GLOBAL_HOOK__' in window)) {
|
||||||
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {};
|
(window as Window).__REACT_DEVTOOLS_GLOBAL_HOOK__ = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () { };
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () { };
|
||||||
|
|
7020
package-lock.json
generated
7020
package-lock.json
generated
File diff suppressed because it is too large
Load diff
130
package.json
130
package.json
|
@ -17,74 +17,74 @@
|
||||||
"author": "TeaSpeak (WolverinDEV)",
|
"author": "TeaSpeak (WolverinDEV)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.4",
|
"@babel/core": "^7.23.3",
|
||||||
"@babel/plugin-transform-runtime": "^7.10.4",
|
"@babel/plugin-transform-runtime": "^7.23.3",
|
||||||
"@babel/preset-env": "^7.10.4",
|
"@babel/preset-env": "^7.23.3",
|
||||||
"@google-cloud/translate": "^5.3.0",
|
"@google-cloud/translate": "^5.3.0",
|
||||||
"@svgr/webpack": "^5.5.0",
|
"@svgr/webpack": "^5.5.0",
|
||||||
"@types/dompurify": "^2.0.1",
|
"@types/dompurify": "^2.4.0",
|
||||||
"@types/ejs": "^3.0.2",
|
"@types/ejs": "^3.1.5",
|
||||||
"@types/emoji-mart": "^3.0.2",
|
"@types/emscripten": "^1.39.10",
|
||||||
"@types/emscripten": "^1.38.0",
|
"@types/fs-extra": "^8.1.5",
|
||||||
"@types/fs-extra": "^8.0.1",
|
|
||||||
"@types/html-minifier": "^3.5.3",
|
"@types/html-minifier": "^3.5.3",
|
||||||
"@types/jquery": "^3.3.34",
|
"@types/jquery": "^3.5.27",
|
||||||
"@types/jsrender": "^1.0.5",
|
"@types/jsrender": "^1.0.5",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.201",
|
||||||
"@types/moment": "^2.13.0",
|
"@types/moment": "^2.13.0",
|
||||||
"@types/node": "^12.7.2",
|
"@types/node": "^12.20.55",
|
||||||
"@types/react-color": "^3.0.4",
|
"@types/react": "^16.14.51",
|
||||||
"@types/react-dom": "^16.9.5",
|
"@types/react-color": "^3.0.10",
|
||||||
"@types/react-grid-layout": "^1.1.1",
|
"@types/react-dom": "^16.9.22",
|
||||||
"@types/remarkable": "^1.7.4",
|
"@types/react-grid-layout": "^1.3.5",
|
||||||
"@types/sdp-transform": "^2.4.4",
|
"@types/remarkable": "^1.7.6",
|
||||||
"@types/sha256": "^0.2.0",
|
"@types/sdp-transform": "^2.4.9",
|
||||||
"@types/twemoji": "^12.1.1",
|
"@types/sha256": "^0.2.2",
|
||||||
|
"@types/twemoji": "^12.1.2",
|
||||||
"@types/websocket": "0.0.40",
|
"@types/websocket": "0.0.40",
|
||||||
"@types/xml-parser": "^1.2.29",
|
"@types/xml-parser": "^1.2.33",
|
||||||
"@wasm-tool/wasm-pack-plugin": "^1.3.1",
|
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
|
||||||
"autoprefixer": "^10.2.5",
|
"autoprefixer": "^10.4.16",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.3.0",
|
||||||
"circular-dependency-plugin": "^5.2.0",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"clean-css": "^4.2.1",
|
"clean-css": "^4.2.4",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^8.0.0",
|
"copy-webpack-plugin": "^8.1.1",
|
||||||
"css-loader": "^3.6.0",
|
"css-loader": "^3.6.0",
|
||||||
"css-minimizer-webpack-plugin": "^1.3.0",
|
"css-minimizer-webpack-plugin": "^1.3.0",
|
||||||
"exports-loader": "^0.7.0",
|
"exports-loader": "^0.7.0",
|
||||||
"fast-xml-parser": "^3.17.4",
|
"fast-xml-parser": "^3.21.1",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.2.0",
|
||||||
"fs-extra": "latest",
|
"fs-extra": "latest",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"html-loader": "^1.0.0",
|
"html-loader": "^1.3.2",
|
||||||
"html-minifier": "^4.0.0",
|
"html-minifier": "^4.0.0",
|
||||||
"html-webpack-inline-source-plugin": "0.0.10",
|
"html-webpack-inline-source-plugin": "0.0.10",
|
||||||
"html-webpack-plugin": "^5.3.1",
|
"html-webpack-plugin": "^5.5.3",
|
||||||
"inline-chunks-html-webpack-plugin": "^1.3.1",
|
"inline-chunks-html-webpack-plugin": "^1.3.1",
|
||||||
"mime-types": "^2.1.24",
|
"mime-types": "^2.1.35",
|
||||||
"mini-css-extract-plugin": "^1.3.9",
|
"mini-css-extract-plugin": "^1.6.2",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.6",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^4.14.1",
|
||||||
"postcss": "^8.3.0",
|
"postcss": "^8.4.31",
|
||||||
"postcss-loader": "^5.2.0",
|
"postcss-loader": "^5.3.0",
|
||||||
"potpack": "^1.0.1",
|
"potpack": "^1.0.2",
|
||||||
"raw-loader": "^4.0.0",
|
"raw-loader": "^4.0.2",
|
||||||
"sass": "1.22.10",
|
"sass": "1.22.10",
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
"sha256": "^0.2.0",
|
"sha256": "^0.2.0",
|
||||||
"style-loader": "^1.1.3",
|
"style-loader": "^1.3.0",
|
||||||
"svg-inline-loader": "^0.8.2",
|
"svg-inline-loader": "^0.8.2",
|
||||||
"terser": "^4.2.1",
|
"terser": "^4.8.1",
|
||||||
"terser-webpack-plugin": "4.2.3",
|
"terser-webpack-plugin": "4.2.3",
|
||||||
"ts-loader": "^6.2.2",
|
"ts-loader": "^8.4.0",
|
||||||
"tsd": "^0.13.1",
|
"tsd": "^0.13.1",
|
||||||
"typescript": "^4.2",
|
"typescript": "^4.9.5",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
"wabt": "^1.0.13",
|
"wabt": "1.0.13",
|
||||||
"webpack": "^5.26.1",
|
"webpack": "^5.89.0",
|
||||||
"webpack-bundle-analyzer": "^3.6.1",
|
"webpack-bundle-analyzer": "^3.9.0",
|
||||||
"webpack-cli": "^4.5.0",
|
"webpack-cli": "^4.10.0",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.3",
|
||||||
"webpack-svg-sprite-generator": "^5.0.4",
|
"webpack-svg-sprite-generator": "^5.0.4",
|
||||||
"zip-webpack-plugin": "^4.0.1"
|
"zip-webpack-plugin": "^4.0.1"
|
||||||
},
|
},
|
||||||
|
@ -97,33 +97,35 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://www.teaspeak.de",
|
"homepage": "https://www.teaspeak.de",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/crypto-js": "^4.0.1",
|
"@emoji-mart/data": "^1.1.2",
|
||||||
|
"@emoji-mart/react": "^1.1.1",
|
||||||
|
"@types/crypto-js": "^4.2.1",
|
||||||
"broadcastchannel-polyfill": "^1.0.1",
|
"broadcastchannel-polyfill": "^1.0.1",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"crypto-browserify": "^3.12.0",
|
"crypto-browserify": "^3.12.0",
|
||||||
"crypto-js": "^4.0.0",
|
"crypto-js": "^4.2.0",
|
||||||
"detect-browser": "^5.2.0",
|
"detect-browser": "^5.3.0",
|
||||||
"dompurify": "^2.2.8",
|
"dompurify": "^2.4.7",
|
||||||
"emoji-mart": "git+https://github.com/WolverinDEV/emoji-mart.git",
|
"emoji-mart": "^5.5.2",
|
||||||
"emoji-regex": "^9.0.0",
|
"emoji-regex": "^9.2.2",
|
||||||
"highlight.js": "^10.1.1",
|
"highlight.js": "^10.7.3",
|
||||||
"ip-regex": "^4.2.0",
|
"ip-regex": "^4.3.0",
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.7.1",
|
||||||
"jsrender": "^1.0.7",
|
"jsrender": "^1.0.13",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.29.4",
|
||||||
"react": "^16.13.1",
|
"react": "^16.14.0",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.14.0",
|
||||||
"react-grid-layout": "^1.2.2",
|
"react-grid-layout": "^1.4.3",
|
||||||
"react-player": "^2.5.0",
|
"react-player": "^2.13.0",
|
||||||
"remarkable": "^2.0.1",
|
"remarkable": "^2.0.1",
|
||||||
"resize-observer-polyfill": "git+https://github.com/albancreton/resize-observer-polyfill.git#patch-1",
|
"resize-observer-polyfill": "git+https://github.com/albancreton/resize-observer-polyfill.git#patch-1",
|
||||||
"sdp-transform": "^2.14.0",
|
"sdp-transform": "^2.14.1",
|
||||||
"simple-jsonp-promise": "^1.1.0",
|
"simple-jsonp-promise": "^1.1.0",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"twemoji": "^13.0.0",
|
"twemoji": "^13.1.1",
|
||||||
"url-knife": "^3.1.3",
|
"url-knife": "^3.1.3",
|
||||||
"webcrypto-liner": "^1.2.4",
|
"webcrypto-liner": "^1.4.2",
|
||||||
"webpack-manifest-plugin": "^3.1.0",
|
"webpack-manifest-plugin": "^3.2.0",
|
||||||
"webrtc-adapter": "^7.5.1"
|
"webrtc-adapter": "^7.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
scripts/build.sh
Normal file → Executable file
0
scripts/build.sh
Normal file → Executable file
0
scripts/build_declarations.sh
Normal file → Executable file
0
scripts/build_declarations.sh
Normal file → Executable file
45
scripts/build_in_docker.sh
Executable file
45
scripts/build_in_docker.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/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
|
||||||
|
docker run --rm --workdir "/work" -v "${NPM_DIR}:/home/" -v "${BASEPATH}:/work" -e BUILDINDOCKER=yes 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 npmrc"
|
||||||
|
cat >>"${HOME}/.npmrc" <<'EOF'
|
||||||
|
cache=/work/.npm
|
||||||
|
fund=false
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "adding secure git dir"
|
||||||
|
git config --global --add safe.directory /work
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "fixing perms"
|
||||||
|
chown -R 1000:1000 /work
|
0
scripts/cleanup.sh
Normal file → Executable file
0
scripts/cleanup.sh
Normal file → Executable file
0
scripts/deploy_ui_files.sh
Normal file → Executable file
0
scripts/deploy_ui_files.sh
Normal file → Executable file
0
scripts/helper.sh
Normal file → Executable file
0
scripts/helper.sh
Normal file → Executable file
0
scripts/install_dependencies.sh
Normal file → Executable file
0
scripts/install_dependencies.sh
Normal file → Executable file
0
scripts/travis/build.sh
Normal file → Executable file
0
scripts/travis/build.sh
Normal file → Executable file
0
scripts/travis/deploy_docker.sh
Normal file → Executable file
0
scripts/travis/deploy_docker.sh
Normal file → Executable file
0
scripts/travis/deploy_github.sh
Normal file → Executable file
0
scripts/travis/deploy_github.sh
Normal file → Executable file
0
scripts/travis/deploy_server.sh
Normal file → Executable file
0
scripts/travis/deploy_server.sh
Normal file → Executable file
0
scripts/travis/properties.sh
Normal file → Executable file
0
scripts/travis/properties.sh
Normal file → Executable file
|
@ -10,7 +10,8 @@
|
||||||
justify-content: stretch !important;
|
justify-content: stretch !important;
|
||||||
|
|
||||||
@include user-select(none);
|
@include user-select(none);
|
||||||
width: 10000em; /* allocate some space */
|
width: 10000em;
|
||||||
|
/* allocate some space */
|
||||||
|
|
||||||
.inner-container {
|
.inner-container {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -23,7 +24,8 @@
|
||||||
flex-direction: row !important;
|
flex-direction: row !important;
|
||||||
justify-content: stretch;
|
justify-content: stretch;
|
||||||
|
|
||||||
> .left, > .right {
|
>.left,
|
||||||
|
>.right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: stretch;
|
justify-content: stretch;
|
||||||
|
@ -113,7 +115,9 @@
|
||||||
|
|
||||||
@include chat-scrollbar-horizontal();
|
@include chat-scrollbar-horizontal();
|
||||||
|
|
||||||
&.general-chat, &.general-application, &.audio-sounds {
|
&.general-chat,
|
||||||
|
&.general-application,
|
||||||
|
&.audio-sounds {
|
||||||
label {
|
label {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -168,7 +172,8 @@
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
a, div {
|
a,
|
||||||
|
div {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -333,15 +338,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.audio-speaker, &.audio-sounds, &.identity-forum {
|
&.audio-speaker,
|
||||||
|
&.audio-sounds,
|
||||||
|
&.identity-forum {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: stretch;
|
justify-content: stretch;
|
||||||
|
|
||||||
.left, .right, .fill {
|
.left,
|
||||||
|
.right,
|
||||||
|
.fill {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
|
||||||
width: calc(50% - .5em); /* the .5em for the padding/margin */
|
width: calc(50% - .5em);
|
||||||
|
|
||||||
|
/* the .5em for the padding/margin */
|
||||||
&.fill {
|
&.fill {
|
||||||
width: calc(100% - 1em);
|
width: calc(100% - 1em);
|
||||||
}
|
}
|
||||||
|
@ -410,7 +421,8 @@
|
||||||
|
|
||||||
background-color: $color_list_background;
|
background-color: $color_list_background;
|
||||||
|
|
||||||
&.container-devices, .container-devices {
|
&.container-devices,
|
||||||
|
.container-devices {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
|
||||||
|
@ -540,7 +552,9 @@
|
||||||
border-bottom: 1px solid #242527;
|
border-bottom: 1px solid #242527;
|
||||||
border-top: 1px solid #242527;
|
border-top: 1px solid #242527;
|
||||||
}
|
}
|
||||||
.container-name, .container-activity {
|
|
||||||
|
.container-name,
|
||||||
|
.container-activity {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
@ -588,8 +602,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right, .fill {
|
.right,
|
||||||
padding-right: .5em; /* for the sliders etc*/
|
.fill {
|
||||||
|
padding-right: .5em;
|
||||||
|
/* for the sliders etc*/
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
|
@ -711,6 +727,7 @@
|
||||||
|
|
||||||
.thumb {
|
.thumb {
|
||||||
background-color: #4d4d4d !important;
|
background-color: #4d4d4d !important;
|
||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
}
|
}
|
||||||
|
@ -1082,11 +1099,13 @@
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.left, .right {
|
.left,
|
||||||
|
.right {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
|
||||||
width: calc(50% - .5em); /* the .5em for the padding/margin */
|
width: calc(50% - .5em);
|
||||||
|
/* the .5em for the padding/margin */
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -1167,7 +1186,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&[value] {
|
&[value] {
|
||||||
overflow: visible; /* for the thumb */
|
overflow: visible;
|
||||||
|
/* for the thumb */
|
||||||
|
|
||||||
border-bottom-left-radius: $border_radius_large;
|
border-bottom-left-radius: $border_radius_large;
|
||||||
border-top-left-radius: $border_radius_large;
|
border-top-left-radius: $border_radius_large;
|
||||||
|
@ -1217,11 +1237,16 @@
|
||||||
box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, 0.25);
|
box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, 0.25);
|
||||||
|
|
||||||
/* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#70407e+0,45407e+100 */
|
/* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#70407e+0,45407e+100 */
|
||||||
background: rgb(112,64,126); /* Old browsers */
|
background: rgb(112, 64, 126);
|
||||||
background: -moz-linear-gradient(left, rgba(112,64,126,1) 0%, rgba(69,64,126,1) 100%); /* FF3.6-15 */
|
/* Old browsers */
|
||||||
background: -webkit-linear-gradient(left, rgba(112,64,126,1) 0%,rgba(69,64,126,1) 100%); /* Chrome10-25,Safari5.1-6 */
|
background: -moz-linear-gradient(left, rgba(112, 64, 126, 1) 0%, rgba(69, 64, 126, 1) 100%);
|
||||||
background: linear-gradient(to right, rgba(112,64,126,1) 0%,rgba(69,64,126,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
|
/* FF3.6-15 */
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#70407e', endColorstr='#45407e',GradientType=1 ); /* IE6-9 */
|
background: -webkit-linear-gradient(left, rgba(112, 64, 126, 1) 0%, rgba(69, 64, 126, 1) 100%);
|
||||||
|
/* Chrome10-25,Safari5.1-6 */
|
||||||
|
background: linear-gradient(to right, rgba(112, 64, 126, 1) 0%, rgba(69, 64, 126, 1) 100%);
|
||||||
|
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#70407e', endColorstr='#45407e', GradientType=1);
|
||||||
|
/* IE6-9 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
|
@ -1245,7 +1270,8 @@
|
||||||
|
|
||||||
background-color: $color_list_background;
|
background-color: $color_list_background;
|
||||||
|
|
||||||
&.container-devices, .container-devices {
|
&.container-devices,
|
||||||
|
.container-devices {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
|
||||||
|
@ -1402,7 +1428,9 @@
|
||||||
border-bottom: 1px solid #242527;
|
border-bottom: 1px solid #242527;
|
||||||
border-top: 1px solid #242527;
|
border-top: 1px solid #242527;
|
||||||
}
|
}
|
||||||
.container-name, .container-activity {
|
|
||||||
|
.container-name,
|
||||||
|
.container-activity {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
@ -1480,7 +1508,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-right: .5em; /* for the sliders etc*/
|
padding-right: .5em;
|
||||||
|
/* for the sliders etc*/
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
|
@ -1602,6 +1631,7 @@
|
||||||
|
|
||||||
.thumb {
|
.thumb {
|
||||||
background-color: #4d4d4d !important;
|
background-color: #4d4d4d !important;
|
||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
}
|
}
|
||||||
|
@ -1731,7 +1761,8 @@
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.left, .right {
|
.left,
|
||||||
|
.right {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
|
||||||
|
@ -1905,8 +1936,10 @@
|
||||||
>*:not(:first-of-type) {
|
>*:not(:first-of-type) {
|
||||||
margin-left: .25em;
|
margin-left: .25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-status {
|
.icon-status {
|
||||||
margin-bottom: .2em; /* push it a bit higher than the center */
|
margin-bottom: .2em;
|
||||||
|
/* push it a bit higher than the center */
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
|
@ -1934,7 +1967,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttons, .buttons-small {
|
.buttons,
|
||||||
|
.buttons-small {
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
@ -1977,7 +2011,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-right: .5em; /* for the sliders etc*/
|
padding-right: .5em;
|
||||||
|
/* for the sliders etc*/
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
|
@ -1997,6 +2032,7 @@
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-valid {
|
.container-valid {
|
||||||
.container-level {
|
.container-level {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -2042,17 +2078,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-teaforo {
|
|
||||||
.container-valid, .container-invalid {
|
|
||||||
padding: 1em;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
button {
|
|
||||||
margin-top: .5em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-highlight-dummy {
|
.container-highlight-dummy {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
|
@ -2065,9 +2090,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the highlight stuff for the newcommer modal */
|
/* the highlight stuff for the newcommer modal */
|
||||||
.container-settings-identity-profile, .container-settings-audio-microphone {
|
.container-settings-identity-profile,
|
||||||
|
.container-settings-audio-microphone {
|
||||||
$highlight-time: .5s;
|
$highlight-time: .5s;
|
||||||
$backdrop-color: rgba(0, 0, 0, .9);
|
$backdrop-color: rgba(0, 0, 0, .9);
|
||||||
|
|
||||||
.help-background {
|
.help-background {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
|
@ -2164,7 +2191,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-teamspeak, .container-teaforo, .container-nickname {
|
.container-teamspeak,
|
||||||
|
.container-nickname {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2206,6 +2234,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
|
@-moz-keyframes spin {
|
||||||
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
|
100% {
|
||||||
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
|
-moz-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes spin {
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
0
shared/generate_declarations.sh
Normal file → Executable file
0
shared/generate_declarations.sh
Normal file → Executable file
|
@ -1,9 +1,11 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>TeaSpeak-Web client templates</title>
|
<title>TeaSpeak-Web client templates</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="template-group-modals">
|
<div class="template-group-modals">
|
||||||
<script class="jsrender-template" id="tmpl_modal" type="text/html">
|
<script class="jsrender-template" id="tmpl_modal" type="text/html">
|
||||||
|
@ -103,7 +105,6 @@
|
||||||
|
|
||||||
<div class="entry group">{{tr "Identity" /}}</div>
|
<div class="entry group">{{tr "Identity" /}}</div>
|
||||||
<div class="entry" container="identity-profiles">{{tr "Profiles" /}}</div>
|
<div class="entry" container="identity-profiles">{{tr "Profiles" /}}</div>
|
||||||
<div class="entry" container="identity-forum">{{tr "TeaForo connection" /}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="container-seperator vertical" seperator-id="seperator-settings"></div>
|
<div class="container-seperator vertical" seperator-id="seperator-settings"></div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
@ -417,7 +418,6 @@
|
||||||
<select class="form-control profile-identity-type">
|
<select class="form-control profile-identity-type">
|
||||||
<option value="error" style="display: none">error: error</option>
|
<option value="error" style="display: none">error: error</option>
|
||||||
<option value="unset" style="display: none">{{tr "Unset" /}}</option>
|
<option value="unset" style="display: none">{{tr "Unset" /}}</option>
|
||||||
<option value="teaforo">{{tr "Forum Account" /}}</option>
|
|
||||||
<option value="teamspeak">{{tr "TeamSpeak Identity" /}}</option>
|
<option value="teamspeak">{{tr "TeamSpeak Identity" /}}</option>
|
||||||
<option value="nickname">{{tr "Nickname (Debug only!)" /}}</option>
|
<option value="nickname">{{tr "Nickname (Debug only!)" /}}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -453,16 +453,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container-teaforo">
|
|
||||||
<div class="container-valid">
|
|
||||||
{{tr "You're using your forum account as identification" /}}
|
|
||||||
</div>
|
|
||||||
<div class="container-invalid">
|
|
||||||
<a>{{tr "You cant use your TeaSpeak forum account. You're not connected with your forum Account!" /}}</a>
|
|
||||||
<button class="btn btn-success button-setup">{{tr "Setup your connection" /}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container-nickname">
|
<div class="container-nickname">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{tr "Nickname" /}}</label>
|
<label>{{tr "Nickname" /}}</label>
|
||||||
|
@ -1970,14 +1960,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="property property-teaforo">
|
|
||||||
<div class="title">
|
|
||||||
<a>{{tr "TeaForo Connection" /}}</a>
|
|
||||||
</div>
|
|
||||||
<div class="value">
|
|
||||||
<a>This will be a really long string...</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="property property-version">
|
<div class="property property-version">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<a>{{tr "Version" /}}</a>
|
<a>{{tr "Version" /}}</a>
|
||||||
|
@ -2170,4 +2152,5 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -89,7 +89,7 @@ export class AbstractKeyBoard implements KeyBoardBackend {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.registeredKeyHooks.remove(hook);
|
this.registeredKeyHooks.remove(hook as RegisteredKeyHook);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerListener(listener: (event: KeyEvent) => void) {
|
registerListener(listener: (event: KeyEvent) => void) {
|
||||||
|
|
|
@ -166,11 +166,6 @@ export class SelectedClientInfo {
|
||||||
};
|
};
|
||||||
this.events.fire("notify_cache_changed", { category: "version" });
|
this.events.fire("notify_cache_changed", { category: "version" });
|
||||||
}
|
}
|
||||||
|
|
||||||
if('client_teaforo_flags' in event.updated_properties || 'client_teaforo_name' in event.updated_properties || 'client_teaforo_id' in event.updated_properties) {
|
|
||||||
this.updateForumAccount(client);
|
|
||||||
this.events.fire("notify_cache_changed", { category: "forum-account" });
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
events.push(client.events.on("notify_audio_level_changed", () => {
|
events.push(client.events.on("notify_audio_level_changed", () => {
|
||||||
|
@ -209,17 +204,6 @@ export class SelectedClientInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateForumAccount(client: ClientEntry) {
|
|
||||||
if(client.properties.client_teaforo_id) {
|
|
||||||
this.currentClientStatus.forumAccount = {
|
|
||||||
flags: client.properties.client_teaforo_flags,
|
|
||||||
nickname: client.properties.client_teaforo_name,
|
|
||||||
userId: client.properties.client_teaforo_id
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
this.currentClientStatus.forumAccount = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private updateChannelGroup(client: ClientEntry) {
|
private updateChannelGroup(client: ClientEntry) {
|
||||||
this.currentClientStatus.channelGroup = client.properties.client_channel_group_id;
|
this.currentClientStatus.channelGroup = client.properties.client_channel_group_id;
|
||||||
|
@ -259,6 +243,5 @@ export class SelectedClientInfo {
|
||||||
this.updateCachedClientStatus(client);
|
this.updateCachedClientStatus(client);
|
||||||
this.updateCachedCountry(client);
|
this.updateCachedCountry(client);
|
||||||
this.updateCachedVolume(client);
|
this.updateCachedVolume(client);
|
||||||
this.updateForumAccount(client);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@ import {getAudioBackend} from "tc-shared/audio/Player";
|
||||||
const kSdpCompressionMode = 1;
|
const kSdpCompressionMode = 1;
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface RTCIceCandidate {
|
// interface RTCIceCandidate {
|
||||||
/* Firefox has this */
|
// /* Firefox has this */
|
||||||
address: string | undefined;
|
// address: string;
|
||||||
}
|
// }
|
||||||
|
|
||||||
interface HTMLCanvasElement {
|
interface HTMLCanvasElement {
|
||||||
captureStream(framed: number): MediaStream;
|
captureStream(framed: number): MediaStream;
|
||||||
|
@ -583,7 +583,6 @@ export class RTCConnection {
|
||||||
this.peer.onicegatheringstatechange = undefined;
|
this.peer.onicegatheringstatechange = undefined;
|
||||||
this.peer.onnegotiationneeded = undefined;
|
this.peer.onnegotiationneeded = undefined;
|
||||||
this.peer.onsignalingstatechange = undefined;
|
this.peer.onsignalingstatechange = undefined;
|
||||||
this.peer.onstatsended = undefined;
|
|
||||||
this.peer.ontrack = undefined;
|
this.peer.ontrack = undefined;
|
||||||
|
|
||||||
this.peer.close();
|
this.peer.close();
|
||||||
|
@ -896,7 +895,7 @@ export class RTCConnection {
|
||||||
this.peer = new RTCPeerConnection({
|
this.peer = new RTCPeerConnection({
|
||||||
bundlePolicy: "max-bundle",
|
bundlePolicy: "max-bundle",
|
||||||
rtcpMuxPolicy: "require",
|
rtcpMuxPolicy: "require",
|
||||||
iceServers: [{ urls: ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"] }]
|
iceServers: [{ urls: ["stun:turn.lp.kle.li:3478", "stuns:turn.kle.li:5349"] }]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.audioSupport) {
|
if (this.audioSupport) {
|
||||||
|
@ -928,7 +927,7 @@ export class RTCConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.peer.onicecandidate = event => this.handleLocalIceCandidate(event.candidate);
|
this.peer.onicecandidate = event => this.handleLocalIceCandidate(event.candidate);
|
||||||
this.peer.onicecandidateerror = event => this.handleIceCandidateError(event);
|
this.peer.onicecandidateerror = event => this.handleIceCandidateError(event as RTCPeerConnectionIceErrorEvent);
|
||||||
this.peer.oniceconnectionstatechange = () => this.handleIceConnectionStateChanged();
|
this.peer.oniceconnectionstatechange = () => this.handleIceConnectionStateChanged();
|
||||||
this.peer.onicegatheringstatechange = () => this.handleIceGatheringStateChanged();
|
this.peer.onicegatheringstatechange = () => this.handleIceGatheringStateChanged();
|
||||||
|
|
||||||
|
@ -1130,10 +1129,10 @@ export class RTCConnection {
|
||||||
private handleIceCandidateError(event: RTCPeerConnectionIceErrorEvent) {
|
private handleIceCandidateError(event: RTCPeerConnectionIceErrorEvent) {
|
||||||
if (this.peer.iceGatheringState === "gathering") {
|
if (this.peer.iceGatheringState === "gathering") {
|
||||||
logWarn(LogCategory.WEBRTC, tr("Received error while gathering the ice candidates: %d/%s for %s (url: %s)"),
|
logWarn(LogCategory.WEBRTC, tr("Received error while gathering the ice candidates: %d/%s for %s (url: %s)"),
|
||||||
event.errorCode, event.errorText, event.hostCandidate, event.url);
|
event.errorCode, event.errorText, event.address, event.url);
|
||||||
} else {
|
} else {
|
||||||
logTrace(LogCategory.WEBRTC, tr("Ice candidate %s (%s) errored: %d/%s"),
|
logTrace(LogCategory.WEBRTC, tr("Ice candidate %s (%s) errored: %d/%s"),
|
||||||
event.url, event.hostCandidate, event.errorCode, event.errorText);
|
event.url, event.address, event.errorCode, event.errorText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private handleIceConnectionStateChanged() {
|
private handleIceConnectionStateChanged() {
|
||||||
|
|
|
@ -107,7 +107,6 @@ export class RemoteRTPVideoTrack extends RemoteRTPTrack {
|
||||||
track.onended = () => logTrace(LogCategory.VIDEO, "Track %d ended", ssrc);
|
track.onended = () => logTrace(LogCategory.VIDEO, "Track %d ended", ssrc);
|
||||||
track.onmute = () => logTrace(LogCategory.VIDEO, "Track %d muted", ssrc);
|
track.onmute = () => logTrace(LogCategory.VIDEO, "Track %d muted", ssrc);
|
||||||
track.onunmute = () => logTrace(LogCategory.VIDEO, "Track %d unmuted", ssrc);
|
track.onunmute = () => logTrace(LogCategory.VIDEO, "Track %d unmuted", ssrc);
|
||||||
track.onisolationchange = () => logTrace(LogCategory.VIDEO, "Track %d isolation changed", ssrc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getMediaStream(): MediaStream {
|
getMediaStream(): MediaStream {
|
||||||
|
|
|
@ -173,7 +173,7 @@ export class OwnAvatarStorage {
|
||||||
const hasher = crypto.algo.MD5.create();
|
const hasher = crypto.algo.MD5.create();
|
||||||
await target.stream().pipeTo(new WritableStream({
|
await target.stream().pipeTo(new WritableStream({
|
||||||
write(data) {
|
write(data) {
|
||||||
hasher.update(crypto.lib.WordArray.create(data));
|
hasher.update(crypto.lib.WordArray.create(Array.from(data)));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import * as loader from "tc-loader";
|
import * as loader from "tc-loader";
|
||||||
import { initializeI18N, tra } from "./i18n/localize";
|
import { initializeI18N, tra } from "./i18n/localize";
|
||||||
import * as fidentity from "./profiles/identities/TeaForumIdentity";
|
|
||||||
import * as global_ev_handler from "./events/ClientGlobalControlHandler";
|
import * as global_ev_handler from "./events/ClientGlobalControlHandler";
|
||||||
import { AppParameters, settings, Settings, UrlParameterBuilder, UrlParameterParser } from "tc-shared/settings";
|
import { AppParameters, settings, Settings, UrlParameterBuilder, UrlParameterParser } from "tc-shared/settings";
|
||||||
import { LogCategory, logDebug, logError, logInfo, logWarn } from "tc-shared/log";
|
import { LogCategory, logDebug, logError, logInfo, logWarn } from "tc-shared/log";
|
||||||
|
@ -387,8 +386,6 @@ function main() {
|
||||||
server_connections.setActiveConnectionHandler(initialHandler);
|
server_connections.setActiveConnectionHandler(initialHandler);
|
||||||
initialHandler.acquireInputHardware().then(() => { });
|
initialHandler.acquireInputHardware().then(() => { });
|
||||||
|
|
||||||
/** Setup the XF forum identity **/
|
|
||||||
fidentity.update_forum();
|
|
||||||
initializeKeyControl();
|
initializeKeyControl();
|
||||||
|
|
||||||
checkForUpdatedApp();
|
checkForUpdatedApp();
|
||||||
|
|
|
@ -82,8 +82,8 @@ export async function requestMediaStream(deviceId: string | undefined, groupId:
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function queryMediaPermissions(type: MediaStreamType, changeListener?: (value: PermissionState) => void): Promise<PermissionState> {
|
export async function queryMediaPermissions(type: MediaStreamType, changeListener?: (value: PermissionState) => void): Promise<PermissionState> {
|
||||||
if('permissions' in navigator && 'query' in navigator.permissions) {
|
|
||||||
try {
|
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" });
|
const result = await navigator.permissions.query({ name: type === "audio" ? "microphone" : "camera" });
|
||||||
if (changeListener) {
|
if (changeListener) {
|
||||||
result.addEventListener("change", () => {
|
result.addEventListener("change", () => {
|
||||||
|
@ -92,8 +92,11 @@ export async function queryMediaPermissions(type: MediaStreamType, changeListene
|
||||||
}
|
}
|
||||||
return result.state;
|
return result.state;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logWarn(LogCategory.GENERAL, tr("Failed to query for %s permissions: %s"), type, 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";
|
return "prompt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { decode_identity, IdentitifyType, Identity } from "../profiles/Identity";
|
import { decode_identity, IdentitifyType, Identity } from "../profiles/Identity";
|
||||||
import { guid } from "../crypto/uid";
|
import { guid } from "../crypto/uid";
|
||||||
import {TeaForumIdentity} from "../profiles/identities/TeaForumIdentity";
|
|
||||||
import { TeaSpeakIdentity } from "../profiles/identities/TeamSpeakIdentity";
|
import { TeaSpeakIdentity } from "../profiles/identities/TeamSpeakIdentity";
|
||||||
import { AbstractServerConnection } from "../connection/ConnectionBase";
|
import { AbstractServerConnection } from "../connection/ConnectionBase";
|
||||||
import { HandshakeIdentityHandler } from "../connection/HandshakeHandler";
|
import { HandshakeIdentityHandler } from "../connection/HandshakeHandler";
|
||||||
|
@ -52,9 +51,7 @@ export class ConnectionProfile {
|
||||||
if (current_type === undefined)
|
if (current_type === undefined)
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
if (current_type == IdentitifyType.TEAFORO) {
|
if (current_type == IdentitifyType.TEAMSPEAK || current_type == IdentitifyType.NICKNAME) {
|
||||||
return TeaForumIdentity.identity();
|
|
||||||
} else if (current_type == IdentitifyType.TEAMSPEAK || current_type == IdentitifyType.NICKNAME) {
|
|
||||||
return this.identities[IdentitifyType[current_type].toLowerCase()];
|
return this.identities[IdentitifyType[current_type].toLowerCase()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +167,7 @@ async function loadConnectProfiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultProfile = findConnectProfile("default");
|
const defaultProfile = findConnectProfile("default");
|
||||||
if (!defaultProfile) { //Create a default profile and teaforo profile
|
if (!defaultProfile) { //Create a default profile
|
||||||
{
|
{
|
||||||
const profile = createConnectProfile(tr("Default Profile"), "default");
|
const profile = createConnectProfile(tr("Default Profile"), "default");
|
||||||
profile.defaultPassword = "";
|
profile.defaultPassword = "";
|
||||||
|
@ -194,15 +191,6 @@ async function loadConnectProfiles() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ /* forum identity (works only when connected to the forum) */
|
|
||||||
const profile = createConnectProfile(tr("TeaSpeak Forum Profile"), "teaforo");
|
|
||||||
profile.defaultPassword = "";
|
|
||||||
profile.defaultUsername = "";
|
|
||||||
|
|
||||||
profile.setIdentity(IdentitifyType.TEAFORO, TeaForumIdentity.identity());
|
|
||||||
profile.selectedIdentityType = IdentitifyType[IdentitifyType.TEAFORO];
|
|
||||||
}
|
|
||||||
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||||
import { tr } from "tc-shared/i18n/localize";
|
import { tr } from "tc-shared/i18n/localize";
|
||||||
|
|
||||||
export enum IdentitifyType {
|
export enum IdentitifyType {
|
||||||
TEAFORO,
|
|
||||||
TEAMSPEAK,
|
TEAMSPEAK,
|
||||||
NICKNAME
|
NICKNAME
|
||||||
}
|
}
|
||||||
|
@ -31,10 +30,6 @@ export async function decode_identity(type: IdentitifyType, data: string) : Prom
|
||||||
const nidentity = require("tc-shared/profiles/identities/NameIdentity");
|
const nidentity = require("tc-shared/profiles/identities/NameIdentity");
|
||||||
identity = new nidentity.NameIdentity();
|
identity = new nidentity.NameIdentity();
|
||||||
break;
|
break;
|
||||||
case IdentitifyType.TEAFORO:
|
|
||||||
const fidentity = require("tc-shared/profiles/identities/TeaForumIdentity");
|
|
||||||
identity = new fidentity.TeaForumIdentity(undefined);
|
|
||||||
break;
|
|
||||||
case IdentitifyType.TEAMSPEAK:
|
case IdentitifyType.TEAMSPEAK:
|
||||||
const tidentity = require("tc-shared/profiles/identities/TeamSpeakIdentity");
|
const tidentity = require("tc-shared/profiles/identities/TeamSpeakIdentity");
|
||||||
identity = new tidentity.TeaSpeakIdentity(undefined, undefined);
|
identity = new tidentity.TeaSpeakIdentity(undefined, undefined);
|
||||||
|
@ -60,10 +55,6 @@ export function create_identity(type: IdentitifyType) {
|
||||||
const nidentity = require("tc-shared/profiles/identities/NameIdentity");
|
const nidentity = require("tc-shared/profiles/identities/NameIdentity");
|
||||||
identity = new nidentity.NameIdentity();
|
identity = new nidentity.NameIdentity();
|
||||||
break;
|
break;
|
||||||
case IdentitifyType.TEAFORO:
|
|
||||||
const fidentity = require("tc-shared/profiles/identities/TeaForumIdentity");
|
|
||||||
identity = new fidentity.TeaForumIdentity(undefined);
|
|
||||||
break;
|
|
||||||
case IdentitifyType.TEAMSPEAK:
|
case IdentitifyType.TEAMSPEAK:
|
||||||
const tidentity = require("tc-shared/profiles/identities/TeamSpeakIdentity");
|
const tidentity = require("tc-shared/profiles/identities/TeamSpeakIdentity");
|
||||||
identity = new tidentity.TeaSpeakIdentity(undefined, undefined);
|
identity = new tidentity.TeaSpeakIdentity(undefined, undefined);
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
import {
|
|
||||||
AbstractHandshakeIdentityHandler,
|
|
||||||
HandshakeCommandHandler,
|
|
||||||
IdentitifyType,
|
|
||||||
Identity
|
|
||||||
} from "../../profiles/Identity";
|
|
||||||
import {LogCategory, logError} from "../../log";
|
|
||||||
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
|
|
||||||
import {AbstractServerConnection} from "../../connection/ConnectionBase";
|
|
||||||
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
|
|
||||||
import * as forum from "./teaspeak-forum";
|
|
||||||
import { tr } from "tc-shared/i18n/localize";
|
|
||||||
|
|
||||||
class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|
||||||
readonly identity: TeaForumIdentity;
|
|
||||||
handler: HandshakeCommandHandler<TeaForumHandshakeHandler>;
|
|
||||||
|
|
||||||
constructor(connection: AbstractServerConnection, identity: TeaForumIdentity) {
|
|
||||||
super(connection);
|
|
||||||
this.identity = identity;
|
|
||||||
this.handler = new HandshakeCommandHandler(connection, this);
|
|
||||||
this.handler["handshakeidentityproof"] = this.handle_proof.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
executeHandshake() {
|
|
||||||
this.connection.getCommandHandler().registerHandler(this.handler);
|
|
||||||
this.connection.send_command("handshakebegin", {
|
|
||||||
intention: 0,
|
|
||||||
authentication_method: this.identity.type(),
|
|
||||||
data: this.identity.data().data_json()
|
|
||||||
}).catch(error => {
|
|
||||||
logError(LogCategory.IDENTITIES, tr("Failed to initialize TeaForum based handshake. Error: %o"), error);
|
|
||||||
|
|
||||||
if(error instanceof CommandResult)
|
|
||||||
error = error.extra_message || error.message;
|
|
||||||
this.trigger_fail("failed to execute begin (" + error + ")");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private handle_proof(json) {
|
|
||||||
this.connection.send_command("handshakeindentityproof", {
|
|
||||||
proof: this.identity.data().data_sign()
|
|
||||||
}).catch(error => {
|
|
||||||
logError(LogCategory.IDENTITIES, tr("Failed to proof the identity. Error: %o"), error);
|
|
||||||
|
|
||||||
if(error instanceof CommandResult)
|
|
||||||
error = error.extra_message || error.message;
|
|
||||||
this.trigger_fail("failed to execute proof (" + error + ")");
|
|
||||||
}).then(() => this.trigger_success());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected trigger_fail(message: string) {
|
|
||||||
this.connection.getCommandHandler().unregisterHandler(this.handler);
|
|
||||||
super.trigger_fail(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected trigger_success() {
|
|
||||||
this.connection.getCommandHandler().unregisterHandler(this.handler);
|
|
||||||
super.trigger_success();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TeaForumIdentity implements Identity {
|
|
||||||
private readonly identity_data: forum.Data;
|
|
||||||
|
|
||||||
valid() : boolean {
|
|
||||||
return !!this.identity_data && !this.identity_data.is_expired();
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(data: forum.Data) {
|
|
||||||
this.identity_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return this.identity_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
decode(data) : Promise<void> {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if(data.version !== 1)
|
|
||||||
throw "invalid version";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
encode() : string {
|
|
||||||
return JSON.stringify({
|
|
||||||
version: 1
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
spawn_identity_handshake_handler(connection: AbstractServerConnection) : HandshakeIdentityHandler {
|
|
||||||
return new TeaForumHandshakeHandler(connection, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
fallback_name(): string | undefined {
|
|
||||||
return this.identity_data ? this.identity_data.name() : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
type(): IdentitifyType {
|
|
||||||
return IdentitifyType.TEAFORO;
|
|
||||||
}
|
|
||||||
|
|
||||||
uid(): string {
|
|
||||||
//FIXME: Real UID!
|
|
||||||
return "TeaForo#" + ((this.identity_data ? this.identity_data.name() : "Another TeaSpeak user"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static identity() {
|
|
||||||
return static_identity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let static_identity: TeaForumIdentity;
|
|
||||||
|
|
||||||
export function set_static_identity(identity: TeaForumIdentity) {
|
|
||||||
static_identity = identity;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function update_forum() {
|
|
||||||
if(forum.logged_in() && (!static_identity || static_identity.data() !== forum.data())) {
|
|
||||||
static_identity = new TeaForumIdentity(forum.data());
|
|
||||||
} else {
|
|
||||||
static_identity = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function valid_static_forum_identity() : boolean {
|
|
||||||
return static_identity && static_identity.valid();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function static_forum_identity() : TeaForumIdentity | undefined {
|
|
||||||
return static_identity;
|
|
||||||
}
|
|
|
@ -1,399 +0,0 @@
|
||||||
import {settings, Settings} from "../../settings";
|
|
||||||
import * as loader from "tc-loader";
|
|
||||||
import * as fidentity from "./TeaForumIdentity";
|
|
||||||
import {LogCategory, logDebug, logError, logInfo, logWarn} from "../../log";
|
|
||||||
import {tr} from "tc-shared/i18n/localize";
|
|
||||||
import {getStorageAdapter} from "tc-shared/StorageAdapter";
|
|
||||||
|
|
||||||
/* TODO: Properly redesign this whole system! */
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
grecaptcha: GReCaptcha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GReCaptcha {
|
|
||||||
render(container: string | HTMLElement, parameters: {
|
|
||||||
sitekey: string;
|
|
||||||
theme?: "dark" | "light";
|
|
||||||
size?: "compact" | "normal";
|
|
||||||
|
|
||||||
tabindex?: number;
|
|
||||||
|
|
||||||
callback?: (token: string) => any;
|
|
||||||
"expired-callback"?: () => any;
|
|
||||||
"error-callback"?: (error: any) => any;
|
|
||||||
}) : string; /* widget_id */
|
|
||||||
|
|
||||||
reset(widget_id?: string);
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace gcaptcha {
|
|
||||||
export async function initialize() {
|
|
||||||
if(typeof(window.grecaptcha) === "undefined") {
|
|
||||||
let script = document.createElement("script");
|
|
||||||
script.async = true;
|
|
||||||
|
|
||||||
let timeout;
|
|
||||||
const callback_name = "captcha_callback_" + Math.random().toString().replace(".", "");
|
|
||||||
try {
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
script.onerror = reject;
|
|
||||||
window[callback_name] = resolve;
|
|
||||||
script.src = "https://www.google.com/recaptcha/api.js?onload=" + encodeURIComponent(callback_name) + "&render=explicit";
|
|
||||||
|
|
||||||
document.body.append(script);
|
|
||||||
timeout = setTimeout(() => reject("timeout"), 15000);
|
|
||||||
});
|
|
||||||
} catch(error) {
|
|
||||||
script.remove();
|
|
||||||
script = undefined;
|
|
||||||
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to fetch recaptcha javascript source: %o"), error);
|
|
||||||
throw tr("failed to download source");
|
|
||||||
} finally {
|
|
||||||
if(script)
|
|
||||||
script.onerror = undefined;
|
|
||||||
delete window[callback_name];
|
|
||||||
timeout && clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof(window.grecaptcha) === "undefined") {
|
|
||||||
throw tr("failed to load recaptcha");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function spawn(container: JQuery, key: string, callback_data: (token: string) => any) {
|
|
||||||
try {
|
|
||||||
await initialize();
|
|
||||||
} catch(error) {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to initialize G-Recaptcha. Error: %o"), error);
|
|
||||||
throw tr("initialisation failed");
|
|
||||||
}
|
|
||||||
if(container.attr("captcha-uuid"))
|
|
||||||
window.grecaptcha.reset(container.attr("captcha-uuid"));
|
|
||||||
else {
|
|
||||||
container.attr("captcha-uuid", window.grecaptcha.render(container[0], {
|
|
||||||
"sitekey": key,
|
|
||||||
callback: callback_data
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getForumApiURL() {
|
|
||||||
return settings.getValue(Settings.KEY_TEAFORO_URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Data {
|
|
||||||
readonly auth_key: string;
|
|
||||||
readonly raw: string;
|
|
||||||
readonly sign: string;
|
|
||||||
|
|
||||||
parsed: {
|
|
||||||
user_id: number;
|
|
||||||
user_name: string;
|
|
||||||
|
|
||||||
data_age: number;
|
|
||||||
|
|
||||||
user_group_id: number;
|
|
||||||
|
|
||||||
is_staff: boolean;
|
|
||||||
user_groups: number[];
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(auth: string, raw: string, sign: string) {
|
|
||||||
this.auth_key = auth;
|
|
||||||
this.raw = raw;
|
|
||||||
this.sign = sign;
|
|
||||||
|
|
||||||
this.parsed = JSON.parse(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
data_json() : string { return this.raw; }
|
|
||||||
data_sign() : string { return this.sign; }
|
|
||||||
|
|
||||||
name() : string { return this.parsed.user_name; }
|
|
||||||
|
|
||||||
user_id() { return this.parsed.user_id; }
|
|
||||||
user_group() { return this.parsed.user_group_id; }
|
|
||||||
|
|
||||||
is_stuff() : boolean { return this.parsed.is_staff; }
|
|
||||||
is_premium() : boolean { return this.parsed.user_groups.indexOf(5) != -1; }
|
|
||||||
|
|
||||||
data_age() : Date { return new Date(this.parsed.data_age); }
|
|
||||||
|
|
||||||
is_expired() : boolean { return this.parsed.data_age + 48 * 60 * 60 * 1000 < Date.now(); }
|
|
||||||
should_renew() : boolean { return this.parsed.data_age + 24 * 60 * 60 * 1000 < Date.now(); } /* renew data all 24hrs */
|
|
||||||
}
|
|
||||||
let forumData: Data | undefined;
|
|
||||||
|
|
||||||
export function logged_in() : boolean {
|
|
||||||
return !!forumData && !forumData.is_expired();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function data() : Data { return forumData; }
|
|
||||||
|
|
||||||
export interface LoginResult {
|
|
||||||
status: "success" | "captcha" | "error";
|
|
||||||
|
|
||||||
error_message?: string;
|
|
||||||
captcha?: {
|
|
||||||
type: "gre-captcha" | "unknown";
|
|
||||||
data: any; /* in case of gre-captcha it would be the side key */
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function login(username: string, password: string, captcha?: any) : Promise<LoginResult> {
|
|
||||||
let response;
|
|
||||||
try {
|
|
||||||
response = await new Promise<any>((resolve, reject) => {
|
|
||||||
$.ajax({
|
|
||||||
url: getForumApiURL() + "?web-api/v1/login",
|
|
||||||
type: "POST",
|
|
||||||
cache: false,
|
|
||||||
data: {
|
|
||||||
username: username,
|
|
||||||
password: password,
|
|
||||||
remember: true,
|
|
||||||
"g-recaptcha-response": captcha
|
|
||||||
},
|
|
||||||
|
|
||||||
crossDomain: true,
|
|
||||||
|
|
||||||
success: resolve,
|
|
||||||
error: (xhr, status, error) => {
|
|
||||||
logDebug(LogCategory.GENERAL, tr("Login request failed %o: %o"), status, error);
|
|
||||||
reject(tr("request failed"));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
} catch(error) {
|
|
||||||
return {
|
|
||||||
status: "error",
|
|
||||||
error_message: tr("failed to send login request")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if(response["status"] !== "ok") {
|
|
||||||
logError(LogCategory.GENERAL, tr("Response status not okey. Error happend: %o"), response);
|
|
||||||
return {
|
|
||||||
status: "error",
|
|
||||||
error_message: (response["errors"] || [])[0] || tr("Unknown error")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!response["success"]) {
|
|
||||||
logError(LogCategory.GENERAL, tr("Login failed. Response %o"), response);
|
|
||||||
|
|
||||||
let message = tr("failed to login");
|
|
||||||
let captcha;
|
|
||||||
/* user/password wrong | and maybe captcha required */
|
|
||||||
if(response["code"] == 1 || response["code"] == 3)
|
|
||||||
message = tr("Invalid username or password");
|
|
||||||
if(response["code"] == 2 || response["code"] == 3) {
|
|
||||||
captcha = {
|
|
||||||
type: response["captcha"]["type"],
|
|
||||||
data: response["captcha"]["siteKey"] //TODO: Why so static here?
|
|
||||||
};
|
|
||||||
if(response["code"] == 2)
|
|
||||||
message = tr("captcha required");
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: typeof(captcha) !== "undefined" ? "captcha" : "error",
|
|
||||||
error_message: message,
|
|
||||||
captcha: captcha
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//document.cookie = "user_data=" + response["data"] + ";path=/";
|
|
||||||
//document.cookie = "user_sign=" + response["sign"] + ";path=/";
|
|
||||||
|
|
||||||
try {
|
|
||||||
forumData = new Data(response["auth-key"], response["data"], response["sign"]);
|
|
||||||
const adapter = getStorageAdapter();
|
|
||||||
await adapter.set("teaspeak-forum-data", response["data"]);
|
|
||||||
await adapter.set("teaspeak-forum-sign", response["sign"]);
|
|
||||||
await adapter.set("teaspeak-forum-auth", response["auth-key"]);
|
|
||||||
fidentity.update_forum();
|
|
||||||
} catch(error) {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to parse forum given data: %o"), error);
|
|
||||||
return {
|
|
||||||
status: "error",
|
|
||||||
error_message: tr("Failed to parse response data")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: "success"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async function resetForumLocalData() {
|
|
||||||
const adapter = getStorageAdapter();
|
|
||||||
await adapter.delete("teaspeak-forum-data");
|
|
||||||
await adapter.delete("teaspeak-forum-sign");
|
|
||||||
await adapter.delete("teaspeak-forum-auth");
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function renew_data() : Promise<"success" | "login-required"> {
|
|
||||||
let response;
|
|
||||||
try {
|
|
||||||
response = await new Promise<any>((resolve, reject) => {
|
|
||||||
$.ajax({
|
|
||||||
url: getForumApiURL() + "?web-api/v1/renew-data",
|
|
||||||
type: "GET",
|
|
||||||
cache: false,
|
|
||||||
|
|
||||||
crossDomain: true,
|
|
||||||
|
|
||||||
data: {
|
|
||||||
"auth-key": forumData.auth_key
|
|
||||||
},
|
|
||||||
|
|
||||||
success: resolve,
|
|
||||||
error: (xhr, status, error) => {
|
|
||||||
logError(LogCategory.GENERAL, tr("Renew request failed %o: %o"), status, error);
|
|
||||||
reject(tr("request failed"));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
} catch(error) {
|
|
||||||
throw tr("failed to send renew request");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(response["status"] !== "ok") {
|
|
||||||
logError(LogCategory.GENERAL, tr("Response status not okey. Error happend: %o"), response);
|
|
||||||
throw (response["errors"] || [])[0] || tr("Unknown error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!response["success"]) {
|
|
||||||
if(response["code"] == 1) {
|
|
||||||
return "login-required";
|
|
||||||
}
|
|
||||||
throw "invalid error code (" + response["code"] + ")";
|
|
||||||
}
|
|
||||||
if(!response["data"] || !response["sign"])
|
|
||||||
throw tr("response missing data");
|
|
||||||
|
|
||||||
logDebug(LogCategory.GENERAL, tr("Renew succeeded. Parsing data."));
|
|
||||||
|
|
||||||
try {
|
|
||||||
forumData = new Data(forumData.auth_key, response["data"], response["sign"]);
|
|
||||||
await getStorageAdapter().set("teaspeak-forum-data", response["data"]);
|
|
||||||
await getStorageAdapter().set("teaspeak-forum-sign", response["sign"]);
|
|
||||||
fidentity.update_forum();
|
|
||||||
} catch(error) {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to parse forum given data: %o"), error);
|
|
||||||
throw tr("failed to parse data");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function logout() : Promise<void> {
|
|
||||||
if(!logged_in()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let response;
|
|
||||||
try {
|
|
||||||
response = await new Promise<any>((resolve, reject) => {
|
|
||||||
$.ajax({
|
|
||||||
url: getForumApiURL() + "?web-api/v1/logout",
|
|
||||||
type: "GET",
|
|
||||||
cache: false,
|
|
||||||
|
|
||||||
crossDomain: true,
|
|
||||||
|
|
||||||
data: {
|
|
||||||
"auth-key": forumData.auth_key
|
|
||||||
},
|
|
||||||
|
|
||||||
success: resolve,
|
|
||||||
error: (xhr, status, error) => {
|
|
||||||
logInfo(LogCategory.GENERAL, tr("Logout request failed %o: %o"), status, error);
|
|
||||||
reject(tr("request failed"));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
} catch(error) {
|
|
||||||
throw tr("failed to send logout request");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(response["status"] !== "ok") {
|
|
||||||
logError(LogCategory.GENERAL, tr("Response status not ok. Error happened: %o"), response);
|
|
||||||
throw (response["errors"] || [])[0] || tr("Unknown error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!response["success"]) {
|
|
||||||
/* code 1 means not logged in, its an success */
|
|
||||||
if(response["code"] != 1) {
|
|
||||||
throw "invalid error code (" + response["code"] + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
forumData = undefined;
|
|
||||||
await resetForumLocalData();
|
|
||||||
fidentity.update_forum();
|
|
||||||
}
|
|
||||||
|
|
||||||
loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, {
|
|
||||||
name: "TeaForo initialize",
|
|
||||||
priority: 10,
|
|
||||||
function: async () => {
|
|
||||||
const rawData = await getStorageAdapter().get("teaspeak-forum-data");
|
|
||||||
const rawSign = await getStorageAdapter().get("teaspeak-forum-sign");
|
|
||||||
const rawForumAuth = await getStorageAdapter().get("teaspeak-forum-auth");
|
|
||||||
if(!rawData || !rawSign || !rawForumAuth) {
|
|
||||||
logInfo(LogCategory.GENERAL, tr("No TeaForo authentication found. TeaForo connection status: unconnected"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
forumData = new Data(rawForumAuth, rawData, rawSign);
|
|
||||||
} catch(error) {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to initialize TeaForo connection from local data. Error: %o"), error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(forumData.should_renew()) {
|
|
||||||
logInfo(LogCategory.GENERAL, tr("TeaForo data should be renewed. Executing renew."));
|
|
||||||
renew_data().then(async status => {
|
|
||||||
if(status === "success") {
|
|
||||||
logInfo(LogCategory.GENERAL, tr("TeaForo data has been successfully renewed."));
|
|
||||||
} else {
|
|
||||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. New login required."));
|
|
||||||
await resetForumLocalData();
|
|
||||||
}
|
|
||||||
}).catch(error => {
|
|
||||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(forumData && forumData.is_expired()) {
|
|
||||||
logError(LogCategory.GENERAL, tr("TeaForo data is expired. TeaForo connection isn't available!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
setInterval(() => {
|
|
||||||
/* if we don't have any _data object set we could not renew anything */
|
|
||||||
if(forumData) {
|
|
||||||
logInfo(LogCategory.IDENTITIES, tr("Renewing TeaForo data."));
|
|
||||||
renew_data().then(async status => {
|
|
||||||
if(status === "success") {
|
|
||||||
logInfo(LogCategory.IDENTITIES,tr("TeaForo data has been successfully renewed."));
|
|
||||||
} else {
|
|
||||||
logWarn(LogCategory.IDENTITIES,tr("Failed to renew TeaForo data. New login required."));
|
|
||||||
await resetForumLocalData();
|
|
||||||
}
|
|
||||||
}).catch(error => {
|
|
||||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 24 * 60 * 60 * 1000);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -73,9 +73,6 @@ declare global {
|
||||||
name: string,
|
name: string,
|
||||||
version: string
|
version: string
|
||||||
};
|
};
|
||||||
|
|
||||||
mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
|
||||||
webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ObjectConstructor {
|
interface ObjectConstructor {
|
||||||
|
|
|
@ -408,12 +408,12 @@ export class Settings {
|
||||||
static readonly KEY_FLAG_CONNECT_DEFAULT: ValuedRegistryKey<boolean> = {
|
static readonly KEY_FLAG_CONNECT_DEFAULT: ValuedRegistryKey<boolean> = {
|
||||||
key: "connect_default",
|
key: "connect_default",
|
||||||
valueType: "boolean",
|
valueType: "boolean",
|
||||||
defaultValue: false
|
defaultValue: true
|
||||||
};
|
};
|
||||||
static readonly KEY_CONNECT_ADDRESS: ValuedRegistryKey<string> = {
|
static readonly KEY_CONNECT_ADDRESS: ValuedRegistryKey<string> = {
|
||||||
key: "connect_address",
|
key: "connect_address",
|
||||||
valueType: "string",
|
valueType: "string",
|
||||||
defaultValue: undefined
|
defaultValue: "tea.lp.kle.li"
|
||||||
};
|
};
|
||||||
static readonly KEY_CONNECT_PROFILE: ValuedRegistryKey<string> = {
|
static readonly KEY_CONNECT_PROFILE: ValuedRegistryKey<string> = {
|
||||||
key: "connect_profile",
|
key: "connect_profile",
|
||||||
|
@ -448,7 +448,7 @@ export class Settings {
|
||||||
|
|
||||||
static readonly KEY_CONNECT_NO_DNSPROXY: ValuedRegistryKey<boolean> = {
|
static readonly KEY_CONNECT_NO_DNSPROXY: ValuedRegistryKey<boolean> = {
|
||||||
key: "connect_no_dnsproxy",
|
key: "connect_no_dnsproxy",
|
||||||
defaultValue: false,
|
defaultValue: true,
|
||||||
valueType: "boolean",
|
valueType: "boolean",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -572,12 +572,6 @@ export class Settings {
|
||||||
valueType: "boolean",
|
valueType: "boolean",
|
||||||
};
|
};
|
||||||
|
|
||||||
static readonly KEY_TEAFORO_URL: ValuedRegistryKey<string> = {
|
|
||||||
key: "teaforo_url",
|
|
||||||
defaultValue: "https://forum.teaspeak.de/",
|
|
||||||
valueType: "string",
|
|
||||||
};
|
|
||||||
|
|
||||||
static readonly KEY_FONT_SIZE: ValuedRegistryKey<number> = {
|
static readonly KEY_FONT_SIZE: ValuedRegistryKey<number> = {
|
||||||
key: "font_size",
|
key: "font_size",
|
||||||
valueType: "number",
|
valueType: "number",
|
||||||
|
|
|
@ -44,7 +44,7 @@ const useInviteLink = (linkId: string): LocalInviteInfo => {
|
||||||
|
|
||||||
const callback = () => setValue(localInviteCache[linkId].status);
|
const callback = () => setValue(localInviteCache[linkId].status);
|
||||||
(localInviteCallbacks[linkId] || (localInviteCallbacks[linkId] = [])).push(callback);
|
(localInviteCallbacks[linkId] || (localInviteCallbacks[linkId] = [])).push(callback);
|
||||||
return () => localInviteCallbacks[linkId]?.remove(callback);
|
return () => { localInviteCallbacks[linkId]?.remove(callback); }
|
||||||
}, [linkId]);
|
}, [linkId]);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -74,10 +74,6 @@ export class ClientProperties {
|
||||||
client_output_muted: boolean = false;
|
client_output_muted: boolean = false;
|
||||||
client_is_channel_commander: boolean = false;
|
client_is_channel_commander: boolean = false;
|
||||||
|
|
||||||
client_teaforo_id: number = 0;
|
|
||||||
client_teaforo_name: string = "";
|
|
||||||
client_teaforo_flags: number = 0; /* 0x01 := Banned | 0x02 := Stuff | 0x04 := Premium */
|
|
||||||
|
|
||||||
|
|
||||||
/* not updated in view! */
|
/* not updated in view! */
|
||||||
client_month_bytes_uploaded: number = 0;
|
client_month_bytes_uploaded: number = 0;
|
||||||
|
@ -928,7 +924,7 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
|
||||||
return ClientType.CLIENT_UNDEFINED;
|
return ClientType.CLIENT_UNDEFINED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(this.properties.client_type_exact) {
|
switch (this.properties.client_type_exact as ClientType) {
|
||||||
case 0:
|
case 0:
|
||||||
return ClientType.CLIENT_VOICE;
|
return ClientType.CLIENT_VOICE;
|
||||||
|
|
||||||
|
@ -943,7 +939,7 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
return ClientType.CLIENT_TEASPEAK;
|
return ClientType.CLIENT_TEASPEAK;
|
||||||
|
// @ts-ignore
|
||||||
case 2:
|
case 2:
|
||||||
/* 2 is the internal client type which should never be visible for the target user */
|
/* 2 is the internal client type which should never be visible for the target user */
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -83,9 +83,11 @@ $bot_thumbnail_height: 9em;
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include transition(opacity $button_hover_animation_time ease-in-out);
|
@include transition(opacity $button_hover_animation_time ease-in-out);
|
||||||
|
|
||||||
&:before, &:after {
|
&:before,
|
||||||
|
&:after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: .25em;
|
left: .25em;
|
||||||
content: ' ';
|
content: ' ';
|
||||||
|
@ -126,6 +128,7 @@ $bot_thumbnail_height: 9em;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #393939;
|
background-color: #393939;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include transition($button_hover_animation_time ease-in-out);
|
@include transition($button_hover_animation_time ease-in-out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +304,8 @@ $bot_thumbnail_height: 9em;
|
||||||
|
|
||||||
&.list {
|
&.list {
|
||||||
>.icon_em {
|
>.icon_em {
|
||||||
margin-top: 0; /* for lists the .1em patting on the top looks odd */
|
margin-top: 0;
|
||||||
|
/* for lists the .1em patting on the top looks odd */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,13 +315,15 @@ $bot_thumbnail_height: 9em;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
min-width: 4em; /* 2em for the icon the last 4 for the text */
|
min-width: 4em;
|
||||||
|
/* 2em for the icon the last 4 for the text */
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.title, .value {
|
.title,
|
||||||
|
.value {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -340,10 +346,12 @@ $bot_thumbnail_height: 9em;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.status, &.groups {
|
&.status,
|
||||||
|
&.groups {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.statusEntry, .groupEntry {
|
.statusEntry,
|
||||||
|
.groupEntry {
|
||||||
.icon {
|
.icon {
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
|
@ -366,12 +374,6 @@ $bot_thumbnail_height: 9em;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.clientTeaforoAccount {
|
|
||||||
a, a:visited {
|
|
||||||
color: #d9d9d9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,44 +248,6 @@ const ClientVolume = React.memo(() => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const ClientForumAccount = React.memo(() => {
|
|
||||||
const events = useContext(EventsContext);
|
|
||||||
const client = useContext(ClientContext);
|
|
||||||
const [ forum, setForum ] = useDependentState<ClientForumInfo>(() => {
|
|
||||||
if(client.type !== "none") {
|
|
||||||
events.fire("query_forum");
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}, [ client.contextHash ]);
|
|
||||||
|
|
||||||
events.reactUse("notify_forum", event => setForum(event.forum), undefined, []);
|
|
||||||
|
|
||||||
if(!forum) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = forum.nickname;
|
|
||||||
if((forum.flags & 0x01) > 0) {
|
|
||||||
text += " (" + tr("Banned") + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
if((forum.flags & 0x02) > 0) {
|
|
||||||
text += " (" + tr("Stuff") + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
if((forum.flags & 0x04) > 0) {
|
|
||||||
text += " (" + tr("Premium") + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<InfoBlock clientIcon={ClientIcon.ClientInfoForumAccount} valueClass={cssStyle.clientTeaforoAccount}>
|
|
||||||
<Translatable>TeaSpeak Forum account</Translatable>
|
|
||||||
<a href={"https://forum.teaspeak.de/index.php?members/" + forum.userId} target={"_blank"}>{text}</a>
|
|
||||||
</InfoBlock>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const ClientVersion = React.memo(() => {
|
const ClientVersion = React.memo(() => {
|
||||||
const events = useContext(EventsContext);
|
const events = useContext(EventsContext);
|
||||||
|
@ -494,7 +456,6 @@ const ConnectedClientInfoBlock = () => {
|
||||||
<React.Fragment key={"info"}>
|
<React.Fragment key={"info"}>
|
||||||
<ClientOnlineSince />
|
<ClientOnlineSince />
|
||||||
<ClientCountry />
|
<ClientCountry />
|
||||||
<ClientForumAccount />
|
|
||||||
<ClientVolume />
|
<ClientVolume />
|
||||||
<ClientVersion />
|
<ClientVersion />
|
||||||
<ClientStatus />
|
<ClientStatus />
|
||||||
|
|
|
@ -147,31 +147,6 @@ function apply_basic_info(client: ClientEntry, tag: JQuery, modal: Modal, callba
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TeaForo */
|
|
||||||
{
|
|
||||||
const container = tag.find(".property-teaforo .value").empty();
|
|
||||||
|
|
||||||
if (client.properties.client_teaforo_id) {
|
|
||||||
container.children().remove();
|
|
||||||
|
|
||||||
let text = client.properties.client_teaforo_name;
|
|
||||||
if ((client.properties.client_teaforo_flags & 0x01) > 0)
|
|
||||||
text += " (" + tr("Banned") + ")";
|
|
||||||
if ((client.properties.client_teaforo_flags & 0x02) > 0)
|
|
||||||
text += " (" + tr("Stuff") + ")";
|
|
||||||
if ((client.properties.client_teaforo_flags & 0x04) > 0)
|
|
||||||
text += " (" + tr("Premium") + ")";
|
|
||||||
|
|
||||||
$.spawn("a")
|
|
||||||
.attr("href", "https://forum.teaspeak.de/index.php?members/" + client.properties.client_teaforo_id)
|
|
||||||
.attr("target", "_blank")
|
|
||||||
.text(text)
|
|
||||||
.appendTo(container);
|
|
||||||
} else {
|
|
||||||
container.append($.spawn("a").text(tr("Not connected")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Version */
|
/* Version */
|
||||||
{
|
{
|
||||||
const container = tag.find(".property-version");
|
const container = tag.find(".property-version");
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {manager, setSoundMasterVolume, Sound} from "tc-shared/audio/Sounds";
|
||||||
import * as profiles from "tc-shared/profiles/ConnectionProfile";
|
import * as profiles from "tc-shared/profiles/ConnectionProfile";
|
||||||
import { ConnectionProfile } from "tc-shared/profiles/ConnectionProfile";
|
import { ConnectionProfile } from "tc-shared/profiles/ConnectionProfile";
|
||||||
import { IdentitifyType } from "tc-shared/profiles/Identity";
|
import { IdentitifyType } from "tc-shared/profiles/Identity";
|
||||||
import {TeaForumIdentity} from "tc-shared/profiles/identities/TeaForumIdentity";
|
|
||||||
import { TeaSpeakIdentity } from "tc-shared/profiles/identities/TeamSpeakIdentity";
|
import { TeaSpeakIdentity } from "tc-shared/profiles/identities/TeamSpeakIdentity";
|
||||||
import { NameIdentity } from "tc-shared/profiles/identities/NameIdentity";
|
import { NameIdentity } from "tc-shared/profiles/identities/NameIdentity";
|
||||||
import { LogCategory, logDebug, logError, logTrace, logWarn } from "tc-shared/log";
|
import { LogCategory, logDebug, logError, logTrace, logWarn } from "tc-shared/log";
|
||||||
|
@ -14,7 +13,6 @@ import * as i18n from "tc-shared/i18n/localize";
|
||||||
import { RepositoryTranslation, TranslationRepository } from "tc-shared/i18n/localize";
|
import { RepositoryTranslation, TranslationRepository } from "tc-shared/i18n/localize";
|
||||||
import { Registry } from "tc-shared/events";
|
import { Registry } from "tc-shared/events";
|
||||||
import * as i18nc from "../../i18n/CountryFlag";
|
import * as i18nc from "../../i18n/CountryFlag";
|
||||||
import * as forum from "tc-shared/profiles/identities/teaspeak-forum";
|
|
||||||
import { formatMessage, set_icon_size } from "tc-shared/ui/frames/chat";
|
import { formatMessage, set_icon_size } from "tc-shared/ui/frames/chat";
|
||||||
import { spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove } from "tc-shared/ui/modal/ModalIdentity";
|
import { spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove } from "tc-shared/ui/modal/ModalIdentity";
|
||||||
import { getAudioBackend, OutputDevice } from "tc-shared/audio/Player";
|
import { getAudioBackend, OutputDevice } from "tc-shared/audio/Player";
|
||||||
|
@ -32,7 +30,7 @@ type ProfileInfoEvent = {
|
||||||
id: string,
|
id: string,
|
||||||
name: string,
|
name: string,
|
||||||
nickname: string,
|
nickname: string,
|
||||||
identity_type: "teaforo" | "teamspeak" | "nickname",
|
identity_type: "teamspeak" | "nickname",
|
||||||
|
|
||||||
identity_forum?: {
|
identity_forum?: {
|
||||||
valid: boolean,
|
valid: boolean,
|
||||||
|
@ -71,7 +69,7 @@ export interface SettingProfileEvents {
|
||||||
|
|
||||||
"select-identity-type": {
|
"select-identity-type": {
|
||||||
profile_id: string,
|
profile_id: string,
|
||||||
identity_type: "teamspeak" | "teaforo" | "nickname" | "unset"
|
identity_type: "teamspeak" | "nickname" | "unset"
|
||||||
},
|
},
|
||||||
|
|
||||||
"query-profile-validity": { profile_id: string },
|
"query-profile-validity": { profile_id: string },
|
||||||
|
@ -232,7 +230,6 @@ export function spawnSettingsModal(default_page?: string): Modal {
|
||||||
settings_audio_speaker(modal.htmlTag.find(".right .container.audio-speaker"), modal);
|
settings_audio_speaker(modal.htmlTag.find(".right .container.audio-speaker"), modal);
|
||||||
settings_audio_sounds(modal.htmlTag.find(".right .container.audio-sounds"), modal);
|
settings_audio_sounds(modal.htmlTag.find(".right .container.audio-sounds"), modal);
|
||||||
const update_profiles = settings_identity_profiles(modal.htmlTag.find(".right .container.identity-profiles"), modal);
|
const update_profiles = settings_identity_profiles(modal.htmlTag.find(".right .container.identity-profiles"), modal);
|
||||||
settings_identity_forum(modal.htmlTag.find(".right .container.identity-forum"), modal, update_profiles as any);
|
|
||||||
|
|
||||||
modal.close_listener.push(() => {
|
modal.close_listener.push(() => {
|
||||||
if (profiles.requires_save())
|
if (profiles.requires_save())
|
||||||
|
@ -880,7 +877,6 @@ export namespace modal_settings {
|
||||||
});
|
});
|
||||||
|
|
||||||
const build_profile_info = (profile: ConnectionProfile) => {
|
const build_profile_info = (profile: ConnectionProfile) => {
|
||||||
const forum_data = profile.selectedIdentity(IdentitifyType.TEAFORO) as TeaForumIdentity;
|
|
||||||
const teamspeak_data = profile.selectedIdentity(IdentitifyType.TEAMSPEAK) as TeaSpeakIdentity;
|
const teamspeak_data = profile.selectedIdentity(IdentitifyType.TEAMSPEAK) as TeaSpeakIdentity;
|
||||||
const nickname_data = profile.selectedIdentity(IdentitifyType.NICKNAME) as NameIdentity;
|
const nickname_data = profile.selectedIdentity(IdentitifyType.NICKNAME) as NameIdentity;
|
||||||
|
|
||||||
|
@ -889,10 +885,6 @@ export namespace modal_settings {
|
||||||
name: profile.profileName,
|
name: profile.profileName,
|
||||||
nickname: profile.defaultUsername,
|
nickname: profile.defaultUsername,
|
||||||
identity_type: profile.selectedIdentityType as any,
|
identity_type: profile.selectedIdentityType as any,
|
||||||
identity_forum: !forum_data ? undefined : {
|
|
||||||
valid: forum_data.valid(),
|
|
||||||
fallback_name: forum_data.fallback_name()
|
|
||||||
},
|
|
||||||
identity_nickname: !nickname_data ? undefined : {
|
identity_nickname: !nickname_data ? undefined : {
|
||||||
name: nickname_data.name(),
|
name: nickname_data.name(),
|
||||||
fallback_name: nickname_data.fallback_name()
|
fallback_name: nickname_data.fallback_name()
|
||||||
|
@ -1465,7 +1457,6 @@ export namespace modal_settings {
|
||||||
if (event.status === "success") {
|
if (event.status === "success") {
|
||||||
current_identity_type = event.info.identity_type;
|
current_identity_type = event.info.identity_type;
|
||||||
fallback_names["nickname"] = event.info.identity_nickname ? event.info.identity_nickname.fallback_name : undefined;
|
fallback_names["nickname"] = event.info.identity_nickname ? event.info.identity_nickname.fallback_name : undefined;
|
||||||
fallback_names["teaforo"] = event.info.identity_forum ? event.info.identity_forum.fallback_name : undefined;
|
|
||||||
fallback_names["teamspeak"] = event.info.identity_teamspeak ? event.info.identity_teamspeak.fallback_name : undefined;
|
fallback_names["teamspeak"] = event.info.identity_teamspeak ? event.info.identity_teamspeak.fallback_name : undefined;
|
||||||
|
|
||||||
last_name = event.info.nickname;
|
last_name = event.info.nickname;
|
||||||
|
@ -1722,37 +1713,6 @@ export namespace modal_settings {
|
||||||
button_improve.on('click', event => event_registry.fire("improve-identity-teamspeak-level", { profile_id: current_profile }));
|
button_improve.on('click', event => event_registry.fire("improve-identity-teamspeak-level", { profile_id: current_profile }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special info TeaSpeak - Forum */
|
|
||||||
{
|
|
||||||
const container_settings = container.find(".container-teaforo");
|
|
||||||
const container_valid = container_settings.find(".container-valid");
|
|
||||||
const container_invalid = container_settings.find(".container-invalid");
|
|
||||||
|
|
||||||
const button_setup = container_settings.find(".button-setup");
|
|
||||||
|
|
||||||
event_registry.on("select-identity-type", event => {
|
|
||||||
if (event.profile_id !== current_profile) return;
|
|
||||||
|
|
||||||
container_settings.toggle(event.identity_type === "teaforo");
|
|
||||||
});
|
|
||||||
|
|
||||||
event_registry.on("query-profile", event => {
|
|
||||||
container_valid.toggle(false);
|
|
||||||
container_invalid.toggle(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
event_registry.on("query-profile-result", event => {
|
|
||||||
if (event.profile_id !== current_profile) return;
|
|
||||||
|
|
||||||
const valid = event.status === "success" && event.info.identity_forum && event.info.identity_forum.valid;
|
|
||||||
container_valid.toggle(!!valid);
|
|
||||||
container_invalid.toggle(!valid);
|
|
||||||
});
|
|
||||||
|
|
||||||
button_setup.on('click', event => event_registry.fire_react("setup-forum-connection"));
|
|
||||||
button_setup.toggle(settings.forum_setuppable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* special info nickname */
|
/* special info nickname */
|
||||||
{
|
{
|
||||||
const container_settings = container.find(".container-nickname");
|
const container_settings = container.find(".container-nickname");
|
||||||
|
@ -1927,117 +1887,3 @@ export namespace modal_settings {
|
||||||
event_registry.fire("select-identity-type", { profile_id: "default", identity_type: undefined });
|
event_registry.fire("select-identity-type", { profile_id: "default", identity_type: undefined });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function settings_identity_forum(container: JQuery, modal: Modal, update_profiles: () => any) {
|
|
||||||
const containers_connected = container.find(".show-connected");
|
|
||||||
const containers_disconnected = container.find(".show-disconnected");
|
|
||||||
|
|
||||||
const update_state = () => {
|
|
||||||
const logged_in = forum.logged_in();
|
|
||||||
containers_connected.toggle(logged_in);
|
|
||||||
containers_disconnected.toggle(!logged_in);
|
|
||||||
|
|
||||||
if (logged_in) {
|
|
||||||
container.find(".forum-username").text(forum.data().name());
|
|
||||||
container.find(".forum-premium").text(forum.data().is_premium() ? tr("Yes") : tr("No"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* login */
|
|
||||||
{
|
|
||||||
const button_login = container.find(".button-login");
|
|
||||||
const input_username = container.find(".input-username");
|
|
||||||
const input_password = container.find(".input-password");
|
|
||||||
const container_error = container.find(".container-login .container-error");
|
|
||||||
|
|
||||||
const container_captcha_g = container.find(".g-recaptcha");
|
|
||||||
let captcha: boolean | string = false;
|
|
||||||
|
|
||||||
const update_button_state = () => {
|
|
||||||
let enabled = true;
|
|
||||||
enabled = enabled && !!input_password.val();
|
|
||||||
enabled = enabled && !!input_username.val();
|
|
||||||
enabled = enabled && (typeof (captcha) === "boolean" ? !captcha : !!captcha);
|
|
||||||
button_login.prop("disabled", !enabled);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* username */
|
|
||||||
input_username.on('change keyup', update_button_state);
|
|
||||||
|
|
||||||
/* password */
|
|
||||||
input_password.on('change keyup', update_button_state);
|
|
||||||
|
|
||||||
button_login.on('click', event => {
|
|
||||||
input_username.prop("disabled", true);
|
|
||||||
input_password.prop("disabled", true);
|
|
||||||
button_login.prop("disabled", true);
|
|
||||||
container_error.removeClass("shown");
|
|
||||||
|
|
||||||
forum.login(input_username.val() as string, input_password.val() as string, typeof (captcha) === "string" ? captcha : undefined).then(state => {
|
|
||||||
captcha = false;
|
|
||||||
|
|
||||||
logTrace(LogCategory.GENERAL, tr("Forum login result: %o"), state);
|
|
||||||
if (state.status === "success") {
|
|
||||||
update_state();
|
|
||||||
update_profiles();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
if (!!state.error_message) /* clear password if we have an error */
|
|
||||||
input_password.val("");
|
|
||||||
input_password.focus();
|
|
||||||
update_button_state();
|
|
||||||
}, 0);
|
|
||||||
if (state.status === "captcha") {
|
|
||||||
//TODO Works currently only with localhost!
|
|
||||||
button_login.hide();
|
|
||||||
container_error.text(state.error_message || tr("Captcha required")).addClass("shown");
|
|
||||||
|
|
||||||
captcha = "";
|
|
||||||
|
|
||||||
logDebug(LogCategory.GENERAL, tr("Showing captcha for site-key: %o"), state.captcha.data);
|
|
||||||
forum.gcaptcha.spawn(container_captcha_g, state.captcha.data, token => {
|
|
||||||
captcha = token;
|
|
||||||
logTrace(LogCategory.GENERAL, tr("Got captcha token: %o"), token);
|
|
||||||
container_captcha_g.hide();
|
|
||||||
button_login.show();
|
|
||||||
update_button_state();
|
|
||||||
}).catch(error => {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to initialize forum captcha: %o"), error);
|
|
||||||
container_error.text("Failed to initialize GReCaptcha! No authentication possible.").addClass("shown");
|
|
||||||
container_captcha_g.hide();
|
|
||||||
button_login.hide();
|
|
||||||
});
|
|
||||||
container_captcha_g.show();
|
|
||||||
} else {
|
|
||||||
container_error.text(state.error_message || tr("Unknown error")).addClass("shown");
|
|
||||||
}
|
|
||||||
}).catch(error => {
|
|
||||||
logError(LogCategory.GENERAL, tr("Failed to login within the forum. Error: %o"), error);
|
|
||||||
createErrorModal(tr("Forum login failed."), tr("Forum login failed. Lookup the console for more information")).open();
|
|
||||||
}).then(() => {
|
|
||||||
input_username.prop("disabled", false);
|
|
||||||
input_password.prop("disabled", false);
|
|
||||||
update_button_state();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
update_button_state();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* logout */
|
|
||||||
{
|
|
||||||
container.find(".button-logout").on('click', event => {
|
|
||||||
forum.logout().catch(error => {
|
|
||||||
logError(LogCategory.IDENTITIES, tr("Failed to logout from forum: %o"), error);
|
|
||||||
createErrorModal(tr("Forum logout failed"), formatMessage(tr("Failed to logout from forum account.{:br:}Error: {}"), error)).open();
|
|
||||||
}).then(() => {
|
|
||||||
if (modal.shown)
|
|
||||||
update_state();
|
|
||||||
update_profiles();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
update_state();
|
|
||||||
}
|
|
|
@ -2,14 +2,19 @@ import * as React from "react";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Registry } from "tc-shared/events";
|
import { Registry } from "tc-shared/events";
|
||||||
|
|
||||||
import '!style-loader!css-loader!emoji-mart/css/emoji-mart.css'
|
//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 { settings, Settings } from "tc-shared/settings";
|
||||||
import { Translatable } from "tc-shared/ui/react-elements/i18n";
|
import { Translatable } from "tc-shared/ui/react-elements/i18n";
|
||||||
import { getTwenmojiHashFromNativeEmoji } from "tc-shared/text/bbcode/EmojiUtil";
|
import { getTwenmojiHashFromNativeEmoji } from "tc-shared/text/bbcode/EmojiUtil";
|
||||||
import {BaseEmoji} from "emoji-mart";
|
|
||||||
import { useGlobalSetting } from "tc-shared/ui/react-elements/Helper";
|
import { useGlobalSetting } from "tc-shared/ui/react-elements/Helper";
|
||||||
|
|
||||||
|
import Picker from '@emoji-mart/react'
|
||||||
|
import data from '@emoji-mart/data'
|
||||||
|
import { Emoji, init } from "emoji-mart";
|
||||||
|
|
||||||
|
init({ data })
|
||||||
|
|
||||||
|
|
||||||
const cssStyle = require("./ChatBox.scss");
|
const cssStyle = require("./ChatBox.scss");
|
||||||
|
|
||||||
interface ChatBoxEvents {
|
interface ChatBoxEvents {
|
||||||
|
@ -28,15 +33,19 @@ interface ChatBoxEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
const LastUsedEmoji = () => {
|
const LastUsedEmoji = () => {
|
||||||
const settingValue = useGlobalSetting(Settings.KEY_CHAT_LAST_USED_EMOJI);
|
// 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 (
|
// const lastEmoji: BaseEmoji = (emojiIndex.emojis[settingValue] || emojiIndex.emojis["joy"]) as any;
|
||||||
<img draggable={false} src={"https://twemoji.maxcdn.com/v/12.1.2/72x72/" + getTwenmojiHashFromNativeEmoji(lastEmoji.native) + ".png"} alt={lastEmoji.native} className={cssStyle.emoji} />
|
// if (!lastEmoji?.native) {
|
||||||
)
|
// return <img key={"fallback"} alt={""} src={"img/smiley-smile.svg"} />;
|
||||||
|
// }
|
||||||
|
|
||||||
|
const le: Emoji = new Emoji({ id: 'smiley', set: 'native' })
|
||||||
|
return le.component
|
||||||
|
|
||||||
|
// 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> }) => {
|
const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
|
||||||
|
@ -68,6 +77,7 @@ const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
|
||||||
props.events.reactUse("action_set_enabled", event => setEnabled(event.enabled));
|
props.events.reactUse("action_set_enabled", event => setEnabled(event.enabled));
|
||||||
props.events.reactUse("action_submit_message", () => setShown(false));
|
props.events.reactUse("action_submit_message", () => setShown(false));
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cssStyle.containerEmojis} ref={refContainer}>
|
<div className={cssStyle.containerEmojis} ref={refContainer}>
|
||||||
<div className={cssStyle.button} onClick={() => enabled && setShown(true)}>
|
<div className={cssStyle.button} onClick={() => enabled && setShown(true)}>
|
||||||
|
@ -75,19 +85,35 @@ const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
|
||||||
</div>
|
</div>
|
||||||
<div className={cssStyle.picker} style={{ display: shown ? undefined : "none" }}>
|
<div className={cssStyle.picker} style={{ display: shown ? undefined : "none" }}>
|
||||||
{!shown ? undefined :
|
{!shown ? undefined :
|
||||||
|
// <Picker
|
||||||
|
// key={"picker"}
|
||||||
|
// set={"twitter"}
|
||||||
|
// theme={"light"}
|
||||||
|
// showPreview={true}
|
||||||
|
// title={""}
|
||||||
|
// showSkinTones={true}
|
||||||
|
// useButton={false}
|
||||||
|
// native={false}
|
||||||
|
|
||||||
|
// 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 });
|
||||||
|
// }
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
<Picker
|
<Picker
|
||||||
|
data={data}
|
||||||
key={"picker"}
|
key={"picker"}
|
||||||
set={"twitter"}
|
set={"native"}
|
||||||
theme={"light"}
|
noCountryFlags={true}
|
||||||
showPreview={true}
|
showPreview={true}
|
||||||
title={""}
|
title={""}
|
||||||
showSkinTones={true}
|
skinTonePosition={"none"}
|
||||||
useButton={false}
|
|
||||||
native={false}
|
|
||||||
|
|
||||||
onSelect={(emoji: any) => {
|
onEmojiSelect={(emoji: any) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
settings.setValue(Settings.KEY_CHAT_LAST_USED_EMOJI, emoji.id as string);
|
//settings.setValue(Settings.KEY_CHAT_LAST_USED_EMOJI, emoji.id as string);
|
||||||
props.events.fire("action_insert_text", { text: emoji.native, focus: true });
|
props.events.fire("action_insert_text", { text: emoji.native, focus: true });
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
2
shared/svg-sprites/client-icons.d.ts
vendored
2
shared/svg-sprites/client-icons.d.ts
vendored
File diff suppressed because one or more lines are too long
2
shared/svg-sprites/country-flags.d.ts
vendored
2
shared/svg-sprites/country-flags.d.ts
vendored
File diff suppressed because one or more lines are too long
|
@ -8,14 +8,27 @@
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"emitDeclarationOnly": true,
|
"emitDeclarationOnly": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"baseUrl": "../../",
|
"baseUrl": "../../",
|
||||||
"paths": {
|
"paths": {
|
||||||
"tc-shared/*": ["shared/js/*"],
|
"tc-shared/*": [
|
||||||
"tc-loader": ["loader/exports/loader.d.ts"],
|
"shared/js/*"
|
||||||
"svg-sprites/*": ["shared/svg-sprites/*"],
|
],
|
||||||
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"],
|
"tc-loader": [
|
||||||
"tc-events": ["vendor/TeaEventBus/src/index.ts"],
|
"loader/exports/loader.d.ts"
|
||||||
"tc-services": ["vendor/TeaClientServices/src/index.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": [
|
"exclude": [
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"plugins": [ /* ttypescript */
|
"plugins": [ /* ttypescript */
|
||||||
{
|
{
|
||||||
"transform": "../../tools/trgen/ttsc_transformer.js",
|
"transform": "../../tools/trgen/ttsc_transformer.js",
|
||||||
|
|
0
tools/build_trgen.sh
Normal file → Executable file
0
tools/build_trgen.sh
Normal file → Executable file
|
@ -1,13 +1,14 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"skipLibCheck": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"lib": ["es6"],
|
"lib": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
"typeRoots": [],
|
"typeRoots": [],
|
||||||
"types": [],
|
"types": [],
|
||||||
|
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|
|
@ -4,20 +4,22 @@
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"lib": ["es6", "dom"],
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"webpack.config.ts",
|
"webpack.config.ts",
|
||||||
"webpack-client.config.ts",
|
"webpack-client.config.ts",
|
||||||
"webpack-web.config.ts",
|
"webpack-web.config.ts",
|
||||||
|
|
||||||
"webpack/build-definitions.d.ts",
|
"webpack/build-definitions.d.ts",
|
||||||
"webpack/HtmlWebpackInlineSource.ts",
|
"webpack/HtmlWebpackInlineSource.ts",
|
||||||
"webpack/WatLoader.ts",
|
"webpack/WatLoader.ts",
|
||||||
"webpack/ManifestPlugin.ts",
|
"webpack/ManifestPlugin.ts",
|
||||||
|
|
||||||
"babel.config.ts",
|
"babel.config.ts",
|
||||||
"postcss.config.ts",
|
"postcss.config.ts",
|
||||||
"file.ts"
|
"file.ts"
|
||||||
|
|
|
@ -5,19 +5,35 @@
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"lib": ["ES7", "dom", "dom.iterable"],
|
"lib": [
|
||||||
|
"ES7",
|
||||||
|
"dom",
|
||||||
|
"dom.iterable"
|
||||||
|
],
|
||||||
"removeComments": true, /* we dont really need them within the target files */
|
"removeComments": true, /* we dont really need them within the target files */
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"skipLibCheck": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"tc-shared/*": ["shared/js/*"],
|
"tc-shared/*": [
|
||||||
"tc-loader": ["loader/exports/loader.d.ts"],
|
"shared/js/*"
|
||||||
"tc-events": ["vendor/TeaEventBus/src/index.ts"],
|
],
|
||||||
"tc-services": ["vendor/TeaClientServices/src/index.ts"],
|
"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"
|
||||||
|
],
|
||||||
|
"svg-sprites/*": [
|
||||||
|
"shared/svg-sprites/*"
|
||||||
|
],
|
||||||
|
"vendor/xbbcode/*": [
|
||||||
|
"vendor/xbbcode/src/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
|
@ -26,6 +26,20 @@ 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 {
|
class IPResolveMethod implements DNSResolveMethod {
|
||||||
readonly v6: boolean;
|
readonly v6: boolean;
|
||||||
|
|
||||||
|
@ -309,6 +323,7 @@ class TeaSpeakDNSResolve {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const kResolverFake = new FakeResolver();
|
||||||
const kResolverLocalhost = new LocalhostResolver();
|
const kResolverLocalhost = new LocalhostResolver();
|
||||||
|
|
||||||
const kResolverIpV4 = new IPResolveMethod(false);
|
const kResolverIpV4 = new IPResolveMethod(false);
|
||||||
|
@ -327,7 +342,9 @@ export async function resolveTeaSpeakServerAddress(address: DNSAddress, _options
|
||||||
|
|
||||||
const resolver = new TeaSpeakDNSResolve(address);
|
const resolver = new TeaSpeakDNSResolve(address);
|
||||||
|
|
||||||
resolver.registerResolver(kResolverLocalhost);
|
resolver.registerResolver(kResolverFake);
|
||||||
|
|
||||||
|
resolver.registerResolver(kResolverLocalhost, kResolverFake);
|
||||||
|
|
||||||
resolver.registerResolver(resolverSrvTS, kResolverLocalhost);
|
resolver.registerResolver(resolverSrvTS, kResolverLocalhost);
|
||||||
resolver.registerResolver(resolverSrvTS3, kResolverLocalhost);
|
resolver.registerResolver(resolverSrvTS3, kResolverLocalhost);
|
||||||
|
|
|
@ -46,9 +46,9 @@ const generateLocalBuildInfo = async (target: string): Promise<LocalBuildInfo> =
|
||||||
{
|
{
|
||||||
const gitRevision = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
|
const gitRevision = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
|
||||||
if(gitRevision.indexOf("/") === -1) {
|
if(gitRevision.indexOf("/") === -1) {
|
||||||
info.gitVersion = (gitRevision || "00000000").substr(0, 8);
|
info.gitVersion = (gitRevision || "00000000").substring(0, 8);
|
||||||
} else {
|
} else {
|
||||||
info.gitVersion = fs.readFileSync(path.join(__dirname, ".git", gitRevision.substr(5).trim())).toString().substr(0, 8);
|
info.gitVersion = fs.readFileSync(path.join(__dirname, ".git", gitRevision.substring(5).trim())).toString().substring(0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue