Compare commits

..

No commits in common. "9768c08466dd5321fd369cee48315164b808e099" and "b9e064967c94e97fde604c06dd93ce97fea8a6c1" have entirely different histories.

2 changed files with 1 additions and 35 deletions

View File

@ -5,7 +5,7 @@ name = "pypi"
[packages] [packages]
"beautifulsoup4" = "*" "beautifulsoup4" = "*"
bleach = "~=4.1" bleach = "*"
certifi = "*" certifi = "*"
chardet = "*" chardet = "*"
decorator = "*" decorator = "*"

View File

@ -92,7 +92,6 @@ def get_usercontext(request, feature_set="mainline"):
session=get_session(client.api_base_id), session=get_session(client.api_base_id),
ratelimit_method="throw", ratelimit_method="throw",
feature_set=feature_set, feature_set=feature_set,
version_check_mode='none',
) )
return user, mastodon return user, mastodon
else: else:
@ -106,7 +105,6 @@ def is_logged_in(request):
def _notes_count(account, mastodon): def _notes_count(account, mastodon):
if not mastodon: if not mastodon:
return "" return ""
mastodon.version_check_mode = 'none'
notes = mastodon.notifications(limit=40) notes = mastodon.notifications(limit=40)
if account.preferences.filter_notifications: if account.preferences.filter_notifications:
notes = [ notes = [
@ -184,7 +182,6 @@ def user_search(request):
def user_search_inner(request, query): def user_search_inner(request, query):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
results = mastodon.search(query) results = mastodon.search(query)
return render( return render(
request, request,
@ -211,7 +208,6 @@ def timeline(
filter_context="home", filter_context="home",
): ):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
data = mastodon.timeline(timeline, limit=40, max_id=max_id, min_id=min_id) data = mastodon.timeline(timeline, limit=40, max_id=max_id, min_id=min_id)
form = PostForm( form = PostForm(
initial={"visibility": request.session["active_user"].source.privacy} initial={"visibility": request.session["active_user"].source.privacy}
@ -261,7 +257,6 @@ def timeline(
def get_filters(mastodon, context=None): def get_filters(mastodon, context=None):
try: try:
mastodon.version_check_mode = 'none'
if context: if context:
return [ff for ff in mastodon.filters() if context in ff.context] return [ff for ff in mastodon.filters() if context in ff.context]
else: else:
@ -346,7 +341,6 @@ def forget_account(request, account_name):
def notes_count(request): def notes_count(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
count = _notes_count(account, mastodon) count = _notes_count(account, mastodon)
return render( return render(
request, request,
@ -378,7 +372,6 @@ def tag(request, tag):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
except NotLoggedInException: except NotLoggedInException:
return redirect(login) return redirect(login)
mastodon.version_check_mode = 'none'
data = mastodon.timeline_hashtag(tag) data = mastodon.timeline_hashtag(tag)
notifications = _notes_count(account, mastodon) notifications = _notes_count(account, mastodon)
return render( return render(
@ -445,7 +438,6 @@ def login(request):
client_id=client.client_id, client_id=client.client_id,
client_secret=client.client_secret, client_secret=client.client_secret,
api_base_url=api_base_url, api_base_url=api_base_url,
version_check_mode='none',
) )
client.version = mastodon.instance().get("version") client.version = mastodon.instance().get("version")
client.save() client.save()
@ -468,7 +460,6 @@ def oauth_callback(request):
client_id=request.session["active_client_id"], client_id=request.session["active_client_id"],
client_secret=request.session["active_client_secret"], client_secret=request.session["active_client_secret"],
api_base_url=request.session["active_instance"], api_base_url=request.session["active_instance"],
version_check_mode="none",
) )
redirect_uri = request.build_absolute_uri(reverse("oauth_callback")) redirect_uri = request.build_absolute_uri(reverse("oauth_callback"))
access_token = mastodon.log_in( access_token = mastodon.log_in(
@ -476,7 +467,6 @@ def oauth_callback(request):
) )
request.session["access_token"] = access_token request.session["access_token"] = access_token
user = mastodon.account_verify_credentials() user = mastodon.account_verify_credentials()
try: try:
account = Account.objects.get( account = Account.objects.get(
username=user.username + "@" + request.session["active_instance_hostname"] username=user.username + "@" + request.session["active_instance_hostname"]
@ -625,7 +615,6 @@ def note(request, next=None, prev=None):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
except NotLoggedInException: except NotLoggedInException:
return redirect(about) return redirect(about)
mastodon.version_check_mode = 'none'
try: try:
last_seen = mastodon.notifications(limit=1)[0] last_seen = mastodon.notifications(limit=1)[0]
except IndexError: except IndexError:
@ -751,7 +740,6 @@ def user(request, username, prev=None, next=None):
except NotLoggedInException: except NotLoggedInException:
return redirect(about) return redirect(about)
user_dict = None user_dict = None
mastodon.version_check_mode = 'none'
# pleroma currently flops if the user's not already locally known # pleroma currently flops if the user's not already locally known
# this is a BUG that they MUST FIX # this is a BUG that they MUST FIX
# but until then, we might have to fallback to a regular search, # but until then, we might have to fallback to a regular search,
@ -867,7 +855,6 @@ def status_post(account, request, mastodon, **kw):
@br_login_required @br_login_required
def toot(request, mention=None): def toot(request, mention=None):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.method == "GET": if request.method == "GET":
if mention: if mention:
if not mention.startswith("@"): if not mention.startswith("@"):
@ -973,7 +960,6 @@ def toot(request, mention=None):
def redraft(request, id): def redraft(request, id):
if request.method == "GET": if request.method == "GET":
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
toot_content = get_text(toot.content) # convert to plain text toot_content = get_text(toot.content) # convert to plain text
# fix up white space # fix up white space
@ -1009,7 +995,6 @@ def redraft(request, id):
elif request.method == "POST": elif request.method == "POST":
form = PostForm(request.POST, request.FILES) form = PostForm(request.POST, request.FILES)
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
if form.is_valid(): if form.is_valid():
media_objects = [] media_objects = []
@ -1096,7 +1081,6 @@ def safe_get_attachment(toot, index):
def reply(request, id): def reply(request, id):
if request.method == "GET": if request.method == "GET":
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
try: try:
toot = mastodon.status(id) toot = mastodon.status(id)
context = mastodon.status_context(id) context = mastodon.status_context(id)
@ -1215,7 +1199,6 @@ def reply(request, id):
@br_login_required @br_login_required
def share(request): def share(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.method == "GET": if request.method == "GET":
params = request.GET params = request.GET
if request.method == "POST": if request.method == "POST":
@ -1248,7 +1231,6 @@ def share(request):
@br_login_required @br_login_required
def fav(request, id): def fav(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
if request.method == "POST": if request.method == "POST":
if not request.POST.get("cancel", None): if not request.POST.get("cancel", None):
@ -1288,7 +1270,6 @@ def fav(request, id):
@br_login_required @br_login_required
def boost(request, id): def boost(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
if request.method == "POST": if request.method == "POST":
if not request.POST.get("cancel", None): if not request.POST.get("cancel", None):
@ -1328,7 +1309,6 @@ def boost(request, id):
@br_login_required @br_login_required
def delete(request, id): def delete(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
if request.method == "POST" or request.method == "DELETE": if request.method == "POST" or request.method == "DELETE":
if toot.account.acct != request.session["active_user"].acct: if toot.account.acct != request.session["active_user"].acct:
@ -1355,7 +1335,6 @@ def delete(request, id):
@br_login_required @br_login_required
def follow(request, id): def follow(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
try: try:
user_dict = mastodon.account(id) user_dict = mastodon.account(id)
relationship = mastodon.account_relationships(user_dict.id)[0] relationship = mastodon.account_relationships(user_dict.id)[0]
@ -1402,7 +1381,6 @@ def follow(request, id):
@br_login_required @br_login_required
def block(request, id): def block(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
try: try:
user_dict = mastodon.account(id) user_dict = mastodon.account(id)
relationship = mastodon.account_relationships(user_dict.id)[0] relationship = mastodon.account_relationships(user_dict.id)[0]
@ -1441,7 +1419,6 @@ def block(request, id):
@br_login_required @br_login_required
def mute(request, id): def mute(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
try: try:
user_dict = mastodon.account(id) user_dict = mastodon.account(id)
relationship = mastodon.account_relationships(user_dict.id)[0] relationship = mastodon.account_relationships(user_dict.id)[0]
@ -1479,7 +1456,6 @@ def mute(request, id):
@br_login_required @br_login_required
def search(request): def search(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.GET.get("ic-request"): if request.GET.get("ic-request"):
return render( return render(
request, request,
@ -1511,7 +1487,6 @@ def search_results(request):
query = "" query = ""
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
results = mastodon.search(query) results = mastodon.search(query)
notifications = _notes_count(account, mastodon) notifications = _notes_count(account, mastodon)
return render( return render(
@ -1548,7 +1523,6 @@ def about(request):
@cache_page(60 * 30) @cache_page(60 * 30)
def privacy(request): def privacy(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if account: if account:
preferences = account.preferences preferences = account.preferences
else: else:
@ -1567,7 +1541,6 @@ def privacy(request):
@br_login_required @br_login_required
def emoji_reference(request): def emoji_reference(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
emojos = mastodon.custom_emojis() emojos = mastodon.custom_emojis()
notifications = _notes_count(account, mastodon) notifications = _notes_count(account, mastodon)
return render( return render(
@ -1585,7 +1558,6 @@ def emoji_reference(request):
@br_login_required @br_login_required
def list_filters(request): def list_filters(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
filters = mastodon.filters() filters = mastodon.filters()
return render( return render(
request, request,
@ -1597,7 +1569,6 @@ def list_filters(request):
@br_login_required @br_login_required
def create_filter(request): def create_filter(request):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.method == "POST": if request.method == "POST":
form = FilterForm(request.POST) form = FilterForm(request.POST)
if form.is_valid(): if form.is_valid():
@ -1638,7 +1609,6 @@ def create_filter(request):
@br_login_required @br_login_required
def delete_filter(request, id): def delete_filter(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
filter = mastodon.filter(id) filter = mastodon.filter(id)
if request.method == "POST" or request.method == "DELETE": if request.method == "POST" or request.method == "DELETE":
@ -1663,7 +1633,6 @@ def delete_filter(request, id):
@br_login_required @br_login_required
def edit_filter(request, id): def edit_filter(request, id):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
filter = mastodon.filter(id) filter = mastodon.filter(id)
contexts = [] contexts = []
@ -1727,7 +1696,6 @@ def edit_filter(request, id):
@br_login_required @br_login_required
def follow_requests(request, id=None): def follow_requests(request, id=None):
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.method == "GET": if request.method == "GET":
reqs = mastodon.follow_requests() reqs = mastodon.follow_requests()
return render( return render(
@ -1748,7 +1716,6 @@ def follow_requests(request, id=None):
@br_login_required @br_login_required
def accounts(request, id=None): def accounts(request, id=None):
active_account, mastodon = get_usercontext(request) active_account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
if request.method == "GET": if request.method == "GET":
accounts = [x for x in request.session.get("accounts_dict").values()] accounts = [x for x in request.session.get("accounts_dict").values()]
return render( return render(
@ -1791,7 +1758,6 @@ def vote(request, id):
return redirect("thread", id) return redirect("thread", id)
if request.method == "POST": if request.method == "POST":
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
mastodon.version_check_mode = 'none'
toot = mastodon.status(id) toot = mastodon.status(id)
poll = toot.poll poll = toot.poll
if not poll: if not poll: