fixed linting issues
| @@ -134,8 +134,8 @@ const DEFAULT_CSRF_DISABLED = false; | |||
| 134 | const DEFAULT_BASIC_AUTH = false; | 134 | const DEFAULT_BASIC_AUTH = false; |
| 135 | const DEFAULT_PER_USER_BASIC_AUTH = false; | 135 | const DEFAULT_PER_USER_BASIC_AUTH = false; |
| 136 | 136 | ||
| 137 | const DEFAULT_ENABLE_IPV6 = "auto"; | 137 | const DEFAULT_ENABLE_IPV6 = 'auto'; |
| 138 | const DEFAULT_ENABLE_IPV4 = "auto"; | 138 | const DEFAULT_ENABLE_IPV4 = 'auto'; |
| 139 | 139 | ||
| 140 | const DEFAULT_PREFER_IPV6 = false; | 140 | const DEFAULT_PREFER_IPV6 = false; |
| 141 | 141 | ||
| @@ -281,18 +281,18 @@ if (dnsPreferIPv6) { | |||
| 281 | console.log('Preferring IPv4 for DNS resolution'); | 281 | console.log('Preferring IPv4 for DNS resolution'); |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | const ipOptions = ["enabled", "auto", "disabled"]; | 284 | const ipOptions = ['enabled', 'auto', 'disabled']; |
| 285 | 285 | ||
| 286 | if (!ipOptions.includes(enableIPv6)) { | 286 | if (!ipOptions.includes(enableIPv6)) { |
| 287 | console.error("`protocol: ipv6` option invalid"); | 287 | console.error('`protocol: ipv6` option invalid'); |
| 288 | process.exit(1) | 288 | process.exit(1); |
| 289 | } | 289 | } |
| 290 | if (!ipOptions.includes(enableIPv4)) { | 290 | if (!ipOptions.includes(enableIPv4)) { |
| 291 | console.error("`protocol: ipv4` option invalid"); | 291 | console.error('`protocol: ipv4` option invalid'); |
| 292 | process.exit(1) | 292 | process.exit(1); |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | if (enableIPv6 == "disabled" && enableIPv4 == "disabled") { | 295 | if (enableIPv6 == 'disabled' && enableIPv4 == 'disabled') { |
| 296 | console.error('error: You can\'t disable all internet protocols: at least IPv6 or IPv4 must be enabled.'); | 296 | console.error('error: You can\'t disable all internet protocols: at least IPv6 or IPv4 must be enabled.'); |
| 297 | process.exit(1); | 297 | process.exit(1); |
| 298 | } | 298 | } |
| @@ -384,7 +384,7 @@ async function getHasIP() { | |||
| 384 | 384 | ||
| 385 | for (const iface of Object.values(interfaces)) { | 385 | for (const iface of Object.values(interfaces)) { |
| 386 | if (iface === undefined) { | 386 | if (iface === undefined) { |
| 387 | continue | 387 | continue; |
| 388 | } | 388 | } |
| 389 | for (const info of iface) { | 389 | for (const info of iface) { |
| 390 | if (info.family === 'IPv6') { | 390 | if (info.family === 'IPv6') { |
| @@ -924,26 +924,26 @@ async function startHTTPorHTTPS(useIPv6, useIPv4) { | |||
| 924 | } | 924 | } |
| 925 | 925 | ||
| 926 | async function startServer() { | 926 | async function startServer() { |
| 927 | let useIPv6 = (enableIPv6 == "enabled") | 927 | let useIPv6 = (enableIPv6 == 'enabled'); |
| 928 | let useIPv4 = (enableIPv4 == "enabled") | 928 | let useIPv4 = (enableIPv4 == 'enabled'); |
| 929 | 929 | ||
| 930 | const [hasIPv6, hasIPv4] = await getHasIP() | 930 | const [hasIPv6, hasIPv4] = await getHasIP(); |
| 931 | if (enableIPv6 == "auto") { | 931 | if (enableIPv6 == 'auto') { |
| 932 | useIPv6 = hasIPv6; | 932 | useIPv6 = hasIPv6; |
| 933 | if (useIPv6) { | 933 | if (useIPv6) { |
| 934 | console.log("IPv6 support detected") | 934 | console.log('IPv6 support detected'); |
| 935 | } | 935 | } |
| 936 | } | 936 | } |
| 937 | 937 | ||
| 938 | if (enableIPv4 == "auto") { | 938 | if (enableIPv4 == 'auto') { |
| 939 | useIPv4 = hasIPv4; | 939 | useIPv4 = hasIPv4; |
| 940 | if (useIPv4) { | 940 | if (useIPv4) { |
| 941 | console.log("IPv4 support detected") | 941 | console.log('IPv4 support detected'); |
| 942 | } | 942 | } |
| 943 | } | 943 | } |
| 944 | 944 | ||
| 945 | if (!useIPv6 && !useIPv4) { | 945 | if (!useIPv6 && !useIPv4) { |
| 946 | console.log("No IPv6 and no IPv4 enabled") | 946 | console.log('No IPv6 and no IPv4 enabled'); |
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); | 949 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); |