logging.debug('Params: %s', list(self.request.params.items())) if not self.lease(ndb.Key(urlsafe=self.request.params['key'])): return source_domains = self.entity.source.get().domains to_send = set() for url in self.entity.unsent: url, domain, ok = util.get_webmention_target(url) # skip "self" links to this blog's domain if ok and domain not in source_domains: to_send.add(url) self.entity.unsent = list(to_send) self.send_webmentions() def source_url(self, target_url): return self.entity.key.id() application = webutil_handlers.ndb_context_middleware(webapp2.WSGIApplication( [ ('/_ah/queue/poll(-now)?', Poll), ('/_ah/queue/discover', Discover), ('/_ah/queue/propagate', PropagateResponse), ('/_ah/queue/propagate-blogpost', PropagateBlogPost), ('/_ah/(start|stop|warmup)', util.NoopHandler), ] + cron.ROUTES, debug=appengine_info.DEBUG), client=ndb_client)
def handle_exception(self, e, debug): if isinstance( e, (ValueError, requests.RequestException, exc.HTTPException)): logging.warning('', stack_info=True) return self.redirect('/?%s#logins' % urllib.parse.urlencode({'failure': str(e)})) return super(MastodonStart, self).handle_exception(e, debug) oauth_routes = [] for silo, module in OAUTHS.items(): starter = MastodonStart if silo == 'mastodon' else module.StartHandler oauth_routes.extend(( ('/%s/start_auth' % silo, starter.to('/%s/oauth_callback' % silo)), ('/%s/oauth_callback' % silo, module.CallbackHandler.to('/#logins')), )) application = handlers.ndb_context_middleware( webapp2.WSGIApplication([ ('/', FrontPageHandler), ('/demo', DemoHandler), ('/url', UrlHandler), ('/cron/build_circle', cron.BuildCircle), ] + oauth_routes + handlers.HOST_META_ROUTES + [ ('.*', api.Handler), ], debug=appengine_info.DEBUG), client=appengine_config.ndb_client)
routes = [] for module in MODULES: routes += module.ROUTES routes += [ ('/?', FrontPageHandler), ('/users/?', UsersHandler), ('/(blogger|fake|fake_blog|flickr|github|instagram|mastodon|medium|tumblr|twitter|wordpress)/([^/]+)/?', UserHandler), ('/facebook/.*', FacebookIsDeadHandler), ('/googleplus/.*', GooglePlusIsDeadHandler), ('/about/?', AboutHandler), ('/delete/start', DeleteStartHandler), ('/delete/finish', DeleteFinishHandler), ('/discover', DiscoverHandler), ('/poll-now', PollNowHandler), ('/crawl-now', CrawlNowHandler), ('/retry', RetryHandler), ('/(listen|publish)/?', RedirectToFrontPageHandler), ('/edit-websites', EditWebsites), ('/logout', LogoutHandler), ('/csp-report', CspReportHandler), ('/log', LogHandler), ('/_ah/(start|stop|warmup)', util.NoopHandler), ] application = webutil_handlers.ndb_context_middleware(webapp2.WSGIApplication( routes, debug=appengine_info.DEBUG), client=ndb_client)
image_prefix='/static/', outer_classes='col-md-3 col-sm-4 col-xs-6') for site, module in SITES.items() }) return vars class IndieAuthStart(indieauth.StartHandler): handle_exception = handle_discovery_errors class MastodonStart(mastodon.StartHandler): handle_exception = handle_discovery_errors routes = [] for site, module in SITES.items(): starter = (IndieAuthStart if site == 'indieauth' else MastodonStart if site == 'mastodon' else module.StartHandler) routes.extend(( ('/%s/start' % site, starter.to('/%s/oauth_callback' % site)), ('/%s/oauth_callback' % site, module.CallbackHandler.to('/')), )) application = handlers.ndb_context_middleware( webapp2.WSGIApplication([ ('/', FrontPageHandler), ] + routes, debug=appengine_info.DEBUG), client=appengine_config.ndb_client)