Flake ids (#68)

This is a series of squashed commits from cysfor @ github.

* Pleroma base62 "flake_id" isn't a decimal integer

* Is it the path order?

Still learning Django, making sure it's not erroring out because the path order is backwards. /user/:id dies saying /user/:id/next/:thingy won't parse, so I thought they might be out of order. But actually the template main/user.html silently recurses when you do /user/:id sending another query for /user/:id/next/:etc.

* 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.

Co-authored-by: Cy <autocommit>
Co-authored-by: Cy <email>
This commit is contained in:
cyisfor 2020-06-01 13:43:54 +00:00 committed by GitHub
parent ae7be271c9
commit 22036aa22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 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"),