POST from lynx browser

merge-requests/30/head
Bob Mottram 2022-07-10 23:18:36 +01:00
parent 17d7432fc6
commit 712beebcb8
1 changed files with 170 additions and 137 deletions

View File

@ -4739,6 +4739,8 @@ class PubServer(BaseHTTPRequestHandler):
users_path = path.replace('/linksdata', '')
users_path = users_path.replace('/editlinks', '')
actor_str = self._get_instance_url(calling_domain) + users_path
boundary = None
if ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
if ';' in boundary:
@ -4758,6 +4760,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
if self.headers.get('Content-length'):
length = int(self.headers['Content-length'])
# check that the POST isn't too large
@ -4793,6 +4796,11 @@ class PubServer(BaseHTTPRequestHandler):
tos_filename = base_dir + '/accounts/tos.md'
specification_filename = base_dir + '/accounts/activitypub.md'
if not boundary:
if b'--LYNX' in post_bytes:
boundary = '--LYNX'
if boundary:
# extract all of the text fields into a dict
fields = \
extract_text_fields_in_post(post_bytes, boundary, debug)
@ -4918,6 +4926,7 @@ class PubServer(BaseHTTPRequestHandler):
users_path = users_path.split('/tags/')[0]
actor_str = self._get_instance_url(calling_domain) + users_path
tag_screen_str = actor_str + '/tags/' + hashtag
boundary = None
if ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
@ -5007,6 +5016,8 @@ class PubServer(BaseHTTPRequestHandler):
users_path = path.replace('/newswiredata', '')
users_path = users_path.replace('/editnewswire', '')
actor_str = self._get_instance_url(calling_domain) + users_path
boundary = None
if ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
if ';' in boundary:
@ -5026,6 +5037,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
if self.headers.get('Content-length'):
length = int(self.headers['Content-length'])
# check that the POST isn't too large
@ -5058,6 +5070,11 @@ class PubServer(BaseHTTPRequestHandler):
newswire_filename = base_dir + '/accounts/newswire.txt'
if not boundary:
if b'--LYNX' in post_bytes:
boundary = '--LYNX'
if boundary:
# extract all of the text fields into a dict
fields = \
extract_text_fields_in_post(post_bytes, boundary, debug)
@ -5276,6 +5293,8 @@ class PubServer(BaseHTTPRequestHandler):
users_path = path.replace('/newseditdata', '')
users_path = users_path.replace('/editnewspost', '')
actor_str = self._get_instance_url(calling_domain) + users_path
boundary = None
if ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
if ';' in boundary:
@ -5300,6 +5319,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
if self.headers.get('Content-length'):
length = int(self.headers['Content-length'])
# check that the POST isn't too large
@ -5335,6 +5355,11 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
if not boundary:
if b'--LYNX' in post_bytes:
boundary = '--LYNX'
if boundary:
# extract all of the text fields into a dict
fields = \
extract_text_fields_in_post(post_bytes, boundary, debug)
@ -5416,6 +5441,8 @@ class PubServer(BaseHTTPRequestHandler):
users_path = path.replace('/profiledata', '')
users_path = users_path.replace('/editprofile', '')
actor_str = self._get_instance_url(calling_domain) + users_path
boundary = None
if ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
if ';' in boundary:
@ -5429,6 +5456,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
if self.headers.get('Content-length'):
length = int(self.headers['Content-length'])
# check that the POST isn't too large
@ -5462,6 +5490,11 @@ class PubServer(BaseHTTPRequestHandler):
admin_nickname = get_config_param(self.server.base_dir, 'admin')
if not boundary:
if b'--LYNX' in post_bytes:
boundary = '--LYNX'
if boundary:
# get the various avatar, banner and background images
actor_changed = True
profile_media_types = (