kopia lustrzana https://github.com/snarfed/bridgy-fed
use @flask_util.cached
rodzic
cdb9a519e6
commit
17d2066008
|
@ -10,7 +10,7 @@ from flask import request
|
|||
from google.cloud import ndb
|
||||
from granary import as2, microformats2
|
||||
import mf2util
|
||||
from oauth_dropins.webutil import util
|
||||
from oauth_dropins.webutil import flask_util, util
|
||||
from oauth_dropins.webutil.flask_util import error
|
||||
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||
|
||||
|
@ -79,7 +79,7 @@ def send(activity, inbox_url, user_domain):
|
|||
|
||||
|
||||
@app.get(f'/<regex("{common.DOMAIN_RE}"):domain>')
|
||||
@cache.cached(CACHE_TIME.total_seconds())
|
||||
@flask_util.cached(cache, CACHE_TIME)
|
||||
def actor(domain):
|
||||
"""Serves /[DOMAIN], fetches its mf2, converts to AS Actor, and serves it."""
|
||||
tld = domain.split('.')[-1]
|
||||
|
|
|
@ -17,8 +17,7 @@ CACHE_TIME = datetime.timedelta(seconds=15)
|
|||
|
||||
|
||||
@app.get(r'/wm/<path:url>')
|
||||
@cache.cached(timeout=CACHE_TIME.total_seconds(), query_string=True,
|
||||
response_filter=flask_util.not_5xx)
|
||||
@flask_util.cached(cache, CACHE_TIME)
|
||||
def add_wm(url=None):
|
||||
"""Proxies HTTP requests and adds Link header to our webmention endpoint."""
|
||||
url = urllib.parse.unquote(url)
|
||||
|
|
|
@ -29,8 +29,7 @@ CACHE_TIME = datetime.timedelta(seconds=15)
|
|||
|
||||
|
||||
@app.get(r'/r/<path:to>')
|
||||
@cache.cached(timeout=CACHE_TIME.total_seconds(), query_string=True,
|
||||
response_filter=flask_util.not_5xx)
|
||||
@flask_util.cached(cache, CACHE_TIME)
|
||||
def redir(to):
|
||||
"""301 redirect to the embedded fully qualified URL.
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ CACHE_TIME = datetime.timedelta(minutes=15)
|
|||
|
||||
|
||||
@app.get('/render')
|
||||
@cache.cached(timeout=CACHE_TIME.total_seconds(), query_string=True,
|
||||
response_filter=flask_util.not_5xx)
|
||||
@flask_util.cached(cache, CACHE_TIME)
|
||||
def render():
|
||||
"""Fetches a stored Response and renders it as HTML."""
|
||||
source = flask_util.get_required_param('source')
|
||||
|
|
Ładowanie…
Reference in New Issue