Commit Graph

46 Commits

Author SHA1 Message Date
Andrew Dolgov 8ccea1712e
a bit more diskcache tracing 2023-04-10 18:23:26 +03:00
Andrew Dolgov e18295a364
more tracing 2023-04-09 22:15:16 +03:00
Andrew Dolgov d68c736e47
Tracer: rework options to tags 2023-04-09 21:37:17 +03:00
Andrew Dolgov c6d21b3196
make phpstan happy 2022-12-19 21:42:34 +03:00
Andrew Dolgov d373b7b452
* bring back cache-busting for feed icons based on timestamp
* DiskCache: use singleton pattern to create less cache object instances
 * DiskCache: implement ETag
2022-12-19 21:36:50 +03:00
Andrew Dolgov 52180c9f8f
DiskCache: enforce basename() on filenames passed to cache adapter 2022-11-26 14:15:45 +03:00
Andrew Dolgov a30b9bb649
rework favicon storage to use DiskCache 2022-11-24 23:31:33 +03:00
Andrew Dolgov be6bc72a74
DiskCache: tweak how expiration is invoked 2022-11-24 18:49:36 +03:00
Andrew Dolgov 3180b35807
deprecate DiskCache->touch() 2022-11-24 08:16:56 +03:00
Andrew Dolgov 9732d8fc9f
update_rss_feed: use DiskCache to store feed data 2022-11-23 22:09:04 +03:00
Andrew Dolgov 10a1dd35e3
* split local cache implementation into a separate class
* allow custom implementations provided by plugins
2022-11-23 21:18:40 +03:00
wn_ d376cd6142 Address upcoming string interpolation deprecation.
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-11-12 16:20:59 +00:00
wn_ 93fd85df6f Switch to direct type declarations of class properties. 2022-08-12 14:13:26 +00:00
wn_ 59a09790eb Don't type DiskCache's $mimeMap.
PHP typing of class properties is only supported on PHP 7.4+.
2021-11-18 23:51:36 +00:00
Andrew Dolgov b2952843f5 * DiskCache: add download() helper
* Af_Comics_Gocomics_FarSide: cache linked images because it seems to
be required anyway
2021-11-15 23:22:21 +03:00
wn_ d3a81f598b Switch class properties from PHP typing to PHPDoc for compatibility with PHP < 7.4.0 2021-11-12 21:17:31 +00:00
wn_ 2d5603b196 Address PHPStan warnings in 'classes/diskcache.php'. 2021-11-11 22:07:32 +00:00
Andrew Dolgov 70adfd4a74 * sanitize: never rewrite relative links to our own prefix
* use Config::get_self_url() instead of get_self_url_prefix() in a bunch
of places
2021-03-02 08:16:41 +03:00
Andrew Dolgov 211f699aa0 migrate the rest into Config:: 2021-02-22 22:35:27 +03:00
Andrew Dolgov e4107ac952 wip: initial for config object 2021-02-22 21:47:48 +03:00
Andrew Dolgov 053b262aa7 rename public.php/cached_url to cached 2021-02-19 20:28:15 +03:00
Andrew Dolgov 166f2d4666 diskcache: unify naming 2021-02-15 16:11:30 +03:00
Andrew Dolgov 3b52cea811 move some old-style handlers to new callback ones 2021-02-08 16:14:48 +03:00
Andrew Dolgov c94f1b6ff8 fix some more warnings reported by phpstan 2021-02-06 17:38:24 +03:00
Andrew Dolgov 40f38fc87f pluginhost: load plugin data automatically (also marks load_data method as private) 2021-01-15 08:32:06 +03:00
John Aylward 01c0d4bbfd allow audio to be sent to client from the cache 2020-11-04 14:34:37 -05:00
Andrew Dolgov 38a7a1da88 hide uninteresting errors in several DOMDocument->loadHTML() invocations 2020-10-01 13:20:07 +03:00
Andrew Dolgov 74568df4ff remove a lot of stuff from global context (functions.php), add a few helper classes instead 2020-09-22 09:04:33 +03:00
Andrew Dolgov 79f102c25d af_proxy_http: never print received data directly, always redirect to cached_url
cache/getUrl: basename() passed filename just in case
2020-09-15 08:02:28 +03:00
Andrew Dolgov c3d14e1fa5 - fix multiple vulnerabilities in af_proxy_http
- fix vulnerability in rewrite_relative_url() which prevented some URLs from being properly absolutized
- fetch_file_contents: validate all URLs before requesting them
- validate URLs: explicitly whitelist http and https scheme, forbid everything else
- DiskCache/cached_url: only serve whitelisted content types (images, video)
- simplify filename/URL handling code, remove and consolidate some less-used functions
2020-09-14 19:46:52 +03:00
Andrew Dolgov 6eb94f1e13 better support for image srcset attributes as discussed in https://community.tt-rss.org/t/problem-with-img-srcset/3519 2020-06-15 11:58:59 +03:00
Andrew Dolgov c275a0cd33 DiskCache: append fake file extension when sending cached files based on mime type to make saving files easier 2020-05-12 13:28:54 +03:00
Andrew Dolgov 3a4b9249a9 DiskCache: properly deal with srcset attributes 2020-04-29 19:29:36 +03:00
lllusion3418 ec1b0befc7 add support for video[@src] in media cache
it's a valid alternative to a source[@src] child element:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
2020-03-12 11:08:39 +01:00
lllusion3418 b4287a2e98 fix url rewriting for videos with poster and src
if a poster attribute was present only that would have been rewritten
and the (arguably more important) src attribute would be left as-is
2020-03-12 11:08:24 +01:00
Andrew Dolgov 75ab1f05f9 DiskCache::rewriteUrls() - remove img[@srcset] 2019-08-15 09:30:28 +03:00
Andrew Dolgov c34726b2b2 consistency: use DiskCache->exists() to check for present files 2019-08-14 12:52:41 +03:00
Andrew Dolgov 3c075bfd21 DiskCache: more strict checking for input filenames, getUrl() is no longer static 2019-08-14 09:49:18 +03:00
Andrew Dolgov fdb6066bf6 * HOOK_ENCLOSURE_ENTRY: pass article_id to handler
* DiskCache: multiple fixes; support isWritable() for cache entries, set content-disposition for send()
* public/cached_url: allow selecting files from sub-caches other than images
* plugins/Cache_Starred_Images: rework to use DiskCache, can be enabled per-user, properly handles article enclosures, etc
2019-08-13 16:40:21 +03:00
Andrew Dolgov bed695b127 DiskCache::expire: support .no-auto-expiry to prevent automatic cache maintenance 2019-08-13 14:18:14 +03:00
Andrew Dolgov 19b9b27662 expire_cached_files to DiskCache::expire() 2019-08-13 14:13:42 +03:00
Andrew Dolgov 133c2b482b move rewrite_cached_urls to DiskCache::rewriteUrls() 2019-08-13 12:46:57 +03:00
Andrew Dolgov b1dd38f880 add DiskCache.getUrl() and use it in a bunch of places 2019-08-13 12:39:21 +03:00
Andrew Dolgov 7602819b98 add DiskCache.send; switch af_zz_imgproxy to use DiskCache 2019-08-13 12:20:53 +03:00
Andrew Dolgov 82694bd6ce add DiskCache.isWritable 2019-08-13 12:15:43 +03:00
Andrew Dolgov 86308b30ea add classes/diskcache 2019-08-13 12:04:36 +03:00