Comment by ~momijizukamori on ~tsileo/microblog.pub
I can have a look, too - I saw that it's already generated if it doesn't exist when you try to run
inv compile-scss
so it shouldn't be hard to add that logic to the initial setup. I'm just terrified I am either gonna overwrite my theme file, or commit and push my theme file, haha.
Ticket created by ~momijizukamori on ~tsileo/microblog.pub
...which has the unfortunately side effect that git watches it for changes, and gets fussy if you try to pull new updates without stashing it, etc. This is a pretty easy fix (
git rm --cached data/_theme.scss
), I just don't want to be the person deleting files from the repo index!
Comment by ~momijizukamori on ~tsileo/microblog.pub
https://lists.sr.ht/~tsileo/microblog.pub-devel/patches/36950 hopefully I did that right!
Comment by ~momijizukamori on ~tsileo/microblog.pub
Okay, found it - looks like a c/p mistake:
{{ notif_actor_action(notif, "unshared a post") }} {{ utils.display_object(notif.outbox_object, with_icon=True) }}
at line 69 of
app/templates/notifications.html
- comparison to other blocks suggests it should be{{ notif_actor_action(notif, "unshared a post", with_icon=True) }} {{ utils.display_object(notif.outbox_object) }}
Will see about getting a patch done shortly!
Ticket created by ~momijizukamori on ~tsileo/microblog.pub
Hit while trying to view my notifs this morning. Probably a quick fix, but I figured I'd note it in case other people hit it! Traceback:
ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/microblog/pub/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 404, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/microblog/pub/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/fastapi/applications.py", line 269, in __call__ await super().__call__(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__ await self.middleware_stack(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__ raise exc File "/home/microblog/pub/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "/home/microblog/pub/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/home/microblog/pub/./app/main.py", line 174, in __call__ await self.app(scope, receive, send_wrapper) # type: ignore File "/home/microblog/pub/lib/python3.10/site-packages/starlette/exceptions.py", line 93, in __call__ raise exc File "/home/microblog/pub/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__ await self.app(scope, receive, sender) File "/home/microblog/pub/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__ raise e File "/home/microblog/pub/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ await self.app(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/starlette/routing.py", line 670, in __call__ await route.handle(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/starlette/routing.py", line 266, in handle await self.app(scope, receive, send) File "/home/microblog/pub/lib/python3.10/site-packages/starlette/routing.py", line 65, in app response = await func(request) File "/home/microblog/pub/lib/python3.10/site-packages/fastapi/routing.py", line 227, in app raw_response = await run_endpoint_function( File "/home/microblog/pub/lib/python3.10/site-packages/fastapi/routing.py", line 160, in run_endpoint_function return await dependant.call(**values) File "/home/microblog/pub/./app/admin.py", line 741, in get_notifications return await templates.render_template( File "/home/microblog/pub/./app/templates.py", line 96, in render_template return _templates.TemplateResponse( File "/home/microblog/pub/lib/python3.10/site-packages/starlette/templating.py", line 98, in TemplateResponse return _TemplateResponse( File "/home/microblog/pub/lib/python3.10/site-packages/starlette/templating.py", line 37, in __init__ content = template.render(context) File "/home/microblog/pub/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/home/microblog/pub/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "app/templates/notifications.html", line 12, in top-level template code <span title="{{ notif.created_at.isoformat() }}">{{ notif.created_at | timeago }}</span> File "app/templates/layout.html", line 42, in top-level template code {% block content %}{% endblock %} File "app/templates/notifications.html", line 70, in block 'content' {{ utils.display_object(notif.outbox_object, with_icon=True) }} TypeError: macro 'display_object' takes no keyword argument 'with_icon'
Comment by ~momijizukamori on ~tsileo/microblog.pub
Ha, I totally get not wanting to add more deps. That sounds like a decent enough compromise!
Comment by ~momijizukamori on ~tsileo/microblog.pub
Oh hmm I wonder if I'm checking just infrequently enough that I'm hitting the 12-hr timeout and it only looks like it's device-related - I don't do any automatic session-syncing between devices. The big problem with stateless sessions is that you can't remotely expire them, which would be the usual protection against stolen cookies. I'll peek a little more into fastapi-login - it's meant to be like flask-login, which I've used before and found extremely easy to integrate into projects.
A longer (or configurable) timeout may be a good stop-gap solution, though.
Ticket created by ~momijizukamori on ~tsileo/microblog.pub
So I love this little app a lot, but one of the few things that's been bugging me is session expiration - both the fact that you can only have one active session at a time (so if I log in on my phone, my desktop session goes away), and that sessions expire after twelve hours regardless. The session expiration is easy enough to tweak without any major changes, but multi-session support is a little more complex.
I'm happy to do the code work needed, but figured I should open up discussion before diving in. The simplest, slightly hacky solution, would be to store multiple session tokens server-side, and iterate through them. A slightly nicer option would be something like https://fastapi-login.readthedocs.io/ (though I need to check if it supports multiple sessions). There may be other packages providing similar functionality, too.
Comment by ~momijizukamori on ~tsileo/microblog.pub
I've been kind of wanting to try out making a PWA, so I'd be willing to take a stab at this!