From c48a935121b307b2b88386a8440d88bef82fd289 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 13:20:23 +0000
Subject: [PATCH 01/46] Set viewport
---
webapp_utils.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/webapp_utils.py b/webapp_utils.py
index 24b1ea0ed..a8e959536 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -717,6 +717,8 @@ def html_header_with_external_style(css_filename: str, instance_title: str,
metadata + \
' \n' + \
+ ' \n' + \
' ' + instance_title + '\n' + \
' \n' + \
' \n'
From 2ff5e00fb8c6992b5ed98811098dadd13f6abf8b Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 13:22:56 +0000
Subject: [PATCH 02/46] Set viewport
---
webapp_utils.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/webapp_utils.py b/webapp_utils.py
index a8e959536..483686fc5 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -717,8 +717,7 @@ def html_header_with_external_style(css_filename: str, instance_title: str,
metadata + \
' \n' + \
- ' \n' + \
+ ' \n' + \
' ' + instance_title + '\n' + \
' \n' + \
' \n'
From f41d52630b8a8f84415eb9440db9acc0855c6472 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 13:24:34 +0000
Subject: [PATCH 03/46] Remove viewport
---
webapp_utils.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/webapp_utils.py b/webapp_utils.py
index 483686fc5..24b1ea0ed 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -717,7 +717,6 @@ def html_header_with_external_style(css_filename: str, instance_title: str,
metadata + \
' \n' + \
- ' \n' + \
' ' + instance_title + '\n' + \
' \n' + \
' \n'
From acabbc9220e5ca8107c32f63b47c3118727de371 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 18:28:42 +0000
Subject: [PATCH 04/46] Less indentation
---
migrate.py | 59 +++++++++++++++++++++++++++---------------------------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/migrate.py b/migrate.py
index d2252c45b..bf827e39f 100644
--- a/migrate.py
+++ b/migrate.py
@@ -129,41 +129,42 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
following_filename = \
acct_dir(base_dir, nickname, domain) + '/following.txt'
if os.path.isfile(following_filename):
+ following_handles = []
with open(following_filename, 'r', encoding='utf-8') as foll1:
following_handles = foll1.readlines()
- moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
- handle_lower = handle.lower()
+ moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
+ handle_lower = handle.lower()
- refollow_filename = \
- acct_dir(base_dir, nickname, domain) + '/refollow.txt'
+ refollow_filename = \
+ acct_dir(base_dir, nickname, domain) + '/refollow.txt'
- # unfollow the old handle
- with open(following_filename, 'w+', encoding='utf-8') as foll2:
- for follow_handle in following_handles:
- if follow_handle.strip("\n").strip("\r").lower() != \
- handle_lower:
- foll2.write(follow_handle)
+ # unfollow the old handle
+ with open(following_filename, 'w+', encoding='utf-8') as foll2:
+ for follow_handle in following_handles:
+ if follow_handle.strip("\n").strip("\r").lower() != \
+ handle_lower:
+ foll2.write(follow_handle)
+ else:
+ handle_nickname = handle.split('@')[0]
+ handle_domain = handle.split('@')[1]
+ unfollow_account(base_dir, nickname, domain,
+ handle_nickname,
+ handle_domain,
+ debug, group_account, 'following.txt')
+ ctr += 1
+ print('Unfollowed ' + handle + ' who has moved to ' +
+ moved_to_handle)
+
+ # save the new handles to the refollow list
+ if os.path.isfile(refollow_filename):
+ with open(refollow_filename, 'a+',
+ encoding='utf-8') as refoll:
+ refoll.write(moved_to_handle + '\n')
else:
- handle_nickname = handle.split('@')[0]
- handle_domain = handle.split('@')[1]
- unfollow_account(base_dir, nickname, domain,
- handle_nickname,
- handle_domain,
- debug, group_account, 'following.txt')
- ctr += 1
- print('Unfollowed ' + handle + ' who has moved to ' +
- moved_to_handle)
-
- # save the new handles to the refollow list
- if os.path.isfile(refollow_filename):
- with open(refollow_filename, 'a+',
- encoding='utf-8') as refoll:
- refoll.write(moved_to_handle + '\n')
- else:
- with open(refollow_filename, 'w+',
- encoding='utf-8') as refoll:
- refoll.write(moved_to_handle + '\n')
+ with open(refollow_filename, 'w+',
+ encoding='utf-8') as refoll:
+ refoll.write(moved_to_handle + '\n')
followers_filename = \
acct_dir(base_dir, nickname, domain) + '/followers.txt'
From 126032d727affaf81bce491d17fda584867984e2 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 18:35:11 +0000
Subject: [PATCH 05/46] Less indentation
---
migrate.py | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/migrate.py b/migrate.py
index bf827e39f..ca5e7853d 100644
--- a/migrate.py
+++ b/migrate.py
@@ -169,20 +169,21 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
followers_filename = \
acct_dir(base_dir, nickname, domain) + '/followers.txt'
if os.path.isfile(followers_filename):
+ follower_handles = []
with open(followers_filename, 'r', encoding='utf-8') as foll3:
follower_handles = foll3.readlines()
- handle_lower = handle.lower()
+ handle_lower = handle.lower()
- # remove followers who have moved
- with open(followers_filename, 'w+', encoding='utf-8') as foll4:
- for follower_handle in follower_handles:
- if follower_handle.strip("\n").strip("\r").lower() != \
- handle_lower:
- foll4.write(follower_handle)
- else:
- ctr += 1
- print('Removed follower who has moved ' + handle)
+ # remove followers who have moved
+ with open(followers_filename, 'w+', encoding='utf-8') as foll4:
+ for follower_handle in follower_handles:
+ if follower_handle.strip("\n").strip("\r").lower() != \
+ handle_lower:
+ foll4.write(follower_handle)
+ else:
+ ctr += 1
+ print('Removed follower who has moved ' + handle)
return ctr
From cf461cba20b812a823cd16cfd1bcef513ae70650 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 19:30:58 +0000
Subject: [PATCH 06/46] Keep track of moved actors
---
inbox.py | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/inbox.py b/inbox.py
index 0c198bc70..89da6377c 100644
--- a/inbox.py
+++ b/inbox.py
@@ -1088,6 +1088,31 @@ def _person_receive_update(base_dir: str,
if debug:
print('actor updated for ' + person_json['id'])
+ if person_json.get('movedTo'):
+ new_actor = person_json['id'] + ' ' + person_json['movedTo']
+ refollow_str = ''
+ refollow_filename = base_dir + '/accounts/actors_moved.txt'
+ refollow_file_exists = False
+ if os.path.isfile(refollow_filename):
+ try:
+ with open(refollow_filename, 'r',
+ encoding='utf-8') as fp_refollow:
+ refollow_str = fp_refollow.read()
+ refollow_file_exists = True
+ except OSError:
+ print('EX: unable to read ' + refollow_filename)
+ if new_actor not in refollow_str:
+ refollow_type = 'w+'
+ if refollow_file_exists:
+ refollow_type = 'a+'
+ try:
+ with open(refollow_filename, refollow_type,
+ encoding='utf-8') as fp_refollow:
+ fp_refollow.write(new_actor + '\n')
+ except OSError:
+ print('EX: unable to write to ' +
+ refollow_filename)
+
# remove avatar if it exists so that it will be refreshed later
# when a timeline is constructed
actor_str = person_json['id'].replace('/', '-')
From fdbe400def70a0ae84cd9f617b92bd026382a27f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 20:35:12 +0000
Subject: [PATCH 07/46] Function to get moved accounts
---
epicyon.py | 43 ++++++++++++++++++++++++++++++++++++++++
inbox.py | 10 +++++++++-
relationships.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+), 1 deletion(-)
create mode 100644 relationships.py
diff --git a/epicyon.py b/epicyon.py
index 6f078742d..aea29be4f 100644
--- a/epicyon.py
+++ b/epicyon.py
@@ -111,6 +111,7 @@ from desktop_client import run_desktop_client
from happening import dav_month_via_server
from happening import dav_day_via_server
from content import import_emoji
+from relationships import get_moved_accounts
def str2bool(value_str) -> bool:
@@ -343,6 +344,9 @@ def _command_options() -> None:
parser.add_argument('--posts', dest='posts', type=str,
default=None,
help='Show posts for the given handle')
+ parser.add_argument('--moved', dest='moved', type=str,
+ default=None,
+ help='Show moved accounts for the given handle')
parser.add_argument('--postDomains', dest='postDomains', type=str,
default=None,
help='Show domains referenced in public '
@@ -860,6 +864,45 @@ def _command_options() -> None:
signing_priv_key_pem, origin_domain)
sys.exit()
+ if argb.moved:
+ if not argb.domain:
+ origin_domain = get_config_param(base_dir, 'domain')
+ else:
+ origin_domain = argb.domain
+ if debug:
+ print('origin_domain: ' + str(origin_domain))
+ if '@' not in argb.moved:
+ if '/users/' in argb.moved:
+ moved_nickname = get_nickname_from_actor(argb.moved)
+ moved_domain, moved_port = get_domain_from_actor(argb.moved)
+ argb.moved = \
+ get_full_domain(moved_nickname + '@' + moved_domain,
+ moved_port)
+ else:
+ print('Syntax: --moved nickname@domain')
+ sys.exit()
+ if not argb.http:
+ argb.port = 443
+ nickname = argb.moved.split('@')[0]
+ domain = argb.moved.split('@')[1]
+ proxy_type = None
+ if argb.tor or domain.endswith('.onion'):
+ proxy_type = 'tor'
+ if domain.endswith('.onion'):
+ argb.port = 80
+ elif argb.i2p or domain.endswith('.i2p'):
+ proxy_type = 'i2p'
+ if domain.endswith('.i2p'):
+ argb.port = 80
+ elif argb.gnunet:
+ proxy_type = 'gnunet'
+ if not argb.language:
+ argb.language = 'en'
+ moved_dict = \
+ get_moved_accounts(base_dir, nickname, domain, 'following.txt')
+ pprint(moved_dict)
+ sys.exit()
+
if argb.postDomains:
if '@' not in argb.postDomains:
if '/users/' in argb.postDomains:
diff --git a/inbox.py b/inbox.py
index 89da6377c..2789ee364 100644
--- a/inbox.py
+++ b/inbox.py
@@ -1089,7 +1089,15 @@ def _person_receive_update(base_dir: str,
print('actor updated for ' + person_json['id'])
if person_json.get('movedTo'):
- new_actor = person_json['id'] + ' ' + person_json['movedTo']
+ prev_domain, prev_port = get_domain_from_actor(person_json['id'])
+ prev_domain_full = get_full_domain(prev_domain, prev_port)
+ prev_nickname = get_nickname_from_actor(person_json['id'])
+ new_domain, new_port = get_domain_from_actor(person_json['movedTo'])
+ new_domain_full = get_full_domain(new_domain, new_port)
+ new_nickname = get_nickname_from_actor(person_json['movedTo'])
+
+ new_actor = prev_nickname + '@' + prev_domain_full + ' ' + \
+ new_nickname + '@' + new_domain_full
refollow_str = ''
refollow_filename = base_dir + '/accounts/actors_moved.txt'
refollow_file_exists = False
diff --git a/relationships.py b/relationships.py
new file mode 100644
index 000000000..134dedcc1
--- /dev/null
+++ b/relationships.py
@@ -0,0 +1,51 @@
+__filename__ = "relationships.py"
+__author__ = "Bob Mottram"
+__license__ = "AGPL3+"
+__version__ = "1.3.0"
+__maintainer__ = "Bob Mottram"
+__email__ = "bob@libreserver.org"
+__status__ = "Production"
+__module_group__ = "Core"
+
+
+import os
+from utils import acct_dir
+
+
+def get_moved_accounts(base_dir: str, nickname: str, domain: str,
+ filename: str = 'following.txt') -> {}:
+ """returns a dict of moved accounts
+ """
+ refollow_filename = base_dir + '/accounts/actors_moved.txt'
+ if not os.path.isfile(refollow_filename):
+ return {}
+ refollow_str = ''
+ try:
+ with open(refollow_filename, 'r',
+ encoding='utf-8') as fp_refollow:
+ refollow_str = fp_refollow.read()
+ except OSError:
+ print('EX: get_moved_accounts unable to read ' +
+ refollow_filename)
+ refollow_list = refollow_str.split('\n')
+
+ follow_filename = \
+ acct_dir(base_dir, nickname, domain) + '/' + filename
+ follow_str = ''
+ try:
+ with open(follow_filename, 'r',
+ encoding='utf-8') as fp_follow:
+ follow_str = fp_follow.read()
+ except OSError:
+ print('EX: get_moved_accounts unable to read ' +
+ follow_filename)
+ follow_list = follow_str.split('\n')
+
+ result = {}
+ for handle in follow_list:
+ for line in refollow_list:
+ if line.startswith(handle + ' '):
+ new_handle = line.split(' ')[1]
+ result[handle] = new_handle
+ break
+ return result
From d68ed5bf389a34b9ba5ff38019e55cf8d3413216 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 20:44:47 +0000
Subject: [PATCH 08/46] More efficient
---
relationships.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/relationships.py b/relationships.py
index 134dedcc1..1a3f5573c 100644
--- a/relationships.py
+++ b/relationships.py
@@ -28,6 +28,11 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
print('EX: get_moved_accounts unable to read ' +
refollow_filename)
refollow_list = refollow_str.split('\n')
+ refollow_dict = {}
+ for line in refollow_list:
+ prev_handle = line.split(' ')[0]
+ new_handle = line.split(' ')[1]
+ refollow_dict[prev_handle] = new_handle
follow_filename = \
acct_dir(base_dir, nickname, domain) + '/' + filename
@@ -43,9 +48,7 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
result = {}
for handle in follow_list:
- for line in refollow_list:
- if line.startswith(handle + ' '):
- new_handle = line.split(' ')[1]
- result[handle] = new_handle
- break
+ if refollow_dict.get(handle):
+ new_handle = refollow_dict[handle]
+ result[handle] = new_handle
return result
From 40c311336314149637e7974ac7d6526b8d8a855c Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 20:45:23 +0000
Subject: [PATCH 09/46] Tidying
---
relationships.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/relationships.py b/relationships.py
index 1a3f5573c..a906199b1 100644
--- a/relationships.py
+++ b/relationships.py
@@ -49,6 +49,5 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
result = {}
for handle in follow_list:
if refollow_dict.get(handle):
- new_handle = refollow_dict[handle]
- result[handle] = new_handle
+ result[handle] = refollow_dict[handle]
return result
From 1d15e7f94f70af0848fad316575afd1fc5be42d4 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 21:11:16 +0000
Subject: [PATCH 10/46] Remove id ending to avoid ambiguity
---
webapp_profile.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/webapp_profile.py b/webapp_profile.py
index 988a37015..919bd773e 100644
--- a/webapp_profile.py
+++ b/webapp_profile.py
@@ -10,6 +10,7 @@ __module_group__ = "Web Interface"
import os
from pprint import pprint
from webfinger import webfinger_handle
+from utils import remove_id_ending
from utils import standardize_text
from utils import get_display_name
from utils import is_group_account
@@ -1199,9 +1200,10 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
break
shown_items = []
for item in outbox_feed['orderedItems']:
- if not item.get('id'):
- continue
if item['type'] == 'Create':
+ if not item['object'].get('id'):
+ continue
+ item_id = remove_id_ending(item['object']['id'])
post_str = \
individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache,
@@ -1227,9 +1229,9 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images)
- if post_str and item['id'] not in shown_items:
+ if post_str and item_id not in shown_items:
profile_str += post_str + separator_str
- shown_items.append(item['id'])
+ shown_items.append(item_id)
ctr += 1
if ctr >= max_items:
break
From ea500064022838dd6932d075a8f2995b6b9af397 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 22:59:24 +0000
Subject: [PATCH 11/46] Moved follows on profile screen
---
daemon.py | 160 ++++++++++++++++++++++++++++++++++++++++++-
relationships.py | 125 ++++++++++++++++++++++++++++++++-
translations/ar.json | 3 +-
translations/bn.json | 3 +-
translations/ca.json | 3 +-
translations/cy.json | 3 +-
translations/de.json | 3 +-
translations/el.json | 3 +-
translations/en.json | 3 +-
translations/es.json | 3 +-
translations/fa.json | 3 +-
translations/fr.json | 3 +-
translations/ga.json | 3 +-
translations/hi.json | 3 +-
translations/it.json | 3 +-
translations/ja.json | 3 +-
translations/ko.json | 3 +-
translations/ku.json | 3 +-
translations/nl.json | 3 +-
translations/oc.json | 3 +-
translations/pl.json | 3 +-
translations/pt.json | 3 +-
translations/ru.json | 3 +-
translations/sw.json | 3 +-
translations/tr.json | 3 +-
translations/uk.json | 3 +-
translations/yi.json | 3 +-
translations/zh.json | 3 +-
utils.py | 2 +-
webapp_profile.py | 23 +++++++
30 files changed, 359 insertions(+), 29 deletions(-)
diff --git a/daemon.py b/daemon.py
index b9b710bef..2e8b4f996 100644
--- a/daemon.py
+++ b/daemon.py
@@ -415,6 +415,7 @@ from crawlers import load_known_web_bots
from qrcode import save_domain_qrcode
from importFollowing import run_import_following_watchdog
from maps import map_format_from_tagmaps_path
+from relationships import get_moved_feed
import os
@@ -14363,6 +14364,145 @@ class PubServer(BaseHTTPRequestHandler):
return True
return False
+ def _show_moved_feed(self, authorized: bool,
+ calling_domain: str, referer_domain: str,
+ path: str, base_dir: str, http_prefix: str,
+ domain: str, port: int, getreq_start_time,
+ proxy_type: str, cookie: str,
+ debug: str, curr_session) -> bool:
+ """Shows the moved feed
+ """
+ following = \
+ get_moved_feed(base_dir, domain, port, path,
+ http_prefix, authorized, FOLLOWS_PER_PAGE)
+ if following:
+ if self._request_http():
+ page_number = 1
+ if '?page=' not in path:
+ search_path = path
+ # get a page of following, not the summary
+ following = \
+ get_following_feed(base_dir,
+ domain,
+ port,
+ path + '?page=true',
+ http_prefix,
+ authorized, FOLLOWS_PER_PAGE)
+ else:
+ page_number_str = path.split('?page=')[1]
+ if ';' in page_number_str:
+ page_number_str = page_number_str.split(';')[0]
+ if '#' in page_number_str:
+ page_number_str = page_number_str.split('#')[0]
+ if len(page_number_str) > 5:
+ page_number_str = "1"
+ if page_number_str.isdigit():
+ page_number = int(page_number_str)
+ search_path = path.split('?page=')[0]
+ get_person = \
+ person_lookup(domain,
+ search_path.replace('/moved', ''),
+ base_dir)
+ if get_person:
+ curr_session = \
+ self._establish_session("show_moved_feed",
+ curr_session, proxy_type)
+ if not curr_session:
+ self._404()
+ return True
+
+ access_keys = self.server.access_keys
+ city = None
+ timezone = None
+ if '/users/' in path:
+ nickname = path.split('/users/')[1]
+ if '/' in nickname:
+ nickname = nickname.split('/')[0]
+ if self.server.key_shortcuts.get(nickname):
+ access_keys = \
+ self.server.key_shortcuts[nickname]
+
+ city = get_spoofed_city(self.server.city,
+ base_dir, nickname, domain)
+ if self.server.account_timezone.get(nickname):
+ timezone = \
+ self.server.account_timezone.get(nickname)
+ content_license_url = \
+ self.server.content_license_url
+ shared_items_federated_domains = \
+ self.server.shared_items_federated_domains
+ bold_reading = False
+ if self.server.bold_reading.get(nickname):
+ bold_reading = True
+ msg = \
+ html_profile(self.server.signing_priv_key_pem,
+ self.server.rss_icon_at_top,
+ self.server.icons_as_buttons,
+ self.server.default_timeline,
+ self.server.recent_posts_cache,
+ self.server.max_recent_posts,
+ self.server.translate,
+ self.server.project_version,
+ base_dir, http_prefix,
+ authorized,
+ get_person, 'moved',
+ curr_session,
+ self.server.cached_webfingers,
+ self.server.person_cache,
+ self.server.yt_replace_domain,
+ self.server.twitter_replacement_domain,
+ self.server.show_published_date_only,
+ self.server.newswire,
+ self.server.theme_name,
+ self.server.dormant_months,
+ self.server.peertube_instances,
+ self.server.allow_local_network_access,
+ self.server.text_mode_banner,
+ self.server.debug,
+ access_keys, city,
+ self.server.system_language,
+ self.server.max_like_count,
+ shared_items_federated_domains,
+ following,
+ page_number,
+ FOLLOWS_PER_PAGE,
+ self.server.cw_lists,
+ self.server.lists_enabled,
+ content_license_url,
+ timezone, bold_reading).encode('utf-8')
+ msglen = len(msg)
+ self._set_headers('text/html',
+ msglen, cookie, calling_domain, False)
+ self._write(msg)
+ fitness_performance(getreq_start_time,
+ self.server.fitness,
+ '_GET', '_show_moved_feed',
+ debug)
+ return True
+ else:
+ if self._secure_mode(curr_session, proxy_type):
+ msg_str = json.dumps(following,
+ ensure_ascii=False)
+ msg_str = self._convert_domains(calling_domain,
+ referer_domain,
+ msg_str)
+ msg = msg_str.encode('utf-8')
+ msglen = len(msg)
+ accept_str = self.headers['Accept']
+ protocol_str = \
+ get_json_content_from_accept(accept_str)
+ self._set_headers(protocol_str, msglen,
+ None, calling_domain, False)
+ self._write(msg)
+ fitness_performance(getreq_start_time,
+ self.server.fitness,
+ '_GET', '_show_moved_feed json',
+ debug)
+ else:
+ self._404()
+ return True
+ return False
+
def _show_followers_feed(self, authorized: bool,
calling_domain: str, referer_domain: str,
path: str, base_dir: str, http_prefix: str,
@@ -19147,6 +19287,24 @@ class PubServer(BaseHTTPRequestHandler):
'_GET', 'show profile 3 done',
self.server.debug)
+ if self._show_moved_feed(authorized,
+ calling_domain, referer_domain,
+ self.path,
+ self.server.base_dir,
+ self.server.http_prefix,
+ self.server.domain,
+ self.server.port,
+ getreq_start_time,
+ proxy_type,
+ cookie, self.server.debug,
+ curr_session):
+ self.server.getreq_busy = False
+ return
+
+ fitness_performance(getreq_start_time, self.server.fitness,
+ '_GET', 'show moved 4 done',
+ self.server.debug)
+
if self._show_followers_feed(authorized,
calling_domain, referer_domain,
self.path,
@@ -19162,7 +19320,7 @@ class PubServer(BaseHTTPRequestHandler):
return
fitness_performance(getreq_start_time, self.server.fitness,
- '_GET', 'show profile 4 done',
+ '_GET', 'show profile 5 done',
self.server.debug)
# look up a person
diff --git a/relationships.py b/relationships.py
index a906199b1..784cc46c5 100644
--- a/relationships.py
+++ b/relationships.py
@@ -7,9 +7,13 @@ __email__ = "bob@libreserver.org"
__status__ = "Production"
__module_group__ = "Core"
-
import os
from utils import acct_dir
+from utils import valid_nickname
+from utils import get_full_domain
+from utils import local_actor_url
+from utils import remove_domain_port
+from utils import remove_eol
def get_moved_accounts(base_dir: str, nickname: str, domain: str,
@@ -51,3 +55,122 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
if refollow_dict.get(handle):
result[handle] = refollow_dict[handle]
return result
+
+
+def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
+ http_prefix: str, authorized: bool,
+ follows_per_page=12) -> {}:
+ """Returns the moved accounts feed from GET requests.
+ """
+ # Show a small number of follows to non-authorized viewers
+ if not authorized:
+ follows_per_page = 6
+
+ if '/moved' not in path:
+ return None
+ # handle page numbers
+ header_only = True
+ page_number = None
+ if '?page=' in path:
+ page_number = path.split('?page=')[1]
+ if len(page_number) > 5:
+ page_number = "1"
+ if page_number == 'true' or not authorized:
+ page_number = 1
+ else:
+ try:
+ page_number = int(page_number)
+ except BaseException:
+ print('EX: get_moved_feed unable to convert to int ' +
+ str(page_number))
+ path = path.split('?page=')[0]
+ header_only = False
+
+ if not path.endswith('/moved'):
+ return None
+ nickname = None
+ if path.startswith('/users/'):
+ nickname = \
+ path.replace('/users/', '', 1).replace('/moved', '')
+ if path.startswith('/@'):
+ nickname = path.replace('/@', '', 1).replace('/moved', '')
+ if not nickname:
+ return None
+ if not valid_nickname(domain, nickname):
+ return None
+
+ domain = get_full_domain(domain, port)
+
+ lines = get_moved_accounts(base_dir, nickname, domain,
+ 'following.txt')
+
+ if header_only:
+ first_str = \
+ local_actor_url(http_prefix, nickname, domain) + \
+ '/moved?page=1'
+ id_str = \
+ local_actor_url(http_prefix, nickname, domain) + '/moved'
+ total_str = str(len(lines.items()))
+ following = {
+ '@context': 'https://www.w3.org/ns/activitystreams',
+ 'first': first_str,
+ 'id': id_str,
+ 'totalItems': total_str,
+ 'type': 'OrderedCollection'
+ }
+ return following
+
+ if not page_number:
+ page_number = 1
+
+ next_page_number = int(page_number + 1)
+ id_str = \
+ local_actor_url(http_prefix, nickname, domain) + \
+ '/moved?page=' + str(page_number)
+ part_of_str = \
+ local_actor_url(http_prefix, nickname, domain) + '/moved'
+ following = {
+ '@context': 'https://www.w3.org/ns/activitystreams',
+ 'id': id_str,
+ 'orderedItems': [],
+ 'partOf': part_of_str,
+ 'totalItems': 0,
+ 'type': 'OrderedCollectionPage'
+ }
+
+ handle_domain = domain
+ handle_domain = remove_domain_port(handle_domain)
+ accounts_dir = acct_dir(base_dir, nickname, handle_domain)
+ filename = accounts_dir + '/moved.txt'
+ if not os.path.isfile(filename):
+ return following
+ curr_page = 1
+ page_ctr = 0
+ total_ctr = 0
+ for handle, new_handle in lines.items():
+ # nickname@domain
+ page_ctr += 1
+ total_ctr += 1
+ if curr_page == page_number:
+ line2_lower = handle.lower()
+ line2 = remove_eol(line2_lower)
+ nick = line2.split('@')[0]
+ dom = line2.split('@')[1]
+ if not nick.startswith('!'):
+ # person actor
+ url = local_actor_url(http_prefix, nick, dom)
+ else:
+ # group actor
+ url = http_prefix + '://' + dom + '/c/' + nick
+ following['orderedItems'].append(url)
+ if page_ctr >= follows_per_page:
+ page_ctr = 0
+ curr_page += 1
+ following['totalItems'] = total_ctr
+ last_page = int(total_ctr / follows_per_page)
+ last_page = max(last_page, 1)
+ if next_page_number > last_page:
+ following['next'] = \
+ local_actor_url(http_prefix, nickname, domain) + \
+ '/moved?page=' + str(last_page)
+ return following
diff --git a/translations/ar.json b/translations/ar.json
index fa4713dbf..426ed88ed 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -602,5 +602,6 @@
"Minimize all images": "تصغير كل الصور",
"Edit post": "تعديل المنشور",
"Preview posts on profile screen": "معاينة المشاركات على شاشة الملف الشخصي",
- "Reverse timelines": "عكس الجداول الزمنية"
+ "Reverse timelines": "عكس الجداول الزمنية",
+ "Moved": "انتقل"
}
diff --git a/translations/bn.json b/translations/bn.json
index 7d29655b1..2aeb2c333 100644
--- a/translations/bn.json
+++ b/translations/bn.json
@@ -602,5 +602,6 @@
"Minimize all images": "সমস্ত ছবি ছোট করুন",
"Edit post": "পোস্ট সম্পাদনা করুন",
"Preview posts on profile screen": "প্রোফাইল স্ক্রিনে পোস্টের পূর্বরূপ দেখুন",
- "Reverse timelines": "বিপরীত সময়রেখা"
+ "Reverse timelines": "বিপরীত সময়রেখা",
+ "Moved": "সরানো হয়েছে"
}
diff --git a/translations/ca.json b/translations/ca.json
index d67b78592..cf2a852cb 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -602,5 +602,6 @@
"Minimize all images": "Minimitzar totes les imatges",
"Edit post": "Edita la publicació",
"Preview posts on profile screen": "Previsualitza les publicacions a la pantalla del perfil",
- "Reverse timelines": "Cronologia inversa"
+ "Reverse timelines": "Cronologia inversa",
+ "Moved": "Mogut"
}
diff --git a/translations/cy.json b/translations/cy.json
index c12103107..386b8f363 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -602,5 +602,6 @@
"Minimize all images": "Lleihau pob delwedd",
"Edit post": "Golygu post",
"Preview posts on profile screen": "Rhagolwg postiadau ar sgrin proffil",
- "Reverse timelines": "Gwrthdroi llinellau amser"
+ "Reverse timelines": "Gwrthdroi llinellau amser",
+ "Moved": "Wedi symud"
}
diff --git a/translations/de.json b/translations/de.json
index 72c4c5bf3..7769e49f5 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -602,5 +602,6 @@
"Minimize all images": "Alle Bilder minimieren",
"Edit post": "Beitrag bearbeiten",
"Preview posts on profile screen": "Vorschau von Beiträgen auf dem Profilbildschirm",
- "Reverse timelines": "Umgekehrte Zeitlinien"
+ "Reverse timelines": "Umgekehrte Zeitlinien",
+ "Moved": "Gerührt"
}
diff --git a/translations/el.json b/translations/el.json
index cf04ff8d0..044e5ae55 100644
--- a/translations/el.json
+++ b/translations/el.json
@@ -602,5 +602,6 @@
"Minimize all images": "Ελαχιστοποίηση όλων των εικόνων",
"Edit post": "Επεξεργασία ανάρτησης",
"Preview posts on profile screen": "Προεπισκόπηση αναρτήσεων στην οθόνη προφίλ",
- "Reverse timelines": "Αντίστροφα χρονοδιαγράμματα"
+ "Reverse timelines": "Αντίστροφα χρονοδιαγράμματα",
+ "Moved": "Μετακινήθηκε"
}
diff --git a/translations/en.json b/translations/en.json
index 9799205e6..c5a8cce9a 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -602,5 +602,6 @@
"Minimize all images": "Minimize all images",
"Edit post": "Edit post",
"Preview posts on profile screen": "Preview posts on profile screen",
- "Reverse timelines": "Reverse timelines"
+ "Reverse timelines": "Reverse timelines",
+ "Moved": "Moved"
}
diff --git a/translations/es.json b/translations/es.json
index 5e8192763..0a17c74d6 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -602,5 +602,6 @@
"Minimize all images": "Minimizar todas las imágenes",
"Edit post": "Editar post",
"Preview posts on profile screen": "Vista previa de publicaciones en la pantalla de perfil",
- "Reverse timelines": "Líneas de tiempo inversas"
+ "Reverse timelines": "Líneas de tiempo inversas",
+ "Moved": "Movida"
}
diff --git a/translations/fa.json b/translations/fa.json
index e7163e242..a6efb711b 100644
--- a/translations/fa.json
+++ b/translations/fa.json
@@ -602,5 +602,6 @@
"Minimize all images": "تمام تصاویر را به حداقل برسانید",
"Edit post": "ویرایش پست",
"Preview posts on profile screen": "پیش نمایش پست ها در صفحه نمایه",
- "Reverse timelines": "جدول های زمانی معکوس"
+ "Reverse timelines": "جدول های زمانی معکوس",
+ "Moved": "منتقل شد"
}
diff --git a/translations/fr.json b/translations/fr.json
index fb339e044..4a9ce3288 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -602,5 +602,6 @@
"Minimize all images": "Réduire toutes les images",
"Edit post": "Modifier le message",
"Preview posts on profile screen": "Prévisualiser les messages sur l'écran de profil",
- "Reverse timelines": "Chronologies inversées"
+ "Reverse timelines": "Chronologies inversées",
+ "Moved": "Déplacée"
}
diff --git a/translations/ga.json b/translations/ga.json
index a79625165..46ab271f7 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -602,5 +602,6 @@
"Minimize all images": "Íoslaghdaigh gach íomhá",
"Edit post": "Cuir postáil in eagar",
"Preview posts on profile screen": "Réamhamhairc postálacha ar an scáileán próifíle",
- "Reverse timelines": "Amlínte droim ar ais"
+ "Reverse timelines": "Amlínte droim ar ais",
+ "Moved": "Ar athraíodh a ionad"
}
diff --git a/translations/hi.json b/translations/hi.json
index deb79d897..23e5949d1 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -602,5 +602,6 @@
"Minimize all images": "सभी छवियों को छोटा करें",
"Edit post": "संपादित पोस्ट",
"Preview posts on profile screen": "प्रोफ़ाइल स्क्रीन पर पोस्ट का पूर्वावलोकन करें",
- "Reverse timelines": "रिवर्स टाइमलाइन"
+ "Reverse timelines": "रिवर्स टाइमलाइन",
+ "Moved": "ले जाया गया"
}
diff --git a/translations/it.json b/translations/it.json
index c4ec40463..b330f7c8a 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -602,5 +602,6 @@
"Minimize all images": "Riduci a icona tutte le immagini",
"Edit post": "Modifica post",
"Preview posts on profile screen": "Visualizza l'anteprima dei post nella schermata del profilo",
- "Reverse timelines": "Invertire le tempistiche"
+ "Reverse timelines": "Invertire le tempistiche",
+ "Moved": "Mosso"
}
diff --git a/translations/ja.json b/translations/ja.json
index 68b15e773..9914625de 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -602,5 +602,6 @@
"Minimize all images": "すべての画像を最小化",
"Edit post": "投稿を編集",
"Preview posts on profile screen": "プロフィール画面で投稿をプレビュー",
- "Reverse timelines": "逆タイムライン"
+ "Reverse timelines": "逆タイムライン",
+ "Moved": "移動しました"
}
diff --git a/translations/ko.json b/translations/ko.json
index 09722272a..af3f89ab7 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -602,5 +602,6 @@
"Minimize all images": "모든 이미지 최소화",
"Edit post": "게시물 수정",
"Preview posts on profile screen": "프로필 화면에서 게시물 미리보기",
- "Reverse timelines": "역방향 타임라인"
+ "Reverse timelines": "역방향 타임라인",
+ "Moved": "움직이는"
}
diff --git a/translations/ku.json b/translations/ku.json
index 8e7b5ee3b..7646fcb92 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -602,5 +602,6 @@
"Minimize all images": "Hemî wêneyan kêm bikin",
"Edit post": "Biguherîne post",
"Preview posts on profile screen": "Mesajên li ser ekrana profîlê pêşdîtin",
- "Reverse timelines": "Reverse timelines"
+ "Reverse timelines": "Reverse timelines",
+ "Moved": "Moved"
}
diff --git a/translations/nl.json b/translations/nl.json
index 933f1ecf3..70c523ea6 100644
--- a/translations/nl.json
+++ b/translations/nl.json
@@ -602,5 +602,6 @@
"Minimize all images": "Alle afbeeldingen minimaliseren",
"Edit post": "Bericht bewerken",
"Preview posts on profile screen": "Bekijk berichten op het profielscherm",
- "Reverse timelines": "Omgekeerde tijdlijnen"
+ "Reverse timelines": "Omgekeerde tijdlijnen",
+ "Moved": "Verhuisd"
}
diff --git a/translations/oc.json b/translations/oc.json
index 3fb7854f8..67edd637c 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -598,5 +598,6 @@
"Minimize all images": "Minimize all images",
"Edit post": "Edit post",
"Preview posts on profile screen": "Preview posts on profile screen",
- "Reverse timelines": "Reverse timelines"
+ "Reverse timelines": "Reverse timelines",
+ "Moved": "Moved"
}
diff --git a/translations/pl.json b/translations/pl.json
index 8d2b72a20..897f5ffa0 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -602,5 +602,6 @@
"Minimize all images": "Zminimalizuj wszystkie obrazy",
"Edit post": "Edytuj post",
"Preview posts on profile screen": "Podgląd postów na ekranie profilu",
- "Reverse timelines": "Odwróć ramy czasowe"
+ "Reverse timelines": "Odwróć ramy czasowe",
+ "Moved": "Przeniósł"
}
diff --git a/translations/pt.json b/translations/pt.json
index 23c0b6dbd..84b26dc4e 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -602,5 +602,6 @@
"Minimize all images": "Minimize todas as imagens",
"Edit post": "Editar post",
"Preview posts on profile screen": "Visualizar postagens na tela do perfil",
- "Reverse timelines": "Cronogramas reversos"
+ "Reverse timelines": "Cronogramas reversos",
+ "Moved": "Mudou-se"
}
diff --git a/translations/ru.json b/translations/ru.json
index 474607369..26812bb66 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -602,5 +602,6 @@
"Minimize all images": "Свернуть все изображения",
"Edit post": "Редактировать сообщение",
"Preview posts on profile screen": "Предварительный просмотр сообщений на экране профиля",
- "Reverse timelines": "Обратные сроки"
+ "Reverse timelines": "Обратные сроки",
+ "Moved": "Взолнованный"
}
diff --git a/translations/sw.json b/translations/sw.json
index 6c2f0da49..12a7a0802 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -602,5 +602,6 @@
"Minimize all images": "Punguza picha zote",
"Edit post": "Badilisha chapisho",
"Preview posts on profile screen": "Hakiki machapisho kwenye skrini ya wasifu",
- "Reverse timelines": "Обратные сроки"
+ "Reverse timelines": "Обратные сроки",
+ "Moved": "Imehamishwa"
}
diff --git a/translations/tr.json b/translations/tr.json
index 0730e7864..6e20405bc 100644
--- a/translations/tr.json
+++ b/translations/tr.json
@@ -602,5 +602,6 @@
"Minimize all images": "Tüm görüntüleri simge durumuna küçült",
"Edit post": "Gönderiyi düzenle",
"Preview posts on profile screen": "Gönderileri profil ekranında önizleyin",
- "Reverse timelines": "Обратные сроки"
+ "Reverse timelines": "Обратные сроки",
+ "Moved": "Etkilenmiş"
}
diff --git a/translations/uk.json b/translations/uk.json
index 2373f681c..db0d15dc8 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -602,5 +602,6 @@
"Minimize all images": "Згорнути всі зображення",
"Edit post": "Редагувати пост",
"Preview posts on profile screen": "Попередній перегляд дописів на екрані профілю",
- "Reverse timelines": "Обратные сроки"
+ "Reverse timelines": "Обратные сроки",
+ "Moved": "Переїхав"
}
diff --git a/translations/yi.json b/translations/yi.json
index 57c12a08e..fb6db4559 100644
--- a/translations/yi.json
+++ b/translations/yi.json
@@ -602,5 +602,6 @@
"Minimize all images": "מינאַמייז אַלע בילדער",
"Edit post": "רעדאַגירן פּאָסטן",
"Preview posts on profile screen": "פאָרויסיקע ווייַזונג אַרטיקלען אויף פּראָפיל פאַרשטעלן",
- "Reverse timelines": "פאַרקערט טיימליינז"
+ "Reverse timelines": "פאַרקערט טיימליינז",
+ "Moved": "אריבערגעפארן"
}
diff --git a/translations/zh.json b/translations/zh.json
index 92619799b..58433cde0 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -602,5 +602,6 @@
"Minimize all images": "最小化所有图像",
"Edit post": "编辑帖子",
"Preview posts on profile screen": "在个人资料屏幕上预览帖子",
- "Reverse timelines": "倒转时间线"
+ "Reverse timelines": "倒转时间线",
+ "Moved": "אריבערגעפארן"
}
diff --git a/utils.py b/utils.py
index 34ca8912e..496da8ea9 100644
--- a/utils.py
+++ b/utils.py
@@ -2240,7 +2240,7 @@ def _get_reserved_words() -> str:
'minimal', 'search', 'eventdelete',
'searchemoji', 'catalog', 'conversationId',
'mention', 'http', 'https', 'ipfs', 'ipns',
- 'ontologies', 'data', 'postedit')
+ 'ontologies', 'data', 'postedit', 'moved')
def get_nickname_validation_pattern() -> str:
diff --git a/webapp_profile.py b/webapp_profile.py
index 919bd773e..da0d316d1 100644
--- a/webapp_profile.py
+++ b/webapp_profile.py
@@ -680,6 +680,8 @@ def html_profile(signing_priv_key_pem: str,
profile_description = standardize_text(profile_description)
posts_button = 'button'
following_button = 'button'
+ moved_button = 'button'
+ moved_button = 'button'
followers_button = 'button'
roles_button = 'button'
skills_button = 'button'
@@ -689,6 +691,8 @@ def html_profile(signing_priv_key_pem: str,
posts_button = 'buttonselected'
elif selected == 'following':
following_button = 'buttonselected'
+ elif selected == 'moved':
+ moved_button = 'buttonselected'
elif selected == 'followers':
followers_button = 'buttonselected'
elif selected == 'roles':
@@ -1032,6 +1036,12 @@ def html_profile(signing_priv_key_pem: str,
''
if not is_group:
+ if authorized:
+ profile_str += \
+ ' ' + \
+ ''
profile_str += \
' ' + \
@@ -1109,6 +1119,19 @@ def html_profile(signing_priv_key_pem: str,
max_items_per_page,
dormant_months, debug,
signing_priv_key_pem)
+ if authorized and selected == 'moved':
+ profile_str += \
+ _html_profile_following(translate, base_dir, http_prefix,
+ authorized, nickname,
+ domain, session,
+ cached_webfingers,
+ person_cache, extra_json,
+ project_version, ["unfollow"],
+ selected,
+ users_path, page_number,
+ max_items_per_page,
+ dormant_months, debug,
+ signing_priv_key_pem)
if selected == 'followers':
profile_str += \
_html_profile_following(translate, base_dir, http_prefix,
From a4109e5de50fb40d47311b1b7dfa66d42dbad48f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 23:18:42 +0000
Subject: [PATCH 12/46] Ordered items list
---
relationships.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index 784cc46c5..64de6b996 100644
--- a/relationships.py
+++ b/relationships.py
@@ -116,7 +116,8 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
'first': first_str,
'id': id_str,
'totalItems': total_str,
- 'type': 'OrderedCollection'
+ 'type': 'OrderedCollection',
+ 'orderedItems': []
}
return following
From 7d44e9d447a458025ea9807e362d6df22043eea7 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 23:25:18 +0000
Subject: [PATCH 13/46] Debug
---
daemon.py | 1 +
relationships.py | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/daemon.py b/daemon.py
index 2e8b4f996..6471a4900 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14376,6 +14376,7 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized, FOLLOWS_PER_PAGE)
if following:
+ print('DEBUG: get_moved_feed ' + str(get_moved_feed))
if self._request_http():
page_number = 1
if '?page=' not in path:
diff --git a/relationships.py b/relationships.py
index 64de6b996..daac1950e 100644
--- a/relationships.py
+++ b/relationships.py
@@ -62,9 +62,9 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
follows_per_page=12) -> {}:
"""Returns the moved accounts feed from GET requests.
"""
- # Show a small number of follows to non-authorized viewers
+ # Don't show moved accounts to non-authorized viewers
if not authorized:
- follows_per_page = 6
+ follows_per_page = 0
if '/moved' not in path:
return None
@@ -116,8 +116,7 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
'first': first_str,
'id': id_str,
'totalItems': total_str,
- 'type': 'OrderedCollection',
- 'orderedItems': []
+ 'type': 'OrderedCollection'
}
return following
From 4378f5606fdd4e323eadd7dbf24c9e450930ec91 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 23:29:06 +0000
Subject: [PATCH 14/46] Debug
---
daemon.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon.py b/daemon.py
index 6471a4900..e2b926bd3 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14376,7 +14376,7 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized, FOLLOWS_PER_PAGE)
if following:
- print('DEBUG: get_moved_feed ' + str(get_moved_feed))
+ print('DEBUG: get_moved_feed ' + str(following))
if self._request_http():
page_number = 1
if '?page=' not in path:
From ad7b82eec8261e80518220aad67716381b808819 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 23:34:24 +0000
Subject: [PATCH 15/46] Ordered items
---
relationships.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/relationships.py b/relationships.py
index daac1950e..b7374ddcd 100644
--- a/relationships.py
+++ b/relationships.py
@@ -115,6 +115,7 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
'@context': 'https://www.w3.org/ns/activitystreams',
'first': first_str,
'id': id_str,
+ 'orderedItems': [],
'totalItems': total_str,
'type': 'OrderedCollection'
}
From d561d0f81e8a3bd82355ccc7e2912bf13c186768 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 27 Nov 2022 23:39:29 +0000
Subject: [PATCH 16/46] Get moved feed
---
daemon.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/daemon.py b/daemon.py
index e2b926bd3..1edc8bcf7 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14376,19 +14376,15 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized, FOLLOWS_PER_PAGE)
if following:
- print('DEBUG: get_moved_feed ' + str(following))
if self._request_http():
page_number = 1
if '?page=' not in path:
search_path = path
# get a page of following, not the summary
following = \
- get_following_feed(base_dir,
- domain,
- port,
- path + '?page=true',
- http_prefix,
- authorized, FOLLOWS_PER_PAGE)
+ get_moved_feed(base_dir, domain, port, path,
+ http_prefix, authorized,
+ FOLLOWS_PER_PAGE)
else:
page_number_str = path.split('?page=')[1]
if ';' in page_number_str:
From 36bac670a0d0c6af4170800c91599fb6593c93a6 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 12:05:13 +0000
Subject: [PATCH 17/46] Moved menu option
---
webapp_profile.py | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/webapp_profile.py b/webapp_profile.py
index da0d316d1..63cbb43c8 100644
--- a/webapp_profile.py
+++ b/webapp_profile.py
@@ -639,6 +639,10 @@ def html_profile(signing_priv_key_pem: str,
timezone: str, bold_reading: bool) -> str:
"""Show the profile page as html
"""
+ show_moved_accounts = False
+ if authorized:
+ show_moved_accounts = True
+
nickname = profile_json['preferredUsername']
if not nickname:
return ""
@@ -984,14 +988,26 @@ def html_profile(signing_priv_key_pem: str,
html_hide_from_screen_reader('✍') + ' ' + translate['Edit']
menu_followers = \
html_hide_from_screen_reader('👪') + ' ' + followers_str
+ if show_moved_accounts:
+ menu_moved = \
+ html_hide_from_screen_reader('⌂') + ' ' + translate['Moved']
menu_logout = \
html_hide_from_screen_reader('❎') + ' ' + translate['Logout']
- nav_links = {
- menu_timeline: user_path_str + '/' + deft,
- menu_edit: user_path_str + '/editprofile',
- menu_followers: user_path_str + '/followers#timeline',
- menu_logout: '/logout'
- }
+ if not show_moved_accounts:
+ nav_links = {
+ menu_timeline: user_path_str + '/' + deft,
+ menu_edit: user_path_str + '/editprofile',
+ menu_followers: user_path_str + '/followers#timeline',
+ menu_logout: '/logout'
+ }
+ else:
+ nav_links = {
+ menu_timeline: user_path_str + '/' + deft,
+ menu_edit: user_path_str + '/editprofile',
+ menu_followers: user_path_str + '/followers#timeline',
+ menu_moved: user_path_str + '/moved#timeline',
+ menu_logout: '/logout'
+ }
if not is_group:
menu_following = \
html_hide_from_screen_reader('👥') + ' ' + translate['Following']
@@ -1036,7 +1052,7 @@ def html_profile(signing_priv_key_pem: str,
''
if not is_group:
- if authorized:
+ if show_moved_accounts:
profile_str += \
' ' + \
@@ -1119,7 +1135,7 @@ def html_profile(signing_priv_key_pem: str,
max_items_per_page,
dormant_months, debug,
signing_priv_key_pem)
- if authorized and selected == 'moved':
+ if show_moved_accounts and selected == 'moved':
profile_str += \
_html_profile_following(translate, base_dir, http_prefix,
authorized, nickname,
From 0243c5579e1846f2e3c8f438d2884ba36e777d91 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 12:11:34 +0000
Subject: [PATCH 18/46] Check for moved actors
---
webapp_profile.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/webapp_profile.py b/webapp_profile.py
index 63cbb43c8..f50b1ed2f 100644
--- a/webapp_profile.py
+++ b/webapp_profile.py
@@ -641,7 +641,9 @@ def html_profile(signing_priv_key_pem: str,
"""
show_moved_accounts = False
if authorized:
- show_moved_accounts = True
+ moved_accounts_filename = base_dir + '/accounts/actors_moved.txt'
+ if os.path.isfile(moved_accounts_filename):
+ show_moved_accounts = True
nickname = profile_json['preferredUsername']
if not nickname:
From 8eeae6968b32c3709f81f7c3e221f130987e4600 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:33:11 +0000
Subject: [PATCH 19/46] Check for moved actors on daemon start
---
daemon.py | 3 ++
relationships.py | 112 +++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 111 insertions(+), 4 deletions(-)
diff --git a/daemon.py b/daemon.py
index 1edc8bcf7..acc9d5207 100644
--- a/daemon.py
+++ b/daemon.py
@@ -416,6 +416,7 @@ from qrcode import save_domain_qrcode
from importFollowing import run_import_following_watchdog
from maps import map_format_from_tagmaps_path
from relationships import get_moved_feed
+from relationships import update_moved_actors
import os
@@ -22077,6 +22078,8 @@ def run_daemon(max_hashtags: int,
print('Invalid domain: ' + domain)
return
+ update_moved_actors(base_dir, debug)
+
if unit_test:
server_address = (domain, proxy_port)
pub_handler = partial(PubServerUnitTest)
diff --git a/relationships.py b/relationships.py
index b7374ddcd..3901c3aa4 100644
--- a/relationships.py
+++ b/relationships.py
@@ -14,23 +14,27 @@ from utils import get_full_domain
from utils import local_actor_url
from utils import remove_domain_port
from utils import remove_eol
+from utils import is_account_dir
+from utils import get_nickname_from_actor
+from utils import get_domain_from_actor
+from utils import load_json
def get_moved_accounts(base_dir: str, nickname: str, domain: str,
filename: str = 'following.txt') -> {}:
"""returns a dict of moved accounts
"""
- refollow_filename = base_dir + '/accounts/actors_moved.txt'
- if not os.path.isfile(refollow_filename):
+ moved_accounts_filename = base_dir + '/accounts/actors_moved.txt'
+ if not os.path.isfile(moved_accounts_filename):
return {}
refollow_str = ''
try:
- with open(refollow_filename, 'r',
+ with open(moved_accounts_filename, 'r',
encoding='utf-8') as fp_refollow:
refollow_str = fp_refollow.read()
except OSError:
print('EX: get_moved_accounts unable to read ' +
- refollow_filename)
+ moved_accounts_filename)
refollow_list = refollow_str.split('\n')
refollow_dict = {}
for line in refollow_list:
@@ -175,3 +179,103 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
local_actor_url(http_prefix, nickname, domain) + \
'/moved?page=' + str(last_page)
return following
+
+
+def update_moved_actors(base_dir: str, debug: bool) -> None:
+ """Updates the file containing moved actors
+ """
+ actors_cache_dir = base_dir + '/cache/actors'
+ if not os.path.isdir(actors_cache_dir):
+ if debug:
+ print('No cached actors')
+ return
+
+ if debug:
+ print('Updating moved actors')
+ actors_dict = {}
+ for _, _, files in os.walk(actors_cache_dir):
+ for actor_str in files:
+ if not actor_str.endswith('.json'):
+ continue
+ orig_str = actor_str
+ actor_str = actor_str.replace('.json', '').replace('#', '/')
+ nickname = get_nickname_from_actor(actor_str)
+ domain, port = get_domain_from_actor(actor_str)
+ domain_full = get_full_domain(domain, port)
+ handle = nickname + '@' + domain_full
+ actors_dict[handle] = orig_str
+ break
+
+ if debug:
+ if actors_dict:
+ print('Actors dict created')
+ else:
+ print('No cached actors found')
+
+ # get the handles to be checked for movedTo attribute
+ handles_to_check = []
+ for _, dirs, _ in os.walk(base_dir + '/accounts'):
+ for account in dirs:
+ if not is_account_dir(account):
+ continue
+ following_filename = base_dir + '/' + account + '/following.txt'
+ if not os.path.isfile(following_filename):
+ continue
+ following_str = ''
+ try:
+ with open(following_filename, 'r',
+ encoding='utf-8') as fp_foll:
+ following_str - fp_foll.read()
+ except OSError:
+ print('EX: update_moved_actors unable to read ' +
+ following_filename)
+ continue
+ following_list = following_str.split('\n')
+ for handle in following_list:
+ if handle not in handles_to_check:
+ handles_to_check.append(handle)
+ break
+
+ if debug:
+ if handles_to_check:
+ print('All accounts handles list generated')
+ else:
+ print('No accounts are following')
+
+ moved_str = ''
+ for handle in handles_to_check:
+ if not actors_dict.get(handle):
+ continue
+ actor_filename = base_dir + '/cache/actors/' + actors_dict[handle]
+ if not os.path.isfile(actor_filename):
+ continue
+ actor_json = load_json(actor_filename, 1, 1)
+ if not actor_json:
+ continue
+ if not actor_json.get('movedTo'):
+ continue
+ moved_str += handle + ' ' + actor_json['movedTo'] + '\n'
+
+ if debug:
+ if moved_str:
+ print('Moved accounts detected')
+ else:
+ print('No moved accounts detected')
+
+ moved_accounts_filename = base_dir + '/accounts/actors_moved.txt'
+ if not moved_str:
+ if os.path.isfile(moved_accounts_filename):
+ try:
+ os.remove(moved_accounts_filename)
+ except OSError:
+ print('EX: update_moved_actors unable to remove ' +
+ moved_accounts_filename)
+ return
+
+ try:
+ with open(moved_accounts_filename, 'w+',
+ encoding='utf-8') as fp_moved:
+ fp_moved.write(moved_str)
+ except OSError:
+ print('EX: update_moved_actors unable to save ' +
+ moved_accounts_filename)
From aa664c265e9f1d461af4999d649cfacec38aa86d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:38:22 +0000
Subject: [PATCH 20/46] Debug
---
relationships.py | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/relationships.py b/relationships.py
index 3901c3aa4..a25832eb8 100644
--- a/relationships.py
+++ b/relationships.py
@@ -193,6 +193,7 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
if debug:
print('Updating moved actors')
actors_dict = {}
+ ctr = 0
for _, _, files in os.walk(actors_cache_dir):
for actor_str in files:
if not actor_str.endswith('.json'):
@@ -204,13 +205,13 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
domain_full = get_full_domain(domain, port)
handle = nickname + '@' + domain_full
actors_dict[handle] = orig_str
+ ctr += 1
break
- if debug:
- if actors_dict:
- print('Actors dict created')
- else:
- print('No cached actors found')
+ if actors_dict:
+ print('Actors dict created ' + str(ctr))
+ else:
+ print('No cached actors found')
# get the handles to be checked for movedTo attribute
handles_to_check = []
@@ -236,13 +237,14 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
handles_to_check.append(handle)
break
- if debug:
- if handles_to_check:
- print('All accounts handles list generated')
- else:
- print('No accounts are following')
+ if handles_to_check:
+ print('All accounts handles list generated ' +
+ str(len(handles_to_check)))
+ else:
+ print('No accounts are following')
moved_str = ''
+ ctr = 0
for handle in handles_to_check:
if not actors_dict.get(handle):
continue
@@ -255,12 +257,12 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
if not actor_json.get('movedTo'):
continue
moved_str += handle + ' ' + actor_json['movedTo'] + '\n'
+ ctr = ctr + 1
- if debug:
- if moved_str:
- print('Moved accounts detected')
- else:
- print('No moved accounts detected')
+ if moved_str:
+ print('Moved accounts detected ' + str(ctr))
+ else:
+ print('No moved accounts detected')
moved_accounts_filename = base_dir + '/accounts/actors_moved.txt'
if not moved_str:
From f7806a76e80b142f3588c2cec83ec4d3a062edf1 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:41:26 +0000
Subject: [PATCH 21/46] Accounts directory
---
relationships.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index a25832eb8..20c5bbec2 100644
--- a/relationships.py
+++ b/relationships.py
@@ -219,7 +219,8 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
for account in dirs:
if not is_account_dir(account):
continue
- following_filename = base_dir + '/' + account + '/following.txt'
+ following_filename = \
+ base_dir + '/accounts/' + account + '/following.txt'
if not os.path.isfile(following_filename):
continue
following_str = ''
From 9b06a99cc8f862ae67ce8c9c5e865ca32422df0a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:42:37 +0000
Subject: [PATCH 22/46] Typo
---
relationships.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index 20c5bbec2..6cfbbc9b4 100644
--- a/relationships.py
+++ b/relationships.py
@@ -227,7 +227,7 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
try:
with open(following_filename, 'r',
encoding='utf-8') as fp_foll:
- following_str - fp_foll.read()
+ following_str = fp_foll.read()
except OSError:
print('EX: update_moved_actors unable to read ' +
following_filename)
From ebff972b49d67a4177369a01fab6e6066ed03d68 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:46:32 +0000
Subject: [PATCH 23/46] Moved to handle
---
relationships.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index 6cfbbc9b4..cab09a6ef 100644
--- a/relationships.py
+++ b/relationships.py
@@ -257,7 +257,11 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
continue
if not actor_json.get('movedTo'):
continue
- moved_str += handle + ' ' + actor_json['movedTo'] + '\n'
+ nickname = get_nickname_from_actor(actor_json['movedTo'])
+ domain, port = get_domain_from_actor(actor_json['movedTo'])
+ domain_full = get_full_domain(domain, port)
+ new_handle = nickname + '@' + domain_full
+ moved_str += handle + ' ' + new_handle + '\n'
ctr = ctr + 1
if moved_str:
From 025eb6339b089563f8c594bf135a07291d71dc57 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:49:16 +0000
Subject: [PATCH 24/46] Debug
---
relationships.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/relationships.py b/relationships.py
index cab09a6ef..c394d38c0 100644
--- a/relationships.py
+++ b/relationships.py
@@ -38,6 +38,7 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
refollow_list = refollow_str.split('\n')
refollow_dict = {}
for line in refollow_list:
+ print(line)
prev_handle = line.split(' ')[0]
new_handle = line.split(' ')[1]
refollow_dict[prev_handle] = new_handle
From e30ddfd7c7f907692823a34c6d01b168d684c5e2 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:52:33 +0000
Subject: [PATCH 25/46] Check for space
---
relationships.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index c394d38c0..8831053e0 100644
--- a/relationships.py
+++ b/relationships.py
@@ -38,7 +38,8 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
refollow_list = refollow_str.split('\n')
refollow_dict = {}
for line in refollow_list:
- print(line)
+ if ' ' not in line:
+ continue
prev_handle = line.split(' ')[0]
new_handle = line.split(' ')[1]
refollow_dict[prev_handle] = new_handle
From 57122be0dd4112e49d595c06c4faad0e8c756ca2 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:54:59 +0000
Subject: [PATCH 26/46] Debug
---
relationships.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/relationships.py b/relationships.py
index 8831053e0..65107ae59 100644
--- a/relationships.py
+++ b/relationships.py
@@ -39,6 +39,7 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
refollow_dict = {}
for line in refollow_list:
if ' ' not in line:
+ print('Missing space separator "' + line + '"')
continue
prev_handle = line.split(' ')[0]
new_handle = line.split(' ')[1]
From cedb4fbb8bcfd1dfaeef0a865e51ea2306c7abd5 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 13:57:17 +0000
Subject: [PATCH 27/46] Tidying
---
relationships.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index 65107ae59..8831053e0 100644
--- a/relationships.py
+++ b/relationships.py
@@ -39,7 +39,6 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
refollow_dict = {}
for line in refollow_list:
if ' ' not in line:
- print('Missing space separator "' + line + '"')
continue
prev_handle = line.split(' ')[0]
new_handle = line.split(' ')[1]
From 9170a0df4facae52633b6e2050eb9e3fbe169aaf Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 14:03:08 +0000
Subject: [PATCH 28/46] Debug
---
relationships.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/relationships.py b/relationships.py
index 8831053e0..b93f441ef 100644
--- a/relationships.py
+++ b/relationships.py
@@ -37,12 +37,17 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
moved_accounts_filename)
refollow_list = refollow_str.split('\n')
refollow_dict = {}
+ ctr = 0
for line in refollow_list:
if ' ' not in line:
continue
prev_handle = line.split(' ')[0]
new_handle = line.split(' ')[1]
refollow_dict[prev_handle] = new_handle
+ ctr = ctr + 1
+
+ print(str(ctr) + ' moved accounts')
+ print('moved_dict: ' + str(refollow_dict))
follow_filename = \
acct_dir(base_dir, nickname, domain) + '/' + filename
@@ -60,6 +65,7 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
for handle in follow_list:
if refollow_dict.get(handle):
result[handle] = refollow_dict[handle]
+ print('moved_dict 2: ' + str(result))
return result
From 2db37e93a7547005865c87efef3b14e6c5875a94 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 14:16:01 +0000
Subject: [PATCH 29/46] Default page number for moved accounts
---
daemon.py | 2 ++
relationships.py | 4 ----
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/daemon.py b/daemon.py
index acc9d5207..c1def2d2e 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14382,6 +14382,8 @@ class PubServer(BaseHTTPRequestHandler):
if '?page=' not in path:
search_path = path
# get a page of following, not the summary
+ path = path.replace('/moved', '/moved?page=' +
+ str(page_number))
following = \
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized,
diff --git a/relationships.py b/relationships.py
index b93f441ef..fdac55ed2 100644
--- a/relationships.py
+++ b/relationships.py
@@ -46,9 +46,6 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
refollow_dict[prev_handle] = new_handle
ctr = ctr + 1
- print(str(ctr) + ' moved accounts')
- print('moved_dict: ' + str(refollow_dict))
-
follow_filename = \
acct_dir(base_dir, nickname, domain) + '/' + filename
follow_str = ''
@@ -65,7 +62,6 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
for handle in follow_list:
if refollow_dict.get(handle):
result[handle] = refollow_dict[handle]
- print('moved_dict 2: ' + str(result))
return result
From a88a1bb51d6f364cf1cab3330ddf488246636fac Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 15:45:48 +0000
Subject: [PATCH 30/46] debug
---
daemon.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/daemon.py b/daemon.py
index c1def2d2e..08895fe35 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14382,8 +14382,6 @@ class PubServer(BaseHTTPRequestHandler):
if '?page=' not in path:
search_path = path
# get a page of following, not the summary
- path = path.replace('/moved', '/moved?page=' +
- str(page_number))
following = \
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized,
@@ -14434,6 +14432,7 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False
if self.server.bold_reading.get(nickname):
bold_reading = True
+ print('moved following: ' + str(following))
msg = \
html_profile(self.server.signing_priv_key_pem,
self.server.rss_icon_at_top,
From 21bc4e0a4682197cca1183ddf26987230fcc9b17 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 15:50:41 +0000
Subject: [PATCH 31/46] Debug
---
daemon.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon.py b/daemon.py
index 08895fe35..38e634b3e 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14377,6 +14377,7 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized, FOLLOWS_PER_PAGE)
if following:
+ print('_show_moved_feed 1: ' + str(following))
if self._request_http():
page_number = 1
if '?page=' not in path:
@@ -14386,6 +14387,7 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized,
FOLLOWS_PER_PAGE)
+ print('_show_moved_feed 2: ' + str(following))
else:
page_number_str = path.split('?page=')[1]
if ';' in page_number_str:
@@ -14432,7 +14434,6 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False
if self.server.bold_reading.get(nickname):
bold_reading = True
- print('moved following: ' + str(following))
msg = \
html_profile(self.server.signing_priv_key_pem,
self.server.rss_icon_at_top,
From 2ae6c8794c90d9a37b03e1b37312c3ea0673df37 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 28 Nov 2022 15:57:44 +0000
Subject: [PATCH 32/46] Set page number
---
daemon.py | 2 --
relationships.py | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon.py b/daemon.py
index 38e634b3e..acc9d5207 100644
--- a/daemon.py
+++ b/daemon.py
@@ -14377,7 +14377,6 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized, FOLLOWS_PER_PAGE)
if following:
- print('_show_moved_feed 1: ' + str(following))
if self._request_http():
page_number = 1
if '?page=' not in path:
@@ -14387,7 +14386,6 @@ class PubServer(BaseHTTPRequestHandler):
get_moved_feed(base_dir, domain, port, path,
http_prefix, authorized,
FOLLOWS_PER_PAGE)
- print('_show_moved_feed 2: ' + str(following))
else:
page_number_str = path.split('?page=')[1]
if ';' in page_number_str:
diff --git a/relationships.py b/relationships.py
index fdac55ed2..3f64afc21 100644
--- a/relationships.py
+++ b/relationships.py
@@ -76,6 +76,8 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
if '/moved' not in path:
return None
+ if '?page=' not in path:
+ path = path.replace('/moved', '/moved?page=true')
# handle page numbers
header_only = True
page_number = None
From 04b15b8aa2b77265c620a0bd262a4d301f76ff53 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 12:50:50 +0000
Subject: [PATCH 33/46] Don't check for moved file
---
relationships.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/relationships.py b/relationships.py
index 3f64afc21..95c2fe21e 100644
--- a/relationships.py
+++ b/relationships.py
@@ -81,6 +81,7 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
# handle page numbers
header_only = True
page_number = None
+ print('DEBUG: get_moved_feed path ' + path)
if '?page=' in path:
page_number = path.split('?page=')[1]
if len(page_number) > 5:
@@ -114,6 +115,9 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
lines = get_moved_accounts(base_dir, nickname, domain,
'following.txt')
+ print('DEBUG: get_moved_feed moved lines ' +
+ str(lines) + ' ' + str(header_only))
+
if header_only:
first_str = \
local_actor_url(http_prefix, nickname, domain) + \
@@ -151,10 +155,6 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
handle_domain = domain
handle_domain = remove_domain_port(handle_domain)
- accounts_dir = acct_dir(base_dir, nickname, handle_domain)
- filename = accounts_dir + '/moved.txt'
- if not os.path.isfile(filename):
- return following
curr_page = 1
page_ctr = 0
total_ctr = 0
From 16851d9fb6a2c388c0876efd836c15836cd56cd8 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 13:44:06 +0000
Subject: [PATCH 34/46] Indentation
---
relationships.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/relationships.py b/relationships.py
index 95c2fe21e..3ea201656 100644
--- a/relationships.py
+++ b/relationships.py
@@ -158,6 +158,7 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
curr_page = 1
page_ctr = 0
total_ctr = 0
+ print('DEBUG: get_moved_feed moved page_number ' + str(page_number))
for handle, new_handle in lines.items():
# nickname@domain
page_ctr += 1
@@ -173,7 +174,7 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
else:
# group actor
url = http_prefix + '://' + dom + '/c/' + nick
- following['orderedItems'].append(url)
+ following['orderedItems'].append(url)
if page_ctr >= follows_per_page:
page_ctr = 0
curr_page += 1
From 6fa1ec4740fd2e06f883c6abbdbda5d986d1e8e0 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 14:03:52 +0000
Subject: [PATCH 35/46] Indicate blocked new accounts
---
daemon.py | 3 ++-
webapp_person_options.py | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/daemon.py b/daemon.py
index acc9d5207..511ed7470 100644
--- a/daemon.py
+++ b/daemon.py
@@ -8385,7 +8385,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.news_instance,
authorized,
access_keys, is_group,
- self.server.theme_name)
+ self.server.theme_name,
+ self.server.blocked_cache)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
diff --git a/webapp_person_options.py b/webapp_person_options.py
index 64f4a7b1e..f946a74a1 100644
--- a/webapp_person_options.py
+++ b/webapp_person_options.py
@@ -163,7 +163,8 @@ def html_person_options(default_timeline: str,
authorized: bool,
access_keys: {},
is_group: bool,
- theme: str) -> str:
+ theme: str,
+ blocked_cache: []) -> str:
"""Show options for a person: view/follow/block/report
"""
options_domain, options_port = get_domain_from_actor(options_actor)
@@ -300,10 +301,15 @@ def html_person_options(default_timeline: str,
new_domain, _ = get_domain_from_actor(moved_to)
if new_nickname and new_domain:
new_handle = new_nickname + '@' + new_domain
+ blocked_icon_str = ''
+ if is_blocked(base_dir, nickname, domain,
+ new_nickname, new_domain, blocked_cache):
+ blocked_icon_str = '❌'
options_str += \
' ' + \
translate['New account'] + \
- ': @' + new_handle + '
\n'
+ ': @' + new_handle + '' + \
+ blocked_icon_str + '
\n'
elif also_known_as:
other_accounts_html = \
' ' + \
From aee6cc313deb63497128ae5f7b3042f43469ba45 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 14:14:02 +0000
Subject: [PATCH 36/46] Remove debug
---
relationships.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/relationships.py b/relationships.py
index 3ea201656..639b17c7d 100644
--- a/relationships.py
+++ b/relationships.py
@@ -81,7 +81,6 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
# handle page numbers
header_only = True
page_number = None
- print('DEBUG: get_moved_feed path ' + path)
if '?page=' in path:
page_number = path.split('?page=')[1]
if len(page_number) > 5:
@@ -115,9 +114,6 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
lines = get_moved_accounts(base_dir, nickname, domain,
'following.txt')
- print('DEBUG: get_moved_feed moved lines ' +
- str(lines) + ' ' + str(header_only))
-
if header_only:
first_str = \
local_actor_url(http_prefix, nickname, domain) + \
@@ -158,7 +154,6 @@ def get_moved_feed(base_dir: str, domain: str, port: int, path: str,
curr_page = 1
page_ctr = 0
total_ctr = 0
- print('DEBUG: get_moved_feed moved page_number ' + str(page_number))
for handle, new_handle in lines.items():
# nickname@domain
page_ctr += 1
From 65c783e6de6b7e067adf9c9f3a575e6bfd88a3a3 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 21:56:36 +0000
Subject: [PATCH 37/46] Check that not already following the moved account
---
relationships.py | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/relationships.py b/relationships.py
index 639b17c7d..3e86b26c2 100644
--- a/relationships.py
+++ b/relationships.py
@@ -37,14 +37,6 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
moved_accounts_filename)
refollow_list = refollow_str.split('\n')
refollow_dict = {}
- ctr = 0
- for line in refollow_list:
- if ' ' not in line:
- continue
- prev_handle = line.split(' ')[0]
- new_handle = line.split(' ')[1]
- refollow_dict[prev_handle] = new_handle
- ctr = ctr + 1
follow_filename = \
acct_dir(base_dir, nickname, domain) + '/' + filename
@@ -58,10 +50,20 @@ def get_moved_accounts(base_dir: str, nickname: str, domain: str,
follow_filename)
follow_list = follow_str.split('\n')
+ ctr = 0
+ for line in refollow_list:
+ if ' ' not in line:
+ continue
+ prev_handle = line.split(' ')[0]
+ new_handle = line.split(' ')[1]
+ refollow_dict[prev_handle] = new_handle
+ ctr = ctr + 1
+
result = {}
for handle in follow_list:
if refollow_dict.get(handle):
- result[handle] = refollow_dict[handle]
+ if refollow_dict[handle] not in follow_list:
+ result[handle] = refollow_dict[handle]
return result
From eea20c559cc8e37e5f4f1d4dbf9957e5d66fb575 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 29 Nov 2022 22:46:40 +0000
Subject: [PATCH 38/46] Move button
---
translations/ar.json | 3 ++-
translations/bn.json | 3 ++-
translations/ca.json | 3 ++-
translations/cy.json | 3 ++-
translations/de.json | 3 ++-
translations/el.json | 3 ++-
translations/en.json | 3 ++-
translations/es.json | 3 ++-
translations/fa.json | 3 ++-
translations/fr.json | 3 ++-
translations/ga.json | 3 ++-
translations/hi.json | 3 ++-
translations/it.json | 3 ++-
translations/ja.json | 3 ++-
translations/ko.json | 3 ++-
translations/ku.json | 3 ++-
translations/nl.json | 3 ++-
translations/oc.json | 3 ++-
translations/pl.json | 3 ++-
translations/pt.json | 3 ++-
translations/ru.json | 3 ++-
translations/sw.json | 3 ++-
translations/tr.json | 3 ++-
translations/uk.json | 3 ++-
translations/yi.json | 3 ++-
translations/zh.json | 3 ++-
webapp_profile.py | 9 ++++++++-
27 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/translations/ar.json b/translations/ar.json
index 426ed88ed..aebe2413b 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -603,5 +603,6 @@
"Edit post": "تعديل المنشور",
"Preview posts on profile screen": "معاينة المشاركات على شاشة الملف الشخصي",
"Reverse timelines": "عكس الجداول الزمنية",
- "Moved": "انتقل"
+ "Moved": "انتقل",
+ "Move": "يتحرك"
}
diff --git a/translations/bn.json b/translations/bn.json
index 2aeb2c333..7354466bd 100644
--- a/translations/bn.json
+++ b/translations/bn.json
@@ -603,5 +603,6 @@
"Edit post": "পোস্ট সম্পাদনা করুন",
"Preview posts on profile screen": "প্রোফাইল স্ক্রিনে পোস্টের পূর্বরূপ দেখুন",
"Reverse timelines": "বিপরীত সময়রেখা",
- "Moved": "সরানো হয়েছে"
+ "Moved": "সরানো হয়েছে",
+ "Move": "সরান"
}
diff --git a/translations/ca.json b/translations/ca.json
index cf2a852cb..a93d01f78 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -603,5 +603,6 @@
"Edit post": "Edita la publicació",
"Preview posts on profile screen": "Previsualitza les publicacions a la pantalla del perfil",
"Reverse timelines": "Cronologia inversa",
- "Moved": "Mogut"
+ "Moved": "Mogut",
+ "Move": "Moure's"
}
diff --git a/translations/cy.json b/translations/cy.json
index 386b8f363..127cc8b11 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -603,5 +603,6 @@
"Edit post": "Golygu post",
"Preview posts on profile screen": "Rhagolwg postiadau ar sgrin proffil",
"Reverse timelines": "Gwrthdroi llinellau amser",
- "Moved": "Wedi symud"
+ "Moved": "Wedi symud",
+ "Move": "Symud"
}
diff --git a/translations/de.json b/translations/de.json
index 7769e49f5..dfdba1016 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -603,5 +603,6 @@
"Edit post": "Beitrag bearbeiten",
"Preview posts on profile screen": "Vorschau von Beiträgen auf dem Profilbildschirm",
"Reverse timelines": "Umgekehrte Zeitlinien",
- "Moved": "Gerührt"
+ "Moved": "Gerührt",
+ "Move": "Bewegen"
}
diff --git a/translations/el.json b/translations/el.json
index 044e5ae55..ed3a0a7af 100644
--- a/translations/el.json
+++ b/translations/el.json
@@ -603,5 +603,6 @@
"Edit post": "Επεξεργασία ανάρτησης",
"Preview posts on profile screen": "Προεπισκόπηση αναρτήσεων στην οθόνη προφίλ",
"Reverse timelines": "Αντίστροφα χρονοδιαγράμματα",
- "Moved": "Μετακινήθηκε"
+ "Moved": "Μετακινήθηκε",
+ "Move": "Κίνηση"
}
diff --git a/translations/en.json b/translations/en.json
index c5a8cce9a..a3a3bf8b3 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -603,5 +603,6 @@
"Edit post": "Edit post",
"Preview posts on profile screen": "Preview posts on profile screen",
"Reverse timelines": "Reverse timelines",
- "Moved": "Moved"
+ "Moved": "Moved",
+ "Move": "Move"
}
diff --git a/translations/es.json b/translations/es.json
index 0a17c74d6..c7b75bcf2 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -603,5 +603,6 @@
"Edit post": "Editar post",
"Preview posts on profile screen": "Vista previa de publicaciones en la pantalla de perfil",
"Reverse timelines": "Líneas de tiempo inversas",
- "Moved": "Movida"
+ "Moved": "Movida",
+ "Move": "Muevete"
}
diff --git a/translations/fa.json b/translations/fa.json
index a6efb711b..469a984b6 100644
--- a/translations/fa.json
+++ b/translations/fa.json
@@ -603,5 +603,6 @@
"Edit post": "ویرایش پست",
"Preview posts on profile screen": "پیش نمایش پست ها در صفحه نمایه",
"Reverse timelines": "جدول های زمانی معکوس",
- "Moved": "منتقل شد"
+ "Moved": "منتقل شد",
+ "Move": "حرکت"
}
diff --git a/translations/fr.json b/translations/fr.json
index 4a9ce3288..a17d18394 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -603,5 +603,6 @@
"Edit post": "Modifier le message",
"Preview posts on profile screen": "Prévisualiser les messages sur l'écran de profil",
"Reverse timelines": "Chronologies inversées",
- "Moved": "Déplacée"
+ "Moved": "Déplacée",
+ "Move": "Déplacer"
}
diff --git a/translations/ga.json b/translations/ga.json
index 46ab271f7..19e0b43f6 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -603,5 +603,6 @@
"Edit post": "Cuir postáil in eagar",
"Preview posts on profile screen": "Réamhamhairc postálacha ar an scáileán próifíle",
"Reverse timelines": "Amlínte droim ar ais",
- "Moved": "Ar athraíodh a ionad"
+ "Moved": "Ar athraíodh a ionad",
+ "Move": "Bog"
}
diff --git a/translations/hi.json b/translations/hi.json
index 23e5949d1..ba02685dd 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -603,5 +603,6 @@
"Edit post": "संपादित पोस्ट",
"Preview posts on profile screen": "प्रोफ़ाइल स्क्रीन पर पोस्ट का पूर्वावलोकन करें",
"Reverse timelines": "रिवर्स टाइमलाइन",
- "Moved": "ले जाया गया"
+ "Moved": "ले जाया गया",
+ "Move": "कदम"
}
diff --git a/translations/it.json b/translations/it.json
index b330f7c8a..f7f8cda26 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -603,5 +603,6 @@
"Edit post": "Modifica post",
"Preview posts on profile screen": "Visualizza l'anteprima dei post nella schermata del profilo",
"Reverse timelines": "Invertire le tempistiche",
- "Moved": "Mosso"
+ "Moved": "Mosso",
+ "Move": "Spostare"
}
diff --git a/translations/ja.json b/translations/ja.json
index 9914625de..ea6e57eea 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -603,5 +603,6 @@
"Edit post": "投稿を編集",
"Preview posts on profile screen": "プロフィール画面で投稿をプレビュー",
"Reverse timelines": "逆タイムライン",
- "Moved": "移動しました"
+ "Moved": "移動しました",
+ "Move": "動く"
}
diff --git a/translations/ko.json b/translations/ko.json
index af3f89ab7..25f478338 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -603,5 +603,6 @@
"Edit post": "게시물 수정",
"Preview posts on profile screen": "프로필 화면에서 게시물 미리보기",
"Reverse timelines": "역방향 타임라인",
- "Moved": "움직이는"
+ "Moved": "움직이는",
+ "Move": "이동하다"
}
diff --git a/translations/ku.json b/translations/ku.json
index 7646fcb92..5b54daa6b 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -603,5 +603,6 @@
"Edit post": "Biguherîne post",
"Preview posts on profile screen": "Mesajên li ser ekrana profîlê pêşdîtin",
"Reverse timelines": "Reverse timelines",
- "Moved": "Moved"
+ "Moved": "Moved",
+ "Move": "Barkirin"
}
diff --git a/translations/nl.json b/translations/nl.json
index 70c523ea6..b37327e50 100644
--- a/translations/nl.json
+++ b/translations/nl.json
@@ -603,5 +603,6 @@
"Edit post": "Bericht bewerken",
"Preview posts on profile screen": "Bekijk berichten op het profielscherm",
"Reverse timelines": "Omgekeerde tijdlijnen",
- "Moved": "Verhuisd"
+ "Moved": "Verhuisd",
+ "Move": "Beweging"
}
diff --git a/translations/oc.json b/translations/oc.json
index 67edd637c..6d501052f 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -599,5 +599,6 @@
"Edit post": "Edit post",
"Preview posts on profile screen": "Preview posts on profile screen",
"Reverse timelines": "Reverse timelines",
- "Moved": "Moved"
+ "Moved": "Moved",
+ "Move": "Move"
}
diff --git a/translations/pl.json b/translations/pl.json
index 897f5ffa0..44ecbbc80 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -603,5 +603,6 @@
"Edit post": "Edytuj post",
"Preview posts on profile screen": "Podgląd postów na ekranie profilu",
"Reverse timelines": "Odwróć ramy czasowe",
- "Moved": "Przeniósł"
+ "Moved": "Przeniósł",
+ "Move": "Przenosić"
}
diff --git a/translations/pt.json b/translations/pt.json
index 84b26dc4e..a7ea17e39 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -603,5 +603,6 @@
"Edit post": "Editar post",
"Preview posts on profile screen": "Visualizar postagens na tela do perfil",
"Reverse timelines": "Cronogramas reversos",
- "Moved": "Mudou-se"
+ "Moved": "Mudou-se",
+ "Move": "Jogada"
}
diff --git a/translations/ru.json b/translations/ru.json
index 26812bb66..3536c1dbb 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -603,5 +603,6 @@
"Edit post": "Редактировать сообщение",
"Preview posts on profile screen": "Предварительный просмотр сообщений на экране профиля",
"Reverse timelines": "Обратные сроки",
- "Moved": "Взолнованный"
+ "Moved": "Взолнованный",
+ "Move": "Шаг"
}
diff --git a/translations/sw.json b/translations/sw.json
index 12a7a0802..1670892db 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -603,5 +603,6 @@
"Edit post": "Badilisha chapisho",
"Preview posts on profile screen": "Hakiki machapisho kwenye skrini ya wasifu",
"Reverse timelines": "Обратные сроки",
- "Moved": "Imehamishwa"
+ "Moved": "Imehamishwa",
+ "Move": "Sogeza"
}
diff --git a/translations/tr.json b/translations/tr.json
index 6e20405bc..63bc3d975 100644
--- a/translations/tr.json
+++ b/translations/tr.json
@@ -603,5 +603,6 @@
"Edit post": "Gönderiyi düzenle",
"Preview posts on profile screen": "Gönderileri profil ekranında önizleyin",
"Reverse timelines": "Обратные сроки",
- "Moved": "Etkilenmiş"
+ "Moved": "Etkilenmiş",
+ "Move": "Hareket"
}
diff --git a/translations/uk.json b/translations/uk.json
index db0d15dc8..361cec1c6 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -603,5 +603,6 @@
"Edit post": "Редагувати пост",
"Preview posts on profile screen": "Попередній перегляд дописів на екрані профілю",
"Reverse timelines": "Обратные сроки",
- "Moved": "Переїхав"
+ "Moved": "Переїхав",
+ "Move": "рухатися"
}
diff --git a/translations/yi.json b/translations/yi.json
index fb6db4559..72ef11def 100644
--- a/translations/yi.json
+++ b/translations/yi.json
@@ -603,5 +603,6 @@
"Edit post": "רעדאַגירן פּאָסטן",
"Preview posts on profile screen": "פאָרויסיקע ווייַזונג אַרטיקלען אויף פּראָפיל פאַרשטעלן",
"Reverse timelines": "פאַרקערט טיימליינז",
- "Moved": "אריבערגעפארן"
+ "Moved": "אריבערגעפארן",
+ "Move": "מאַך"
}
diff --git a/translations/zh.json b/translations/zh.json
index 58433cde0..29c62ee29 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -603,5 +603,6 @@
"Edit post": "编辑帖子",
"Preview posts on profile screen": "在个人资料屏幕上预览帖子",
"Reverse timelines": "倒转时间线",
- "Moved": "אריבערגעפארן"
+ "Moved": "אריבערגעפארן",
+ "Move": "移动"
}
diff --git a/webapp_profile.py b/webapp_profile.py
index f50b1ed2f..be13f3cab 100644
--- a/webapp_profile.py
+++ b/webapp_profile.py
@@ -1144,7 +1144,7 @@ def html_profile(signing_priv_key_pem: str,
domain, session,
cached_webfingers,
person_cache, extra_json,
- project_version, ["unfollow"],
+ project_version, ["moveAccount"],
selected,
users_path, page_number,
max_items_per_page,
@@ -2786,6 +2786,13 @@ def _individual_follow_as_html(signing_priv_key_pem: str,
';1;' + avatar_url + \
'">\n'
+ elif btn == 'moveAccount':
+ buttons_str += \
+ '\n'
result_str = '\n'
result_str += \
From bc58077eea3ef9dcbfce1995809a6c40117a4e73 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 30 Nov 2022 21:33:14 +0000
Subject: [PATCH 39/46] Move button
---
daemon.py | 23 +++++++++++++++++++++++
webapp_person_options.py | 13 ++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/daemon.py b/daemon.py
index 511ed7470..e8c0e20a6 100644
--- a/daemon.py
+++ b/daemon.py
@@ -3007,6 +3007,11 @@ class PubServer(BaseHTTPRequestHandler):
if '&' in options_actor:
options_actor = options_actor.split('&')[0]
+ # actor for the movedTo
+ options_actor_moved = options_confirm_params.split('movedToActor=')[1]
+ if '&' in options_actor_moved:
+ options_actor_moved = options_actor_moved.split('&')[0]
+
# url of the avatar
options_avatar_url = options_confirm_params.split('avatarUrl=')[1]
if '&' in options_avatar_url:
@@ -3414,6 +3419,24 @@ class PubServer(BaseHTTPRequestHandler):
self.server.postreq_busy = False
return
+ # person options screen, move button
+ # See html_person_options followStr
+ if '&submitMove=' in options_confirm_params:
+ if debug:
+ print('Moving ' + options_actor_moved)
+ msg = \
+ html_confirm_follow(self.server.translate,
+ base_dir,
+ users_path,
+ options_actor_moved,
+ options_avatar_url).encode('utf-8')
+ msglen = len(msg)
+ self._set_headers('text/html', msglen,
+ cookie, calling_domain, False)
+ self._write(msg)
+ self.server.postreq_busy = False
+ return
+
# person options screen, unfollow button
# See html_person_options followStr
if '&submitUnfollow=' in options_confirm_params or \
diff --git a/webapp_person_options.py b/webapp_person_options.py
index f946a74a1..23557e63e 100644
--- a/webapp_person_options.py
+++ b/webapp_person_options.py
@@ -217,6 +217,10 @@ def html_person_options(default_timeline: str,
options_link_str = \
' \n'
+ if moved_to:
+ options_link_str += \
+ ' \n'
css_filename = base_dir + '/epicyon-options.css'
if os.path.isfile(base_dir + '/options.css'):
css_filename = base_dir + '/options.css'
@@ -309,7 +313,14 @@ def html_person_options(default_timeline: str,
' ' + \
translate['New account'] + \
': @' + new_handle + '' + \
- blocked_icon_str + '
\n'
+ blocked_icon_str
+ if follow_str == 'Unfollow' and not blocked_icon_str:
+ options_str += \
+ ''
+ options_str += '\n'
elif also_known_as:
other_accounts_html = \
' ' + \
From e12935f9a36d1345157745b6aa30eaab55698505 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 30 Nov 2022 21:44:12 +0000
Subject: [PATCH 40/46] Missing accesskey
---
daemon.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemon.py b/daemon.py
index e8c0e20a6..bfe45e546 100644
--- a/daemon.py
+++ b/daemon.py
@@ -22200,6 +22200,7 @@ def run_daemon(max_hashtags: int,
'Page down': '.',
'submitButton': 'y',
'followButton': 'f',
+ 'moveButton': 'm',
'blockButton': 'b',
'infoButton': 'i',
'snoozeButton': 's',
From a61963c83bc34e3a8300d026c1a6a4a0c07d69cb Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 30 Nov 2022 22:20:21 +0000
Subject: [PATCH 41/46] Earlier POST
---
webapp_person_options.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/webapp_person_options.py b/webapp_person_options.py
index 23557e63e..f56c467c9 100644
--- a/webapp_person_options.py
+++ b/webapp_person_options.py
@@ -300,6 +300,8 @@ def html_person_options(default_timeline: str,
if follows_you and authorized:
options_str += \
' ' + translate['Follows you'] + '
\n'
+ options_str += '