mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-06 04:59:41 -06:00
Made the numbers of the config clean
This commit is contained in:
@@ -2,10 +2,10 @@ const db = require('../index').database;
|
||||
|
||||
const configDefaults = {
|
||||
"setupDone": "true",
|
||||
"ping": 25,
|
||||
"download": 100,
|
||||
"upload": 50,
|
||||
"timeLevel": 3,
|
||||
"ping": "25",
|
||||
"download": "100",
|
||||
"upload": "50",
|
||||
"timeLevel": "3",
|
||||
"serverId": "none",
|
||||
"password": "none"
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ app.patch("/:key", async (req, res) => {
|
||||
if ((req.params.key === "ping" || req.params.key === "download" || req.params.key === "upload" || req.params.key === "timeLevel") && isNaN(req.body.value))
|
||||
return res.status(400).json({message: "You need to provide a number in order to change this"});
|
||||
|
||||
if (req.params.key === "ping")
|
||||
req.body.value = req.body.value.split(".")[0];
|
||||
|
||||
if (req.params.key === "password" && req.body.value !== "none") req.body.value = await require('bcrypt').hash(req.body.value, 10);
|
||||
|
||||
if (!config.update(req.params.key, req.body.value)) return res.status(404).json({message: "The provided key does not exist"});
|
||||
|
||||
Reference in New Issue
Block a user