commit
f3e68e7fb4
|
@ -65,7 +65,7 @@ class ImgProxyCache(object):
|
||||||
if(resp.status_code != 200):
|
if(resp.status_code != 200):
|
||||||
return
|
return
|
||||||
|
|
||||||
header_whitelist = [
|
allowed_headers = [
|
||||||
'content-type',
|
'content-type',
|
||||||
'cache-control',
|
'cache-control',
|
||||||
'etag',
|
'etag',
|
||||||
|
@ -81,7 +81,7 @@ class ImgProxyCache(object):
|
||||||
if match:
|
if match:
|
||||||
expire = max(self.expire, int(match.group(1)))
|
expire = max(self.expire, int(match.group(1)))
|
||||||
|
|
||||||
for key in header_whitelist:
|
for key in allowed_headers:
|
||||||
if key in resp.headers:
|
if key in resp.headers:
|
||||||
headers[key] = resp.headers[key]
|
headers[key] = resp.headers[key]
|
||||||
self.redis.set(self.key('headers', url), pickle.dumps(headers, -1),
|
self.redis.set(self.key('headers', url), pickle.dumps(headers, -1),
|
||||||
|
|
|
@ -195,11 +195,11 @@ def delete(post):
|
||||||
raise TemporaryError(e)
|
raise TemporaryError(e)
|
||||||
|
|
||||||
|
|
||||||
def suggested_instances(limit=5, min_popularity=5, blacklist=tuple()):
|
def suggested_instances(limit=5, min_popularity=5, blocklist=tuple()):
|
||||||
return tuple((ins.instance for ins in (
|
return tuple((ins.instance for ins in (
|
||||||
MastodonInstance.query
|
MastodonInstance.query
|
||||||
.filter(MastodonInstance.popularity > min_popularity)
|
.filter(MastodonInstance.popularity > min_popularity)
|
||||||
.filter(~MastodonInstance.instance.in_(blacklist))
|
.filter(~MastodonInstance.instance.in_(blocklist))
|
||||||
.order_by(db.desc(MastodonInstance.popularity),
|
.order_by(db.desc(MastodonInstance.popularity),
|
||||||
MastodonInstance.instance)
|
MastodonInstance.instance)
|
||||||
.limit(limit).all())))
|
.limit(limit).all())))
|
||||||
|
|
Loading…
Reference in New Issue