changed formatting
| @@ -419,6 +419,7 @@ async function getHasIP() { | |||
| 419 | if (iface === undefined) { | 419 | if (iface === undefined) { |
| 420 | continue; | 420 | continue; |
| 421 | } | 421 | } |
| 422 | |||
| 422 | for (const info of iface) { | 423 | for (const info of iface) { |
| 423 | if (info.family === 'IPv6') { | 424 | if (info.family === 'IPv6') { |
| 424 | hasIPv6 = true; | 425 | hasIPv6 = true; |
| @@ -437,7 +438,12 @@ async function getHasIP() { | |||
| 437 | } | 438 | } |
| 438 | if (hasIPv6 && hasIPv4 && hasIPv6Local && hasIPv4Local) break; | 439 | if (hasIPv6 && hasIPv4 && hasIPv6Local && hasIPv4Local) break; |
| 439 | } | 440 | } |
| 440 | return [hasIPv6, hasIPv4, hasIPv6Local, hasIPv4Local]; | 441 | return [ |
| 442 | hasIPv6, | ||
| 443 | hasIPv4, | ||
| 444 | hasIPv6Local, | ||
| 445 | hasIPv4Local, | ||
| 446 | ]; | ||
| 441 | } | 447 | } |
| 442 | 448 | ||
| 443 | app.use(cookieSession({ | 449 | app.use(cookieSession({ |
| @@ -808,11 +814,15 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) { | |||
| 808 | let logListen = 'SillyTavern is listening on'; | 814 | let logListen = 'SillyTavern is listening on'; |
| 809 | 815 | ||
| 810 | if (useIPv6 && !v6Failed) { | 816 | if (useIPv6 && !v6Failed) { |
| 811 | logListen += color.green(' IPv6: ' + tavernUrlV6.host); | 817 | logListen += color.green( |
| 818 | ' IPv6: ' + tavernUrlV6.host | ||
| 819 | ); | ||
| 812 | } | 820 | } |
| 813 | 821 | ||
| 814 | if (useIPv4 && !v4Failed) { | 822 | if (useIPv4 && !v4Failed) { |
| 815 | logListen += color.green(' IPv4: ' + tavernUrl.host); | 823 | logListen += color.green( |
| 824 | ' IPv4: ' + tavernUrl.host | ||
| 825 | ); | ||
| 816 | } | 826 | } |
| 817 | 827 | ||
| 818 | const goToLog = 'Go to: ' + color.blue(autorunUrl) + ' to open SillyTavern'; | 828 | const goToLog = 'Go to: ' + color.blue(autorunUrl) + ' to open SillyTavern'; |
| @@ -824,16 +834,22 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) { | |||
| 824 | console.log('\n' + getSeparator(plainGoToLog.length) + '\n'); | 834 | console.log('\n' + getSeparator(plainGoToLog.length) + '\n'); |
| 825 | 835 | ||
| 826 | if (listen) { | 836 | if (listen) { |
| 827 | 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'); | 837 | console.log( |
| 838 | '[::] 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' | ||
| 839 | ); | ||
| 828 | } | 840 | } |
| 829 | 841 | ||
| 830 | if (basicAuthMode) { | 842 | if (basicAuthMode) { |
| 831 | if (perUserBasicAuth && !enableAccounts) { | 843 | if (perUserBasicAuth && !enableAccounts) { |
| 832 | console.error(color.red('Per-user basic authentication is enabled, but user accounts are disabled. This configuration may be insecure.')); | 844 | console.error(color.red( |
| 845 | 'Per-user basic authentication is enabled, but user accounts are disabled. This configuration may be insecure.' | ||
| 846 | )); | ||
| 833 | } else if (!perUserBasicAuth) { | 847 | } else if (!perUserBasicAuth) { |
| 834 | const basicAuthUser = getConfigValue('basicAuthUser', {}); | 848 | const basicAuthUser = getConfigValue('basicAuthUser', {}); |
| 835 | if (!basicAuthUser?.username || !basicAuthUser?.password) { | 849 | if (!basicAuthUser?.username || !basicAuthUser?.password) { |
| 836 | console.warn(color.yellow('Basic Authentication is enabled, but username or password is not set or empty!')); | 850 | console.warn(color.yellow( |
| 851 | 'Basic Authentication is enabled, but username or password is not set or empty!' | ||
| 852 | )); | ||
| 837 | } | 853 | } |
| 838 | } | 854 | } |
| 839 | } | 855 | } |
| @@ -1010,6 +1026,7 @@ async function startServer() { | |||
| 1010 | if (enableIPv6 === 'auto' || enableIPv4 === 'auto') { | 1026 | if (enableIPv6 === 'auto' || enableIPv4 === 'auto') { |
| 1011 | [hasIPv6Any, hasIPv4Any, hasIPv6Local, hasIPv4Local] = await getHasIP(); | 1027 | [hasIPv6Any, hasIPv4Any, hasIPv6Local, hasIPv4Local] = await getHasIP(); |
| 1012 | 1028 | ||
| 1029 | |||
| 1013 | hasIPv6 = listen ? hasIPv6Any : hasIPv6Local; | 1030 | hasIPv6 = listen ? hasIPv6Any : hasIPv6Local; |
| 1014 | if (enableIPv6 === 'auto') { | 1031 | if (enableIPv6 === 'auto') { |
| 1015 | useIPv6 = hasIPv6; | 1032 | useIPv6 = hasIPv6; |
| @@ -1059,6 +1076,7 @@ async function startServer() { | |||
| 1059 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); | 1076 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); |
| 1060 | 1077 | ||
| 1061 | handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4); | 1078 | handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4); |
| 1079 | |||
| 1062 | postSetupTasks(v6Failed, v4Failed, useIPv6, useIPv4); | 1080 | postSetupTasks(v6Failed, v4Failed, useIPv6, useIPv4); |
| 1063 | } | 1081 | } |
| 1064 | 1082 | ||