From cf7478e43c1cc39eb45f2f02a96ef131acfeb425 Mon Sep 17 00:00:00 2001 From: fcaps Date: Sun, 19 Nov 2023 08:47:52 +0100 Subject: [PATCH] removed dead code, since we have to re-implement it differently. related #475 --- express.js | 9 --------- public/js/app/index.js | 12 ----------- scripts/getRecentUsers.js | 42 --------------------------------------- templates/views/index.pug | 7 +------ 4 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 public/js/app/index.js delete mode 100644 scripts/getRecentUsers.js diff --git a/express.js b/express.js index 1eb3bfc6..f029bd13 100644 --- a/express.js +++ b/express.js @@ -188,15 +188,6 @@ for (let i = 0; i < requireRunArray.length; i++) { } }, appConfig.extractorInterval * 60 * 1000); } -setInterval(() => { - try { - require(`./scripts/getRecentUsers`).run(); - - } catch (e) { - console.error(`getRecentUsers script caused the error`, e); - } -}, appConfig.playerCountInterval * 1000); - //404 Error Handlers app.use(function (req, res) { diff --git a/public/js/app/index.js b/public/js/app/index.js deleted file mode 100644 index 9fb3dab7..00000000 --- a/public/js/app/index.js +++ /dev/null @@ -1,12 +0,0 @@ -async function playerCounterJSON() { - const response = await fetch('js/app/members/recentUsers.json'); - const data = await response.json(); - return data; -} - -playerCounterJSON() - .then((data) => { - // disabled due https://github.com/FAForever/website/issues/445 - // document.getElementById('playerCounter').insertAdjacentHTML("afterbegin", data.length); - document.getElementById('playerCounter').insertAdjacentHTML("afterbegin", "MANY"); - }); diff --git a/scripts/getRecentUsers.js b/scripts/getRecentUsers.js deleted file mode 100644 index 889986fa..00000000 --- a/scripts/getRecentUsers.js +++ /dev/null @@ -1,42 +0,0 @@ -require('dotenv').config(); - -// /data/game?filter=endTime=gt=date.toISOString() &include=playerStats.player&fields[player]=login &sort=-endTime - -const fs = require('fs'); -const fetch = require('node-fetch'); - -let d = new Date(); -let timeFilter = 1; -let minusTimeFilter = d.setHours(d.getHours() - timeFilter); -let currentDate = new Date(minusTimeFilter).toISOString(); - - -async function getRecentUsers() { - - return [] - // disabled due https://github.com/FAForever/website/issues/445 - // try { - // let response = await fetch(`${process.env.API_URL}/data/leaderboardRating?filter=updateTime=gt=${currentDate}&page[size]=5000`); - // let fetchData = await response.json(); - // //Now we get a js array rather than a js object. Otherwise we can't sort it out. - // let dataObjectToArray = Object.values(fetchData); - // let data = dataObjectToArray[0].map((item)=> ({ - // playerID: item.id - // })); - // return await data; - // }catch (e) { - // console.log(e); - // return null; - // } -} - -module.exports.run = function run() { - getRecentUsers() - .then(data => { - fs.writeFile(`public/js/app/members/recentUsers.json`, JSON.stringify(data), error => { - if (error) { - console.log(error); - } - }); - }); -}; diff --git a/templates/views/index.pug b/templates/views/index.pug index c07e6696..346348f1 100644 --- a/templates/views/index.pug +++ b/templates/views/index.pug @@ -3,7 +3,7 @@ block bannerData - var bannerImage = "home" - var bannerFirstTitle = "AN RTS CLASSIC REFORGED" - var bannerSecondTitle = "MASSIVE SCALE WARFARE" - - var bannerSubTitle = "" + " " + "COMMANDERS PLAYING RIGHT NOW" + - var bannerSubTitle = "MANY COMMANDERS PLAYING RIGHT NOW" block banner mixin banner() .mainBannerContainer(class= bannerImage + 'Banner' style='background-image: url(../images/banner/' + bannerImage + '.webp);') @@ -120,8 +120,3 @@ block content button PLAY NOW a(href='https://discord.gg/mXahVSKGVb') button Join our Discord - -block js - script(src="../../js/app/index.js") - -