mirror of https://gitlab.com/bashrc2/epicyon
Don't show individual posts for premium account to unauthorized viewers
parent
ff4cc80a29
commit
6e54d1d69d
|
@ -3668,7 +3668,8 @@ def daemon_http_get(self) -> None:
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type,
|
proxy_type,
|
||||||
cookie, self.server.debug,
|
cookie, self.server.debug,
|
||||||
curr_session):
|
curr_session,
|
||||||
|
self.server.translate):
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -3770,7 +3771,8 @@ def daemon_http_get(self) -> None:
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type,
|
proxy_type,
|
||||||
cookie, self.server.debug,
|
cookie, self.server.debug,
|
||||||
curr_session):
|
curr_session,
|
||||||
|
self.server.translate):
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -3788,7 +3790,8 @@ def daemon_http_get(self) -> None:
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type,
|
proxy_type,
|
||||||
cookie, self.server.debug,
|
cookie, self.server.debug,
|
||||||
curr_session):
|
curr_session,
|
||||||
|
self.server.translate):
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Core"
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from webapp_conversation import html_conversation_view
|
from webapp_conversation import html_conversation_view
|
||||||
|
from utils import is_premium_account
|
||||||
from utils import get_instance_url
|
from utils import get_instance_url
|
||||||
from utils import is_public_post_from_url
|
from utils import is_public_post_from_url
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
|
@ -55,7 +56,7 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type: str, cookie: str,
|
proxy_type: str, cookie: str,
|
||||||
debug: str, include_create_wrapper: bool,
|
debug: str, include_create_wrapper: bool,
|
||||||
curr_session) -> bool:
|
curr_session, translate: {}) -> bool:
|
||||||
"""Shows an individual post from its filename
|
"""Shows an individual post from its filename
|
||||||
"""
|
"""
|
||||||
if not os.path.isfile(post_filename):
|
if not os.path.isfile(post_filename):
|
||||||
|
@ -63,6 +64,13 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# if this is a premium account and the viewer is unauthorized
|
||||||
|
if not authorized:
|
||||||
|
if is_premium_account(base_dir, nickname, domain):
|
||||||
|
http_401(self, translate['Premium account'])
|
||||||
|
self.server.getreq_busy = False
|
||||||
|
return True
|
||||||
|
|
||||||
post_json_object = load_json(post_filename)
|
post_json_object = load_json(post_filename)
|
||||||
if not post_json_object:
|
if not post_json_object:
|
||||||
self.send_response(429)
|
self.send_response(429)
|
||||||
|
@ -178,7 +186,7 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type: str, cookie: str,
|
proxy_type: str, cookie: str,
|
||||||
debug: str,
|
debug: str,
|
||||||
curr_session) -> bool:
|
curr_session, translate: {}) -> bool:
|
||||||
"""Shows an individual post
|
"""Shows an individual post
|
||||||
"""
|
"""
|
||||||
liked_by = None
|
liked_by = None
|
||||||
|
@ -258,7 +266,7 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type, cookie, debug,
|
proxy_type, cookie, debug,
|
||||||
include_create_wrapper,
|
include_create_wrapper,
|
||||||
curr_session)
|
curr_session, translate)
|
||||||
fitness_performance(getreq_start_time, self.server.fitness,
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
'_GET', 'show_individual_post',
|
'_GET', 'show_individual_post',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
@ -426,7 +434,7 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type: str, cookie: str,
|
proxy_type: str, cookie: str,
|
||||||
debug: str,
|
debug: str,
|
||||||
curr_session) -> bool:
|
curr_session, translate) -> bool:
|
||||||
"""get an individual post from the path /@nickname/statusnumber
|
"""get an individual post from the path /@nickname/statusnumber
|
||||||
"""
|
"""
|
||||||
if '/@' not in path:
|
if '/@' not in path:
|
||||||
|
@ -512,7 +520,7 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type, cookie, debug,
|
proxy_type, cookie, debug,
|
||||||
include_create_wrapper,
|
include_create_wrapper,
|
||||||
curr_session)
|
curr_session, translate)
|
||||||
fitness_performance(getreq_start_time, self.server.fitness,
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
'_GET', 'show_individual_at_post',
|
'_GET', 'show_individual_at_post',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
@ -936,7 +944,7 @@ def show_notify_post(self, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type: str, cookie: str,
|
proxy_type: str, cookie: str,
|
||||||
debug: str,
|
debug: str,
|
||||||
curr_session) -> bool:
|
curr_session, translate: {}) -> bool:
|
||||||
"""Shows an individual post from an account which you are following
|
"""Shows an individual post from an account which you are following
|
||||||
and where you have the notify checkbox set on person options
|
and where you have the notify checkbox set on person options
|
||||||
"""
|
"""
|
||||||
|
@ -969,7 +977,7 @@ def show_notify_post(self, authorized: bool,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
proxy_type, cookie, debug,
|
proxy_type, cookie, debug,
|
||||||
include_create_wrapper,
|
include_create_wrapper,
|
||||||
curr_session)
|
curr_session, translate)
|
||||||
fitness_performance(getreq_start_time, self.server.fitness,
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
'_GET', 'show_notify_post',
|
'_GET', 'show_notify_post',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
|
Loading…
Reference in New Issue