Refactor logAddress check

c98d241f3c93e6b94d4fc66e99739bffebf55738

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -11Showing whitespace changes
server.js+8 -11
@@ -857,19 +857,16 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) {
857 console.log('\n' + getSeparator(plainGoToLog.length) + '\n');857 console.log('\n' + getSeparator(plainGoToLog.length) + '\n');
858858
859 if (listen) {859 if (listen) {
860 if (ipRegex.v6({ exact: true }).test(listenAddressIPv6)) {860 const logAddress = ipRegex.v6({ exact: true }).test(listenAddressIPv6)
861 ? listenAddressIPv6
862 : ipRegex.v4({ exact: true }).test(listenAddressIPv4)
863 ? listenAddressIPv4
864 : null;
861 console.log(865 console.log(
862 `SillyTavern is listening on the address ${listenAddressIPv6}. If you want to limit it only to internal localhost ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false". Check "access.log" file in the SillyTavern directory if you want to inspect incoming connections.\n`,866 logAddress
867 ? `SillyTavern is listening on the address ${logAddress}. If you want to limit it only to internal localhost ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false". Check "access.log" file in the SillyTavern directory if you want to inspect incoming connections.\n`
868 : '[::] or 0.0.0.0 means SillyTavern is listening on all network interfaces (Wi-Fi, LAN, localhost). If you want to limit it only to internal localhost ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false". Check "access.log" file in the SillyTavern directory if you want to inspect incoming connections.\n',
863 );869 );
864 } else if (ipRegex.v4({ exact: true }).test(listenAddressIPv4)) {
865 console.log(
866 `SillyTavern is listening on the address ${listenAddressIPv4}. If you want to limit it only to internal localhost ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false". Check "access.log" file in the SillyTavern directory if you want to inspect incoming connections.\n`,
867 );
868 } else {
869 console.log(
870 '[::] or 0.0.0.0 means SillyTavern is listening on all network interfaces (Wi-Fi, LAN, localhost). If you want to limit it only to internal localhost ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false". Check "access.log" file in the SillyTavern directory if you want to inspect incoming connections.\n',
871 );
872 }
873 }870 }
874871
875 if (basicAuthMode) {872 if (basicAuthMode) {