Merge branch 'main' of gitlab.com:bashrc2/epicyon
|
@ -175,7 +175,7 @@ server {
|
|||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen 443 ssl http2;
|
||||
server_name YOUR_DOMAIN;
|
||||
|
||||
gzip on;
|
||||
|
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 228 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 198 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 263 KiB After Width: | Height: | Size: 280 KiB |
30
daemon.py
|
@ -8996,6 +8996,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'/followers'
|
||||
if not repeat_private:
|
||||
announce_to_str = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
announce_id = None
|
||||
announce_json = \
|
||||
create_announce(curr_session,
|
||||
base_dir,
|
||||
|
@ -9105,6 +9106,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
actor_absolute = self._get_instance_url(calling_domain) + actor
|
||||
|
||||
if announce_id:
|
||||
first_post_id = announce_id.replace('/', '--')
|
||||
else:
|
||||
first_post_id = repeat_url.replace('/', '--')
|
||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||
|
||||
|
@ -9226,12 +9230,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
actor_absolute = self._get_instance_url(calling_domain) + actor
|
||||
|
||||
first_post_id = repeat_url.replace('/', '--')
|
||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||
|
||||
actor_path_str = \
|
||||
actor_absolute + '/' + timeline_str + '?page=' + \
|
||||
str(page_number) + first_post_id + timeline_bookmark
|
||||
str(page_number) + timeline_bookmark
|
||||
fitness_performance(getreq_start_time, self.server.fitness,
|
||||
'_GET', '_undo_announce_button',
|
||||
self.server.debug)
|
||||
|
@ -11003,12 +11004,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
first_post_id = mute_url.replace('/', '--')
|
||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||
|
||||
self._redirect_headers(actor + '/' +
|
||||
timeline_str +
|
||||
'?page=' + str(page_number) +
|
||||
first_post_id +
|
||||
timeline_bookmark,
|
||||
cookie, calling_domain)
|
||||
page_number_str = str(page_number)
|
||||
redirect_str = \
|
||||
actor + '/' + timeline_str + '?page=' + page_number_str + \
|
||||
first_post_id + timeline_bookmark
|
||||
self._redirect_headers(redirect_str, cookie, calling_domain)
|
||||
|
||||
def _undo_mute_button(self, calling_domain: str, path: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
|
@ -11141,11 +11141,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
first_post_id = mute_url.replace('/', '--')
|
||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||
|
||||
self._redirect_headers(actor + '/' + timeline_str +
|
||||
'?page=' + str(page_number) +
|
||||
first_post_id +
|
||||
timeline_bookmark,
|
||||
cookie, calling_domain)
|
||||
page_number_str = str(page_number)
|
||||
redirect_str = \
|
||||
actor + '/' + timeline_str + '?page=' + page_number_str + \
|
||||
first_post_id + timeline_bookmark
|
||||
self._redirect_headers(redirect_str, cookie, calling_domain)
|
||||
|
||||
def _show_replies_to_post(self, authorized: bool,
|
||||
calling_domain: str, referer_domain: str,
|
||||
|
|
|
@ -96,7 +96,7 @@ And paste the following:
|
|||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen 443 ssl http2;
|
||||
server_name YOUR_DOMAIN;
|
||||
|
||||
ssl_stapling off;
|
||||
|
|
|
@ -196,7 +196,7 @@ class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="
|
|||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen 443 ssl http2;
|
||||
server_name YOUR_DOMAIN;
|
||||
|
||||
gzip on;
|
||||
|
|
|
@ -150,7 +150,7 @@ server {
|
|||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen 443 ssl http2;
|
||||
server_name YOUR_DOMAIN;
|
||||
|
||||
gzip on;
|
||||
|
|
193
posts.py
|
@ -3957,81 +3957,36 @@ def _passed_newswire_voting(newswire_votes_threshold: int,
|
|||
return True
|
||||
|
||||
|
||||
def _create_box_indexed(recent_posts_cache: {},
|
||||
base_dir: str, boxname: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
items_per_page: int, header_only: bool,
|
||||
authorized: bool,
|
||||
newswire_votes_threshold: int, positive_voting: bool,
|
||||
voting_time_mins: int, page_number: int,
|
||||
first_post_id: str = '') -> {}:
|
||||
"""Constructs the box feed for a person with the given nickname
|
||||
def _create_box_items(base_dir: str,
|
||||
timeline_nickname: str,
|
||||
original_domain: str,
|
||||
nickname: str, domain: str,
|
||||
index_box_name: str,
|
||||
first_post_id: str,
|
||||
page_number: int,
|
||||
items_per_page: int,
|
||||
newswire_votes_threshold: int,
|
||||
positive_voting: bool,
|
||||
voting_time_mins: int,
|
||||
post_urls_in_box: [],
|
||||
recent_posts_cache: {},
|
||||
boxname: str,
|
||||
posts_in_box: [],
|
||||
box_actor: str) -> (int, int):
|
||||
"""Creates the list of posts within a timeline
|
||||
"""
|
||||
if not authorized or not page_number:
|
||||
page_number = 1
|
||||
|
||||
if boxname not in ('inbox', 'dm', 'tlreplies', 'tlmedia',
|
||||
'tlblogs', 'tlnews', 'tlfeatures', 'outbox',
|
||||
'tlbookmarks', 'bookmarks'):
|
||||
print('ERROR: invalid boxname ' + boxname)
|
||||
return None
|
||||
|
||||
# bookmarks and events timelines are like the inbox
|
||||
# but have their own separate index
|
||||
index_box_name = boxname
|
||||
timeline_nickname = nickname
|
||||
if boxname == "tlbookmarks":
|
||||
boxname = "bookmarks"
|
||||
index_box_name = boxname
|
||||
elif boxname == "tlfeatures":
|
||||
boxname = "tlblogs"
|
||||
index_box_name = boxname
|
||||
timeline_nickname = 'news'
|
||||
|
||||
original_domain = domain
|
||||
domain = get_full_domain(domain, port)
|
||||
|
||||
box_actor = local_actor_url(http_prefix, nickname, domain)
|
||||
|
||||
page_str = '?page=true'
|
||||
if page_number:
|
||||
page_number = max(page_number, 1)
|
||||
try:
|
||||
page_str = '?page=' + str(page_number)
|
||||
except BaseException:
|
||||
print('EX: _create_box_indexed ' +
|
||||
'unable to convert page number to string')
|
||||
box_url = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
|
||||
box_header = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': box_url + '?page=true',
|
||||
'id': box_url,
|
||||
'last': box_url + '?page=true',
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
box_items = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': box_url + page_str,
|
||||
'orderedItems': [
|
||||
],
|
||||
'partOf': box_url,
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
posts_in_box = []
|
||||
post_urls_in_box = []
|
||||
|
||||
index_filename = \
|
||||
acct_dir(base_dir, timeline_nickname, original_domain) + \
|
||||
'/' + index_box_name + '.index'
|
||||
total_posts_count = 0
|
||||
posts_added_to_timeline = 0
|
||||
if os.path.isfile(index_filename):
|
||||
if not os.path.isfile(index_filename):
|
||||
return total_posts_count, posts_added_to_timeline
|
||||
|
||||
if first_post_id:
|
||||
first_post_id = first_post_id.replace('--', '#')
|
||||
first_post_id = first_post_id.replace('/', '#')
|
||||
|
||||
with open(index_filename, 'r', encoding='utf-8') as index_file:
|
||||
posts_added_to_timeline = 0
|
||||
while posts_added_to_timeline < items_per_page:
|
||||
|
@ -4134,6 +4089,112 @@ def _create_box_indexed(recent_posts_cache: {},
|
|||
else:
|
||||
print('WARN: Unable to locate post ' + post_url +
|
||||
' nickname ' + nickname)
|
||||
return total_posts_count, posts_added_to_timeline
|
||||
|
||||
|
||||
def _create_box_indexed(recent_posts_cache: {},
|
||||
base_dir: str, boxname: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
items_per_page: int, header_only: bool,
|
||||
authorized: bool,
|
||||
newswire_votes_threshold: int, positive_voting: bool,
|
||||
voting_time_mins: int, page_number: int,
|
||||
first_post_id: str = '') -> {}:
|
||||
"""Constructs the box feed for a person with the given nickname
|
||||
"""
|
||||
if not authorized or not page_number:
|
||||
page_number = 1
|
||||
|
||||
if boxname not in ('inbox', 'dm', 'tlreplies', 'tlmedia',
|
||||
'tlblogs', 'tlnews', 'tlfeatures', 'outbox',
|
||||
'tlbookmarks', 'bookmarks'):
|
||||
print('ERROR: invalid boxname ' + boxname)
|
||||
return None
|
||||
|
||||
# bookmarks and events timelines are like the inbox
|
||||
# but have their own separate index
|
||||
index_box_name = boxname
|
||||
timeline_nickname = nickname
|
||||
if boxname == "tlbookmarks":
|
||||
boxname = "bookmarks"
|
||||
index_box_name = boxname
|
||||
elif boxname == "tlfeatures":
|
||||
boxname = "tlblogs"
|
||||
index_box_name = boxname
|
||||
timeline_nickname = 'news'
|
||||
|
||||
original_domain = domain
|
||||
domain = get_full_domain(domain, port)
|
||||
|
||||
box_actor = local_actor_url(http_prefix, nickname, domain)
|
||||
|
||||
page_str = '?page=true'
|
||||
if page_number:
|
||||
page_number = max(page_number, 1)
|
||||
try:
|
||||
page_str = '?page=' + str(page_number)
|
||||
except BaseException:
|
||||
print('EX: _create_box_indexed ' +
|
||||
'unable to convert page number to string')
|
||||
box_url = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
|
||||
box_header = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': box_url + '?page=true',
|
||||
'id': box_url,
|
||||
'last': box_url + '?page=true',
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
box_items = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': box_url + page_str,
|
||||
'orderedItems': [
|
||||
],
|
||||
'partOf': box_url,
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
posts_in_box = []
|
||||
post_urls_in_box = []
|
||||
|
||||
total_posts_count, posts_added_to_timeline = \
|
||||
_create_box_items(base_dir,
|
||||
timeline_nickname,
|
||||
original_domain,
|
||||
nickname, domain,
|
||||
index_box_name,
|
||||
first_post_id,
|
||||
page_number,
|
||||
items_per_page,
|
||||
newswire_votes_threshold,
|
||||
positive_voting,
|
||||
voting_time_mins,
|
||||
post_urls_in_box,
|
||||
recent_posts_cache,
|
||||
boxname,
|
||||
posts_in_box,
|
||||
box_actor)
|
||||
if first_post_id and posts_added_to_timeline == 0:
|
||||
# no first post was found within the index, so just use the page number
|
||||
first_post_id = ''
|
||||
total_posts_count, posts_added_to_timeline = \
|
||||
_create_box_items(base_dir,
|
||||
timeline_nickname,
|
||||
original_domain,
|
||||
nickname, domain,
|
||||
index_box_name,
|
||||
first_post_id,
|
||||
page_number,
|
||||
items_per_page,
|
||||
newswire_votes_threshold,
|
||||
positive_voting,
|
||||
voting_time_mins,
|
||||
post_urls_in_box,
|
||||
recent_posts_cache,
|
||||
boxname,
|
||||
posts_in_box,
|
||||
box_actor)
|
||||
|
||||
if total_posts_count < 3:
|
||||
print('Posts added to json timeline ' + boxname + ': ' +
|
||||
|
|
2
utils.py
|
@ -1112,7 +1112,7 @@ def dangerous_markup(content: str, allow_local_network_access: bool) -> bool:
|
|||
"""
|
||||
separators = [['<', '>'], ['<', '>']]
|
||||
invalid_strings = [
|
||||
'analytics', 'ampproject', 'googleapis', '_exec('
|
||||
'ampproject', 'googleapis', '_exec('
|
||||
]
|
||||
if _is_dangerous_string_simple(content, allow_local_network_access,
|
||||
separators, invalid_strings):
|
||||
|
|
|
@ -1455,7 +1455,7 @@ Ever feel like corporate social media is deliberately pressing your buttons or g
|
|||
}<br>
|
||||
<br>
|
||||
server {<br>
|
||||
listen 443 ssl;<br>
|
||||
listen 443 ssl http2;<br>
|
||||
server_name YOUR_DOMAIN;<br>
|
||||
<br>
|
||||
gzip on;<br>
|
||||
|
|