Resolve wordpress style id when getting posts from the commandline

merge-requests/30/head
Bob Mottram 2023-10-12 12:59:14 +01:00
parent 126c3aa2e8
commit b7800e3fcc
2 changed files with 15 additions and 2 deletions

View File

@ -881,7 +881,12 @@ def _command_options() -> None:
print('origin_domain: ' + str(origin_domain))
if argb.posts.startswith('@'):
argb.posts = argb.posts[1:]
if '@' not in argb.posts or '/@/' in argb.posts:
url_with_at = False
if '://' in argb.posts and '/@' in argb.posts and \
'/@/' not in argb.posts:
url_with_at = True
if '@' not in argb.posts or '/@/' in argb.posts or \
url_with_at:
posts_nickname = get_nickname_from_actor(argb.posts)
if not posts_nickname:
print('No nickname found ' + argb.posts)
@ -1151,7 +1156,12 @@ def _command_options() -> None:
print('origin_domain: ' + str(origin_domain))
if argb.postsraw.startswith('@'):
argb.postsraw = argb.postsraw[1:]
if '@' not in argb.postsraw or '/@/' in argb.postsraw:
url_with_at = False
if '://' in argb.postsraw and '/@' in argb.postsraw and \
'/@/' not in argb.postsraw:
url_with_at = True
if '@' not in argb.postsraw or '/@/' in argb.postsraw or \
url_with_at:
posts_nickname = get_nickname_from_actor(argb.postsraw)
if not posts_nickname:
print('No nickname found ' + argb.postsraw)
@ -1163,6 +1173,8 @@ def _command_options() -> None:
argb.postsraw = \
get_full_domain(posts_nickname + '@' + posts_domain,
posts_port)
if argb.debug:
print('handle: ' + argb.postsraw)
if '@' not in argb.postsraw:
print('Syntax: --postsraw nickname@domain')
sys.exit()

View File

@ -4554,6 +4554,7 @@ def harmless_markup(post_json_object: {}) -> None:
print('WARN: harmless_markup unknown Map ' + map_name + ' ' +
str(post_json_object['object'][map_name]))
def ap_proxy_type(json_object: {}) -> str:
"""Returns a string indicating the proxy for an activitypub post
or None if not proxied