Added some scripts and live statistics
This commit is contained in:
parent
6da22ca24c
commit
9e01c84641
6 changed files with 58 additions and 11 deletions
|
@ -21,7 +21,7 @@ function replace_tribble() {
|
||||||
|
|
||||||
#Building the generator
|
#Building the generator
|
||||||
./tools/build_dtsgen.sh
|
./tools/build_dtsgen.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Failed to build typescript declaration generator"
|
echo "Failed to build typescript declaration generator"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
25
scripts/cleanup.sh
Executable file
25
scripts/cleanup.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
cd "$BASEDIR/../"
|
||||||
|
|
||||||
|
# This script cleanups all generated files
|
||||||
|
function remove_if_exists() {
|
||||||
|
if [[ -f "$1" ]] || [[ -d "$1" ]]; then
|
||||||
|
echo "Deleting $1"
|
||||||
|
rm -r "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanup_declarations() {
|
||||||
|
remove_if_exists shared/declarations/
|
||||||
|
remove_if_exists web/declarations/
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanup_generated_files() {
|
||||||
|
remove_if_exists shared/generated
|
||||||
|
remove_if_exists web/generated
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup_declarations
|
||||||
|
cleanup_generated_files
|
|
@ -554,6 +554,8 @@ const loader_javascript = {
|
||||||
"js/connection/HandshakeHandler.js",
|
"js/connection/HandshakeHandler.js",
|
||||||
"js/connection/ServerConnection.js",
|
"js/connection/ServerConnection.js",
|
||||||
|
|
||||||
|
"js/stats.js",
|
||||||
|
|
||||||
"js/PPTListener.js",
|
"js/PPTListener.js",
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace log {
|
||||||
[LogCategory.GENERAL, true],
|
[LogCategory.GENERAL, true],
|
||||||
[LogCategory.NETWORKING, true],
|
[LogCategory.NETWORKING, true],
|
||||||
[LogCategory.VOICE, true],
|
[LogCategory.VOICE, true],
|
||||||
[LogCategory.I18N, true]
|
[LogCategory.I18N, false]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
loader.register_task(loader.Stage.LOADED, {
|
loader.register_task(loader.Stage.LOADED, {
|
||||||
|
|
|
@ -272,6 +272,15 @@ function main() {
|
||||||
globalClient.channelTree.handle_resized();
|
globalClient.channelTree.handle_resized();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
stats.initialize({
|
||||||
|
verbose: true,
|
||||||
|
anonymize_ip_addresses: true,
|
||||||
|
volatile_collection_only: false
|
||||||
|
});
|
||||||
|
stats.register_user_count_listener(status => {
|
||||||
|
console.log("Received user count update: %o", status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loader.register_task(loader.Stage.LOADED, {
|
loader.register_task(loader.Stage.LOADED, {
|
||||||
|
|
|
@ -96,16 +96,14 @@ namespace stats {
|
||||||
|
|
||||||
export function start_connection() {
|
export function start_connection() {
|
||||||
cancel_reconnect();
|
cancel_reconnect();
|
||||||
|
close_connection();
|
||||||
if(connection) {
|
|
||||||
const connection_copy = connection;
|
|
||||||
connection = undefined;
|
|
||||||
|
|
||||||
connection_copy.close(3001);
|
|
||||||
}
|
|
||||||
|
|
||||||
connection_state = ConnectionState.CONNECTING;
|
connection_state = ConnectionState.CONNECTING;
|
||||||
connection = new WebSocket('wss://web-stats.teaspeak.de:1774');
|
|
||||||
|
connection = new WebSocket('wss://web-stats.teaspeak.de:27790');
|
||||||
|
if(!connection)
|
||||||
|
connection = new WebSocket('wss://localhost:27788');
|
||||||
|
|
||||||
{
|
{
|
||||||
const connection_copy = connection;
|
const connection_copy = connection;
|
||||||
connection.onclose = (event: CloseEvent) => {
|
connection.onclose = (event: CloseEvent) => {
|
||||||
|
@ -135,7 +133,7 @@ namespace stats {
|
||||||
console.log(LOG_PREFIX + tr("Received an error. Closing connection. Object: %o"), event);
|
console.log(LOG_PREFIX + tr("Received an error. Closing connection. Object: %o"), event);
|
||||||
|
|
||||||
connection.close(CloseCodes.INTERNAL_ERROR);
|
connection.close(CloseCodes.INTERNAL_ERROR);
|
||||||
this.invoke_reconnect();
|
invoke_reconnect();
|
||||||
};
|
};
|
||||||
|
|
||||||
connection.onmessage = (event: MessageEvent) => {
|
connection.onmessage = (event: MessageEvent) => {
|
||||||
|
@ -152,7 +150,20 @@ namespace stats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function close_connection() {
|
||||||
|
if(connection) {
|
||||||
|
const connection_copy = connection;
|
||||||
|
connection = undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection_copy.close(3001);
|
||||||
|
} catch(_) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function invoke_reconnect() {
|
function invoke_reconnect() {
|
||||||
|
close_connection();
|
||||||
|
|
||||||
if(reconnect_timer) {
|
if(reconnect_timer) {
|
||||||
clearTimeout(reconnect_timer);
|
clearTimeout(reconnect_timer);
|
||||||
reconnect_timer = undefined;
|
reconnect_timer = undefined;
|
||||||
|
|
Loading…
Add table
Reference in a new issue