Refactor logAddress check

This commit is contained in:
Cohee
2025-02-14 23:09:36 +02:00
parent 961a71877b
commit c98d241f3c

View File

@ -857,19 +857,16 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) {
console.log('\n' + getSeparator(plainGoToLog.length) + '\n'); console.log('\n' + getSeparator(plainGoToLog.length) + '\n');
if (listen) { if (listen) {
if (ipRegex.v6({ exact: true }).test(listenAddressIPv6)) { const logAddress = ipRegex.v6({ exact: true }).test(listenAddressIPv6)
console.log( ? listenAddressIPv6
`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`, : ipRegex.v4({ exact: true }).test(listenAddressIPv4)
); ? listenAddressIPv4
} else if (ipRegex.v4({ exact: true }).test(listenAddressIPv4)) { : null;
console.log( console.log(
`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`, logAddress
); ? `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`
} else { : '[::] 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',
console.log( );
'[::] 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',
);
}
} }
if (basicAuthMode) { if (basicAuthMode) {