This commit is contained in:
Squidly271 2022-03-05 06:32:17 -05:00
parent 4c40319df2
commit c9715f127f
5 changed files with 72 additions and 70 deletions

View File

@ -239,7 +239,7 @@ $(function(){
$(".maxPerPage").html(sprintf("<?tr("Results Per Page: %s")?>","<?=$cfg['maxPerPage']?>"));
context.attach("#maxPerPage",getPerPageOpts(<?=$cfg['maxPerPage']?>));
$(".sidebarClose").on("click",function(e) {
closeSidebar();
});
@ -273,7 +273,7 @@ $(function(){
closeSidebar();
}
});
$('.caChangeLog').on("click",function() {disableSort();scrollToTop();caChangeLog();});
$('.mainArea').on("click",'.ca_multiselect',function() {enableMultiInstall();});
@ -405,12 +405,12 @@ $(function(){
break;
}
});
$("body").on("click",".repoPopup,.ca_repoinfo,.ca_reporeadmore,.ca_repoFromPopUp,.cardDescriptionRepo", function() {
var repository = $(this).data("repository");
showRepoPopup(repository);
});
$('body').on("click",".ca_holder",function(event) {
if (data.actions) {
data.actions = false;
@ -459,7 +459,7 @@ $(function(){
}
showSortIcons();
scrollToTop();
// This is the checkSortOrder function to prevent a race condition
var sortButton = false;
$(".sortIcons").each(function() {
@ -514,9 +514,9 @@ $(function(){
var slideFlag = true;
var currentCat = $(".selectedMenu").data("category");
var newCat = $(this).data("category");
if ( currentCat && currentCat.startsWith(newCat) )
slideFlag = false;
if ( currentCat && currentCat.startsWith(newCat) )
slideFlag = false;
if ( ! $(this).hasClass("caRepositoryMenu") ) {
$(".caMenuItem").removeClass("selectedMenu");
if ( ! $(this).parent().hasClass("subCategory") ) {
@ -906,10 +906,10 @@ function doSidebarSearch(newSearch) {
function doSearch(button,newSearch) {
if ( data.searchInProgress )
return;
data.searchInProgress = true;
if ( ! newSearch === false ) {
$('#searchBox').val(newSearch);
}
@ -1125,10 +1125,10 @@ function installPlugin(pluginURL,update=false,comment="") {
if (isConfirm) {
openBox('/plugins/community.applications/scripts/pluginInstall.php&arg1='+type+'&arg2='+pluginURL,title,600,900,true,"OpenSidebarAndRefreshDisplay");
}
});
});
} else {
openBox('/plugins/community.applications/scripts/pluginInstall.php&arg1='+type+'&arg2='+pluginURL,title,600,900,true,"OpenSidebarAndRefreshDisplay");
}
}
}
@ -1170,7 +1170,7 @@ function previousApps(installed,dontClear=false,filter="") {
clearSearchBox();
$(".dockerSearch").hide();
showSortIcons();
// this is the checkSortOrder function running to prevent a race condition
var sortButton = false;
$(".sortIcons").each(function() {
@ -1378,7 +1378,7 @@ function pinnedApps() {
pins();
}
}
function pins() {
setPageOne();
data.docker = "";
@ -1411,7 +1411,7 @@ function displayTags(leadTemplate,rename=false,comment="",ports="") {
if (flag) {
comment = comment.concat("<br><?tr("One or more ports used by this application are already in use by another service or app running on your server. You will need to adjust the host ports accordingly on the template")?>");
}
}
}
if (comment) {
swal({
title: "<?tr("Attention")?>",
@ -1463,7 +1463,7 @@ function displayTags(leadTemplate,rename=false,comment="",ports="") {
enableSearch();
}
});
});
});
}
}
@ -1720,7 +1720,7 @@ function updateDisplay(content) {
removeBannerWarning(data.translationBanner);
}
saveState();
if ( ! $(".startupButton").hasClass("selectedMenu") && ! data.docker) {
$(".maxPerPage").show();
}
@ -1863,12 +1863,12 @@ function postNoSpin(options,callback) {
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;
}
}
if ( typeof callback === "function" ) {
$.post(URL,options,function(retval){
try {
@ -1912,7 +1912,7 @@ function postNoSpin(options,callback) {
} else {
$.post(URL,options);
}
}
}
function post(options,callback) {
var URL = "/plugins/<?=$plugin?>/include/exec.php";
@ -2219,7 +2219,7 @@ function popupInstallXML(xml,type,comment="",ports="") {
}
if (flag) {
comment = comment.concat("<br><?tr("One or more ports used by this application are already in use by another service or app running on your server. You will need to adjust the host ports accordingly on the template")?>");
}
}
}
if ( $.trim(comment) ) {
swal({

View File

@ -1,9 +1,9 @@
37e661a0dba61f17b1a498cccb779f13 ./Apps.page
25e7936fb85a1c75253f0293c449160c ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
e718d7825dbdc96a17a915079222b098 ./default.cfg
02c69f473c5abe9b3776b1142cf5b6aa ./include/exec.php
51a726cbd05fecf5ec30000b29581de7 ./include/helpers.php
1ae6dd2709d3ba7427fd83bc390ce6db ./include/exec.php
1b68fa71be6bf13db50117a534ed5edf ./include/helpers.php
d827ebdf8c29aa6a9818df043a37721e ./include/paths.php
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
71f911a818d88d3d567f8a2898094ee2 ./README.md
@ -20,4 +20,4 @@ e19c8f05c687dcf03ea0ba2ed7099a6e ./scripts/showStatistics.php
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
2da35d3042b93459f171595811d534b3 ./skins/Narrow/css.php
e9244df3418ca3e7fa206d9b6e94c6b1 ./skins/Narrow/skin.html
5103c8a524e6149f44dbab3ba67fa24e ./skins/Narrow/skin.php
66f7536343a928d415997ed450336cb0 ./skins/Narrow/skin.php

View File

@ -259,8 +259,10 @@ function DownloadApplicationFeed() {
$o['SortName'] = str_replace("-"," ",$o['Name']);
$o['SortName'] = preg_replace('/\s+/',' ',$o['SortName']);
$o['random'] = rand();
if ( $o['CAComment'] ) $o['CAComment'] = tr($o['CAComment']);
if ( $o['CAComment'] ) $o['CAComment'] = tr($o['CAComment']);
if ( $o['RequiresFile'] ) $o['RequiresFile'] = trim($o['RequiresFile']);
if ( $o['Requires'] ) $o['Requires'] = trim($o['Requires']);
$des = $o['OriginalOverview'] ?: $o['Overview'];
$des = $o['Language'] ? $o['Description'] : $des;
@ -514,7 +516,7 @@ function appOfDay($file) {
foreach($file as $template) {
if ($template['RecommendedDate']) {
if ( ! checkRandomApp($template) ) continue;
$appOfDay[] = $template['ID'];
if ( count($appOfDay) == $max ) break;
} else {
@ -809,7 +811,7 @@ function get_content() {
$searchResults['favNameHit'][] = $template;
continue;
}
if ( strpos($filter,"/") && filterMatch($filter,array($template['Repository'])) )
if ( strpos($filter,"/") && filterMatch($filter,array($template['Repository'])) )
$searchResults['nameHit'][] = $template;
else {
if ( filterMatch($filter,array($template['SortName'],$template['RepoShort'],$template['Language'],$template['LanguageLocal'],$template['ExtraSearchTerms'])) ) {
@ -1539,7 +1541,7 @@ function removePrivateApp() {
####################################################
function populateAutoComplete() {
global $caPaths, $caSettings;
while ( ! $templates ) {
$templates = readJsonFile($caPaths['community-templates-info']);
if ( ! $templates )
@ -1742,9 +1744,9 @@ function createXML() {
$valueReferenced = array_values(array_filter(explode("/",$config['value'])));
if ( $valueReferenced[0] == "mnt" && $valueReferenced[1] && ! in_array($valueReferenced[1],$disksPresent) )
$config['value'] = str_replace("/mnt/{$valueReferenced[1]}/","/mnt/{$disksPresent[0]}/",$config['value']);
// Check for pre-existing folders only differing by "case" and adjust accordingly
// Default path
if ( ! $config['value'] ) { // Don't override default if value exists
$configPath = explode("/",$config['@attributes']['Default']);
@ -1758,7 +1760,7 @@ function createXML() {
if ( strtolower($testDir) == strtolower($entry) ) {
if ( $testDir == $entry )
break;
$entry = $testDir;
}
}
@ -1766,7 +1768,7 @@ function createXML() {
}
$config['@attributes']['Default'] = implode("/",$configPath);
}
// entered path
if ( $config['value'] ) {
$configPath = explode("/",$config['value']);
@ -1780,7 +1782,7 @@ function createXML() {
if ( strtolower($testDir) == strtolower($entry) ) {
if ( $testDir == $entry )
break;
$entry = $testDir;
}
}
@ -2077,7 +2079,7 @@ function search_dockerhub() {
##############################################
function getLastUpdate($ID) {
global $caPaths;
$count = 0;
while ( $count < 5 ) {
$templates = readJsonFile($caPaths['community-templates-info']);
@ -2087,11 +2089,11 @@ function getLastUpdate($ID) {
$index = searchArray($templates,"ID",$ID);
if ( $index === false )
return "Unknown";
$app = $templates[$index];
if ( $app['PluginURL'] || $app['LanguageURL'] )
return;
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'];
@ -2104,7 +2106,7 @@ function getLastUpdate($ID) {
if ( !strpos($reg[0],"/") )
$reg[0] = "library/{$reg[0]}";
$count = 0;
while ( ! $registry && $count < 5 ) {
$registry = download_url("https://registry.hub.docker.com/v2/repositories/{$reg[0]}");
@ -2116,17 +2118,17 @@ function getLastUpdate($ID) {
$registry_json = json_decode($registry,true);
if ( ! $registry_json['last_updated'] )
return;
}
$lastUpdated = $registry_json['last_updated'] ? tr(date("M j, Y",strtotime($registry_json['last_updated'])),0) : "Unknown";
return $lastUpdated;
}
function changeMaxPerPage() {
global $caPaths, $caSettings;
$max = getPost("max",24);
if ($caSettings['maxPerPage'] == $max)
postReturn(["status"=>"same"]);
@ -2136,8 +2138,8 @@ function changeMaxPerPage() {
postReturn(["status"=>"updated"]);
}
}
#######################################
# Logs Javascript errors being caught #
#######################################

View File

@ -42,7 +42,7 @@ function randomFile() {
##################################################################
function readJsonFile($filename) {
global $caSettings, $caPaths;
debug("CA Read JSON file $filename");
$json = json_decode(@file_get_contents($filename),true);
@ -56,14 +56,14 @@ function readJsonFile($filename) {
}
function writeJsonFile($filename,$jsonArray) {
global $caSettings, $caPaths;
debug("Write JSON File $filename");
$result = file_put_contents($filename,json_encode($jsonArray, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
if ( ! $result )
debug("Write error $filename");
}
function download_url($url, $path = "", $bg = false, $timeout = 45) {
@ -662,7 +662,7 @@ function getAllInfo($force=false) {
#######################
function debug($str) {
global $caSettings, $caPaths;
if ( $caSettings['debugging'] == "yes" )
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." $str\n",FILE_APPEND);
}
@ -680,19 +680,19 @@ function portsUsed($template) {
if ( $config['@attributes']['Type'] !== "Port" ) continue;
$portsUsed[] = $config['value'] ?: $config['@attributes']['Default'];
}
}
}
return json_encode($portsUsed);
}
########################
# Get the ports in use #
########################
function getPortsInUse() {
global $var, $caPaths;
if ( !$var )
if ( !$var )
$var = parse_ini_file($caPaths['unRaidVars']);
$portsInUse = [];
exec("lsof -Pni|awk '/LISTEN/ && \$9!~/127.0.0.1/ && \$9!~/\\[::1\\]/{print \$9}'|sort -u", $output);
@ -714,7 +714,7 @@ function ca_explode($split,$text,$count=2) {
}
function plain($ip) {
return str_replace(['[',']'],'',$ip);
}
}
/**
* @copyright Copyright 2006-2012, Miles Johnson - http://milesj.me

View File

@ -96,10 +96,10 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$actionsContext = [];
$selected = false;
$installComment = $template['CAComment'];
if ( $template['Requires'] )
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires'])."<br>$installComment";
if ( ! $template['Language'] ) {
if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) {
if ( ! $template['Plugin'] ) {
@ -193,7 +193,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
foreach ($searchMatches[1] as $searchResult) {
$template['Requires'] = str_replace("//$searchResult\\\\",$searchResult,$template['Requires']);
}
}
}
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires']);
}
}
@ -388,7 +388,7 @@ function getPopupDescriptionSkin($appNumber) {
$index = searchArray($displayed['community'],"InstallPath",$appNumber);
if ( $index === false ) {
$ind = $index;
$ind = $index;
while ( true ) {
$template = $displayed[$ind];
if ( $template['Name'] == $displayed['community'][$ind]['Name'] ) {
@ -400,7 +400,7 @@ function getPopupDescriptionSkin($appNumber) {
unset($template);
break;
}
}
}
}
if ( $index !== false ) {
@ -641,11 +641,11 @@ function getPopupDescriptionSkin($appNumber) {
elseif ( $allRepositories[$template['Repo']]['Discord'] )
$supportContext[] = array("icon"=>"ca_discord","link"=>$allRepositories[$template['Repo']]['Discord'],"text"=>tr("Discord"));
if ( $template['Facebook'] )
if ( $template['Facebook'] )
$supportContext[] = array("icon"=>"ca_facebook","link"=>$template['Facebook'],"text"=>tr("Facebook"));
if ( $template['Reddit'] )
$supportContext[] = array("icon"=>"ca_reddit","link"=>$template['Reddit'],"text"=>tr("Reddit"));
if ( $template['Support'] )
$supportContext[] = array("icon"=>"ca_fa-support","link"=>$template['Support'],"text"=> $template['SupportLanguage'] ?: tr("Support Forum"));
@ -878,7 +878,7 @@ function displaySearchResults($pageNumber) {
$result['Description'] = $result['Description'] ?: tr("No description present");
$result['Compatible'] = true;
$result['actionsContext'] = [["icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"dockerConvert({$result['ID']});"]];
$templateSearch = searchArray($templates,"Repository",$result['Repository']);
if ( $templateSearch === false )
$templateSearch = searchArray($templates,"Repository","{$result['Repository']}.latest");
@ -1093,7 +1093,7 @@ function displayCard($template) {
";
$Overview = $Overview ?: $Description;
$ovr = html_entity_decode($Overview);
$ovr = trim($ovr);
$ovr = str_replace(["[","]"],["<",">"],$ovr);
@ -1104,7 +1104,7 @@ function displayCard($template) {
$ovr = str_replace("\n","<br>",$ovr);
$Overview = strip_tags(str_replace("<br>"," ",$ovr));
$descClass= $RepositoryTemplate ? "cardDescriptionRepo" : "cardDescription";
$card .= "<div class='$descClass $backgroundClickable'><div class='cardDesc'>$Overview</div></div>";
if ( $RecommendedDate ) {
@ -1127,7 +1127,7 @@ function displayCard($template) {
<div class='warningCardBackground'>
<div class='betaPopupText ca_center' title='".tr("This application template / has been blacklisted")."'>$flagTextStart".tr("Blacklisted")."$flagTextEnd</div>
</div>
";
";
} elseif ( $caTemplateExists ) {
$card .= "
<div class='warningCardBackground'>
@ -1151,7 +1151,7 @@ function displayCard($template) {
$card .= "
<div class='installedCardBackground'>
<div class='installedCardText ca_center'>".tr("INSTALLED")."</div>
</div>";
</div>";
} elseif ( $Official ) {
$card .= "
<div class='officialCardBackground'>
@ -1325,7 +1325,7 @@ function displayPopup($template) {
$card .= "<tr><td class='popupTableLeft'>".tr("Upgrade Version")."</td><td class='popupTableRight'>$pluginVersion</td></tr>";
}
}
if ( $Plugin || ! $Compatible) {
if ( $MinVer )
$card .= "<tr><td class='popupTableLeft'>".tr("Min OS")."</td><td class='popupTableRight'>$MinVer</td></tr>";
@ -1335,7 +1335,7 @@ function displayPopup($template) {
$Licence = $Licence ?: $License;
if ( $Licence )
$card .= "<tr><td class='popupTableLeft'>".tr("Licence")."</td><td class='popupTableRight'>$Licence</td></tr>";
$card .= "</table>";
if ( $Repo || $Private ) {
$card .= "