aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controllers')
-rw-r--r--app/Controllers/configureController.php16
-rw-r--r--app/Controllers/extensionController.php13
2 files changed, 28 insertions, 1 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index cc31430b0..6d25493cf 100644
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -503,4 +503,20 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'system' ]);
}
}
+
+ public function privacyAction(): void {
+ if (!FreshRSS_Auth::hasAccess('admin')) {
+ Minz_Error::error(403);
+ }
+
+ if (Minz_Request::isPost()) {
+ FreshRSS_Context::userConf()->retrieve_extension_list = Minz_Request::paramBoolean('retrieve_extension_list');
+ FreshRSS_Context::userConf()->save();
+ invalidateHttpCache();
+
+ Minz_Request::good(_t('feedback.conf.updated'), array('c' => 'configure', 'a' => 'privacy'));
+ }
+
+ FreshRSS_View::prependTitle(_t('conf.privacy') . ' ยท ');
+ }
}
diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php
index bf1f01c59..42538153d 100644
--- a/app/Controllers/extensionController.php
+++ b/app/Controllers/extensionController.php
@@ -44,7 +44,18 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
*/
protected function getAvailableExtensionList(): array {
$extensionListUrl = 'https://raw.githubusercontent.com/FreshRSS/Extensions/master/extensions.json';
- $json = httpGet($extensionListUrl, CACHE_PATH . '/extension_list.json', 'json');
+
+ $cacheFile = CACHE_PATH . '/extension_list.json';
+ if (FreshRSS_Context::userConf()->retrieve_extension_list === true) {
+ if (!file_exists($cacheFile) || (time() - (filemtime($cacheFile) ?: 0) > 86400)) {
+ $json = httpGet($extensionListUrl, $cacheFile, 'json');
+ } else {
+ $json = @file_get_contents($cacheFile) ?: '';
+ }
+ } else {
+ Minz_Log::warning('The extension list retrieval is disabled in privacy configuration');
+ return [];
+ }
// we ran into problems, simply ignore them
if ($json === '') {