mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 08:39:34 +00:00
fix: prevent error when port is unchanged (#551)
* fix: prevent error when port is unchanged
This commit is contained in:
@@ -207,11 +207,16 @@ export const postSettings = async (req, res) => {
|
|||||||
const settings = DataProvider.getSettings();
|
const settings = DataProvider.getSettings();
|
||||||
const editorKey = extractPin(req.body?.editorKey, settings.editorKey);
|
const editorKey = extractPin(req.body?.editorKey, settings.editorKey);
|
||||||
const operatorKey = extractPin(req.body?.operatorKey, settings.operatorKey);
|
const operatorKey = extractPin(req.body?.operatorKey, settings.operatorKey);
|
||||||
|
const serverPort = Number(req.body?.serverPort);
|
||||||
|
if (isNaN(serverPort)) {
|
||||||
|
return res.status(400).send(`Invalid value found for server port: ${req.body?.serverPort}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (isDocker && req.body?.serverPort) {
|
const hasChangedPort = settings.serverPort !== serverPort;
|
||||||
|
|
||||||
|
if (isDocker && hasChangedPort) {
|
||||||
return res.status(403).json({ message: 'Can`t change port when running inside docker' });
|
return res.status(403).json({ message: 'Can`t change port when running inside docker' });
|
||||||
}
|
}
|
||||||
const serverPort = parseInt(req.body?.serverPort ?? settings.serverPort, 10);
|
|
||||||
|
|
||||||
let timeFormat = settings.timeFormat;
|
let timeFormat = settings.timeFormat;
|
||||||
if (req.body?.timeFormat === '12' || req.body?.timeFormat === '24') {
|
if (req.body?.timeFormat === '12' || req.body?.timeFormat === '24') {
|
||||||
|
|||||||
Reference in New Issue
Block a user