aboutsummaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2025-09-03 10:30:19 +0300
committerRblSb <msrblsb@gmail.com>2025-09-03 10:30:19 +0300
commit9ec382facd8d7813716a10e5f7db3ca7f4ba0259 (patch)
tree323d4eb3b2b0d51c030daf63c1dac7db974f2b63 /src/server
parent0a771c1ab48819561c766790092407cf602fd68c (diff)
/crash, update yt-dlp on start, newer node fix
Diffstat (limited to 'src/server')
-rw-r--r--src/server/ConsoleInput.hx5
-rw-r--r--src/server/Main.hx5
-rw-r--r--src/server/cache/Cache.hx5
-rw-r--r--src/server/cache/YoutubeCache.hx10
4 files changed, 23 insertions, 2 deletions
diff --git a/src/server/ConsoleInput.hx b/src/server/ConsoleInput.hx
index e0712f5..f729e0d 100644
--- a/src/server/ConsoleInput.hx
+++ b/src/server/ConsoleInput.hx
@@ -57,6 +57,7 @@ class ConsoleInput {
output: process.stdout,
completer: onCompletion
});
+ final originalTrace = haxe.Log.trace;
haxe.Log.trace = (msg:Dynamic, ?infos:haxe.PosInfos) -> {
Readline.clearLine(process.stdout, 0);
Readline.cursorTo(process.stdout, 0, null);
@@ -68,7 +69,9 @@ class ConsoleInput {
parseLine(line);
rl.prompt();
});
- // rl.on("close", exit);
+ rl.on("close", () -> {
+ haxe.Log.trace = originalTrace;
+ });
}
function formatOutput(v:Dynamic, infos:haxe.PosInfos):String {
diff --git a/src/server/Main.hx b/src/server/Main.hx
index 66fbb27..e926492 100644
--- a/src/server/Main.hx
+++ b/src/server/Main.hx
@@ -1032,6 +1032,11 @@ class Main {
data: json
}
});
+ case CrashTest:
+ if (!client.isAdmin) return;
+ trace("Crashing...");
+ final arr:Array<Int> = cast null;
+ arr[1]++;
}
}
diff --git a/src/server/cache/Cache.hx b/src/server/cache/Cache.hx
index 56749d8..cfe2f66 100644
--- a/src/server/cache/Cache.hx
+++ b/src/server/cache/Cache.hx
@@ -28,7 +28,10 @@ class Cache {
youtubeCache = new YoutubeCache(main, this);
rawCache = new RawCache(main, this);
isYtReady = youtubeCache.checkYtDeps();
- if (isYtReady) youtubeCache.cleanYtInputFiles();
+ if (isYtReady) {
+ youtubeCache.cleanYtInputFiles();
+ youtubeCache.checkUpdate();
+ }
}
public function getCachedFiles():Array<String> {
diff --git a/src/server/cache/YoutubeCache.hx b/src/server/cache/YoutubeCache.hx
index 4f74080..c7053f9 100644
--- a/src/server/cache/YoutubeCache.hx
+++ b/src/server/cache/YoutubeCache.hx
@@ -29,6 +29,16 @@ class YoutubeCache {
}
}
+ public function checkUpdate():Void {
+ ytDlp.execAsync("-U", {
+ onData: d -> {
+ trace(d);
+ }
+ }).catchError(e -> {
+ trace(e);
+ });
+ }
+
public function cleanYtInputFiles(prefix = "__tmp"):Void {
final names = FileSystem.readDirectory(cache.cacheDir);
for (name in names) {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage