mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
f1b37f2bde
41
daemon.py
41
daemon.py
|
@ -7862,21 +7862,33 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if actor_json.get('alsoKnownAs'):
|
if actor_json.get('alsoKnownAs'):
|
||||||
also_known_as = actor_json['alsoKnownAs']
|
also_known_as = actor_json['alsoKnownAs']
|
||||||
|
|
||||||
if curr_session:
|
|
||||||
check_for_changed_actor(curr_session,
|
|
||||||
self.server.base_dir,
|
|
||||||
self.server.http_prefix,
|
|
||||||
self.server.domain_full,
|
|
||||||
options_actor, options_profile_url,
|
|
||||||
self.server.person_cache, 5)
|
|
||||||
|
|
||||||
access_keys = self.server.access_keys
|
access_keys = self.server.access_keys
|
||||||
|
nickname = 'instance'
|
||||||
if '/users/' in path:
|
if '/users/' in path:
|
||||||
nickname = path.split('/users/')[1]
|
nickname = path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
if self.server.key_shortcuts.get(nickname):
|
if self.server.key_shortcuts.get(nickname):
|
||||||
access_keys = self.server.key_shortcuts[nickname]
|
access_keys = self.server.key_shortcuts[nickname]
|
||||||
|
|
||||||
|
if curr_session:
|
||||||
|
# because this is slow, do it in a separate thread
|
||||||
|
if self.server.thrCheckActor.get(nickname):
|
||||||
|
# kill existing thread
|
||||||
|
self.server.thrCheckActor[nickname].kill()
|
||||||
|
|
||||||
|
self.server.thrCheckActor[nickname] = \
|
||||||
|
thread_with_trace(target=check_for_changed_actor,
|
||||||
|
args=(curr_session,
|
||||||
|
self.server.base_dir,
|
||||||
|
self.server.http_prefix,
|
||||||
|
self.server.domain_full,
|
||||||
|
options_actor, options_profile_url,
|
||||||
|
self.server.person_cache,
|
||||||
|
self.server.check_actor_timeout),
|
||||||
|
daemon=True)
|
||||||
|
self.server.thrCheckActor[nickname].start()
|
||||||
|
|
||||||
msg = \
|
msg = \
|
||||||
html_person_options(self.server.default_timeline,
|
html_person_options(self.server.default_timeline,
|
||||||
self.server.css_cache,
|
self.server.css_cache,
|
||||||
|
@ -20620,7 +20632,8 @@ def load_tokens(base_dir: str, tokens_dict: {}, tokens_lookup: {}) -> None:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def run_daemon(crawlers_allowed: [],
|
def run_daemon(check_actor_timeout: int,
|
||||||
|
crawlers_allowed: [],
|
||||||
dyslexic_font: bool,
|
dyslexic_font: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
lists_enabled: str,
|
lists_enabled: str,
|
||||||
|
@ -20786,6 +20799,12 @@ def run_daemon(crawlers_allowed: [],
|
||||||
'Reminder': 'r'
|
'Reminder': 'r'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# timeout used when checking for actor changes when clicking an avatar
|
||||||
|
# and entering person options screen
|
||||||
|
if check_actor_timeout < 2:
|
||||||
|
check_actor_timeout = 2
|
||||||
|
httpd.check_actor_timeout = check_actor_timeout
|
||||||
|
|
||||||
# how many hours after a post was publushed can a reply be made
|
# how many hours after a post was publushed can a reply be made
|
||||||
default_reply_interval_hrs = 9999999
|
default_reply_interval_hrs = 9999999
|
||||||
httpd.default_reply_interval_hrs = default_reply_interval_hrs
|
httpd.default_reply_interval_hrs = default_reply_interval_hrs
|
||||||
|
@ -21211,6 +21230,10 @@ def run_daemon(crawlers_allowed: [],
|
||||||
# this is the instance actor private key
|
# this is the instance actor private key
|
||||||
httpd.signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
httpd.signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||||
|
|
||||||
|
# threads used for checking for actor changes when clicking on
|
||||||
|
# avatar icon / person options
|
||||||
|
httpd.thrCheckActor = {}
|
||||||
|
|
||||||
if not unit_test:
|
if not unit_test:
|
||||||
print('THREAD: Creating inbox queue watchdog')
|
print('THREAD: Creating inbox queue watchdog')
|
||||||
httpd.thrWatchdog = \
|
httpd.thrWatchdog = \
|
||||||
|
|
|
@ -195,6 +195,10 @@ parser.add_argument('--i2p_domain', dest='i2p_domain', type=str,
|
||||||
parser.add_argument('-p', '--port', dest='port', type=int,
|
parser.add_argument('-p', '--port', dest='port', type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help='Port number to run on')
|
help='Port number to run on')
|
||||||
|
parser.add_argument('--check-actor-timeout', dest='check_actor_timeout',
|
||||||
|
type=int, default=2,
|
||||||
|
help='Timeout in seconds used for checking is an actor ' +
|
||||||
|
'has changed when clicking their avatar image')
|
||||||
parser.add_argument('--year', dest='year', type=int,
|
parser.add_argument('--year', dest='year', type=int,
|
||||||
default=search_date.year,
|
default=search_date.year,
|
||||||
help='Year for calendar query')
|
help='Year for calendar query')
|
||||||
|
@ -3425,7 +3429,8 @@ if args.defaultCurrency:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print('allowdeletion: ' + str(args.allowdeletion))
|
print('allowdeletion: ' + str(args.allowdeletion))
|
||||||
run_daemon(crawlers_allowed,
|
run_daemon(args.check_actor_timeout,
|
||||||
|
crawlers_allowed,
|
||||||
args.dyslexic_font,
|
args.dyslexic_font,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
lists_enabled,
|
lists_enabled,
|
||||||
|
|
19
tests.py
19
tests.py
|
@ -824,8 +824,10 @@ def create_server_alice(path: str, domain: str, port: int,
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
dyslexic_font = False
|
dyslexic_font = False
|
||||||
crawlers_allowed = []
|
crawlers_allowed = []
|
||||||
|
check_actor_timeout = 2
|
||||||
print('Server running: Alice')
|
print('Server running: Alice')
|
||||||
run_daemon(crawlers_allowed,
|
run_daemon(check_actor_timeout,
|
||||||
|
crawlers_allowed,
|
||||||
dyslexic_font,
|
dyslexic_font,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
|
@ -979,8 +981,10 @@ def create_server_bob(path: str, domain: str, port: int,
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
dyslexic_font = False
|
dyslexic_font = False
|
||||||
crawlers_allowed = []
|
crawlers_allowed = []
|
||||||
|
check_actor_timeout = 2
|
||||||
print('Server running: Bob')
|
print('Server running: Bob')
|
||||||
run_daemon(crawlers_allowed,
|
run_daemon(check_actor_timeout,
|
||||||
|
crawlers_allowed,
|
||||||
dyslexic_font,
|
dyslexic_font,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
|
@ -1057,8 +1061,10 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
dyslexic_font = False
|
dyslexic_font = False
|
||||||
crawlers_allowed = []
|
crawlers_allowed = []
|
||||||
|
check_actor_timeout = 2
|
||||||
print('Server running: Eve')
|
print('Server running: Eve')
|
||||||
run_daemon(crawlers_allowed,
|
run_daemon(check_actor_timeout,
|
||||||
|
crawlers_allowed,
|
||||||
dyslexic_font,
|
dyslexic_font,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
|
@ -1137,8 +1143,10 @@ def create_server_group(path: str, domain: str, port: int,
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
dyslexic_font = False
|
dyslexic_font = False
|
||||||
crawlers_allowed = []
|
crawlers_allowed = []
|
||||||
|
check_actor_timeout = 2
|
||||||
print('Server running: Group')
|
print('Server running: Group')
|
||||||
run_daemon(crawlers_allowed,
|
run_daemon(check_actor_timeout,
|
||||||
|
crawlers_allowed,
|
||||||
dyslexic_font,
|
dyslexic_font,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
|
@ -5096,7 +5104,8 @@ def _test_functions():
|
||||||
'e2e_eremove_device',
|
'e2e_eremove_device',
|
||||||
'setOrganizationScheme',
|
'setOrganizationScheme',
|
||||||
'fill_headers',
|
'fill_headers',
|
||||||
'_nothing'
|
'_nothing',
|
||||||
|
'check_for_changed_actor'
|
||||||
]
|
]
|
||||||
exclude_imports = [
|
exclude_imports = [
|
||||||
'link',
|
'link',
|
||||||
|
|
|
@ -136,6 +136,7 @@ def html_person_options(default_timeline: str,
|
||||||
get_config_param(base_dir, 'instanceTitle')
|
get_config_param(base_dir, 'instanceTitle')
|
||||||
options_str = \
|
options_str = \
|
||||||
html_header_with_external_style(css_filename, instance_title, None)
|
html_header_with_external_style(css_filename, instance_title, None)
|
||||||
|
|
||||||
options_str += html_keyboard_navigation(text_mode_banner, {}, {})
|
options_str += html_keyboard_navigation(text_mode_banner, {}, {})
|
||||||
options_str += '<br><br>\n'
|
options_str += '<br><br>\n'
|
||||||
options_str += '<div class="options">\n'
|
options_str += '<div class="options">\n'
|
||||||
|
@ -196,6 +197,7 @@ def html_person_options(default_timeline: str,
|
||||||
other_accounts_html += '</p>\n'
|
other_accounts_html += '</p>\n'
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
options_str += other_accounts_html
|
options_str += other_accounts_html
|
||||||
|
|
||||||
if email_address:
|
if email_address:
|
||||||
options_str += \
|
options_str += \
|
||||||
'<p class="imText">' + translate['Email'] + \
|
'<p class="imText">' + translate['Email'] + \
|
||||||
|
@ -259,6 +261,7 @@ def html_person_options(default_timeline: str,
|
||||||
options_actor + '">\n'
|
options_actor + '">\n'
|
||||||
options_str += ' <input type="hidden" name="avatarUrl" value="' + \
|
options_str += ' <input type="hidden" name="avatarUrl" value="' + \
|
||||||
options_profile_url + '">\n'
|
options_profile_url + '">\n'
|
||||||
|
|
||||||
if authorized:
|
if authorized:
|
||||||
if origin_path_str == '/users/' + nickname:
|
if origin_path_str == '/users/' + nickname:
|
||||||
if options_nickname:
|
if options_nickname:
|
||||||
|
|
Loading…
Reference in New Issue