Add provisions to run a local appfeed file

master
Squidly271 2024-02-03 19:32:25 -05:00
parent 817b068dfb
commit 80f613c92e
5 changed files with 30 additions and 15 deletions

View File

@ -267,7 +267,10 @@ $(function(){
if ( "<?=$date?>" == "12/31" ) addBannerWarning("<?tr("Happy New Year!")?> <i style='float:initial;cursor:initial;' class='fa fa-beer'></i> <?tr("Please Enjoy Responsibly")?>",false); if ( "<?=$date?>" == "12/31" ) addBannerWarning("<?tr("Happy New Year!")?> <i style='float:initial;cursor:initial;' class='fa fa-beer'></i> <?tr("Please Enjoy Responsibly")?>",false);
if ( "<?=$ServerDateCorrect?>" == "false" ) addBannerWarning("<?tr("Server Date and Time Incorrect. Issues will result with Community Applications. Fix this in Settings - Date And Time")?>",true,true); if ( "<?=$ServerDateCorrect?>" == "false" ) addBannerWarning("<?tr("Server Date and Time Incorrect. Issues will result with Community Applications. Fix this in Settings - Date And Time")?>",true,true);
if ( "<?=$RequirementsBanner?>" == "true" ) addBannerWarning("<?tr("Memory Requirements not met. Problems may result")?>"); if ( "<?=$RequirementsBanner?>" == "true" ) addBannerWarning("<?tr("Memory Requirements not met. Problems may result")?>");
<?if ( $caPaths['localONLY'] == true ):?>
addBannerWarning("*** LOCAL FEED RUNNING - DO NOT RELEASE ***",true,true);
<?endif;?>
context.init({preventDoubleContext:false,left:false,right:false,bottom:true,above:true}); context.init({preventDoubleContext:false,left:false,right:false,bottom:true,above:true});
$(".maxPerPage").html(sprintf("<?tr("Results Per Page: %s")?>","<?=$cfg['maxPerPage']?>")); $(".maxPerPage").html(sprintf("<?tr("Results Per Page: %s")?>","<?=$cfg['maxPerPage']?>"));

View File

@ -1,10 +1,10 @@
e846701491233a242570807f29517fed ./Apps.page d2c361aeb0461a7f76f1fa106d315d60 ./Apps.page
2defe45163697e40c813a57ae9a50231 ./CA_notices.page 2defe45163697e40c813a57ae9a50231 ./CA_notices.page
a3cb6f32cb9453c058563b6860f70a31 ./ca_settings.page a3cb6f32cb9453c058563b6860f70a31 ./ca_settings.page
01ed7990078dee7cecfeda9a4e49377e ./default.cfg 01ed7990078dee7cecfeda9a4e49377e ./default.cfg
76538e21e626308522c1e13198a00bdd ./include/exec.php 1605a0265cab145fb2b4b26632215bb6 ./include/exec.php
1d21e20284741127836e4acdafff3cb1 ./include/helpers.php 1d21e20284741127836e4acdafff3cb1 ./include/helpers.php
024499c59dcea65a8cf1f224e2bd36e7 ./include/paths.php da69c4eaa9879a32152dc5fc3fedbcbf ./include/paths.php
7234caf6800479df03abb222aaedaca5 ./javascript/libraries.js 7234caf6800479df03abb222aaedaca5 ./javascript/libraries.js
71f911a818d88d3d567f8a2898094ee2 ./README.md 71f911a818d88d3d567f8a2898094ee2 ./README.md
d6d93feb1975100b513b15b31aa20068 ./scripts/checkForUpdates.php d6d93feb1975100b513b15b31aa20068 ./scripts/checkForUpdates.php

View File

@ -218,17 +218,21 @@ function DownloadApplicationFeed() {
@mkdir($caPaths['templates-community'],0777,true); @mkdir($caPaths['templates-community'],0777,true);
$currentFeed = "Primary Server"; $currentFeed = "Primary Server";
$downloadURL = randomFile(); if ( $caPaths['localONLY'] ) {
$ApplicationFeed = download_json($caPaths['application-feed'],$downloadURL,"",20); $ApplicationFeed = json_decode(file_get_contents($caPaths['application-feed-local']),true);
if ( (! is_array($ApplicationFeed['applist'])) || empty($ApplicationFeed['applist']) ) { } else {
$currentFeed = "Backup Server"; $downloadURL = randomFile();
$ApplicationFeed = download_json($caPaths['application-feedBackup'],$downloadURL); $ApplicationFeed = download_json($caPaths['application-feed'],$downloadURL,"",20);
} if ( (! is_array($ApplicationFeed['applist'])) || empty($ApplicationFeed['applist']) ) {
@unlink($downloadURL); $currentFeed = "Backup Server";
if ( (! is_array($ApplicationFeed['applist'])) || empty($ApplicationFeed['applist']) ) { $ApplicationFeed = download_json($caPaths['application-feedBackup'],$downloadURL);
@unlink($caPaths['currentServer']); }
ca_file_put_contents($caPaths['appFeedDownloadError'],$downloadURL); @unlink($downloadURL);
return false; if ( (! is_array($ApplicationFeed['applist'])) || empty($ApplicationFeed['applist']) ) {
@unlink($caPaths['currentServer']);
ca_file_put_contents($caPaths['appFeedDownloadError'],$downloadURL);
return false;
}
} }
ca_file_put_contents($caPaths['currentServer'],$currentFeed); ca_file_put_contents($caPaths['currentServer'],$currentFeed);
$i = 0; $i = 0;
@ -1022,6 +1026,12 @@ function get_content() {
function force_update() { function force_update() {
global $caPaths, $caSettings; global $caPaths, $caSettings;
if ( $caPaths['localONLY'] ) {
exec("rm -rf '{$caPaths['tempFiles']}'");
@mkdir($caPaths['templates-community'],0777,true);
$GLOBALS['templates'] = [];
}
$lastUpdatedOld = readJsonFile($caPaths['lastUpdated-old']); $lastUpdatedOld = readJsonFile($caPaths['lastUpdated-old']);
debug("old feed timestamp: ".($lastUpdatedOld['last_updated_timestamp'] ?? "")); debug("old feed timestamp: ".($lastUpdatedOld['last_updated_timestamp'] ?? ""));
@unlink($caPaths['lastUpdated']); @unlink($caPaths['lastUpdated']);

View File

@ -38,10 +38,12 @@ $caPaths['community-templates-allSearchResults']= $caPaths['tempFiles']."/allSea
$caPaths['community-templates-catSearchResults']= $caPaths['tempFiles']."/catSearchResults.json"; $caPaths['community-templates-catSearchResults']= $caPaths['tempFiles']."/catSearchResults.json";
$caPaths['startupDisplayed'] = $caPaths['tempFiles']."/startupDisplayed"; $caPaths['startupDisplayed'] = $caPaths['tempFiles']."/startupDisplayed";
$caPaths['repositoriesDisplayed'] = $caPaths['tempFiles']."/repositoriesDisplayed.json"; $caPaths['repositoriesDisplayed'] = $caPaths['tempFiles']."/repositoriesDisplayed.json";
$caPaths['localONLY'] = false; /* THIS MUST NOT BE SET TO TRUE WHEN DOING A RELEASE */
$caPaths['application-feed'] = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed.json"; $caPaths['application-feed'] = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed.json";
$caPaths['application-feed-last-updated'] = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed-lastUpdated.json"; $caPaths['application-feed-last-updated'] = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed-lastUpdated.json";
$caPaths['application-feedBackup'] = "https://dnld.lime-technology.com/appfeed/master/applicationFeed.json"; $caPaths['application-feedBackup'] = "https://dnld.lime-technology.com/appfeed/master/applicationFeed.json";
$caPaths['application-feed-last-updatedBackup'] = "https://dnld.lime-technology.com/appfeed/master/applicationFeed-lastUpdated.json"; $caPaths['application-feed-last-updatedBackup'] = "https://dnld.lime-technology.com/appfeed/master/applicationFeed-lastUpdated.json";
$caPaths['application-feed-local'] = "/tmp/GitHub/AppFeed/applicationFeed.json";
$caPaths['appFeedDownloadError'] = $caPaths['tempFiles']."/downloaderror.txt"; $caPaths['appFeedDownloadError'] = $caPaths['tempFiles']."/downloaderror.txt";
$caPaths['categoryList'] = $caPaths['tempFiles']."/categoryList.json"; $caPaths['categoryList'] = $caPaths['tempFiles']."/categoryList.json";
$caPaths['repositoryList'] = $caPaths['tempFiles']."/repositoryList.json"; $caPaths['repositoryList'] = $caPaths['tempFiles']."/repositoryList.json";