From a20cb343f1ee76a461cd3138d20c720845727420 Mon Sep 17 00:00:00 2001 From: PRO100KatYT <67335438+PRO100KatYT@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:24:08 +0100 Subject: [PATCH] Fixed MOTD not appearing on latest --- .../Athena/Discovery/discovery_frontend.json | 10 +++++++ responses/Athena/motd.json | 2 +- structure/contentpages.js | 28 ++++++++++++++----- structure/functions.js | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/responses/Athena/Discovery/discovery_frontend.json b/responses/Athena/Discovery/discovery_frontend.json index 74d928e..8b31fb0 100644 --- a/responses/Athena/Discovery/discovery_frontend.json +++ b/responses/Athena/Discovery/discovery_frontend.json @@ -340,7 +340,9 @@ "accountId": "epic", "creatorName": "Epic", "descriptionTags": [], + "discoveryIntent": "PUBLIC", "metadata": { + "product_tag": "Product.LawinServer", "image_url": "https://cdn2.unrealengine.com/solo-1920x1080-1920x1080-bc0a5455ce20.jpg", "alt_introduction": { "ar": "انطلق وحدك في معركة لتصبح آخر لاعب صامد.", @@ -418,7 +420,9 @@ "accountId": "epic", "creatorName": "Epic", "descriptionTags": [], + "discoveryIntent": "PUBLIC", "metadata": { + "product_tag": "Product.LawinServer", "image_url": "https://cdn2.unrealengine.com/duos-1920x1080-1920x1080-5a411fe07b21.jpg", "alt_introduction": { "ar": "تعاون مع أحد الأصدقاء واقض على الجميع.", @@ -496,7 +500,9 @@ "accountId": "epic", "creatorName": "Epic", "descriptionTags": [], + "discoveryIntent": "PUBLIC", "metadata": { + "product_tag": "Product.LawinServer", "image_url": "https://cdn2.unrealengine.com/trios-1920x1080-1920x1080-d5054bb9691a.jpg", "alt_introduction": { "ar": "باتل رويال الكلاسيكية بفرق مكونة من ثلاثة أشخاص.", @@ -574,7 +580,9 @@ "accountId": "epic", "creatorName": "Epic", "descriptionTags": [], + "discoveryIntent": "PUBLIC", "metadata": { + "product_tag": "Product.LawinServer", "image_url": "https://cdn2.unrealengine.com/squads-1920x1080-1920x1080-095c0732502e.jpg", "alt_introduction": { "ar": "انضم لمجموعة وتفوق على جميع الفرق الأخرى التي تقاتل للوصول للنصر.", @@ -654,7 +662,9 @@ "descriptionTags": [ "pve" ], + "discoveryIntent": "PUBLIC", "metadata": { + "product_tag": "Product.LawinServer", "ownership_token": "Token:campaignaccess", "image_url": "https://cdn2.unrealengine.com/stw-1920-1920x1080-5a049ecca449.jpg", "alt_introduction": { diff --git a/responses/Athena/motd.json b/responses/Athena/motd.json index e36f554..a4fb8d7 100644 --- a/responses/Athena/motd.json +++ b/responses/Athena/motd.json @@ -26,7 +26,7 @@ }, "FullScreenBody": { "ar": "استمتع بتجربة لعب استثنائية!\nDiscord: https://discord.gg/KJ8UaHZ", - "en": "Have a phenomenal gaming experience\nDiscord: https://discord.gg/KJ8UaHZ!", + "en": "Have a phenomenal gaming experience\nDiscord: https://discord.gg/KJ8UaHZ", "de": "Wünsche allen ein wunderbares Spielerlebnis!\nDiscord: https://discord.gg/KJ8UaHZ", "es": "¡Que disfrutes de tu experiencia de videojuegos!\nDiscord: https://discord.gg/KJ8UaHZ", "es-419": "¡Ten una experiencia de juego espectacular!\nDiscord: https://discord.gg/KJ8UaHZ", diff --git a/structure/contentpages.js b/structure/contentpages.js index 0b2efa6..3ce157e 100644 --- a/structure/contentpages.js +++ b/structure/contentpages.js @@ -53,18 +53,32 @@ express.get("/content/api/pages/*", async (req, res) => { res.json(contentpages) }) -express.post("/api/v1/fortnite-br/surfaces/*/target", async (req, res) => { +express.post("/api/v1/fortnite-br/*/target", async (req, res) => { const motd = JSON.parse(JSON.stringify(require("./../responses/Athena/motd.json"))); const fields = ["title", "body", "TeaserTitle", "FullScreenTitle", "FullScreenBody"]; + var language = req.body.language || req.body.parameters.language; - try { - motd.contentItems.forEach(item => { - fields.forEach(field => { - item.contentFields[field] = item.contentFields[field][req.body.language]; - }) + motd.contentItems.forEach(item => { + fields.forEach(field => { + try { + item.contentFields[field] = item.contentFields[field][language]; + } catch (err) {} }) - } catch (err) {} + }) + if (req.body.hasOwnProperty("tags")) { + motd.contentItems.forEach(item => { + item.placements = []; + req.body.tags.forEach(tag => { + item.placements.push({ + "trackingId": "lawinstrackingidlol", + "tag": tag, + "position": 0 + }) + }) + }) + } + res.json(motd) }) diff --git a/structure/functions.js b/structure/functions.js index 681af8d..eeeee01 100644 --- a/structure/functions.js +++ b/structure/functions.js @@ -156,7 +156,7 @@ function getTheater(req) { try { if (memory.build >= 30.20) { // Those changes have to be made before the 15.30+ ones - theater = theater.replace(/\/Game\/World\/ZoneThemes/g, "/STW_Zones/World/ZoneThemes"); + theater = theater.replace(/\/Game\/World\/ZoneThemes/ig, "/STW_Zones/World/ZoneThemes"); theater = theater.replace(/\"DataTable\'\/Game\//ig, "\"/Script/Engine.DataTable\'\/Game\/"); }