diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-01-09 16:51:51 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-01-10 10:14:04 +0100 |
commit | f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6 (patch) | |
tree | 2786e879b381bd637ebaaf84f7fa7f1ad08d8279 /server/middlewares/cache.ts | |
parent | 9270ccf6dca5b2955ad126947d4296deb385fdcb (diff) | |
download | PeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.tar.gz PeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.tar.zst PeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.zip |
Adapt feeds content-type to accept header
Diffstat (limited to 'server/middlewares/cache.ts')
-rw-r--r-- | server/middlewares/cache.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index ef8611875..cb24d9e0e 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts | |||
@@ -4,12 +4,18 @@ import * as apicache from 'apicache' | |||
4 | // Ensure Redis is initialized | 4 | // Ensure Redis is initialized |
5 | Redis.Instance.init() | 5 | Redis.Instance.init() |
6 | 6 | ||
7 | const options = { | 7 | const defaultOptions = { |
8 | redisClient: Redis.Instance.getClient(), | 8 | redisClient: Redis.Instance.getClient(), |
9 | appendKey: () => Redis.Instance.getPrefix() | 9 | appendKey: () => Redis.Instance.getPrefix(), |
10 | statusCodes: { | ||
11 | exclude: [ 404, 403 ] | ||
12 | } | ||
10 | } | 13 | } |
11 | 14 | ||
12 | const cacheRoute = apicache.options(options).middleware | 15 | const cacheRoute = (extraOptions = {}) => apicache.options({ |
16 | ...defaultOptions, | ||
17 | ...extraOptions | ||
18 | }).middleware | ||
13 | 19 | ||
14 | // --------------------------------------------------------------------------- | 20 | // --------------------------------------------------------------------------- |
15 | 21 | ||