fix wtv-setup incorrect optimizations
This commit is contained in:
@@ -85,8 +85,8 @@ ${(categories.length > 14) ? '</font>' : ''}
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Object.keys(categories).forEach(function (k) {
|
Object.keys(categories).forEach(function (k) {
|
||||||
var catID = categories[k].id;
|
const catID = categories[k].id;
|
||||||
var songsInCat = wtvbgm.getCategorySongList(catID);
|
const songsInCat = wtvbgm.getCategorySongList(catID);
|
||||||
if (songsInCat.length > 0) {
|
if (songsInCat.length > 0) {
|
||||||
if (catsListed == divide) {
|
if (catsListed == divide) {
|
||||||
data += `</td ><td width="20">
|
data += `</td ><td width="20">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
let timezone = "-0000";
|
let timezone = "-0000";
|
||||||
let zip = "";
|
let zip = "";
|
||||||
@@ -15,7 +15,7 @@ if (session_data.isRegistered()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strf = strftime.timezone(timezone)
|
const strf = strftime.timezone(timezone)
|
||||||
|
|
||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Connection: Keep-Alive
|
Connection: Keep-Alive
|
||||||
@@ -28,7 +28,7 @@ Content-Type: text/html`
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
html = `<HTML>
|
data = `<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>
|
<TITLE>
|
||||||
Region Settings
|
Region Settings
|
||||||
@@ -88,13 +88,13 @@ const timezones = [
|
|||||||
["UTC+08:00", "+0800"], ["UTC+09:00", "+0900"], ["UTC+10:00", "+1000"], ["UTC+11:00", "+1100"], ["UTC+12:00", "+1200"]
|
["UTC+08:00", "+0800"], ["UTC+09:00", "+0900"], ["UTC+10:00", "+1000"], ["UTC+11:00", "+1100"], ["UTC+12:00", "+1200"]
|
||||||
];
|
];
|
||||||
|
|
||||||
html += `<select name="timezone" onchange="this.form.submit()">\n`;
|
data += `<select name="timezone" onchange="this.form.submit()">\n`;
|
||||||
for (const tz of timezones) {
|
for (const tz of timezones) {
|
||||||
html += ` <option value="${tz[1]}" ${tz[1] === timezone ? 'selected' : ''}>${tz[0]}</option>\n`;
|
data += ` <option value="${tz[1]}" ${tz[1] === timezone ? 'selected' : ''}>${tz[0]}</option>\n`;
|
||||||
}
|
}
|
||||||
html += `</select>`;
|
data += `</select>`;
|
||||||
|
|
||||||
html += `</form>
|
data += `</form>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -138,5 +138,3 @@ html += `</form>
|
|||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
data = html;
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
if (request_headers.query.category) {
|
if (request_headers.query.category) {
|
||||||
const wtvbgm = new WTVBGMusic(minisrv_config, session_data);
|
const wtvbgm = new WTVBGMusic(minisrv_config, session_data);
|
||||||
@@ -105,7 +105,7 @@ Choose the songs that you'd like to include.
|
|||||||
<td valign="top">
|
<td valign="top">
|
||||||
<input type="checkbox" name="enableSong" value=${musicList[k]['id']}${(wtvbgm.isSongEnabled(musicList[k]['id'])) ? ' checked="checked"' : ''}>
|
<input type="checkbox" name="enableSong" value=${musicList[k]['id']}${(wtvbgm.isSongEnabled(musicList[k]['id'])) ? ' checked="checked"' : ''}>
|
||||||
</td><td valign="bottom">`;
|
</td><td valign="bottom">`;
|
||||||
const strLenLimit = 16;
|
let strLenLimit = 16;
|
||||||
if (musicList.length > 14) strLenLimit = 20;
|
if (musicList.length > 14) strLenLimit = 20;
|
||||||
let songTitle = musicList[k]['title'];
|
let songTitle = musicList[k]['title'];
|
||||||
if (songTitle.length > strLenLimit) songTitle = musicList[k]['title'].substr(0, strLenLimit - 3) + "...";
|
if (songTitle.length > strLenLimit) songTitle = musicList[k]['title'].substr(0, strLenLimit - 3) + "...";
|
||||||
@@ -150,7 +150,7 @@ Choose the songs that you'd like to include.
|
|||||||
</display></display></body></html>`;
|
</display></display></body></html>`;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const errPage = doErrorPage("400", "Category ID is required.");
|
const errPage = wtvshared.doErrorPage("400", "Category ID is required.");
|
||||||
headers = errPage[0];
|
headers = errPage[0];
|
||||||
data = errPage[1];
|
data = errPage[1];
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
if (request_headers.query && session_data) {
|
if (request_headers.query && session_data) {
|
||||||
const settings_obj = session_data.getSessionData("wtv-setup");
|
let settings_obj = session_data.getSessionData("wtv-setup");
|
||||||
if (settings_obj === null) settings_obj = {};
|
if (settings_obj === null) settings_obj = {};
|
||||||
|
|
||||||
Object.keys(request_headers.query).forEach(function (k) {
|
Object.keys(request_headers.query).forEach(function (k) {
|
||||||
@@ -12,7 +12,7 @@ if (request_headers.query && session_data) {
|
|||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-type: text/html`;
|
Content-type: text/html`;
|
||||||
} else {
|
} else {
|
||||||
const errpage = doErrorPage();
|
const errpage = wtvshared.doErrorPage();
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,10 @@ const minisrv_service_file = true;
|
|||||||
const wtvbgm = new WTVBGMusic(minisrv_config, session_data);
|
const wtvbgm = new WTVBGMusic(minisrv_config, session_data);
|
||||||
|
|
||||||
if (request_headers.query && session_data) {
|
if (request_headers.query && session_data) {
|
||||||
|
let music_obj = wtvbgm.getMusicObj();
|
||||||
|
const old_music_obj = Object.assign({}, music_obj);
|
||||||
if (request_headers.request_url.indexOf('?') >= 0) {
|
if (request_headers.request_url.indexOf('?') >= 0) {
|
||||||
const category = (request_headers.query.category) ? request_headers.query.category : null;
|
const category = (request_headers.query.category) ? request_headers.query.category : null;
|
||||||
const music_obj = wtvbgm.getMusicObj();
|
|
||||||
|
|
||||||
if (category == null) music_obj.enableCategories = [];
|
if (category == null) music_obj.enableCategories = [];
|
||||||
else {
|
else {
|
||||||
@@ -52,7 +52,7 @@ wtv-backgroundmusic-load-playlist: wtv-setup:/get-playlist`;
|
|||||||
Content-type: text/html`;
|
Content-type: text/html`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const outdata = doErrorPage();
|
const outdata = wtvshared.doErrorPage();
|
||||||
headers = outdata[0];
|
headers = outdata[0];
|
||||||
data = outdata[1];
|
data = outdata[1];
|
||||||
}
|
}
|
||||||
@@ -7,14 +7,14 @@ let user_id = null;
|
|||||||
if (request_headers.query.user_id) {
|
if (request_headers.query.user_id) {
|
||||||
user_id = request_headers.query.user_id;
|
user_id = request_headers.query.user_id;
|
||||||
} else {
|
} else {
|
||||||
errpage = doErrorPage(400, "User was not specified.");
|
errpage = wtvshared.doErrorPage(400, "User was not specified.");
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||||
user_id = null; // force unset
|
user_id = null; // force unset
|
||||||
errpage = doErrorPage(400, "You are not authorized to edit the selected user.");
|
errpage = wtvshared.doErrorPage(400, "You are not authorized to edit the selected user.");
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ Content-Type: text/html`
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!userSession.loadSessionData()) {
|
if (!userSession.loadSessionData()) {
|
||||||
errpage = doErrorPage(400, "Invalid user ID.");
|
errpage = wtvshared.doErrorPage(400, "Invalid user ID.");
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ if (request_headers.query && session_data) {
|
|||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-type: text/html`
|
Content-type: text/html`
|
||||||
} else {
|
} else {
|
||||||
const outdata = doErrorPage();
|
const outdata = wtvshared.doErrorPage();
|
||||||
headers = outdata[0];
|
headers = outdata[0];
|
||||||
data = outdata[1];
|
data = outdata[1];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ if (Object.keys(session_data.listPrimaryAccountUsers()).length == 1) {
|
|||||||
}
|
}
|
||||||
else if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to remove users from this account.");
|
else if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to remove users from this account.");
|
||||||
|
|
||||||
var usersToRemove = [];
|
const usersToRemove = [];
|
||||||
Object.keys(request_headers.query).forEach(function (k) {
|
Object.keys(request_headers.query).forEach(function (k) {
|
||||||
if (k.substr(0, 4) === "user" && request_headers.query[k] === "on") {
|
if (k.substr(0, 4) === "user" && request_headers.query[k] === "on") {
|
||||||
usersToRemove.push(parseInt(k.replace("user", "")));
|
usersToRemove.push(parseInt(k.replace("user", "")));
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ if (!session_data.getUserPasswordEnabled()) {
|
|||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else if (session_data.getUserPasswordEnabled() && session_data.user_id === 0 && request_headers.query.ssid && request_headers.query.password) {
|
} else if (session_data.getUserPasswordEnabled() && session_data.user_id === 0 && request_headers.query.ssid && request_headers.query.password) {
|
||||||
validPassword = session_data.validateUserPassword(request_headers.query.password);
|
const validPassword = session_data.validateUserPassword(request_headers.query.password);
|
||||||
if (!validPassword) {
|
if (!validPassword) {
|
||||||
const errpage = wtvshared.doErrorPage(400, "Incorrect Password");
|
const errpage = wtvshared.doErrorPage(400, "Incorrect Password");
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
|
|
||||||
const fast_splash = wtvshared.parseBool(request_headers.query.fast_splash);
|
const fast_splash = wtvshared.parseBool(request_headers.query.fast_splash);
|
||||||
|
|||||||
Reference in New Issue
Block a user