From 985aa0427c346e83f8d9f5643dde9e7531fbef50 Mon Sep 17 00:00:00 2001
From: Henry Gross-Hellsen <6283258+cowpod@users.noreply.github.com>
Date: Wed, 13 Nov 2024 15:03:30 -0800
Subject: [PATCH] hide some table elements on mobile, dynamic ui for /build,
expose db id in api
---
api/index.php | 4 +-
functions/change_show_all.php | 11 ---
index.php | 159 +++++++++-----------------------
resources/js/global.js | 38 +++++++-
resources/js/page_build.js | 136 +++++++++++++++++++--------
resources/js/page_lib-mods.js | 29 +++---
resources/js/page_modloaders.js | 2 +-
resources/js/page_modpack.js | 14 ++-
8 files changed, 206 insertions(+), 187 deletions(-)
delete mode 100644 functions/change_show_all.php
diff --git a/api/index.php b/api/index.php
index 7da9cd6..1921a44 100644
--- a/api/index.php
+++ b/api/index.php
@@ -75,8 +75,10 @@
$modq = $db->query("SELECT * FROM mods");
if ($modq) {
foreach ($modq as $mod) {
+ if ($mod['type']!='mod') continue;
$filesize = isset($mod['filesize']) ? $mod['filesize'] : 0;
$modentry = [
+ 'id'=>$mod['id'],
'pretty_name'=>$mod['pretty_name'],
'name'=>$mod['name'],
'version'=>$mod['version'],
@@ -86,7 +88,7 @@
'filesize'=>$filesize
];
- array_push($modslist,$modentry);
+ array_push($modslist, $modentry);
}
}
echo json_encode($modslist, JSON_UNESCAPED_SLASHES);
diff --git a/functions/change_show_all.php b/functions/change_show_all.php
deleted file mode 100644
index a5c3ea6..0000000
--- a/functions/change_show_all.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
Builds
-
+
-
Build
+
Name
Minecraft
-
Java
+
Java
Mods
@@ -1104,7 +1104,7 @@ function uri($uri) {
" id="b-">
-
+
@@ -1292,9 +1292,8 @@ function uri($uri) {
Mod Name
Version
-
Minecraft
+
Minecraft
-
@@ -1343,11 +1342,20 @@ function uri($uri) {
echo ': For Minecraft '.$mod['mcversion'].', you have '.$user['minecraft'].'. May not be compatible!';
}
?>
-
-
- query("SELECT * FROM mods WHERE type = 'mod' AND loadertype = '".$loadertype."'");
- // todo: use a group-by?
-
- $name_version_details=[]; // [serialize([name,prettyname])=>[id,version,mcversion],...]
-
- if ($mods_compatq && sizeof($mods_compatq)>0) {
- foreach($mods_compatq as $mod){
- // skip if any version of this mod is already in build
- if (in_array($mod['name'], $modsluglist))
- continue;
-
- // skip incompatible mods as long as we're not showing all
- if (!in_range($mod['mcversion'], $user['minecraft']) && (empty($_SESSION['showall']) || !$_SESSION['showall']))
- continue;
-
- $tuple=serialize([$mod['name'],$mod['pretty_name']]);
-
- if (empty($name_version_details[$tuple])) {
- $name_version_details[$tuple]=[];
- }
-
- array_push($name_version_details[$tuple], [$mod['id'], !empty($mod['version']) ? $mod['version'] : '', $mod['mcversion']]);
- }
- }
-
- if (sizeof($name_version_details)==0) {
- echo "
There are no mods available for this version. Upload mods in Mod Library.