I figure out flake_ids

Go figure Pleroma can't even use hexadecimal numbers. Nope, base62 is clearly the way to go. They're working for me, at any rate.
This commit is contained in:
Cy 2020-05-30 21:24:56 +00:00
parent aca2adcd27
commit 9ac01a85d1
No known key found for this signature in database
GPG Key ID: F66D599380F88521
2 changed files with 9 additions and 8 deletions

View File

@ -45,8 +45,13 @@ urlpatterns = [
path("tags/<tag>", views.tag, name="tag"),
path("user/", views.home, name="user_bad"),
path("user/<username>", views.user, name="user"),
path("user/<username>/next/<int:next>", views.user, name="user_next"),
path("user/<username>/prev/<int:prev>", views.user, name="user_prev"),
# next/prev are integers, but pleroma uses 128 bit integers
# ...encoded in Base62.
# aka a "flake_id"
# from baseconv import base62, but we don't need to decode it
# just pass it along back to pleroma but it is NOT an <int:>
path("user/<username>/next/<next>", views.user, name="user_next"),
path("user/<username>/prev/<prev>", views.user, name="user_prev"),
path("toot/<mention>", views.toot, name="toot"),
path("toot", views.toot, name="toot"),
path("reply/<id>", views.reply, name="reply"),

View File

@ -29,6 +29,7 @@ from time import sleep
from requests import Session
import re
class NotLoggedInException(Exception):
pass
@ -142,10 +143,7 @@ def br_login_required(function=None, home_url=None, redirect_field_name=None):
url = "/"
return HttpResponseRedirect(url)
else:
try:
return view_func(request, *args, **kwargs)
except:
print(view_func, function)
return view_func(request, *args, **kwargs)
_view.__name__ = view_func.__name__
_view.__dict__ = view_func.__dict__
@ -740,8 +738,6 @@ def user(request, username, prev=None, next=None):
next = data[-1]._pagination_next
except (IndexError, AttributeError, KeyError):
next = None
help(render)
raise SystemExit(23)
return render(
request,
"main/user.html",