main
Bob Mottram 2022-06-09 12:02:34 +01:00
parent 0fde692c24
commit ee8ce74bad
2 changed files with 15 additions and 46 deletions

41
blog.py
View File

@ -354,11 +354,8 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
return blog_str
def _html_blog_post_rss2(authorized: bool,
base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, domain_full: str,
post_json_object: {},
handle: str, restrict_to_domain: bool,
def _html_blog_post_rss2(domain: str, post_json_object: {},
restrict_to_domain: bool,
system_language: str) -> str:
"""Returns the RSS version 2 feed for a single blog post
"""
@ -389,11 +386,8 @@ def _html_blog_post_rss2(authorized: bool,
return rss_str
def _html_blog_post_rss3(authorized: bool,
base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, domain_full: str,
post_json_object: {},
handle: str, restrict_to_domain: bool,
def _html_blog_post_rss3(domain: str, post_json_object: {},
restrict_to_domain: bool,
system_language: str) -> str:
"""Returns the RSS version 3 feed for a single blog post
"""
@ -605,8 +599,7 @@ def html_blog_page(authorized: bool, session,
return blog_str + html_footer()
def html_blog_page_rss2(authorized: bool, session,
base_dir: str, http_prefix: str, translate: {},
def html_blog_page_rss2(base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, port: int,
no_of_items: int, page_number: int,
include_header: bool, system_language: str) -> str:
@ -646,19 +639,14 @@ def html_blog_page_rss2(authorized: bool, session,
continue
blog_rss2 += \
_html_blog_post_rss2(authorized, base_dir,
http_prefix, translate,
nickname, domain,
domain_full, item,
None, True, system_language)
_html_blog_post_rss2(domain, item, True, system_language)
if include_header:
return blog_rss2 + rss2footer()
return blog_rss2
def html_blog_page_rss3(authorized: bool, session,
base_dir: str, http_prefix: str, translate: {},
def html_blog_page_rss3(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
no_of_items: int, page_number: int,
system_language: str) -> str:
@ -668,8 +656,6 @@ def html_blog_page_rss3(authorized: bool, session,
'\n' in nickname or '\r' in nickname:
return None
domain_full = get_full_domain(domain, port)
blog_rss3 = ''
blogs_index = acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
@ -690,12 +676,7 @@ def html_blog_page_rss3(authorized: bool, session,
continue
blog_rss3 += \
_html_blog_post_rss3(authorized, base_dir,
http_prefix, translate,
nickname, domain,
domain_full, item,
None, True,
system_language)
_html_blog_post_rss3(domain, item, True, system_language)
return blog_rss3
@ -760,7 +741,7 @@ def html_blog_view(authorized: bool,
domain_full = get_full_domain(domain, port)
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
for _, dirs, _ in os.walk(base_dir + '/accounts'):
for acct in dirs:
if not is_account_dir(acct):
continue
@ -778,9 +759,7 @@ def html_blog_view(authorized: bool,
def html_edit_blog(media_instance: bool, translate: {},
base_dir: str, http_prefix: str,
path: str,
page_number: int,
base_dir: str, path: str, page_number: int,
nickname: str, domain: str,
post_url: str, system_language: str) -> str:
"""Edit a blog post after it was created

View File

@ -7643,9 +7643,7 @@ class PubServer(BaseHTTPRequestHandler):
return
msg = \
html_blog_page_rss2(authorized,
curr_session,
base_dir,
html_blog_page_rss2(base_dir,
http_prefix,
self.server.translate,
nickname,
@ -7698,9 +7696,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = acct.split('@')[0]
domain = acct.split('@')[1]
msg += \
html_blog_page_rss2(authorized,
curr_session,
base_dir,
html_blog_page_rss2(base_dir,
http_prefix,
self.server.translate,
nickname,
@ -7807,8 +7803,7 @@ class PubServer(BaseHTTPRequestHandler):
path + ' ' + calling_domain)
self._404()
def _get_rss3feed(self, authorized: bool,
calling_domain: str, path: str,
def _get_rss3feed(self, calling_domain: str, path: str,
base_dir: str, http_prefix: str,
domain: str, port: int, proxy_type: str,
getreq_start_time,
@ -7829,10 +7824,7 @@ class PubServer(BaseHTTPRequestHandler):
self._404()
return
msg = \
html_blog_page_rss3(authorized,
curr_session,
base_dir, http_prefix,
self.server.translate,
html_blog_page_rss3(base_dir, http_prefix,
nickname, domain, port,
MAX_POSTS_IN_RSS_FEED, 1,
system_language)
@ -15642,8 +15634,7 @@ class PubServer(BaseHTTPRequestHandler):
# RSS 3.0
if self.path.startswith('/blog/') and \
self.path.endswith('/rss.txt'):
self._get_rss3feed(authorized,
calling_domain, self.path,
self._get_rss3feed(calling_domain, self.path,
self.server.base_dir,
self.server.http_prefix,
self.server.domain,
@ -17645,7 +17636,6 @@ class PubServer(BaseHTTPRequestHandler):
msg = html_edit_blog(self.server.media_instance,
self.server.translate,
self.server.base_dir,
self.server.http_prefix,
self.path, reply_page_number,
nickname, self.server.domain,
post_url,