Merge branch 'main' of gitlab.com:bashrc2/epicyon
|
@ -175,7 +175,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
server_name YOUR_DOMAIN;
|
server_name YOUR_DOMAIN;
|
||||||
|
|
||||||
gzip on;
|
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 |
32
daemon.py
|
@ -8996,6 +8996,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'/followers'
|
'/followers'
|
||||||
if not repeat_private:
|
if not repeat_private:
|
||||||
announce_to_str = 'https://www.w3.org/ns/activitystreams#Public'
|
announce_to_str = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
|
announce_id = None
|
||||||
announce_json = \
|
announce_json = \
|
||||||
create_announce(curr_session,
|
create_announce(curr_session,
|
||||||
base_dir,
|
base_dir,
|
||||||
|
@ -9105,7 +9106,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
actor_absolute = self._get_instance_url(calling_domain) + actor
|
actor_absolute = self._get_instance_url(calling_domain) + actor
|
||||||
|
|
||||||
first_post_id = repeat_url.replace('/', '--')
|
if announce_id:
|
||||||
|
first_post_id = announce_id.replace('/', '--')
|
||||||
|
else:
|
||||||
|
first_post_id = repeat_url.replace('/', '--')
|
||||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||||
|
|
||||||
actor_path_str = \
|
actor_path_str = \
|
||||||
|
@ -9226,12 +9230,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
actor_absolute = self._get_instance_url(calling_domain) + actor
|
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_path_str = \
|
||||||
actor_absolute + '/' + timeline_str + '?page=' + \
|
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,
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
'_GET', '_undo_announce_button',
|
'_GET', '_undo_announce_button',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
@ -11003,12 +11004,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
first_post_id = mute_url.replace('/', '--')
|
first_post_id = mute_url.replace('/', '--')
|
||||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||||
|
|
||||||
self._redirect_headers(actor + '/' +
|
page_number_str = str(page_number)
|
||||||
timeline_str +
|
redirect_str = \
|
||||||
'?page=' + str(page_number) +
|
actor + '/' + timeline_str + '?page=' + page_number_str + \
|
||||||
first_post_id +
|
first_post_id + timeline_bookmark
|
||||||
timeline_bookmark,
|
self._redirect_headers(redirect_str, cookie, calling_domain)
|
||||||
cookie, calling_domain)
|
|
||||||
|
|
||||||
def _undo_mute_button(self, calling_domain: str, path: str,
|
def _undo_mute_button(self, calling_domain: str, path: str,
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
|
@ -11141,11 +11141,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
first_post_id = mute_url.replace('/', '--')
|
first_post_id = mute_url.replace('/', '--')
|
||||||
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
first_post_id = ';firstpost=' + first_post_id.replace('#', '--')
|
||||||
|
|
||||||
self._redirect_headers(actor + '/' + timeline_str +
|
page_number_str = str(page_number)
|
||||||
'?page=' + str(page_number) +
|
redirect_str = \
|
||||||
first_post_id +
|
actor + '/' + timeline_str + '?page=' + page_number_str + \
|
||||||
timeline_bookmark,
|
first_post_id + timeline_bookmark
|
||||||
cookie, calling_domain)
|
self._redirect_headers(redirect_str, cookie, calling_domain)
|
||||||
|
|
||||||
def _show_replies_to_post(self, authorized: bool,
|
def _show_replies_to_post(self, authorized: bool,
|
||||||
calling_domain: str, referer_domain: str,
|
calling_domain: str, referer_domain: str,
|
||||||
|
|
|
@ -96,7 +96,7 @@ And paste the following:
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
server_name YOUR_DOMAIN;
|
server_name YOUR_DOMAIN;
|
||||||
|
|
||||||
ssl_stapling off;
|
ssl_stapling off;
|
||||||
|
|
|
@ -196,7 +196,7 @@ class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
server_name YOUR_DOMAIN;
|
server_name YOUR_DOMAIN;
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
|
|
|
@ -150,7 +150,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
server_name YOUR_DOMAIN;
|
server_name YOUR_DOMAIN;
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
|
|
283
posts.py
|
@ -3957,6 +3957,141 @@ def _passed_newswire_voting(newswire_votes_threshold: int,
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
"""
|
||||||
|
index_filename = \
|
||||||
|
acct_dir(base_dir, timeline_nickname, original_domain) + \
|
||||||
|
'/' + index_box_name + '.index'
|
||||||
|
total_posts_count = 0
|
||||||
|
posts_added_to_timeline = 0
|
||||||
|
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:
|
||||||
|
post_filename = index_file.readline()
|
||||||
|
|
||||||
|
if not post_filename:
|
||||||
|
break
|
||||||
|
|
||||||
|
if first_post_id and total_posts_count == 0:
|
||||||
|
if first_post_id not in post_filename:
|
||||||
|
continue
|
||||||
|
total_posts_count = \
|
||||||
|
int((page_number - 1) * items_per_page)
|
||||||
|
|
||||||
|
# Has this post passed through the newswire voting stage?
|
||||||
|
if not _passed_newswire_voting(newswire_votes_threshold,
|
||||||
|
base_dir, domain,
|
||||||
|
post_filename,
|
||||||
|
positive_voting,
|
||||||
|
voting_time_mins):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip through any posts previous to the current page
|
||||||
|
if not first_post_id:
|
||||||
|
if total_posts_count < \
|
||||||
|
int((page_number - 1) * items_per_page):
|
||||||
|
total_posts_count += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
# if this is a full path then remove the directories
|
||||||
|
if '/' in post_filename:
|
||||||
|
post_filename = post_filename.split('/')[-1]
|
||||||
|
|
||||||
|
# filename of the post without any extension or path
|
||||||
|
# This should also correspond to any index entry in
|
||||||
|
# the posts cache
|
||||||
|
post_url = remove_eol(post_filename)
|
||||||
|
post_url = post_url.replace('.json', '').strip()
|
||||||
|
|
||||||
|
if post_url in post_urls_in_box:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# is the post cached in memory?
|
||||||
|
if recent_posts_cache.get('index'):
|
||||||
|
if post_url in recent_posts_cache['index']:
|
||||||
|
if recent_posts_cache['json'].get(post_url):
|
||||||
|
url = recent_posts_cache['json'][post_url]
|
||||||
|
if _add_post_string_to_timeline(url,
|
||||||
|
boxname,
|
||||||
|
posts_in_box,
|
||||||
|
box_actor):
|
||||||
|
total_posts_count += 1
|
||||||
|
posts_added_to_timeline += 1
|
||||||
|
post_urls_in_box.append(post_url)
|
||||||
|
continue
|
||||||
|
print('Post not added to timeline')
|
||||||
|
|
||||||
|
# read the post from file
|
||||||
|
full_post_filename = \
|
||||||
|
locate_post(base_dir, nickname,
|
||||||
|
original_domain, post_url, False)
|
||||||
|
if full_post_filename:
|
||||||
|
# has the post been rejected?
|
||||||
|
if os.path.isfile(full_post_filename + '.reject'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if _add_post_to_timeline(full_post_filename, boxname,
|
||||||
|
posts_in_box, box_actor):
|
||||||
|
posts_added_to_timeline += 1
|
||||||
|
total_posts_count += 1
|
||||||
|
post_urls_in_box.append(post_url)
|
||||||
|
else:
|
||||||
|
print('WARN: Unable to add post ' + post_url +
|
||||||
|
' nickname ' + nickname +
|
||||||
|
' timeline ' + boxname)
|
||||||
|
else:
|
||||||
|
if timeline_nickname != nickname:
|
||||||
|
# if this is the features timeline
|
||||||
|
full_post_filename = \
|
||||||
|
locate_post(base_dir, timeline_nickname,
|
||||||
|
original_domain, post_url, False)
|
||||||
|
if full_post_filename:
|
||||||
|
if _add_post_to_timeline(full_post_filename,
|
||||||
|
boxname,
|
||||||
|
posts_in_box, box_actor):
|
||||||
|
posts_added_to_timeline += 1
|
||||||
|
total_posts_count += 1
|
||||||
|
post_urls_in_box.append(post_url)
|
||||||
|
else:
|
||||||
|
print('WARN: Unable to add features post ' +
|
||||||
|
post_url + ' nickname ' + nickname +
|
||||||
|
' timeline ' + boxname)
|
||||||
|
else:
|
||||||
|
print('WARN: features timeline. ' +
|
||||||
|
'Unable to locate post ' + post_url)
|
||||||
|
else:
|
||||||
|
if timeline_nickname == 'news':
|
||||||
|
print('WARN: Unable to locate news post ' +
|
||||||
|
post_url + ' nickname ' + nickname)
|
||||||
|
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: {},
|
def _create_box_indexed(recent_posts_cache: {},
|
||||||
base_dir: str, boxname: str,
|
base_dir: str, boxname: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
|
@ -4023,117 +4158,43 @@ def _create_box_indexed(recent_posts_cache: {},
|
||||||
posts_in_box = []
|
posts_in_box = []
|
||||||
post_urls_in_box = []
|
post_urls_in_box = []
|
||||||
|
|
||||||
index_filename = \
|
total_posts_count, posts_added_to_timeline = \
|
||||||
acct_dir(base_dir, timeline_nickname, original_domain) + \
|
_create_box_items(base_dir,
|
||||||
'/' + index_box_name + '.index'
|
timeline_nickname,
|
||||||
total_posts_count = 0
|
original_domain,
|
||||||
posts_added_to_timeline = 0
|
nickname, domain,
|
||||||
if os.path.isfile(index_filename):
|
index_box_name,
|
||||||
if first_post_id:
|
first_post_id,
|
||||||
first_post_id = first_post_id.replace('--', '#')
|
page_number,
|
||||||
first_post_id = first_post_id.replace('/', '#')
|
items_per_page,
|
||||||
with open(index_filename, 'r', encoding='utf-8') as index_file:
|
newswire_votes_threshold,
|
||||||
posts_added_to_timeline = 0
|
positive_voting,
|
||||||
while posts_added_to_timeline < items_per_page:
|
voting_time_mins,
|
||||||
post_filename = index_file.readline()
|
post_urls_in_box,
|
||||||
|
recent_posts_cache,
|
||||||
if not post_filename:
|
boxname,
|
||||||
break
|
posts_in_box,
|
||||||
|
box_actor)
|
||||||
if first_post_id and total_posts_count == 0:
|
if first_post_id and posts_added_to_timeline == 0:
|
||||||
if first_post_id not in post_filename:
|
# no first post was found within the index, so just use the page number
|
||||||
continue
|
first_post_id = ''
|
||||||
total_posts_count = \
|
total_posts_count, posts_added_to_timeline = \
|
||||||
int((page_number - 1) * items_per_page)
|
_create_box_items(base_dir,
|
||||||
|
timeline_nickname,
|
||||||
# Has this post passed through the newswire voting stage?
|
original_domain,
|
||||||
if not _passed_newswire_voting(newswire_votes_threshold,
|
nickname, domain,
|
||||||
base_dir, domain,
|
index_box_name,
|
||||||
post_filename,
|
first_post_id,
|
||||||
positive_voting,
|
page_number,
|
||||||
voting_time_mins):
|
items_per_page,
|
||||||
continue
|
newswire_votes_threshold,
|
||||||
|
positive_voting,
|
||||||
# Skip through any posts previous to the current page
|
voting_time_mins,
|
||||||
if not first_post_id:
|
post_urls_in_box,
|
||||||
if total_posts_count < \
|
recent_posts_cache,
|
||||||
int((page_number - 1) * items_per_page):
|
boxname,
|
||||||
total_posts_count += 1
|
posts_in_box,
|
||||||
continue
|
box_actor)
|
||||||
|
|
||||||
# if this is a full path then remove the directories
|
|
||||||
if '/' in post_filename:
|
|
||||||
post_filename = post_filename.split('/')[-1]
|
|
||||||
|
|
||||||
# filename of the post without any extension or path
|
|
||||||
# This should also correspond to any index entry in
|
|
||||||
# the posts cache
|
|
||||||
post_url = remove_eol(post_filename)
|
|
||||||
post_url = post_url.replace('.json', '').strip()
|
|
||||||
|
|
||||||
if post_url in post_urls_in_box:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# is the post cached in memory?
|
|
||||||
if recent_posts_cache.get('index'):
|
|
||||||
if post_url in recent_posts_cache['index']:
|
|
||||||
if recent_posts_cache['json'].get(post_url):
|
|
||||||
url = recent_posts_cache['json'][post_url]
|
|
||||||
if _add_post_string_to_timeline(url,
|
|
||||||
boxname,
|
|
||||||
posts_in_box,
|
|
||||||
box_actor):
|
|
||||||
total_posts_count += 1
|
|
||||||
posts_added_to_timeline += 1
|
|
||||||
post_urls_in_box.append(post_url)
|
|
||||||
continue
|
|
||||||
print('Post not added to timeline')
|
|
||||||
|
|
||||||
# read the post from file
|
|
||||||
full_post_filename = \
|
|
||||||
locate_post(base_dir, nickname,
|
|
||||||
original_domain, post_url, False)
|
|
||||||
if full_post_filename:
|
|
||||||
# has the post been rejected?
|
|
||||||
if os.path.isfile(full_post_filename + '.reject'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if _add_post_to_timeline(full_post_filename, boxname,
|
|
||||||
posts_in_box, box_actor):
|
|
||||||
posts_added_to_timeline += 1
|
|
||||||
total_posts_count += 1
|
|
||||||
post_urls_in_box.append(post_url)
|
|
||||||
else:
|
|
||||||
print('WARN: Unable to add post ' + post_url +
|
|
||||||
' nickname ' + nickname +
|
|
||||||
' timeline ' + boxname)
|
|
||||||
else:
|
|
||||||
if timeline_nickname != nickname:
|
|
||||||
# if this is the features timeline
|
|
||||||
full_post_filename = \
|
|
||||||
locate_post(base_dir, timeline_nickname,
|
|
||||||
original_domain, post_url, False)
|
|
||||||
if full_post_filename:
|
|
||||||
if _add_post_to_timeline(full_post_filename,
|
|
||||||
boxname,
|
|
||||||
posts_in_box, box_actor):
|
|
||||||
posts_added_to_timeline += 1
|
|
||||||
total_posts_count += 1
|
|
||||||
post_urls_in_box.append(post_url)
|
|
||||||
else:
|
|
||||||
print('WARN: Unable to add features post ' +
|
|
||||||
post_url + ' nickname ' + nickname +
|
|
||||||
' timeline ' + boxname)
|
|
||||||
else:
|
|
||||||
print('WARN: features timeline. ' +
|
|
||||||
'Unable to locate post ' + post_url)
|
|
||||||
else:
|
|
||||||
if timeline_nickname == 'news':
|
|
||||||
print('WARN: Unable to locate news post ' +
|
|
||||||
post_url + ' nickname ' + nickname)
|
|
||||||
else:
|
|
||||||
print('WARN: Unable to locate post ' + post_url +
|
|
||||||
' nickname ' + nickname)
|
|
||||||
|
|
||||||
if total_posts_count < 3:
|
if total_posts_count < 3:
|
||||||
print('Posts added to json timeline ' + boxname + ': ' +
|
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 = [['<', '>'], ['<', '>']]
|
separators = [['<', '>'], ['<', '>']]
|
||||||
invalid_strings = [
|
invalid_strings = [
|
||||||
'analytics', 'ampproject', 'googleapis', '_exec('
|
'ampproject', 'googleapis', '_exec('
|
||||||
]
|
]
|
||||||
if _is_dangerous_string_simple(content, allow_local_network_access,
|
if _is_dangerous_string_simple(content, allow_local_network_access,
|
||||||
separators, invalid_strings):
|
separators, invalid_strings):
|
||||||
|
|
|
@ -1455,7 +1455,7 @@ Ever feel like corporate social media is deliberately pressing your buttons or g
|
||||||
}<br>
|
}<br>
|
||||||
<br>
|
<br>
|
||||||
server {<br>
|
server {<br>
|
||||||
listen 443 ssl;<br>
|
listen 443 ssl http2;<br>
|
||||||
server_name YOUR_DOMAIN;<br>
|
server_name YOUR_DOMAIN;<br>
|
||||||
<br>
|
<br>
|
||||||
gzip on;<br>
|
gzip on;<br>
|
||||||
|
|