From f48d90a9c9befeaa4983a30e081b401aaf4d143d Mon Sep 17 00:00:00 2001 From: steve02081504 Date: Sun, 14 Apr 2024 01:39:28 +0800 Subject: [PATCH] some fixes --- server.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 0b332b83d..3cedf14cd 100644 --- a/server.js +++ b/server.js @@ -499,11 +499,14 @@ const setupTasks = async function () { const cleanupPlugins = await loadPlugins(); + const BackUpTitle = process.title; + const exitProcess = async () => { statsEndpoint.onExit(); if (typeof cleanupPlugins === 'function') { await cleanupPlugins(); } + setWindowTitle(BackUpTitle); process.exit(); }; @@ -520,7 +523,7 @@ const setupTasks = async function () { if (autorun) open(autorunUrl.toString()); - console.log(String.fromCharCode(27) + "]0;SillyTavern WebServer" + String.fromCharCode(7)); // set window title + setWindowTitle('SillyTavern WebServer'); console.log(color.green('SillyTavern is listening on: ' + tavernUrl)); @@ -589,3 +592,10 @@ function ensurePublicDirectoriesExist() { } } } + +function setWindowTitle(title) { + if (process.platform == 'win32') + process.title = title + else + process.stdout.write('\x1b]2;' + title + '\x1b\x5c') +}