diff --git a/functions/send_mods.php b/functions/send_mods.php index 8a65ec0..8d930c8 100644 --- a/functions/send_mods.php +++ b/functions/send_mods.php @@ -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=[]; @@ -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; diff --git a/resources/js/page_lib-mods.js b/resources/js/page_lib-mods.js index 7d6929b..c3eb4e8 100644 --- a/resources/js/page_lib-mods.js +++ b/resources/js/page_lib-mods.js @@ -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();