diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-13 00:37:39 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-03-14 20:45:25 +0100 |
commit | df502c114da97a6a9cfbb61c55212ab342875189 (patch) | |
tree | 875959abebde87d11d956ee095c3feb3e7a648df /lib/private/App | |
parent | ac4003879d65f5cfaf27a8a4c90090fc62f3ce2d (diff) | |
download | nextcloud-server-df502c114da97a6a9cfbb61c55212ab342875189.tar.gz nextcloud-server-df502c114da97a6a9cfbb61c55212ab342875189.zip |
feat(settings): Cache app discover images to ensure privacy of users
Co-authored-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php index 17ee446aaa1..48dba6d48dc 100644 --- a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php @@ -97,4 +97,20 @@ class AppDiscoverFetcher extends Fetcher { return $entries; } + + public function getETag(): string|null { + $rootFolder = $this->appData->getFolder('/'); + + try { + $file = $rootFolder->getFile($this->fileName); + $jsonBlob = json_decode($file->getContent(), true); + + if (is_array($jsonBlob) && isset($jsonBlob['ETag'])) { + return (string)$jsonBlob['ETag']; + } + } catch (\Throwable $e) { + // ignore + } + return null; + } } |