kopia lustrzana https://github.com/snarfed/bridgy-fed
add /responses page with links to raw logs
log handler itself is next.pull/27/head
rodzic
cf1f4122ec
commit
22ca3e64a6
4
app.yaml
4
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
|
||||
|
|
|
@ -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)
|
|
@ -4,6 +4,7 @@ bs4
|
|||
feedparser
|
||||
granary>=1.8
|
||||
httpsig
|
||||
jinja2
|
||||
mf2py>=1.0.4
|
||||
mf2util>=0.5.0
|
||||
mock
|
||||
|
|
|
@ -50,6 +50,7 @@ and the rest of the <a href="https://en.wikipedia.org/wiki/Fediverse">fediverse<
|
|||
<li><a href="#sites">Which sites are supported?</a></li>
|
||||
<li><a href="#setup">How do I set it up?</a></li>
|
||||
<li><a href="#use">How do I use it?</a></li>
|
||||
<li><a href="#troubleshooting">I tried it, and it didn't work!</a></li>
|
||||
<li><a href="#cost">How much does it cost?</a></li>
|
||||
<li><a href="#who">Who are you? Why did you make this?</a></li>
|
||||
<li><a href="#privacy">What do you do with my data?</a></li>
|
||||
|
@ -204,6 +205,13 @@ For replies, the source will usually be the permalink on the social network itse
|
|||
</p>
|
||||
</li>
|
||||
|
||||
<li id="troubleshooting" class="question">I tried it, and it didn't work!</li>
|
||||
<li class="answer">
|
||||
<p>If you sent a webmention, check the HTTP response code and body. It will usually describe the error.</p>
|
||||
<p>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.</p>
|
||||
<p>You can also <a href="/responses">see recent Bridgy Fed requests here</a>, including raw logs. Warning: not for the faint of heart!</p>
|
||||
</li>
|
||||
|
||||
<li id="cost" class="question">How much does it cost?</li>
|
||||
<li class="answer">
|
||||
<p>Nothing! Bridgy Fed is small, and it doesn't cost much to run. We don't need donations, promise.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>Bridgy Fed: Logs</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes"/>
|
||||
<link rel="stylesheet" href="/static/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="/static/style.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="tp-main lead container">
|
||||
<h1>Bridgy Fed: Logs</h1>
|
||||
<h3>Recent requests we've attempted to federate.</h3>
|
||||
|
||||
<table>
|
||||
<tr><th>Source</th> <th>Target</th> <th>Protocol</th> <th>Status</th> <th>Log</th></tr>
|
||||
{% for r in responses %}
|
||||
<tr>
|
||||
<td>{{ r.source|safe }}</td>
|
||||
<td>{{ r.target|safe }}</td>
|
||||
<td>{{ r.protocol }}</td>
|
||||
<td>{{ r.status }}</td>
|
||||
<td><a href="">{{ r.updated.replace(microsecond=0) }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Ładowanie…
Reference in New Issue