kopia lustrzana https://github.com/snarfed/bridgy-fed
add OGP to HTML
rodzic
96ab2f80f1
commit
0da3f205c1
10
common.py
10
common.py
|
|
@ -518,3 +518,13 @@ class FlashErrors(View):
|
|||
_, body = interpret_http_exception(e)
|
||||
flask_util.flash(util.linkify(body or str(e), pretty=True))
|
||||
return redirect('/login')
|
||||
|
||||
|
||||
def render_template(template, **kwargs):
|
||||
return flask.render_template(
|
||||
template,
|
||||
isinstance=isinstance,
|
||||
request=request,
|
||||
set=set,
|
||||
util=util,
|
||||
**kwargs)
|
||||
|
|
|
|||
25
pages.py
25
pages.py
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import re
|
||||
import time
|
||||
|
||||
from flask import render_template, request
|
||||
from flask import request
|
||||
from google.cloud.ndb import tasklets
|
||||
from google.cloud.ndb.key import Key
|
||||
from google.cloud.ndb.query import OR
|
||||
|
|
@ -33,7 +33,13 @@ from activitypub import ActivityPub
|
|||
import atproto
|
||||
from atproto import ATProto, BlueskyOAuthStart
|
||||
import common
|
||||
from common import CACHE_CONTROL, DOMAIN_RE, ErrorButDoNotRetryTask, PROTOCOL_DOMAINS
|
||||
from common import (
|
||||
CACHE_CONTROL,
|
||||
DOMAIN_RE,
|
||||
ErrorButDoNotRetryTask,
|
||||
PROTOCOL_DOMAINS,
|
||||
render_template,
|
||||
)
|
||||
from flask_app import app
|
||||
from flask import redirect, session
|
||||
import ids
|
||||
|
|
@ -53,12 +59,6 @@ from protocol import Protocol
|
|||
from web import Web
|
||||
import webfinger
|
||||
|
||||
# precompute this because we get a ton of requests for non-existing users
|
||||
# from weird open redirect referrers:
|
||||
# https://github.com/snarfed/bridgy-fed/issues/422
|
||||
with app.test_request_context('/'):
|
||||
USER_NOT_FOUND_HTML = render_template('user_not_found.html')
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
BLOG_REDIRECT_DOMAINS = (
|
||||
|
|
@ -72,15 +72,18 @@ TEMPLATE_VARS = {
|
|||
'as2': as2,
|
||||
'ATProto': ATProto,
|
||||
'ids': ids,
|
||||
'isinstance': isinstance,
|
||||
'logs': logs,
|
||||
'Nostr': Nostr,
|
||||
'PROTOCOLS': PROTOCOLS,
|
||||
'set': set,
|
||||
'util': util,
|
||||
'Web': Web,
|
||||
}
|
||||
|
||||
# precompute this because we get a ton of requests for non-existing users
|
||||
# from weird open redirect referrers:
|
||||
# https://github.com/snarfed/bridgy-fed/issues/422
|
||||
with app.test_request_context('/'):
|
||||
USER_NOT_FOUND_HTML = render_template('user_not_found.html', **TEMPLATE_VARS)
|
||||
|
||||
|
||||
def load_user(protocol, id):
|
||||
"""Loads and returns the current request's user.
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@
|
|||
-- happen before an async script loads. -->
|
||||
<script src="/oauth_dropins_static/util.js"></script>
|
||||
<script src="/static/util.js"></script>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Bridgy Fed" />
|
||||
<meta property="og:description" content="Bridgy Fed is a bridge between decentralized social networks like the fediverse, Bluesky, and web sites and blogs." />
|
||||
<meta property="og:url" content="{{ util.clean_url(request.url) }}" />
|
||||
<meta property="og:image" content="https://brid.gy/static/bridgy_logo.jpg" />
|
||||
</head>
|
||||
|
||||
<body id="{{ body_id }}">
|
||||
|
|
|
|||
3
web.py
3
web.py
|
|
@ -9,7 +9,7 @@ from urllib.parse import quote, urlencode, urljoin, urlparse
|
|||
from xml.etree import ElementTree
|
||||
|
||||
import brevity
|
||||
from flask import redirect, render_template, request
|
||||
from flask import redirect, request
|
||||
from google.cloud import ndb
|
||||
from google.cloud.ndb import ComputedProperty
|
||||
from granary import as1, as2, atom, microformats2, rss
|
||||
|
|
@ -31,6 +31,7 @@ from common import (
|
|||
DOMAINS,
|
||||
PRIMARY_DOMAIN,
|
||||
PROTOCOL_DOMAINS,
|
||||
render_template,
|
||||
SUPERDOMAIN,
|
||||
)
|
||||
from flask_app import app
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue