Merge pull request #145 from CyferShepard/unstable

Small fix where older installs of Jellystat used the start-app command in the docker container. start-app has been changed to be a duplicate of start and the old functionality moved to a command called start-dev

URL cleanup code added to validateSettings endpoint to handle certain use-cases
This commit is contained in:
Thegan Govender
2023-12-22 08:03:10 +02:00
committed by GitHub
2 changed files with 12 additions and 2 deletions

View File

@@ -630,11 +630,17 @@ router.post("/getUserHistory", async (req, res) => {
router.post("/validateSettings", async (req, res) => {
const { url, apikey } = req.body;
var _url=url;
_url = _url.replace(/\/web\/index\.html#!\/home\.html$/, '');
if (!/^https?:\/\//i.test(url)) {
_url = 'http://' + url;
}
let isValid = false;
let errorMessage = "";
try {
await axios
.get(url + "/system/configuration", {
.get(_url + "/system/configuration", {
headers: {
"X-MediaBrowser-Token": apikey,
},
@@ -657,6 +663,9 @@ router.post("/validateSettings", async (req, res) => {
} else if (error.response && error.response.status === 404) {
isValid = false;
errorMessage = `Error ${error.response.status}: The requested URL was not found.`;
} else if (error.code === "EPROTO") {
isValid = false;
errorMessage = `Error: Network protocol mismatch. Please check your url.`;
} else {
isValid = false;
errorMessage = `${error}`;

View File

@@ -6,11 +6,12 @@
"scripts": {
"start-client": "vite --host",
"start-server": "cd backend && nodemon server.js",
"start-app": "concurrently \"npm run start-server\" \"npm run start-client\"",
"start-dev": "concurrently \"npm run start-server\" \"npm run start-client\"",
"deploy-local": "npm run build && npm run start-server",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"build": "vite build",
"start-app": "cd backend && node server.js",
"start": "cd backend && node server.js"
},
"dependencies": {