From fa693aba7ce2de94af580b30a4fe38145f13e2a3 Mon Sep 17 00:00:00 2001 From: Catalin Ta Date: Thu, 18 Jan 2024 18:34:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20version:=201.8.5-b=20chang?= =?UTF-8?q?es=20w/=20web=20release=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 2 +- package.json | 2 +- routes/index.js | 34 +++++++++++++++++++++++++++++++++ views/admin/panel.ejs | 3 +-- views/index.ejs | 11 +++++++++-- views/release.ejs | 44 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 views/release.ejs diff --git a/package-lock.json b/package-lock.json index c9705d3..a12cb5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "eres-main", - "version": "1.8.2-b", + "version": "1.8.5-b", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index a4f13da..a9c2162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eres-main", - "version": "1.8.2-b", + "version": "1.8.5-b", "description": "🍍 Eres; new Discord application with modern web dashboard and new features for your community.", "main": "bot.js", "scripts": { diff --git a/routes/index.js b/routes/index.js index bdb3ce7..2ac34da 100644 --- a/routes/index.js +++ b/routes/index.js @@ -43,6 +43,40 @@ router.get('/tos', async (req, res) => { }); }); +router.get('/release', async (req, res) => { + // Set owner and repo variables + const owner = 'skillzl'; + const repo = 'eres'; + + // Construct the URL for fetching the latest release + const url = `https://api.github.com/repos/${owner}/${repo}/releases/latest`; + + // Add headers for the fetch request + const headers = { + 'Authorization': `token ${process.env.GITHUB_TOKEN}`, + }; + + const response = await fetch(url, { headers }); + const data = await response.json(); + + // Extract only the necessary information + const release = { + tagName: data.tag_name, + name: data.name, + publishedAt: data.published_at, + body: data.body, + author: data.author.login, + avatarUrl: data.author.avatar_url, + }; + + res.render('release', { + tag: (req.user ? req.user.tag : 'Login'), + bot: req.client, + user: req.user || null, + release: release, + }); +}); + router.get('/admin/panel', checkAuth, async (req, res) => { // Check if the user is allowed if (req.user.id !== process.env.DEVELOPER_ID) { diff --git a/views/admin/panel.ejs b/views/admin/panel.ejs index 33a1cbc..0dae062 100644 --- a/views/admin/panel.ejs +++ b/views/admin/panel.ejs @@ -205,10 +205,9 @@
- - +