Skip to content

Commit

Permalink
index.php/lib_mods (modrinth), send_mods.php: use current mcversion i…
Browse files Browse the repository at this point in the history
…f mod is missing it
  • Loading branch information
cowpod committed Nov 13, 2024
1 parent 985aa04 commit 06a8aaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions functions/send_mods.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ function processFile(string $filePath, string $fileName, array $modinfo): int {

$mi = new modInfo();
$modinfos = $mi->getModInfo($file_tmp, $file_name);
error_log(json_encode($modinfos));
$warn = $mi->getWarnings();

foreach ($modinfos as $type=>$mod) {
if (!empty($mod) && empty($mod['mcversion'])) {
assert($_POST['fallback_mcversion']);
$modinfos[$type]['mcversion']=$db->sanitize($_POST['fallback_mcversion']);
unset($warn[array_search('Missing mcversion!', array_keys($warn))]);
}
}

$added_ids=[];
$added_modids=[];
Expand All @@ -189,7 +197,6 @@ function processFile(string $filePath, string $fileName, array $modinfo): int {
$added_mcversions=[];
$num_mods_to_add=sizeof($modinfos);

$warn = $mi->getWarnings();
$num_already_added=0;
$num_process_failed=0;

Expand Down
2 changes: 1 addition & 1 deletion resources/js/page_lib-mods.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function getdescription(id) {
showdetails(id);
} else if (get_cached('details_'+id)) {
console.log('got cached details from localstorage');
details[id]=JSON.parse(localStorage['details_'+id]);
details[id] = JSON.parse(get_cached('details_'+id));
showdetails(id);
} else {
var request = new XMLHttpRequest();
Expand Down

0 comments on commit 06a8aaf

Please sign in to comment.