Popular plugins

This commit is contained in:
Squidly271 2024-11-05 20:12:41 -05:00
parent 9148a36440
commit 5ca0399fde
8 changed files with 104 additions and 43 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,8 +2,8 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "community.applications"> <!ENTITY name "community.applications">
<!ENTITY author "Andrew Zawadzki"> <!ENTITY author "Andrew Zawadzki">
<!ENTITY version "2024.10.27"> <!ENTITY version "2024.11.05">
<!ENTITY md5 "213cc3b76b512558a02a01e5a7caaf09"> <!ENTITY md5 "d7641ae1fac99162da75e5fafb848d6c">
<!ENTITY launch "Apps"> <!ENTITY launch "Apps">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;"> <!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Squidly271/community.applications"> <!ENTITY github "Squidly271/community.applications">
@ -13,6 +13,10 @@
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.12.0" support="https://forums.unraid.net/topic/38582-plug-in-community-applications" icon="users"> <PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.12.0" support="https://forums.unraid.net/topic/38582-plug-in-community-applications" icon="users">
<CHANGES> <CHANGES>
###2024.11.05
- Added: Most popular plugins section on home page
- Added: Warning when clicking a link (eg: Project) that is outside of Limetech's control
###2024.10.27 ###2024.10.27
- Fixed: Under certain circumstances, Action Centre could be enabled with no apps to display - Fixed: Under certain circumstances, Action Centre could be enabled with no apps to display
- Added: Infrastructure changes for future releases - Added: Infrastructure changes for future releases

View File

@ -206,51 +206,57 @@ var ca_done_override = false;
return false; return false;
} }
} }
function checkURL(href,target="") {
$('body').on("click","a", function(e) {
href = $(this).attr("href").trim();
target = $(this).attr("target");
if ( href ) { if ( href ) {
if ( href.match('https://[^\.]*.(my)?unraid.net/') || href.indexOf("https://unraid.net/") == 0 || href == "https://unraid.net" || href.indexOf("http://lime-technology.com") == 0) { if ( href.match('https?://[^\.]*.(my)?unraid.net/') || href.indexOf("https://unraid.net/") == 0 || href == "https://unraid.net" || href.indexOf("http://lime-technology.com") == 0) {
return; return true;
} }
if (href !== "#" && href.indexOf("javascript") !== 0) { if (href !== "#" && href.indexOf("javascript") !== 0) {
if ( ! isValidURL(href) ) { if ( ! isValidURL(href) ) {
if ( href.indexOf("/") == 0 ) { // all internal links start with "/" if ( href.indexOf("/") == 0 ) { // all internal links start with "/"
return; return true;
} }
var baseURLpage = href.split("/"); var baseURLpage = href.split("/");
if ( gui_pages_available.includes(baseURLpage[0]) ) { if ( gui_pages_available.includes(baseURLpage[0]) ) {
return; return true;
} }
} }
if ( $(this).hasClass("localURL") ) { if ( $(this).hasClass("localURL") ) {
return; return true;
} }
e.preventDefault(); return false;
swal({
title: "<?=_('External Link')?>",
text: "<span title='"+href+"'><?=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?><br><br><b>"+href+"</span>",
html: true,
type: 'warning',
showCancelButton: true,
showConfirmButton: true,
cancelButtonText: "<?=_('Cancel')?>",
confirmButtonText: "<?=_('OK')?>"
},function(isConfirm) {
if (isConfirm) {
var popupOpen = window.open(href,target);
if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
var popupWarning = addBannerWarning("<?=_('Popup Blocked.');?>");
setTimeout(function() {
removeBannerWarning(popupWarning);}
,10000);
}
}
});
} }
} }
return true;
}
$('body').on("click","a", function(e) {
href = $(this).attr("href").trim();
target = $(this).attr("target");
if ( ! checkURL(href,target) ) {
e.preventDefault();
swal({
title: "<?=_('External Link')?>",
text: "<span title='"+href+"'><?=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?><br><br><b>"+href+"</span>",
html: true,
type: 'warning',
showCancelButton: true,
showConfirmButton: true,
cancelButtonText: "<?=_('Cancel')?>",
confirmButtonText: "<?=_('OK')?>"
},function(isConfirm) {
if (isConfirm) {
var popupOpen = window.open(href,target);
if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
var popupWarning = addBannerWarning("<?=_('Popup Blocked.');?>");
setTimeout(function() {
removeBannerWarning(popupWarning);}
,10000);
}
}
});
} else return;
}); });
<?endif;?> <?endif;?>
@ -410,11 +416,36 @@ $(function(){
}); });
}); });
$('.mainArea').on("click",".ca_href",function() { $('.mainArea').on("click",".ca_href",function(e) {
var href = $(this).attr("data-href"); var href = $(this).attr("data-href");
var target = $(this).attr("data-target"); var target = $(this).attr("data-target");
if ( ! target ) target = "_blank"; if ( ! target ) target = "_blank";
window.open(href,target); if ( checkURL(href,target) ) {
window.open(href,target);
} else {
e.preventDefault();
swal({
title: "<?=_('External Link')?>",
text: "<span title='"+href+"'><?=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?><br><br><b>"+href+"</span>",
html: true,
type: 'warning',
showCancelButton: true,
showConfirmButton: true,
cancelButtonText: "<?=_('Cancel')?>",
confirmButtonText: "<?=_('OK')?>"
},function(isConfirm) {
if (isConfirm) {
var popupOpen = window.open(href,target);
if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
var popupWarning = addBannerWarning("<?=_('Popup Blocked.');?>");
setTimeout(function() {
removeBannerWarning(popupWarning);}
,10000);
}
}
});
}
}); });
$('body').on("click",".dockerUpdate",function() { $('body').on("click",".dockerUpdate",function() {

View File

@ -1,8 +1,8 @@
4ef966bca1fbaba35279c177b6928267 ./Apps.page 491616daffc25b5a391a807f9f7ce831 ./Apps.page
2defe45163697e40c813a57ae9a50231 ./CA_notices.page 2defe45163697e40c813a57ae9a50231 ./CA_notices.page
c12622d8281346d37398e96cbb6b8b69 ./ca_settings.page c12622d8281346d37398e96cbb6b8b69 ./ca_settings.page
01ed7990078dee7cecfeda9a4e49377e ./default.cfg 01ed7990078dee7cecfeda9a4e49377e ./default.cfg
6457850b971b1e172eb1320f5310f95f ./include/exec.php c825d6ff72b001403386d49397a48753 ./include/exec.php
1a3ecd8b0274801783580d04a232fd2e ./include/helpers.php 1a3ecd8b0274801783580d04a232fd2e ./include/helpers.php
277723d8757f4db32ef8b92cda9b7202 ./include/paths.php 277723d8757f4db32ef8b92cda9b7202 ./include/paths.php
7234caf6800479df03abb222aaedaca5 ./javascript/libraries.js 7234caf6800479df03abb222aaedaca5 ./javascript/libraries.js
@ -22,5 +22,5 @@ c11415ac49ba9cd6af2b5dc022aa3367 ./scripts/notices.php
7592f203dca78dce476051b85f7ca133 ./scripts/updatePluginSupport.php 7592f203dca78dce476051b85f7ca133 ./scripts/updatePluginSupport.php
817d4586a062e3949884d2b281779d76 ./skins/Narrow/css.php 817d4586a062e3949884d2b281779d76 ./skins/Narrow/css.php
f7d48fdb63e116ecc3ec49cbbf6b2dc2 ./skins/Narrow/skin.html f7d48fdb63e116ecc3ec49cbbf6b2dc2 ./skins/Narrow/skin.html
6230591d8cf47956420bd7ef6c380076 ./skins/Narrow/skin.php 3dc0ce9219cff3192b3a655792e83d80 ./skins/Narrow/skin.php
c26b187a50c966adff7bfb9cab6fca16 ./event/disks_mounted c26b187a50c966adff7bfb9cab6fca16 ./event/disks_mounted

View File

@ -577,6 +577,22 @@ function appOfDay($file) {
} }
} }
break; break;
case "topPlugins":
$sortOrder['sortBy'] = "downloads";
$sortOrder['sortDir'] = "Down";
usort($file,"mySort");
$repos = [];
foreach ($file as $template) {
if ( !isset($template['PluginURL']) ) continue;
if ( ! $template['downloads'] ?? false ) continue;
if ( checkRandomApp($template) ) {
$repos[] = $template['Repository'];
$appOfDay[] = $template['ID'];
if ( count($appOfDay) == $max ) break;
}
}
break;
case "trending": case "trending":
$sortOrder['sortBy'] = "trendDelta"; $sortOrder['sortBy'] = "trendDelta";
$sortOrder['sortDir'] = "Down"; $sortOrder['sortDir'] = "Down";
@ -828,6 +844,14 @@ function get_content() {
"sortby"=>"topPerforming", "sortby"=>"topPerforming",
"sortdir"=>"Down" "sortdir"=>"Down"
], ],
[
"type"=>"topPlugins",
"text1"=>tr("Most Popular Plugins"),
"text2"=>tr("The most popular plugins installed by other Unraid users"),
"cat"=>"plugins:",
"sortby"=>"downloads",
"sortdir"=>"Down"
],
[ [
"type"=>"random", "type"=>"random",
"text1"=>tr("Random Apps"), "text1"=>tr("Random Apps"),
@ -874,6 +898,8 @@ function get_content() {
$startupType = "Updated"; break; $startupType = "Updated"; break;
case "trending": case "trending":
$startupType = "Top Performing"; break; $startupType = "Top Performing"; break;
case "topPlugins":
$startupType = "Top Plugins"; break;
case "random": case "random":
$startupType = "Random"; break; $startupType = "Random"; break;
case "upandcoming": case "upandcoming":

View File

@ -1585,12 +1585,12 @@ function displayPopup($template) {
<tr><td class='popupTableLeft'>".tr("Categories")."</td><td class='popupTableRight'>$Category</td></tr> <tr><td class='popupTableLeft'>".tr("Categories")."</td><td class='popupTableRight'>$Category</td></tr>
<tr><td class='popupTableLeft'>".tr("Added")."</td><td class='popupTableRight'>$DateAdded</td></tr> <tr><td class='popupTableLeft'>".tr("Added")."</td><td class='popupTableRight'>$DateAdded</td></tr>
"; ";
$downloadText = getDownloads($downloads); if ( !$Plugin ) {
if ($downloadText) $downloadText = getDownloads($downloads);
$card .= "<tr><td class='popupTableLeft'>".tr("Downloads")."</td><td class='popupTableRight'>$downloadText</td></tr>"; if ($downloadText)
elseif ( isset($topPlugin) ) $card .= "<tr><td class='popupTableLeft'>".tr("Downloads")."</td><td class='popupTableRight'>$downloadText</td></tr>";
$card .= "<tr><td class='popupTableLeft'>".tr("Popularity")."</td><td class='popupTableRight'># $topPlugin</td></tr>"; }
if (!$Plugin && !$LanguagePack) if (!$Plugin && !$LanguagePack)
$card .= "<tr><td class='popupTableLeft'>".tr("Repository")."</td><td class='popupTableRight' style='white-space:nowrap;'>$Repository</td></tr>"; $card .= "<tr><td class='popupTableLeft'>".tr("Repository")."</td><td class='popupTableRight' style='white-space:nowrap;'>$Repository</td></tr>";
if ($stars) if ($stars)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB