Skip to content

Commit

Permalink
2.1.11
Browse files Browse the repository at this point in the history
- Fixed colors in console
- Plugins repo rewritten to use Modrinth API
- Removed some unwanted elements
  • Loading branch information
Seeroy committed Aug 19, 2023
1 parent 54c2dc0 commit d98bf85
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 96 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Kubek version
global.kubek_version = "v2.1.10";
global.kubek_version = "v2.1.11";

// Variables and constants initialization
global.pendingTasks = {};
Expand Down
4 changes: 2 additions & 2 deletions 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": "kubek-minecraft-dashboard",
"version": "2.1.10",
"version": "2.1.11",
"description": "",
"main": "app.js",
"author": "",
Expand Down
15 changes: 9 additions & 6 deletions www/pages/console.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
grid-template-rows: 0.95fr;
gap: 0px 1em;
grid-auto-flow: row;
grid-template-areas:
"main-console additional-blocks";
grid-template-areas: "main-console additional-blocks";
}

.console-container .main-console-grid .main-console {
Expand All @@ -26,6 +25,10 @@
grid-area: additional-blocks;
}

.console-container #console-text * {
color: rgb(245, 245, 245);
}

/* Micro blocks */
.micro-block {
display: grid;
Expand Down Expand Up @@ -55,7 +58,7 @@
grid-area: label;
font-size: 12pt;
font-weight: 400;
align-self: end;
align-self: end;
}

.micro-block .percent {
Expand All @@ -78,10 +81,10 @@

.mono-font,
.mono-font span {
font-family: 'Roboto Mono Regular' !important;
font-family: "Roboto Mono Regular" !important;
}

.consolas-font,
.consolas-font span {
font-family: 'Consolas' !important;
}
font-family: "Consolas" !important;
}
27 changes: 3 additions & 24 deletions www/pages/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,10 @@ function setCTFontFamily(fs) {
function refreshConsole(data) {
split = data.split(/\r?\n/);
$("#console-text").html("");

split.forEach(function (line) {
line = mineParse(line.replaceAll("<", "&lt;")).parsed.innerHTML;

htmlObject = document.createElement("div");
htmlObject.innerHTML = line;
if (htmlObject.firstChild.firstChild != null) {
html_text =
htmlObject.firstChild.firstChild.wholeText.replaceAll("<", "&lt;") +
"<br>";
if (htmlObject.firstChild.style.color != "") {
stl = "color:" + htmlObject.firstChild.style.color + " !important;";
} else {
stl = "";
}
html_text = linkify(html_text);
html_text =
"<span class='text-black dark:text-white' style='" +
stl +
"'>" +
html_text +
"</span>";

$("#console-text").html($("#console-text").html() + html_text);
}
html_text = linkify(mineParse(line).raw) + "<br>";
$("#console-text").html($("#console-text").html() + html_text);
});
if ($("#autoscrollConsoleCheckbox").is(":checked")) {
$("#console-text").scrollTop($("#console-text")[0].scrollHeight);
Expand Down
39 changes: 1 addition & 38 deletions www/pages/file_manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,44 +118,7 @@
<th scope="col" class="px-6 py-3"></th>
</tr>
</thead>
<tbody>
<tr class="bg-white dark:bg-gray-800 glassmorphed">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
<div class="flex items-center">
<i class="ri-information-line text-xl"></i>
<span style="margin-left: 16px">Kubek Uptime</span>
</div>
</th>
<td class="px-6 py-4" id="kubek-uptime">{{unknown}}</td>
</tr>
<tr class="bg-white dark:bg-gray-800 glassmorphed">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
<div class="flex items-center">
<i class="ri-information-line text-xl"></i>
<span style="margin-left: 16px">{{os-sysmon}}</span>
</div>
</th>
<td class="px-6 py-4" id="os-name">{{unknown}}</td>
</tr>
<tr class="bg-white dark:bg-gray-800 glassmorphed">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
<div class="flex items-center">
<i class="ri-information-line text-xl"></i>
<span style="margin-left: 16px">{{osbuild-sysmon}}</span>
</div>
</th>
<td class="px-6 py-4" id="os-build">{{unknown}}</td>
</tr>
</tbody>
<tbody></tbody>
</table>
</div>
</div>
Expand Down
14 changes: 9 additions & 5 deletions www/pages/mods.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
onclick="uploadPlugin()"
class="py-2.5 px-5 mr-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none glassmorphed dark:text-gray-400"
>
<i class="ri-upload-2-line"></i>
<i class="ri-upload-2-line text-xl text-white"></i>
</button>
</div>

Expand All @@ -60,18 +60,22 @@
class="w-full text-sm text-left text-gray-500 dark:text-gray-400"
>
<tbody>
<tr class="bg-white dark:bg-gray-800 glassmorphed cursor-pointer" onclick="gotoPage('plugins_repo')">
<tr
class="bg-white dark:bg-gray-800 glassmorphed cursor-pointer"
onclick="gotoPage('plugins_repo')"
>
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
<div class="flex items-center">
<i class="ri-play-list-add-line text-xl"></i>
<span style="margin-left: 16px">{{plugins-repo}}</span>
<span class="bg-blue-100 text-blue-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300 ml-2">NEW</span>
</div>
</th>
<td class="px-1"><i class="ri-arrow-right-s-line"></i></td>
<td class="px-1">
<i class="ri-arrow-right-s-line text-lg"></i>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -99,7 +103,7 @@
onclick="uploadMod()"
class="py-2.5 px-5 mr-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none glassmorphed dark:text-gray-400"
>
<i class="ri-upload-2-line"></i>
<i class="ri-upload-2-line text-xl text-white"></i>
</button>
</div>

Expand Down
48 changes: 29 additions & 19 deletions www/pages/plugins_repo.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
var PR_LIST_URL =
"https://api.spiget.org/v2/resources/free?size=20&sort=-downloads";
"https://api.modrinth.com/v2/search?filters=categories=paper%20OR%20categories=spigot";
var PR_SEARCH_URL =
"https://api.spiget.org/v2/search/resources/$?size=20&sort=-downloads&fields=url%2CexternalUrl%2Cname%2Cicon%2Cfile%2Crating%2Cdownloads%2Ctag";
"https://api.modrinth.com/v2/search?filters=categories=paper%20OR%20categories=spigot&query=$";
var PR_TABLE_PLACEHOLDER =
'<tr class="bg-white dark:bg-gray-800 glassmorphed"> <th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white max-w-sm tr-placeholder" > <div class="flex items-center"> <div class="flex items-center justify-center bg-gray-300 rounded dark:bg-gray-700" style="width: 64px; height: 64px" > <svg class="text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="height: 32px; width: 32px;" fill="currentColor" viewBox="0 0 640 512" > <path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z" /> </svg> </div> <div class="flex flex-col justify-center" style="margin-left: 16px" > <div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4" ></div> <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5" ></div> <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700" ></div> </div> </div> </th> <td></td> </tr>';
'<tr class="bg-white dark:bg-gray-800 glassmorphed"> <th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white max-w-sm tr-placeholder"> <div class="flex items-center"> <div class="flex items-center justify-center bg-gray-300 rounded dark:bg-gray-700" style="width: 64px; height: 64px" > <svg class="text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="height: 32px; width: 32px;" fill="currentColor" viewBox="0 0 640 512" > <path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z" /> </svg> </div> <div class="flex flex-col justify-center" style="margin-left: 16px" > <div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4" ></div> <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5" ></div> <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700" ></div> </div> </div> </th> <td></td> </tr>';
var PR_IMAGE_PLACEHOLDER =
'<div class="flex items-center justify-center bg-gray-300 rounded dark:bg-gray-700" style="width: 64px; height: 64px" > <svg class="text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="height: 32px; width: 32px;" fill="currentColor" viewBox="0 0 640 512" > <path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z" /> </svg> </div>';
var currentPage = 1;
var currentPage = 0;
var limit = 20;

var currentMode = "";

Expand All @@ -23,10 +24,15 @@ $(document).ready(function () {
loadPluginsList();
}, 100);

$("#search-input").keydown(function (e) {
if (e.originalEvent.keyCode == 13) {
$("#search-input").keyup(function (e) {
if ($(this).val() != "" && e.originalEvent.keyCode == 13) {
searchPlugins();
}
if($(this).val() == ""){
currentMode = "popular";
currentPage = 0;
loadPluginsList();
}
});

$("#search-btn").click(function (e) {
Expand All @@ -41,10 +47,10 @@ function loadPluginsList() {
}
animateTopbar(25, 50);
currentMode = "popular";
$.get(PR_LIST_URL + "&page=" + currentPage, function (data) {
$.get(PR_LIST_URL + "&offset=" + currentPage * limit, function (data) {
animateTopbar(70, 50);
$("#plugins-list").html("");
fillTableFromData(data);
fillTableFromData(data.hits);
animateTopbar(100, 10);
setTimeout(function () {
animateTopbar(0, 5);
Expand All @@ -62,42 +68,46 @@ function searchPlugins() {
currentMode = "search";
$.get(
PR_SEARCH_URL.replace(/\$/gm, $("#search-input").val().trim()) +
"&page=" +
currentPage,
"&offset=" +
currentPage * limit,
function (data) {
animateTopbar(70, 50);
$("#plugins-list").html("");
fillTableFromData(data);
fillTableFromData(data.hits);
animateTopbar(100, 10);
setTimeout(function () {
animateTopbar(0, 5);
}, 11);
}
);
} else {
currentMode = "popular";
currentPage = 0;
loadPluginsList();
}
}

function fillTableFromData(data){
data.forEach((item) => {
if (
item.icon.data.length > 0
typeof item.icon_url !== "undefined"
) {
imgCode =
'<img style="height: 64px; width: 64px;" src="data:image/png;base64, ' +
item.icon.data +
'<img style="height: 64px; width: 64px;" src="' +
item.icon_url +
'">';
} else {
imgCode = PR_IMAGE_PLACEHOLDER;
}
$("#plugins-list").append(
'<tr class="bg-white dark:bg-gray-800 glassmorphed cursor-pointer" onclick="' + 'window.open(`https://spigotmc.org/' + item.file.url + '`, `_blank`)' + '"> <th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"> <div class="flex items-center"> ' + imgCode + ' <div class="flex flex-col justify-center" style="margin-left: 16px"> <span class="text-xl font-semibold">' +
item.name +
'<tr class="bg-white dark:bg-gray-800 glassmorphed cursor-pointer"> <th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white" onclick="window.open(`https://modrinth.com/plugin/' + item.slug + '`,`blank`)"> <div class="flex items-center"> ' + imgCode + ' <div class="flex flex-col justify-center" style="margin-left: 16px"> <span class="text-xl font-semibold">' +
item.title +
'</span> <span class="text-md mb-1 hide-on-mobile">' +
item.tag +
item.description +
'</span> <div class="flex items-center"> <i class="ri-download-line text-gray-400"></i> <span class="ml-1">' +
item.downloads +
'</span> <i class="ri-star-fill text-yellow-300 ml-3"></i> <span class="ml-1">' +
item.rating.average.toFixed(2) +
item.follows +
'</span> </div> </div> </div> </th> <td class="px-4" style="text-align: end;"></td> </tr>'
);
});
Expand All @@ -115,7 +125,7 @@ function nextPage() {
}

function previousPage() {
if (currentPage > 1) {
if (currentPage > 0) {
currentPage--;
}
if (currentMode == "popular") {
Expand Down

0 comments on commit d98bf85

Please sign in to comment.