main
Bob Mottram 2024-04-28 10:47:26 +01:00
parent c5a60176a9
commit 6cd1653681
2 changed files with 12 additions and 8 deletions

View File

@ -248,7 +248,8 @@ def daemon_http_post(self) -> None:
self.server.project_version, self.server.project_version,
self.server.translate, self.server.translate,
self.server.theme_name, self.server.theme_name,
self.server.dyslexic_font) self.server.dyslexic_font,
self.server.peertube_instances)
self.server.postreq_busy = False self.server.postreq_busy = False
return return

View File

@ -237,12 +237,13 @@ def _profile_post_git_projects(base_dir: str, nickname: str, domain: str,
git_projects_filename) git_projects_filename)
def _profile_post_peertube_instances(base_dir: str, fields: {}, self) -> None: def _profile_post_peertube_instances(base_dir: str, fields: {}, self,
peertube_instances: []) -> None:
""" HTTP POST save peertube instances list """ HTTP POST save peertube instances list
""" """
peertube_instances_file = base_dir + '/accounts/peertube.txt' peertube_instances_file = base_dir + '/accounts/peertube.txt'
if fields.get('ptInstances'): if fields.get('ptInstances'):
self.server.peertube_instances.clear() peertube_instances.clear()
try: try:
with open(peertube_instances_file, 'w+', with open(peertube_instances_file, 'w+',
encoding='utf-8') as afile: encoding='utf-8') as afile:
@ -256,9 +257,9 @@ def _profile_post_peertube_instances(base_dir: str, fields: {}, self) -> None:
url = url.strip() url = url.strip()
if not url: if not url:
continue continue
if url in self.server.peertube_instances: if url in peertube_instances:
continue continue
self.server.peertube_instances.append(url) peertube_instances.append(url)
else: else:
if os.path.isfile(peertube_instances_file): if os.path.isfile(peertube_instances_file):
try: try:
@ -266,7 +267,7 @@ def _profile_post_peertube_instances(base_dir: str, fields: {}, self) -> None:
except OSError: except OSError:
print('EX: _profile_edit unable to delete ' + print('EX: _profile_edit unable to delete ' +
peertube_instances_file) peertube_instances_file)
self.server.peertube_instances.clear() peertube_instances.clear()
def _profile_post_block_federated(base_dir: str, fields: {}, self) -> None: def _profile_post_block_federated(base_dir: str, fields: {}, self) -> None:
@ -2427,7 +2428,8 @@ def profile_edit(self, calling_domain: str, cookie: str,
cached_webfingers: {}, cached_webfingers: {},
person_cache: {}, project_version: str, person_cache: {}, project_version: str,
translate: {}, theme_name: str, translate: {}, theme_name: str,
dyslexic_font: bool) -> None: dyslexic_font: bool,
peertube_instances: []) -> None:
"""Updates your user profile after editing via the Edit button """Updates your user profile after editing via the Edit button
on the profile screen on the profile screen
""" """
@ -3053,7 +3055,8 @@ def profile_edit(self, calling_domain: str, cookie: str,
_profile_post_crawlers_allowed(base_dir, fields, self) _profile_post_crawlers_allowed(base_dir, fields, self)
_profile_post_buy_domains(base_dir, fields, self) _profile_post_buy_domains(base_dir, fields, self)
_profile_post_block_federated(base_dir, fields, self) _profile_post_block_federated(base_dir, fields, self)
_profile_post_peertube_instances(base_dir, fields, self) _profile_post_peertube_instances(base_dir, fields, self,
peertube_instances)
_profile_post_git_projects(base_dir, nickname, domain, _profile_post_git_projects(base_dir, nickname, domain,
fields) fields)