Gather last update time live in the background
This commit is contained in:
parent
96d478ff93
commit
9adec804ad
Binary file not shown.
|
@ -1837,6 +1837,71 @@ String.prototype.escapeHTML = function() {
|
|||
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
}
|
||||
|
||||
function postNoSpin(options,callback) {
|
||||
var URL = "/plugins/<?=$plugin?>/include/exec.php";
|
||||
|
||||
if ( typeof options === "function" ) {
|
||||
callback = options;
|
||||
} else {
|
||||
<? if ( $cfg['debugging'] == "yes" ):?>
|
||||
var msg = "No Spin Post: ";
|
||||
console.log(msg+JSON.stringify(options));
|
||||
<?endif;?>
|
||||
}
|
||||
var URL = "/plugins/<?=$plugin?>/include/exec.php";
|
||||
|
||||
if ( typeof options === "function" ) {
|
||||
callback = options;
|
||||
} else {
|
||||
<? if ( $cfg['debugging'] == "yes" ):?>
|
||||
var msg = "No Spin Post: ";
|
||||
console.log(msg+JSON.stringify(options));
|
||||
<?endif;?>
|
||||
}
|
||||
if ( typeof callback === "function" ) {
|
||||
$.post(URL,options,function(retval){
|
||||
try {
|
||||
var result = JSON.parse(retval);
|
||||
if (result.error) {
|
||||
alert(result.error);
|
||||
}
|
||||
} catch(e) {
|
||||
myCloseAlert();
|
||||
myCloseSpinner();
|
||||
if ( ! $.trim(retval) ) {
|
||||
retval = "<?tr("No data was returned. It is probable that another browser session has rebooted your server. Reloading this browser tab will probably fix this error")?>";
|
||||
}
|
||||
if ( retval.indexOf("<!DOCTYPE html>") === 0 ) {
|
||||
alert("<?tr("You have been logged out")?>");
|
||||
window.location.reload();
|
||||
} else {
|
||||
$("#templates_content").html(sprintf(tr("Something really wrong went on during %s"),options.action)+"<br><?tr("Post the ENTIRE contents of this message in the Community Applications Support Thread")?><br><br>OS: <?=$unRaidSettings['version']?> <?=$md5Error ? "<br>Modified CA" : ""?><br>Browser: <?=$_SERVER['HTTP_USER_AGENT']?><br>Language: <?=$_SESSION['locale']?><br><br>"+retval.escapeHTML());
|
||||
throw new Error("Something went badly wrong!"+options.action);
|
||||
}
|
||||
}
|
||||
<? if ( $cfg['debugging'] == "yes" ):?>
|
||||
console.groupCollapsed("Result "+options.action);
|
||||
console.log(result);
|
||||
console.groupEnd();
|
||||
<?endif;?>
|
||||
try {
|
||||
eval(callback(result));
|
||||
} catch(e) {
|
||||
post({action:'javascriptError',postCall:options.action,retval:result});
|
||||
alert("Fatal error during "+options.action+" "+e);
|
||||
}
|
||||
if (result.script) {
|
||||
try {
|
||||
eval(result.script);
|
||||
} catch(e) {
|
||||
alert("Could not execute Script "+e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$.post(URL,options);
|
||||
}
|
||||
}
|
||||
function post(options,callback) {
|
||||
var URL = "/plugins/<?=$plugin?>/include/exec.php";
|
||||
|
||||
|
@ -2430,6 +2495,11 @@ function showSidebarApp(apppath,appname) {
|
|||
$(this).css("font-size",newSize+"px");
|
||||
}
|
||||
});
|
||||
postNoSpin({action:'getLastUpdate',ID:result.ID},function(lastUpdate) {
|
||||
if (lastUpdate.lastUpdate) {
|
||||
$("#template"+result.ID).html(lastUpdate.lastUpdate);
|
||||
}
|
||||
});
|
||||
})
|
||||
},500);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
d5d30470467398b3717b636a7234c9f9 ./Apps.page
|
||||
39b9658d490638157e62f8616c0e587b ./Apps.page
|
||||
4e55f7483b661af21a25b677179baffe ./CA_notices.page
|
||||
c7c6da0a4a4a7ac33f387ea178319bae ./ca_settings.page
|
||||
ed2883d6c44c19304c431079596a1731 ./default.cfg
|
||||
800135166b003221870a39d78f2b2e9e ./include/exec.php
|
||||
fa433889529197f2b0192c887a2f9d84 ./include/exec.php
|
||||
2c1babf5b937925bb47dce1b0566c25d ./include/helpers.php
|
||||
d827ebdf8c29aa6a9818df043a37721e ./include/paths.php
|
||||
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
|
||||
|
@ -21,4 +21,4 @@ a1401a0bed89c182b69f0c7508282c1f ./scripts/pluginInstall.php
|
|||
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
|
||||
549fb44e30554bfba0a6ead71ececa65 ./skins/Narrow/css.php
|
||||
7d827147dc8ede3d518b2cacae1d385b ./skins/Narrow/skin.html
|
||||
e02cae89e42d89bf9576baf04408f4bd ./skins/Narrow/skin.php
|
||||
d41828b5411777821e6ecf4ab8cfd058 ./skins/Narrow/skin.php
|
||||
|
|
|
@ -183,6 +183,9 @@ switch ($_POST['action']) {
|
|||
case 'getPortsInUse':
|
||||
postReturn(["portsInUse"=>getPortsInUse()]);
|
||||
break;
|
||||
case 'getLastUpdate':
|
||||
postReturn(['lastUpdate'=>getLastUpdate(getPost("ID","Unknown"))]);
|
||||
break;
|
||||
###############################################
|
||||
# Return an error if the action doesn't exist #
|
||||
###############################################
|
||||
|
@ -2047,6 +2050,37 @@ function search_dockerhub() {
|
|||
writeJsonFile($caPaths['dockerSearchResults'],$dockerFile);
|
||||
postReturn(['display'=>displaySearchResults($pageNumber)]);
|
||||
}
|
||||
##############################################
|
||||
# Gets the last update issued to a container #
|
||||
##############################################
|
||||
function getLastUpdate($ID) {
|
||||
global $caPaths;
|
||||
|
||||
while ( ! $templates ) {
|
||||
$templates = readJsonFile($caPaths['community-templates-info']);
|
||||
sleep(1); # keep trying in case of a collision between reading and writing
|
||||
}
|
||||
$index = searchArray($templates,"ID",$ID);
|
||||
if ( $index === false )
|
||||
return "Unknown";
|
||||
|
||||
$app = $templates[$index];
|
||||
if ( strpos($app['Repository'],"ghcr.io") !== false || strpos($app['Repository'],"cr.hotio.dev") !== false || strpos($app['Repository'],"lscr.io") !== false) { // try dockerhub for info on ghcr stuff
|
||||
$info = pathinfo($app['Repository']);
|
||||
$regs = basename($info['dirname'])."/".$info['filename'];
|
||||
} else {
|
||||
$regs = $app['Repository'];
|
||||
}
|
||||
$reg = explode(":",$regs)[0];
|
||||
$registry = download_url("https://registry.hub.docker.com/v2/repositories/$reg");
|
||||
$registry_json = json_decode($registry,true);
|
||||
if ( ! $registry_json['last_updated'] )
|
||||
return;
|
||||
|
||||
$lastUpdated = $registry_json['last_updated'] ? date("M j, Y",strtotime(explode("T",$registry_json['last_updated'])[0])) : "Unknown";
|
||||
|
||||
return $lastUpdated;
|
||||
}
|
||||
#######################################
|
||||
# Logs Javascript errors being caught #
|
||||
#######################################
|
||||
|
|
|
@ -98,7 +98,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
|||
$installComment = $template['CAComment'];
|
||||
|
||||
if ( $template['Requires'] )
|
||||
$installComment .= tr("This application has additional requirements")."<br>".markdown($template['Requires'])."<br>$installComment";
|
||||
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires'])."<br>$installComment";
|
||||
|
||||
if ( ! $template['Language'] ) {
|
||||
if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) {
|
||||
|
@ -704,7 +704,7 @@ function getPopupDescriptionSkin($appNumber) {
|
|||
$template['supportContext'] = $supportContext;
|
||||
@unlink($caPaths['pluginTempDownload']);
|
||||
|
||||
return array("description"=>displayPopup($template),"trendData"=>$template['trends'],"trendLabel"=>$chartLabel,"downloadtrend"=>$down,"downloadLabel"=>$downloadLabel,"totaldown"=>$totalDown,"totaldownLabel"=>$downloadLabel,"supportContext"=>$supportContext,"actionsContext"=>$actionsContext);
|
||||
return array("description"=>displayPopup($template),"trendData"=>$template['trends'],"trendLabel"=>$chartLabel,"downloadtrend"=>$down,"downloadLabel"=>$downloadLabel,"totaldown"=>$totalDown,"totaldownLabel"=>$downloadLabel,"supportContext"=>$supportContext,"actionsContext"=>$actionsContext,"ID"=>$template['ID']);
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
@ -1288,9 +1288,8 @@ function displayPopup($template) {
|
|||
if ($stars)
|
||||
$card .= "<tr><td class='popupTableLeft'>".tr("DockerHub Stars:")."</td><td class='popupTableRight'>$stars <span class='dockerHubStar'></span></td></tr>";
|
||||
if ( ! $Plugin && ! $Language ) {
|
||||
if ( $LastUpdate ) {
|
||||
$card .= "<tr><td class='popupTableLeft'>".tr("Last Update:")."</td><td class='popupTableRight'>".date("M n, Y",$LastUpdate)." <span class='ca_note'><span class='ca_fa-asterisk'></span></span></td></tr>";
|
||||
}
|
||||
$lastUpdateMsg = $LastUpdate ? date("M j, Y",$LastUpdate) : "Unknown";
|
||||
$card .= "<tr><td class='popupTableLeft'>".tr("Last Update:")."</td><td class='popupTableRight'><span id='template{$template['ID']}'>$lastUpdateMsg <span class='ca_note'><span class='ca_fa-asterisk'></span></span></span></td></tr>";
|
||||
}
|
||||
if ( $Plugin ) {
|
||||
$card .= "<tr><td class='popupTableLeft'>".tr("Installed Version")."</td><td class='popupTableRight'>$installedVersion</td></tr>";
|
||||
|
|
Loading…
Reference in New Issue
Block a user