Bridgy Fed: Logs
+Recent requests we've attempted to federate.
+ +Source | Target | Protocol | Status | Log |
---|---|---|---|---|
{{ r.source|safe }} | +{{ r.target|safe }} | +{{ r.protocol }} | +{{ r.status }} | +{{ r.updated.replace(microsecond=0) }} | +
diff --git a/app.yaml b/app.yaml
index 6d7b238..010ae5e 100644
--- a/app.yaml
+++ b/app.yaml
@@ -62,6 +62,10 @@ handlers:
script: render.app
secure: always
+- url: /responses
+ script: logs.app
+ secure: always
+
- url: /wm/.+
script: add_webmention.app
secure: always
diff --git a/logs.py b/logs.py
new file mode 100644
index 0000000..9e3de5a
--- /dev/null
+++ b/logs.py
@@ -0,0 +1,39 @@
+"""Handlers and utilities for exposing app logs to users.
+"""
+import cgi
+import datetime
+import logging
+import re
+import urllib
+
+import appengine_config
+from google.appengine.api import logservice
+from google.appengine.ext import ndb
+from oauth_dropins.webutil.handlers import TemplateHandler
+from oauth_dropins.webutil import util
+import webapp2
+
+from models import Response
+
+
+class ResponsesHandler(TemplateHandler):
+ """Renders recent Responses, with links to logs."""
+
+ def template_file(self):
+ return 'templates/responses.html'
+
+ def template_vars(self):
+ responses = Response.query().order(-Response.updated).fetch(20)
+
+ for r in responses:
+ r.source, r.target = [util.pretty_link(url)
+ for url in r.key.id().split(' ')]
+
+ return {
+ 'responses': responses,
+ }
+
+
+app = webapp2.WSGIApplication([
+ ('/responses', ResponsesHandler),
+], debug=appengine_config.DEBUG)
diff --git a/requirements.txt b/requirements.txt
index 1122539..94662ac 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,6 +4,7 @@ bs4
feedparser
granary>=1.8
httpsig
+jinja2
mf2py>=1.0.4
mf2util>=0.5.0
mock
diff --git a/static/index.html b/static/index.html
index 2ca7a30..da53093 100644
--- a/static/index.html
+++ b/static/index.html
@@ -50,6 +50,7 @@ and the rest of the fediverse<
If you sent a webmention, check the HTTP response code and body. It will usually describe the error.
+If you got an HTTP 204 from an attempt to federate a response to Mastodon, that means Mastodon accepted the response. If it doesn't show up, that's a known inconsistency right now. We're actively working with them to debug these cases.
+You can also see recent Bridgy Fed requests here, including raw logs. Warning: not for the faint of heart!
+Nothing! Bridgy Fed is small, and it doesn't cost much to run. We don't need donations, promise. diff --git a/static/style.css b/static/style.css index c40142d..20c2e44 100644 --- a/static/style.css +++ b/static/style.css @@ -157,3 +157,10 @@ pre .keyword, code.keyword { pre .value, code.value { color: chocolate; } + +td, th { + padding-left: .4em; + padding-right: .4em; + padding-top: .2em; + padding-bottom: .2em; +} diff --git a/templates/responses.html b/templates/responses.html new file mode 100644 index 0000000..ba55f66 --- /dev/null +++ b/templates/responses.html @@ -0,0 +1,32 @@ + + +
+ +Source | Target | Protocol | Status | Log |
---|---|---|---|---|
{{ r.source|safe }} | +{{ r.target|safe }} | +{{ r.protocol }} | +{{ r.status }} | +{{ r.updated.replace(microsecond=0) }} | +