mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
added error checking and change messages to the user
This commit is contained in:
54
server.js
54
server.js
@@ -503,6 +503,7 @@ app.use('/api/content', require('./src/endpoints/content-manager').router);
|
|||||||
|
|
||||||
// Settings load/store
|
// Settings load/store
|
||||||
const settingsEndpoint = require('./src/endpoints/settings');
|
const settingsEndpoint = require('./src/endpoints/settings');
|
||||||
|
const { exitProcess } = require('yargs');
|
||||||
app.use('/api/settings', settingsEndpoint.router);
|
app.use('/api/settings', settingsEndpoint.router);
|
||||||
|
|
||||||
// Stable Diffusion generation
|
// Stable Diffusion generation
|
||||||
@@ -622,10 +623,10 @@ const postSetupTasks = async function () {
|
|||||||
|
|
||||||
setWindowTitle('SillyTavern WebServer');
|
setWindowTitle('SillyTavern WebServer');
|
||||||
|
|
||||||
console.log(color.green('SillyTavern is listening on: ' + tavernUrl));
|
console.log(color.green('SillyTavern is listening on ipv6: ' + tavernUrlV6 + " ipv4: " + tavernUrl));
|
||||||
|
|
||||||
if (listen) {
|
if (listen) {
|
||||||
console.log('\n0.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 (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('\n :: 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) {
|
||||||
@@ -714,7 +715,20 @@ userModule.initUserStorage(dataRoot)
|
|||||||
.then(verifySecuritySettings)
|
.then(verifySecuritySettings)
|
||||||
.then(preSetupTasks)
|
.then(preSetupTasks)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
let v6Failed = false
|
||||||
|
let v4Failed = false
|
||||||
if (cliArguments.ssl) {
|
if (cliArguments.ssl) {
|
||||||
|
https.createServer(
|
||||||
|
{
|
||||||
|
cert: fs.readFileSync(cliArguments.certPath),
|
||||||
|
key: fs.readFileSync(cliArguments.keyPath),
|
||||||
|
}, app)
|
||||||
|
.listen(
|
||||||
|
Number(tavernUrlV6.port) || 443,
|
||||||
|
tavernUrlV6.hostname,
|
||||||
|
postSetupTasks,
|
||||||
|
);
|
||||||
|
|
||||||
https.createServer(
|
https.createServer(
|
||||||
{
|
{
|
||||||
cert: fs.readFileSync(cliArguments.certPath),
|
cert: fs.readFileSync(cliArguments.certPath),
|
||||||
@@ -726,15 +740,31 @@ userModule.initUserStorage(dataRoot)
|
|||||||
postSetupTasks,
|
postSetupTasks,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
http.createServer(app).listen(
|
// Handle IPv6 server
|
||||||
Number(tavernUrlV6.port) || 80,
|
try {
|
||||||
tavernUrlV6.hostname,
|
http.createServer(app).listen(
|
||||||
postSetupTasks,
|
Number(tavernUrlV6.port) || 80,
|
||||||
);
|
tavernUrlV6.hostname,
|
||||||
http.createServer(app).listen(
|
);
|
||||||
Number(tavernUrl.port) || 80,
|
} catch (error) {
|
||||||
tavernUrl.hostname,
|
console.error('Failed to start IPv6 HTTP server:', error);
|
||||||
postSetupTasks,
|
v6Failed = true;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
// Handle IPv4 server
|
||||||
|
try {
|
||||||
|
http.createServer(app).listen(
|
||||||
|
Number(tavernUrl.port) || 80,
|
||||||
|
tavernUrl.hostname,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to start IPv4 HTTP server:', error);
|
||||||
|
v4Failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (v6Failed && v4Failed) {
|
||||||
|
console.error("both v6 and v4 failed");
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
postSetupTasks()
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user