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