Grab app errors asyn instead of first time side bar is opened
Adjust some timeouts before switching to backup server because GitHub is a complete and utter Piece of Shit that is only worthwhile because it's free
Don't hold up displaying sidebar for more than 5 seconds max if auxillary file cannot be downloaded
This commit is contained in:
Squidly271 2022-09-03 12:02:48 -04:00
parent 9d503d9748
commit c160a07bf6
9 changed files with 70 additions and 14 deletions

Binary file not shown.

View File

@ -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;

View File

@ -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

View File

@ -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 #
#######################################

View File

@ -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="") {

View File

@ -0,0 +1,14 @@
#!/usr/bin/php
<?
###############################################################
# #
# Community Applications copyright 2015-2022, Andrew Zawadzki #
# Licenced under GPLv2 #
# #
###############################################################
if ( $argv[1] == "check" || $argv[1] == "checkall" )
return;
echo "Executing Community Applications Post-Plugin Settings\n";
@unlink("/tmp/community.applications/pluginPending/{$argv[2]}");
echo "Finished";
?>

View File

@ -0,0 +1,21 @@
#!/usr/bin/php
<?
###############################################################
# #
# Community Applications copyright 2015-2022, Andrew Zawadzki #
# Licenced under GPLv2 #
# #
###############################################################
if ( $argv[1] == "check" || $argv[1] == "checkall" )
return;
echo "Executing Community Applications Pre-Plugin Settings\n";
@mkdir("/tmp/community.applications/pluginPending",0777,true);
touch("/tmp/community.applications/pluginPending/{$argv[2]}");
if ( $argv[1] == "update" ) {
if ( is_file("/var/log/plugins/{$argv[2]}") )
passthru("/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin check ".escapeshellarg($argv[2]));
return;
}
?>

View File

@ -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'];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB