Skip to content

Commit a5d5fdf

Browse files
committed
Show type of software used to create post
1 parent 560d609 commit a5d5fdf

35 files changed

+621
-253
lines changed

daemon.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
from utils import get_config_param
6666
from utils import load_json
6767
from utils import load_mitm_servers
68+
from utils import load_instance_software
6869
from content import load_auto_cw_cache
6970
from content import load_dogwhistles
7071
from theme import scan_themes_for_scripts
@@ -717,6 +718,10 @@ def run_daemon(accounts_data_dir: str,
717718
# servers with man-in-the-middle transport encryption
718719
httpd.mitm_servers = load_mitm_servers(base_dir)
719720

721+
# for each domain name this stores the instance type
722+
# such as mastodon, epicyon, pixelfed, etc
723+
httpd.instance_software = load_instance_software(base_dir)
724+
720725
# default "searchable by" for new posts for each account
721726
httpd.searchable_by_default = load_searchable_by_default(base_dir)
722727

daemon_get.py

Lines changed: 78 additions & 39 deletions
Large diffs are not rendered by default.

daemon_get_buttons.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ def delete_button(self, calling_domain: str, path: str,
221221
session_onion,
222222
session_i2p,
223223
default_timeline: str,
224-
mitm_servers: []) -> None:
224+
mitm_servers: [],
225+
instance_software: {}) -> None:
225226
"""Delete button is pressed on a post
226227
"""
227228
if not cookie:
@@ -316,7 +317,8 @@ def delete_button(self, calling_domain: str, path: str,
316317
min_images_for_accounts,
317318
buy_sites,
318319
auto_cw_cache,
319-
mitm_servers)
320+
mitm_servers,
321+
instance_software)
320322
if delete_str:
321323
delete_str_len = len(delete_str)
322324
set_headers(self, 'text/html', delete_str_len,

daemon_get_buttons_announce.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def announce_button(self, calling_domain: str, path: str,
7070
bold_reading_nicknames: {},
7171
min_images_for_accounts: int,
7272
session_onion, session_i2p,
73-
mitm_servers: []) -> None:
73+
mitm_servers: [],
74+
instance_software: {}) -> None:
7475
"""The announce/repeat button was pressed on a post
7576
"""
7677
page_number = 1
@@ -261,7 +262,8 @@ def announce_button(self, calling_domain: str, path: str,
261262
minimize_all_images, None,
262263
buy_sites,
263264
auto_cw_cache,
264-
mitm_servers)
265+
mitm_servers,
266+
instance_software)
265267

266268
actor_absolute = \
267269
get_instance_url(calling_domain,

daemon_get_buttons_bookmark.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def bookmark_button(self, calling_domain: str, path: str,
6565
min_images_for_accounts: [],
6666
session_onion,
6767
session_i2p,
68-
mitm_servers: []) -> None:
68+
mitm_servers: [],
69+
instance_software: {}) -> None:
6970
"""Bookmark button was pressed
7071
"""
7172
page_number = 1
@@ -216,7 +217,8 @@ def bookmark_button(self, calling_domain: str, path: str,
216217
minimize_all_images, None,
217218
buy_sites,
218219
auto_cw_cache,
219-
mitm_servers)
220+
mitm_servers,
221+
instance_software)
220222
else:
221223
print('WARN: Bookmarked post not found: ' + bookmark_filename)
222224
actor_absolute = \
@@ -275,7 +277,8 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
275277
min_images_for_accounts: [],
276278
session_onion,
277279
session_i2p,
278-
mitm_servers: []) -> None:
280+
mitm_servers: [],
281+
instance_software: {}) -> None:
279282
"""Button pressed to undo a bookmark
280283
"""
281284
page_number = 1
@@ -425,7 +428,8 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
425428
minimize_all_images, None,
426429
buy_sites,
427430
auto_cw_cache,
428-
mitm_servers)
431+
mitm_servers,
432+
instance_software)
429433
else:
430434
print('WARN: Unbookmarked post not found: ' +
431435
bookmark_filename)

daemon_get_buttons_like.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def like_button(self, calling_domain: str, path: str,
6767
min_images_for_accounts: [],
6868
session_onion,
6969
session_i2p,
70-
mitm_servers: []) -> None:
70+
mitm_servers: [],
71+
instance_software: {}) -> None:
7172
"""Press the like button
7273
"""
7374
page_number = 1
@@ -263,7 +264,8 @@ def like_button(self, calling_domain: str, path: str,
263264
minimize_all_images, None,
264265
buy_sites,
265266
auto_cw_cache,
266-
mitm_servers)
267+
mitm_servers,
268+
instance_software)
267269
else:
268270
print('WARN: Liked post not found: ' + liked_post_filename)
269271
# clear the icon from the cache so that it gets updated
@@ -329,7 +331,8 @@ def like_button_undo(self, calling_domain: str, path: str,
329331
icons_cache: {},
330332
session_onion,
331333
session_i2p,
332-
mitm_servers: []) -> None:
334+
mitm_servers: [],
335+
instance_software: {}) -> None:
333336
"""A button is pressed to undo
334337
"""
335338
page_number = 1
@@ -516,7 +519,8 @@ def like_button_undo(self, calling_domain: str, path: str,
516519
minimize_all_images, None,
517520
buy_sites,
518521
auto_cw_cache,
519-
mitm_servers)
522+
mitm_servers,
523+
instance_software)
520524
else:
521525
print('WARN: Unliked post not found: ' + liked_post_filename)
522526
# clear the icon from the cache so that it gets updated

daemon_get_buttons_mute.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def mute_button(self, calling_domain: str, path: str,
5757
bold_reading_nicknames: {},
5858
min_images_for_accounts: [],
5959
default_timeline: str,
60-
mitm_servers: []) -> None:
60+
mitm_servers: [],
61+
instance_software: {}) -> None:
6162
"""Mute button is pressed
6263
"""
6364
mute_url = path.split('?mute=')[1]
@@ -179,7 +180,8 @@ def mute_button(self, calling_domain: str, path: str,
179180
minimize_all_images, None,
180181
buy_sites,
181182
auto_cw_cache,
182-
mitm_servers)
183+
mitm_servers,
184+
instance_software)
183185
else:
184186
print('WARN: Muted post not found: ' + mute_filename)
185187

@@ -233,7 +235,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
233235
bold_reading_nicknames: {},
234236
min_images_for_accounts: [],
235237
default_timeline: str,
236-
mitm_servers: []) -> None:
238+
mitm_servers: [],
239+
instance_software: {}) -> None:
237240
"""Undo mute button is pressed
238241
"""
239242
mute_url = path.split('?unmute=')[1]
@@ -355,7 +358,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
355358
minimize_all_images, None,
356359
buy_sites,
357360
auto_cw_cache,
358-
mitm_servers)
361+
mitm_servers,
362+
instance_software)
359363
else:
360364
print('WARN: Unmuted post not found: ' + mute_filename)
361365
if calling_domain.endswith('.onion') and onion_domain:

daemon_get_buttons_reaction.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def reaction_button(self, calling_domain: str, path: str,
6666
bold_reading_nicknames: {},
6767
min_images_for_accounts: [],
6868
session_onion, session_i2p,
69-
mitm_servers: []) -> None:
69+
mitm_servers: [],
70+
instance_software: {}) -> None:
7071
"""Press an emoji reaction button
7172
Note that this is not the emoji reaction selection icon at the
7273
bottom of the post
@@ -292,7 +293,8 @@ def reaction_button(self, calling_domain: str, path: str,
292293
minimize_all_images, None,
293294
buy_sites,
294295
auto_cw_cache,
295-
mitm_servers)
296+
mitm_servers,
297+
instance_software)
296298
else:
297299
print('WARN: Emoji reaction post not found: ' +
298300
reaction_post_filename)
@@ -355,7 +357,8 @@ def reaction_button_undo(self, calling_domain: str, path: str,
355357
min_images_for_accounts: [],
356358
session_onion,
357359
session_i2p,
358-
mitm_servers: []) -> None:
360+
mitm_servers: [],
361+
instance_software: {}) -> None:
359362
"""A button is pressed to undo emoji reaction
360363
"""
361364
page_number = 1
@@ -567,7 +570,8 @@ def reaction_button_undo(self, calling_domain: str, path: str,
567570
minimize_all_images, None,
568571
buy_sites,
569572
auto_cw_cache,
570-
mitm_servers)
573+
mitm_servers,
574+
instance_software)
571575
else:
572576
print('WARN: Unreaction post not found: ' +
573577
reaction_post_filename)

daemon_get_feeds.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def show_shares_feed(self, authorized: bool,
129129
bold_reading = True
130130
known_epicyon_instances = \
131131
self.server.known_epicyon_instances
132+
instance_software = \
133+
self.server.instance_software
132134
msg = \
133135
html_profile(signing_priv_key_pem,
134136
rss_icon_at_top,
@@ -171,7 +173,8 @@ def show_shares_feed(self, authorized: bool,
171173
no_of_books,
172174
auto_cw_cache,
173175
known_epicyon_instances,
174-
mitm_servers)
176+
mitm_servers,
177+
instance_software)
175178
msg = msg.encode('utf-8')
176179
msglen = len(msg)
177180
set_headers(self, 'text/html', msglen,
@@ -318,6 +321,8 @@ def show_following_feed(self, authorized: bool,
318321
following = {}
319322
known_epicyon_instances = \
320323
self.server.known_epicyon_instances
324+
instance_software = \
325+
self.server.instance_software
321326

322327
msg = \
323328
html_profile(signing_priv_key_pem,
@@ -362,7 +367,8 @@ def show_following_feed(self, authorized: bool,
362367
no_of_books,
363368
auto_cw_cache,
364369
known_epicyon_instances,
365-
mitm_servers).encode('utf-8')
370+
mitm_servers,
371+
instance_software).encode('utf-8')
366372
msglen = len(msg)
367373
set_headers(self, 'text/html',
368374
msglen, cookie, calling_domain, False)
@@ -510,6 +516,8 @@ def show_moved_feed(self, authorized: bool,
510516

511517
known_epicyon_instances = \
512518
self.server.known_epicyon_instances
519+
instance_software = \
520+
self.server.instance_software
513521

514522
msg = \
515523
html_profile(signing_priv_key_pem,
@@ -554,7 +562,8 @@ def show_moved_feed(self, authorized: bool,
554562
no_of_books,
555563
auto_cw_cache,
556564
known_epicyon_instances,
557-
mitm_servers).encode('utf-8')
565+
mitm_servers,
566+
instance_software).encode('utf-8')
558567
msglen = len(msg)
559568
set_headers(self, 'text/html',
560569
msglen, cookie, calling_domain, False)
@@ -696,6 +705,8 @@ def show_inactive_feed(self, authorized: bool,
696705
bold_reading = True
697706
known_epicyon_instances = \
698707
self.server.known_epicyon_instances
708+
instance_software = \
709+
self.server.instance_software
699710
msg = \
700711
html_profile(signing_priv_key_pem,
701712
rss_icon_at_top,
@@ -739,7 +750,8 @@ def show_inactive_feed(self, authorized: bool,
739750
no_of_books,
740751
auto_cw_cache,
741752
known_epicyon_instances,
742-
mitm_servers).encode('utf-8')
753+
mitm_servers,
754+
instance_software).encode('utf-8')
743755
msglen = len(msg)
744756
set_headers(self, 'text/html',
745757
msglen, cookie, calling_domain, False)
@@ -883,6 +895,8 @@ def show_followers_feed(self, authorized: bool,
883895
bold_reading = True
884896
known_epicyon_instances = \
885897
self.server.known_epicyon_instances
898+
instance_software = \
899+
self.server.instance_software
886900
msg = \
887901
html_profile(signing_priv_key_pem,
888902
rss_icon_at_top,
@@ -927,7 +941,8 @@ def show_followers_feed(self, authorized: bool,
927941
no_of_books,
928942
auto_cw_cache,
929943
known_epicyon_instances,
930-
mitm_servers).encode('utf-8')
944+
mitm_servers,
945+
instance_software).encode('utf-8')
931946
msglen = len(msg)
932947
set_headers(self, 'text/html', msglen,
933948
cookie, calling_domain, False)

daemon_get_hashtag.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def hashtag_search2(self, calling_domain: str,
170170
buy_sites: [],
171171
auto_cw_cache: {},
172172
ua_str: str,
173-
mitm_servers: []) -> None:
173+
mitm_servers: [],
174+
instance_software: {}) -> None:
174175
"""Return the result of a hashtag search
175176
"""
176177
page_number = 1
@@ -238,7 +239,8 @@ def hashtag_search2(self, calling_domain: str,
238239
min_images_for_accounts,
239240
buy_sites,
240241
auto_cw_cache, ua_str,
241-
mitm_servers)
242+
mitm_servers,
243+
instance_software)
242244
if hashtag_str:
243245
msg = hashtag_str.encode('utf-8')
244246
msglen = len(msg)

0 commit comments

Comments
 (0)