kopia lustrzana https://github.com/snarfed/bridgy-fed
protocol, activitypub: drop some verbose logging from INFO down to DEBUG
rodzic
c09ea21baf
commit
96846c2f2a
|
|
@ -471,7 +471,7 @@ class ActivityPub(User, Protocol):
|
|||
error('No HTTP Signature', status=401)
|
||||
|
||||
logger.info('Verifying HTTP Signature')
|
||||
# logger.info(f'Headers: {json_dumps(headers, indent=2)}')
|
||||
logger.debug(f'Headers: {json_dumps(headers, indent=2)}')
|
||||
|
||||
# parse_signature_header lower-cases all keys
|
||||
sig_fields = parse_signature_header(sig)
|
||||
|
|
@ -615,7 +615,7 @@ def signed_request(fn, url, data=None, headers=None, from_user=None,
|
|||
from_user = instance_actor()
|
||||
|
||||
if data:
|
||||
logger.info(f'Sending AS2 object: {json_dumps(data, indent=2)}')
|
||||
logger.debug(f'Sending AS2 object: {json_dumps(data, indent=2)}')
|
||||
data = json_dumps(data).encode()
|
||||
|
||||
headers = {
|
||||
|
|
@ -667,7 +667,7 @@ def signed_request(fn, url, data=None, headers=None, from_user=None,
|
|||
if (type and type != 'text/html' and
|
||||
(type.startswith('text/') or type.endswith('+json')
|
||||
or type.endswith('/json'))):
|
||||
logger.info(resp.text)
|
||||
logger.debug(resp.text)
|
||||
|
||||
return resp
|
||||
|
||||
|
|
@ -989,7 +989,7 @@ def actor(handle_or_id):
|
|||
# 'alsoKnownAs': [host_url(id)],
|
||||
})
|
||||
|
||||
# logger.info(f'Returning: {json_dumps(actor, indent=2)}')
|
||||
logger.debug(f'Returning: {json_dumps(actor, indent=2)}')
|
||||
return actor, {
|
||||
'Content-Type': as2.CONTENT_TYPE_LD_PROFILE,
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
|
|
@ -1148,7 +1148,7 @@ def follower_collection(id, collection):
|
|||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': request.url,
|
||||
})
|
||||
# logger.info(f'Returning {json_dumps(page, indent=2)}')
|
||||
logger.debug(f'Returning {json_dumps(page, indent=2)}')
|
||||
return page, {'Content-Type': as2.CONTENT_TYPE_LD_PROFILE}
|
||||
|
||||
ret = {
|
||||
|
|
@ -1167,7 +1167,7 @@ def follower_collection(id, collection):
|
|||
if count != 1001:
|
||||
ret['totalItems'] = count
|
||||
|
||||
# logger.info(f'Returning {json_dumps(collection, indent=2)}')
|
||||
logger.debug(f'Returning {json_dumps(collection, indent=2)}')
|
||||
return ret, {
|
||||
'Content-Type': as2.CONTENT_TYPE_LD_PROFILE,
|
||||
}
|
||||
|
|
@ -1217,7 +1217,7 @@ def outbox(id):
|
|||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': request.url,
|
||||
})
|
||||
# logger.info(f'Returning {json_dumps(page, indent=2)}')
|
||||
logger.debug(f'Returning {json_dumps(page, indent=2)}')
|
||||
return page, {'Content-Type': as2.CONTENT_TYPE_LD_PROFILE}
|
||||
|
||||
ret = {
|
||||
|
|
|
|||
12
protocol.py
12
protocol.py
|
|
@ -768,7 +768,6 @@ class Protocol:
|
|||
id = obj.as1.get('id')
|
||||
obj.key = ndb.Key(Object, id)
|
||||
|
||||
logger.info(f'Receiving {from_cls.LABEL} {obj.type} {id} AS1: {json_dumps(obj.as1, indent=2)}')
|
||||
if not id:
|
||||
error('No id provided')
|
||||
elif from_cls.is_blocklisted(id, allow_internal=internal):
|
||||
|
|
@ -791,6 +790,8 @@ class Protocol:
|
|||
and from_cls.load(id, remote=False)))):
|
||||
error(f'Already seen this activity {id}', status=204)
|
||||
|
||||
logger.info(f'Receiving {from_cls.LABEL} {obj.type} {id} AS1: {json_dumps(obj.as1, indent=2)}')
|
||||
|
||||
# does this protocol support this activity/object type?
|
||||
from_cls.check_supported(obj)
|
||||
|
||||
|
|
@ -1172,7 +1173,8 @@ class Protocol:
|
|||
**obj.as1,
|
||||
},
|
||||
}
|
||||
logger.info(f'Wrapping in update: {json_dumps(update_as1, indent=2)}')
|
||||
logger.info(f'Wrapping in update')
|
||||
logger.debug(f' AS1: {json_dumps(update_as1, indent=2)}')
|
||||
return Object(id=id, our_as1=update_as1,
|
||||
source_protocol=obj.source_protocol)
|
||||
|
||||
|
|
@ -1193,7 +1195,8 @@ class Protocol:
|
|||
'object': obj.as1,
|
||||
'published': now,
|
||||
}
|
||||
logger.info(f'Wrapping in post: {json_dumps(create_as1, indent=2)}')
|
||||
logger.info(f'Wrapping in post')
|
||||
logger.debug(f' AS1: {json_dumps(create_as1, indent=2)}')
|
||||
return Object.get_or_create(create_id, our_as1=create_as1,
|
||||
source_protocol=obj.source_protocol,
|
||||
authed_as=authed_as)
|
||||
|
|
@ -1656,7 +1659,8 @@ def send_task():
|
|||
if form.get('orig_obj') else None)
|
||||
|
||||
# send
|
||||
logger.info(f'Sending {protocol} {obj.type} {obj.key.id()} AS1: {json_dumps(obj.as1, indent=2)}')
|
||||
logger.info(f'Sending {protocol} {obj.type} {obj.key.id()}')
|
||||
logger.debug(f' AS1: {json_dumps(obj.as1, indent=2)}')
|
||||
sent = None
|
||||
try:
|
||||
sent = PROTOCOLS[protocol].send(obj, url, from_user=user, orig_obj=orig_obj)
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue