diff --git a/archive/community.applications-2022.09.03-x86_64-1.txz b/archive/community.applications-2022.09.03-x86_64-1.txz new file mode 100644 index 00000000..4f7329cd Binary files /dev/null and b/archive/community.applications-2022.09.03-x86_64-1.txz differ diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page b/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page index 39d7177a..aec17f4b 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page @@ -1078,11 +1078,16 @@ function getContent(init,category,description,newApp,startupDisplay) { updateDisplay(result.display); if ( initialize ) { populateAutoComplete(); + downloadStatistics(); } }); } } +function downloadStatistics() { + postNoSpin({action:'downloadStatistics'}); +} + function populateAutoComplete() { postNoSpin({action:'populateAutoComplete'},function(result) { searchBoxAwesomplete.list = result.autocomplete; diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 index a21dbfcd..d2942be9 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 @@ -1,12 +1,14 @@ -a984f6fdeb6882f3b644249cde64a49d ./Apps.page +6e0fd877fd62e42e17b284d879e4ac0c ./Apps.page 4e55f7483b661af21a25b677179baffe ./CA_notices.page 42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page e718d7825dbdc96a17a915079222b098 ./default.cfg -16ab48796082240784020833b1988a18 ./include/exec.php -e564b860fa0d5022df83c103922665d7 ./include/helpers.php +69837040d99db6ace79fa8c995579b52 ./include/exec.php +081c8e7f0937ef2f7d77d1f746a8a4f4 ./include/helpers.php 116042a918060278e77379b0dd73482c ./include/paths.php 532fffdf939594c143e679da02bd841e ./javascript/libraries.js 71f911a818d88d3d567f8a2898094ee2 ./README.md +ff1fa32f5bc288631673066da4a36ebe ./scripts/caPostHook.php +981bc776ea83d2f15387e29870554e3f ./scripts/caPreHook.php d3d8286046cc7d6edf8f596067c163a2 ./scripts/checkForUpdates.php 99a9d58a49a7f6812f18bd4be2b563b9 ./scripts/checkForUpdates.sh 677ac9a29993ec57e09ec6a1856f1a11 ./scripts/dockerConvert.php @@ -22,4 +24,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php 34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php 25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php 7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html -a1b3610d2e84841ebfed5f1bf2c5bd46 ./skins/Narrow/skin.php +360f985a0e0e789a02eb66d7d24a6742 ./skins/Narrow/skin.php diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php index 6a29ed32..dc2a6ca8 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php @@ -199,6 +199,9 @@ switch ($_POST['action']) { case 'saveMultiPluginPending': saveMultiPluginPending(); break; + case 'downloadStatistics': + downloadStatistics(); + break; ############################################### # Return an error if the action doesn't exist # ############################################### @@ -218,7 +221,7 @@ function DownloadApplicationFeed() { $currentFeed = "Primary Server"; $downloadURL = randomFile(); - $ApplicationFeed = download_json($caPaths['application-feed'],$downloadURL); + $ApplicationFeed = download_json($caPaths['application-feed'],$downloadURL,"",20); if ( ! is_array($ApplicationFeed['applist']) ) { $currentFeed = "Backup Server"; $ApplicationFeed = download_json($caPaths['application-feedBackup'],$downloadURL); @@ -903,7 +906,7 @@ function force_update() { $lastUpdatedOld = readJsonFile($caPaths['lastUpdated-old']); @unlink($caPaths['lastUpdated']); - $latestUpdate = download_json($caPaths['application-feed-last-updated'],$caPaths['lastUpdated']); + $latestUpdate = download_json($caPaths['application-feed-last-updated'],$caPaths['lastUpdated'],"",5); if ( ! $latestUpdate['last_updated_timestamp'] ) $latestUpdate = download_json($caPaths['application-feed-last-updatedBackup'],$caPaths['lastUpdated']); @@ -2438,6 +2441,15 @@ function saveMultiPluginPending() { postReturn(['status'=>'ok']); } +############################################## +# Downloads the stats file in the background # +############################################## +function downloadStatistics() { + global $caPaths; + + download_json($caPaths['statisticsURL'],$caPaths['statistics']); +} + ####################################### # Logs Javascript errors being caught # ####################################### diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php index cc39ecec..35ef9bbc 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php @@ -69,11 +69,14 @@ function writeJsonFile($filename,$jsonArray) { function download_url($url, $path = "", $bg = false, $timeout = 45) { global $caSettings, $caPaths; + debug("DOWNLOAD starting $url\n"); + $startTime = time(); + $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,true); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); - curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30); + curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); curl_setopt($ch,CURLOPT_ENCODING,""); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); @@ -90,8 +93,9 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) { curl_close($ch); if ( $path ) file_put_contents($path,$out); - - debug("DOWNLOAD URL: $url\nRESULT:\n".var_dump_ret($out)); + + $totalTime = time() - $startTime; + debug("DOWNLOAD $url Time: $totalTime RESULT:\n".var_dump_ret($out)); return $out ?: false; } function download_json($url,$path="") { diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPostHook.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPostHook.php new file mode 100644 index 00000000..5db8463b --- /dev/null +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPostHook.php @@ -0,0 +1,14 @@ +#!/usr/bin/php + \ No newline at end of file diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPreHook.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPreHook.php new file mode 100644 index 00000000..df80e9cc --- /dev/null +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/scripts/caPreHook.php @@ -0,0 +1,21 @@ +#!/usr/bin/php + \ No newline at end of file diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php index 38bd50a1..3f4e8729 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php @@ -445,8 +445,6 @@ function getPopupDescriptionSkin($appNumber) { $extraDeprecated = readJsonFile($caPaths['extraDeprecated']); $pinnedApps = readJsonFile($caPaths['pinnedV2']); - if ( ! is_file($caPaths['statistics']) ) - download_json($caPaths['statisticsURL'],$caPaths['statistics']); if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { $caSettings['dockerRunning'] = "true"; @@ -576,15 +574,15 @@ function getPopupDescriptionSkin($appNumber) { if ( $template['Plugin'] ) { $templateURL = $template['PluginURL']; - download_url($templateURL,$caPaths['pluginTempDownload']); - $template['Changes'] = @plugin("changes",$caPaths['pluginTempDownload']); + download_url($templateURL."1",$caPaths['pluginTempDownload'],"",5); + $template['Changes'] = @plugin("changes",$caPaths['pluginTempDownload']) ?: $template['Changes']; $template['pluginVersion'] = @plugin("version",$caPaths['pluginTempDownload']) ?: $template['pluginVersion']; } else { if ( ! $template['Changes'] && $template['ChangeLogPresent']) { $templateURL = $template['caTemplateURL'] ?: $template['TemplateURL']; - download_url($templateURL,$caPaths['pluginTempDownload']); + download_url($templateURL,$caPaths['pluginTempDownload'],"",5); $xml = readXmlFile($caPaths['pluginTempDownload']); $template['Changes'] = $xml['Changes']; } diff --git a/webImages/sick-octopus-on-white-background-vector-26371940.jpg b/webImages/sick-octopus-on-white-background-vector-26371940.jpg new file mode 100644 index 00000000..0647ad26 Binary files /dev/null and b/webImages/sick-octopus-on-white-background-vector-26371940.jpg differ