You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-27 06:23:53 +01:00
Merge branch 'main' of https://github.com/NoobishSVK/fm-dx-webserver
This commit is contained in:
@@ -63,6 +63,21 @@ app.use(bodyParser.json());
|
|||||||
connectToXdrd();
|
connectToXdrd();
|
||||||
connectToSerial();
|
connectToSerial();
|
||||||
|
|
||||||
|
// Check for working IPv6
|
||||||
|
function checkIPv6Support(callback) {
|
||||||
|
const server = net.createServer();
|
||||||
|
|
||||||
|
server.listen(0, '::1', () => {
|
||||||
|
server.close(() => callback(true));
|
||||||
|
}).on('error', (error) => {
|
||||||
|
if (error.code === 'EADDRNOTAVAIL') {
|
||||||
|
callback(false);
|
||||||
|
} else {
|
||||||
|
callback(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Serial Connection
|
// Serial Connection
|
||||||
function connectToSerial() {
|
function connectToSerial() {
|
||||||
if (serverConfig.xdrd.wirelessConnection === false) {
|
if (serverConfig.xdrd.wirelessConnection === false) {
|
||||||
@@ -490,13 +505,29 @@ httpServer.on('upgrade', (request, socket, head) => {
|
|||||||
|
|
||||||
app.use(express.static(path.join(__dirname, '../web'))); // Serve the entire web folder to the user
|
app.use(express.static(path.join(__dirname, '../web'))); // Serve the entire web folder to the user
|
||||||
|
|
||||||
httpServer.listen(serverConfig.webserver.webserverPort, serverConfig.webserver.webserverIp, () => {
|
// Determine ip stack support and start server accordingly
|
||||||
let currentAddress = serverConfig.webserver.webserverIp;
|
checkIPv6Support((isIPv6Supported) => {
|
||||||
currentAddress == '0.0.0.0' ? currentAddress = 'localhost' : currentAddress = serverConfig.webserver.webserverIp;
|
const ipv4Address = serverConfig.webserver.webserverIp === '0.0.0.0' ? 'localhost' : serverConfig.webserver.webserverIp;
|
||||||
if(configExists()) {
|
const ipv6Address = '::'; // This will bind to all available IPv6 interfaces
|
||||||
logInfo(`Web server has started on address \x1b[34mhttp://${currentAddress}:${serverConfig.webserver.webserverPort}\x1b[0m.`);
|
|
||||||
|
if (isIPv6Supported) {
|
||||||
|
// Start server on both IPv4 and IPv6 addresses
|
||||||
|
httpServer.listen(serverConfig.webserver.webserverPort, ipv4Address, () => {
|
||||||
|
logInfo(`Web server has started on address \x1b[34mhttp://${ipv4Address}:${serverConfig.webserver.webserverPort}\x1b[0m.`);
|
||||||
|
});
|
||||||
|
|
||||||
|
httpServer.listen(serverConfig.webserver.webserverPort, ipv6Address, () => {
|
||||||
|
logInfo(`Web server has started on address \x1b[34mhttp://[${ipv6Address}]:${serverConfig.webserver.webserverPort}\x1b[0m.`);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
logInfo(`Open your browser and proceed to \x1b[34mhttp://${currentAddress}:${serverConfig.webserver.webserverPort}\x1b[0m to continue with setup.`);
|
// Start server only on IPv4 address
|
||||||
|
httpServer.listen(serverConfig.webserver.webserverPort, ipv4Address, () => {
|
||||||
|
if (configExists()) {
|
||||||
|
logInfo(`Web server has started on address \x1b[34mhttp://${ipv4Address}:${serverConfig.webserver.webserverPort}\x1b[0m.`);
|
||||||
|
} else {
|
||||||
|
logInfo(`Open your browser and proceed to \x1b[34mhttp://${ipv4Address}:${serverConfig.webserver.webserverPort}\x1b[0m to continue with setup.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
BIN
server/libraries/librdsparser_ia32.so
Normal file
BIN
server/libraries/librdsparser_ia32.so
Normal file
Binary file not shown.
Reference in New Issue
Block a user