dockerhub conversions

pull/11/head
Squidly271 2021-11-04 09:56:22 -04:00
parent 572f15a7e8
commit 480d4366b8
6 changed files with 55 additions and 30 deletions

View File

@ -90,6 +90,8 @@ if ( $startupDisplayed == "true" && $_COOKIE['ca_languageSwitch'] ) {
$killCookie = "true";
}
$dockerSearchActive = is_file($caPaths['dockerSearchActive']);
// Only check for updates to containers / plugins max once per hour
exec("mkdir -p {$caPaths['tempFiles']}");
if ( $cfg['updateCheck'] == "yes" ) {
@ -635,14 +637,18 @@ $(function(){
initialStartup = false;
getCategories();
restoreState();
refreshDisplay();
searchBoxAwesomplete.close();
initialStartup = true;
var apppath = $.cookie("sidebarAppPath");
var appname = $.cookie("sidebarAppName");
if ( $.trim(apppath) ) {
showSidebarApp(apppath,appname);
}
<? if ( $dockerSearchActive ): ?>
dockerSearch(data.currentpage);
<? else: ?>
refreshDisplay();
searchBoxAwesomplete.close();
initialStartup = true;
var apppath = $.cookie("sidebarAppPath");
var appname = $.cookie("sidebarAppName");
if ( $.trim(apppath) ) {
showSidebarApp(apppath,appname);
}
<? endif; ?>
} else {
post({action:"defaultSortOrder"},function() {
updateContent();
@ -2183,6 +2189,9 @@ function initDockerSearch() {
}
function dockerSearch(pageNumber) {
scrollToTop();
$(".selectedMenu").removeClass("selectedMenu");
$(".nonDockerSearch").removeClass("caMenuEnabled").addClass("caMenuDisabled");
var filter = $('#searchBox').val();
var dockerURL = "https://registry.hub.docker.com/search?q=" + filter;
data.docker = "searching docker";

View File

@ -1,10 +1,10 @@
a234e996c1eef4dddfc4133d64ad34a1 ./Apps.page
dbcaed60ede3ac9aaa96b6a8a186f4eb ./Apps.page
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
7ee0b23dbd92ed55f611360a983f9565 ./ca_settings.page
1b49ec9797713ce869ea0c1066a109f2 ./default.cfg
b7ab76bd389b70d23751f597e6592b16 ./include/exec.php
53f072907318f5134c9a3f1622a77695 ./include/exec.php
5810179d140aadc0a17b2d8782a32cba ./include/helpers.php
6113f62fd4fe2afd03bd5f082a6f5f29 ./include/paths.php
8ba23d3d51816bbb91245cfc3fcb8024 ./include/paths.php
eb76c1b6ed3da5e5b393f22d2ec18430 ./javascript/libraries.js
8c24d585c7dd3ff9ef961bb2c2705711 ./PluginAPI.page
b398273cf7daa62ab00d2de2336ca25f ./README.md
@ -22,4 +22,4 @@ b398273cf7daa62ab00d2de2336ca25f ./README.md
2bd671daecaf01549f8cc0202cb184b3 ./scripts/updatePluginSupport.php
dec2bf4cf4d3d57619d2c3ba49d59b9f ./skins/Narrow/css.php
e965c8fafd1eae7a0387e37cee3aeaf9 ./skins/Narrow/skin.html
42ac1f766f0493837024f11d801c6c33 ./skins/Narrow/skin.php
797f8022c23372b48bdb1603401256ff ./skins/Narrow/skin.php

View File

@ -589,13 +589,15 @@ function displayRepositories() {
######################################################################################
function get_content() {
global $caPaths, $caSettings;
$filter = getPost("filter",false);
$category = getPost("category",false);
$newApp = filter_var(getPost("newApp",false),FILTER_VALIDATE_BOOLEAN);
$caSettings['startup'] = getPost("startupDisplay",false);
@unlink($caPaths['repositoriesDisplayed']);
@unlink($caPaths['dockerSearchActive']);
switch ($category) {
case "PRIVATE":
$category = false;
@ -975,6 +977,7 @@ function previous_apps() {
@unlink($caPaths['community-templates-catSearchResults']);
@unlink($caPaths['repositoriesDisplayed']);
@unlink($caPaths['startupDisplayed']);
@unlink($caPaths['dockerSearchActive']);
$file = readJsonFile($caPaths['community-templates-info']);
@ -1249,13 +1252,15 @@ function areAppsPinned() {
####################################
function pinnedApps() {
global $caPaths, $caSettings;
$pinnedApps = readJsonFile($caPaths['pinnedV2']);
$file = readJsonFile($caPaths['community-templates-info']);
@unlink($caPaths['community-templates-allSearchResults']);
@unlink($caPaths['community-templates-catSearchResults']);
@unlink($caPaths['repositoriesDisplayed']);
@unlink($caPaths['startupDisplayed']);
@unlink($caPaths['dockerSearchActive']);
foreach ($pinnedApps as $pinned) {
$startIndex = 0;
$search = explode("&",$pinned);
@ -1958,10 +1963,12 @@ function search_dockerhub() {
$o['display'] = "<div class='ca_NoDockerAppsFound'>".tr("No Matching Applications Found On Docker Hub")."</div>";
$o['script'] = "$('#dockerSearch').hide();";
postReturn($o);
@unlink($caPaths['dockerSerchResults']);
@unlink($caPaths['dockerSearchResults']);
@unlink($caPaths['dockerSearchActive']);
return;
}
touch($caPaths['dockerSearchActive']);
$i = 0;
foreach ($pageresults['results'] as $result) {
unset($o);

View File

@ -64,5 +64,6 @@ $caPaths['updateTime'] = "/tmp/$CA/checkForUpdatesTime"
$caPaths['dockerWriteTest'] = "/var/lib/docker/communityApplicationsWriteTest";
$caPaths['info'] = $caPaths['tempFiles']."/info.json";
$caPaths['dockerSearchResults'] = $caPaths['tempFiles']."/dockerSearch.json";
$caPaths['dockerSearchInstall'] = $caPaths['tempFiles']."/docksearch.xml";
$caPaths['dockerSearchInstall'] = $caPaths['tempFiles']."/dockerConvert.xml";
$caPaths['dockerSearchActive'] = $caPaths['tempFiles']."/dockerSearchActive";
?>

View File

@ -275,6 +275,10 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
function getPageNavigation($pageNumber,$totalApps,$dockerSearch,$displayCount = true) {
global $caSettings;
$pageFunction = $dockerSearch ? "dockerSearch": "changePage";
if ( $dockerSearch )
$caSettings['maxPerPage'] = 25;
if ( $caSettings['maxPerPage'] < 0 ) return;
$swipeScript = "<script>";
@ -293,30 +297,30 @@ function getPageNavigation($pageNumber,$totalApps,$dockerSearch,$displayCount =
$o .= "<div class='pageNavigation'>";
$previousPage = $pageNumber - 1;
$o .= ( $pageNumber == 1 ) ? "<span class='pageLeft pageNumber pageNavNoClick'></span>" : "<span class='pageLeft ca_tooltip pageNumber' onclick='changePage(&quot;$previousPage&quot;)'></span>";
$o .= ( $pageNumber == 1 ) ? "<span class='pageLeft pageNumber pageNavNoClick'></span>" : "<span class='pageLeft ca_tooltip pageNumber' onclick='$pageFunction(&quot;$previousPage&quot;)'></span>";
$swipeScript .= "data.prevpage = $previousPage;";
$startingPage = $pageNumber - 5;
if ($startingPage < 3 )
$startingPage = 1;
else
$o .= "<a class='ca_tooltip pageNumber' onclick='changePage(&quot;1&quot;);'>1</a><span class='pageNumber pageDots'></span>";
$o .= "<a class='ca_tooltip pageNumber' onclick='pageFunction(&quot;1&quot;);'>1</a><span class='pageNumber pageDots'></span>";
$endingPage = $pageNumber + 5;
if ( $endingPage > $totalPages )
$endingPage = $totalPages;
for ($i = $startingPage; $i <= $endingPage; $i++)
$o .= ( $i == $pageNumber ) ? "<span class='pageNumber pageSelected'>$i</span>" : "<a class='ca_tooltip pageNumber' onclick='changePage(&quot;$i&quot;);'>$i</a>";
$o .= ( $i == $pageNumber ) ? "<span class='pageNumber pageSelected'>$i</span>" : "<a class='ca_tooltip pageNumber' onclick='$pageFunction(&quot;$i&quot;);'>$i</a>";
if ( $endingPage != $totalPages) {
if ( ($totalPages - $pageNumber ) > 6)
$o .= "<span class='pageNumber pageDots'></span>";
if ( ($totalPages - $pageNumber ) >5 )
$o .= "<a class='ca_tooltip pageNumber' onclick='changePage(&quot;$totalPages&quot;);'>$totalPages</a>";
$o .= "<a class='ca_tooltip pageNumber' onclick='$pageFunction(&quot;$totalPages&quot;);'>$totalPages</a>";
}
$nextPage = $pageNumber + 1;
$o .= ( $pageNumber < $totalPages ) ? "<span class='ca_tooltip pageNumber pageRight' onclick='changePage(&quot;$nextPage&quot;);'></span>" : "<span class='pageRight pageNumber pageNavNoClick'></span>";
$o .= ( $pageNumber < $totalPages ) ? "<span class='ca_tooltip pageNumber pageRight' onclick='$pageFunction(&quot;$nextPage&quot;);'></span>" : "<span class='pageRight pageNumber pageNavNoClick'></span>";
$swipeScript .= ( $pageNumber < $totalPages ) ? "data.nextpage = $nextPage;" : "data.nextpage = 0;";
$swipeScript .= "</script>";
$o .= "</div></div><script>data.currentpage = $pageNumber;</script>";
@ -340,9 +344,13 @@ function getPopupDescriptionSkin($appNumber) {
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
$caSettings['dockerRunning'] = "true";
$info = getAllInfo();
$infoTmp = getAllInfo();
foreach ($infoTmp as $container) {
$info[$container['Name']] = $container;
}
$dockerRunning = $DockerClient->getDockerContainers();
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
file_put_contents("/tmp/blah",print_r($dockerRunning,true));
} else {
unset($caSettings['dockerRunning']);
$info = array();
@ -375,7 +383,7 @@ function getPopupDescriptionSkin($appNumber) {
}
}
}
if ( $index !== false ) {
/* $Displayed = true;
*/ $template = $displayed['community'][$index];
@ -799,19 +807,19 @@ function displaySearchResults($pageNumber) {
$num_pages = $tempFile['num_pages'];
$file = $tempFile['results'];
$templates = readJsonFile($caPaths['community-templates-info']);
$caSettings['descriptions'] = "yes";
$ct = dockerNavigate($num_pages,$pageNumber)."<br>";
$ct = tr("NOTE You must visit the dockerHub page to gather the information required to install correctly")."<br><br>";
$ct .= "<div class='ca_templatesDisplay'>";
$columnNumber = 0;
foreach ($file as $result) {
$result['Icon'] = "/plugins/dynamix.docker.manager/images/question.png";
$result['display_dockerName'] = "<a class='ca_tooltip ca_applicationName' style='cursor:pointer;' onclick='mySearch(this.innerText);' title='".tr("Search for similar containers")."'>{$result['Name']}</a>";
$result['Category'] = "Docker Hub Search";
$result['Category'] = "Docker&nbsp;Hub&nbsp;Search";
$result['Description'] = $result['Description'] ?: "No description present";
$result['Compatible'] = true;
$result['actionsContext'] = [["icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"dockerConvert($ID);"]];
$result['actionsContext'] = [["icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"dockerConvert({$result['ID']});"]];
$ct .= displayCard($result);
$count++;
@ -920,7 +928,7 @@ function displayCard($template) {
$card .= "
<div class='ca_holder $class'>
<div class='ca_bottomLine $bottomClass'>
<div class='infoButton_docker dockerPopup' data-dockerHub='$DockerHub'>".tr("Info")."</div>";
<div class='infoButton_docker dockerPopup' data-dockerHub='$DockerHub'>".tr("Docker Hub")."</div>";
} else {
$backgroundClickable = "ca_backgroundClickable";
$card .= "
@ -983,7 +991,7 @@ function displayCard($template) {
$card .= "
<div class='ca_applicationName'>$Name
";
if ( $CAComment || $ModeratorComment || $Deprecated || ! $Compatible || $Blacklist ) {
if ( $CAComment || $ModeratorComment || $Deprecated || (isset($Compatible) && ! $Compatible) || $Blacklist ) {
if ( $CAComment )
$warning = tr($CAComment);
if ( $ModeratorComment )