LawinServer News Tab for CH2 & CH3

Furthermore:
- Fixed the playlist images not loading on some builds.
- Added the original solo, duo and squads images.
- Fixed not being able to press "Play" when StW was selected via the discovery menu on latest.
- Fixed the translations not diplaying for the Portugese (Brazil) language.
This commit is contained in:
PRO100KatYT
2022-07-21 15:00:15 +02:00
parent 7ce5e9035f
commit 4b2ee884f4
13 changed files with 397 additions and 23 deletions

View File

@@ -8,4 +8,27 @@ express.get("/content/api/pages/*", async (req, res) => {
res.json(contentpages)
})
express.post("/api/v1/fortnite-br/surfaces/motd/target", async (req, res) => {
const motdTarget = JSON.parse(JSON.stringify(require("./../responses/motdTarget.json")));
var Language = "en";
if (req.body.language) {
if (req.body.language.includes("-") && req.body.language != "es-419" && req.body.language != "pt-BR") {
Language = req.body.language.split("-")[0];
} else {
Language = req.body.language;
}
}
try {
motdTarget.contentItems.forEach(item => {
item.contentFields.title = item.contentFields.title[Language];
item.contentFields.body = item.contentFields.body[Language];
})
} catch (err) {}
res.json(motdTarget)
})
module.exports = express;

View File

@@ -2,7 +2,7 @@ const Express = require("express");
const express = Express.Router();
const discovery = require("./../responses/discovery/discovery_frontend.json");
express.post("*discovery/surface/*", async (req, res) => {
express.post("*/discovery/surface/*", async (req, res) => {
res.json(discovery);
})
@@ -11,7 +11,6 @@ express.post("/links/api/fn/mnemonic", async (req, res) => {
for (var i in discovery.Panels[0].Pages[0].results) {
MnemonicArray.push(discovery.Panels[0].Pages[0].results[i].linkData)
console.log(discovery.Panels[0].Pages[0].results[i].linkData.mnemonic);
}
res.json(MnemonicArray);
@@ -19,7 +18,6 @@ express.post("/links/api/fn/mnemonic", async (req, res) => {
express.get("/links/api/fn/mnemonic/*", async (req, res) => {
for (var i in discovery.Panels[0].Pages[0].results) {
console.log(discovery.Panels[0].Pages[0].results[i].linkData.mnemonic);
if (discovery.Panels[0].Pages[0].results[i].linkData.mnemonic == req.url.split("/").slice(-1)[0]) {
res.json(discovery.Panels[0].Pages[0].results[i].linkData);
}

View File

@@ -191,7 +191,7 @@ function getContentPages(req) {
var Language = "en";
if (req.headers["accept-language"]) {
if (req.headers["accept-language"].includes("-") && req.headers["accept-language"] != "es-419") {
if (req.headers["accept-language"].includes("-") && req.headers["accept-language"] != "es-419" && req.headers["accept-language"] != "pt-BR") {
Language = req.headers["accept-language"].split("-")[0];
} else {
Language = req.headers["accept-language"];
@@ -200,6 +200,7 @@ function getContentPages(req) {
const modes = ["saveTheWorldUnowned", "battleRoyale", "creative", "saveTheWorld"];
const news = ["savetheworldnews", "battleroyalenews"]
const motdnews = ["battleroyalenews", "battleroyalenewsv2"]
try {
modes.forEach(mode => {
@@ -217,6 +218,15 @@ function getContentPages(req) {
}
} catch (err) {}
try {
motdnews.forEach(news => {
contentpages[news].news.motds.forEach(motd => {
motd.title = motd.title[Language];
motd.body = motd.body[Language];
})
})
} catch (err) {}
try {
contentpages.dynamicbackgrounds.backgrounds.backgrounds[0].stage = `season${memory.season}`;
contentpages.dynamicbackgrounds.backgrounds.backgrounds[1].stage = `season${memory.season}`;