kopia lustrzana https://github.com/snarfed/bridgy-fed
add HTML meta redirects to mf2 rendered pages for end users
browsers will follow them, and hopefully all webmention receivers should/do ignore them, so we'll get the best progressive enhancement for both worlds. IRC background: https://chat.indieweb.org/dev/2019-04-11#t1555004634348000 https://chat.indieweb.org/dev/2019-04-16#t1555440757959400pull/59/head
rodzic
7a94537721
commit
90f7ac3e5b
|
@ -37,7 +37,14 @@ class RenderHandler(ModernHandler):
|
|||
else:
|
||||
self.abort(404, 'Stored response for %s has no data' % id)
|
||||
|
||||
self.response.write(microformats2.activities_to_html([as1]))
|
||||
# add HTML meta redirect to source page. should trigger for end users in
|
||||
# browsers but not for webmention receivers (hopefully).
|
||||
html = microformats2.activities_to_html([as1])
|
||||
utf8 = '<meta charset="utf-8">'
|
||||
refresh = '<meta http-equiv="refresh" content="0;url=%s">' % source
|
||||
html = html.replace(utf8, utf8 + '\n' + refresh)
|
||||
|
||||
self.response.write(html)
|
||||
|
||||
|
||||
app = webapp2.WSGIApplication([
|
||||
|
|
|
@ -43,7 +43,8 @@ class RenderTest(testutil.TestCase):
|
|||
self.html = """\
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
<head><meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0;url=abc"></head>
|
||||
<body>
|
||||
<article class="h-entry">
|
||||
<span class="p-uid">http://this/reply</span>
|
||||
|
|
Ładowanie…
Reference in New Issue