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#t1555440757959400
pull/59/head
Ryan Barrett 2019-04-17 08:44:26 -07:00
rodzic 7a94537721
commit 90f7ac3e5b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -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([

Wyświetl plik

@ -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>