Skip to content

Commit

Permalink
⬆️ version: 1.8.5-b changes w/ web release page
Browse files Browse the repository at this point in the history
  • Loading branch information
skillzl committed Jan 18, 2024
1 parent 0face4c commit fa693ab
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
34 changes: 34 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions views/admin/panel.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,9 @@
<div class="loader size-5"></div>
</div>
</div>
</div>
</div>
</div>

</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$('#logs-button').click(function() {
Expand Down
11 changes: 9 additions & 2 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@
</div>
<% } else { %>
<div class="px-4 py-16 mx-auto sm:max-w-xl md:max-w-full lg:max-w-screen-xl md:px-24 lg:px-8 lg:py-20">
<div class="flex justify-center mb-10">
<a href="/release">
<button type="button" class="rounded-full px-4 mr-2 bg-[#aaaaaa10] border border-[#aaaaaa10] text-white p-2 leading-none flex items-center hover:-translate-y-0.5 duration-300">
<%= eresName %>@<%= eresVersion %> is live! <span class="mx-3 text-gray-500"> | </span><span class="text-cyan-300">see what's new <i class="fa-solid fa-arrow-right text-gray-300"></i></span>
</button>
</a>
</div>
<div class="flex justify-center">
<a href="/"><img src="/static/eres-crop.png" alt="eres.fun logo" class="navicon-fade" width="78" height="auto"></a>
<a href="/"><img src="/static/eres-crop.png" alt="eres.fun logo" class="navicon-fade" width="78" height="auto"></a>
</div>
<div class="max-w-xl sm:mx-auto lg:max-w-2xl">
<div class="flex flex-col mb-16 sm:text-center sm:mb-0">
Expand Down Expand Up @@ -230,7 +237,7 @@
<h1 class="text-xl font-semibold text-white">What is the current version of the application?</h1>
<p class="mt-2 text-sm text-gray-300">
At this moment you are running on <%= eresName %><%= eresVersion %>. The current version is stil in beta so, a lot of features are still in progress. Also you may encounter bugs so if you are trying to help, report them.
At this moment you are running on <%= eresName %>@<%= eresVersion %>. The current version is stil in beta so, a lot of features are still in progress. Also you may encounter bugs so if you are trying to help, report them.
</p>
</div>
</div>
Expand Down
44 changes: 44 additions & 0 deletions views/release.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<%- include("partials/header") %>

<title><%= bot.user.username.toLowerCase() %>.fun - release</title>

<body>
<div class="container mx-auto">
<div class="rounded-xl bg-[#aaaaaa10] border border-[#aaaaaa10] shadow-lg text-white p-6 mt-3">
<div>
<%
const owner = 'skillzl';
const repo = 'eres';
%>

<a href="https://github.com/<%= owner %>/<%= repo %>/releases/tag/<%= release.tagName %>">
<button type="button" class="rounded-full px-4 mr-2 bg-[#aaaaaa10] border border-[#aaaaaa10] text-white p-2 leading-none flex items-center hover:-translate-y-0.5 duration-300">
<%= release.tagName %> release <span class="mx-3 text-gray-500"> | </span><span class="text-cyan-300">see on github <i class="fa-solid fa-arrow-right text-gray-300"></i></span>
</button>
</a>
</div>
<div class="text-white mt-3">
<h1>release name: <%= release.name %></h1>
<p>published at: <%= release.publishedAt %></p>
<ul>
<% release.body.split('\n').forEach(function(line) { %>
<% if (line.startsWith('-')) { %>
<li><span class="text-gray-400 mx-2"></span><%= line.slice(1).trim() %></li>
<% } else { %>
<p class="mt-2"><%= line %></p>
<% } %>
<% }); %>
</ul>
<div class="mt-3">
<a href="https://github.com/<%= release.author %>">
<button type="button" class="rounded-full px-10 mr-2 bg-[#aaaaaa10] border border-[#aaaaaa10] text-white p-2 leading-none flex items-center hover:-translate-y-0.5 duration-300">
<img src="<%= release.avatarUrl %>" alt="Author's avatar" class="-ml-8 size-8 rounded-full"> <span class="pl-4"><%= release.author %></span>
</button>
</a>
</div>
</div>
</div>
</div>
</body>

<%- include("partials/footer") %>

0 comments on commit fa693ab

Please sign in to comment.