mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
server/general: ditch falcon for in-house WSGI app
For quite some time, I hated Falcon's class maps approach that caused more chaos than good for Szurubooru. I've taken a look at the other frameworks (hug, flask, etc) again, but they all looked too bloated/over-engineered. I decided to just talk to WSGI myself. Regex-based routing may not be the fastest in the world, but I'm fine with response time of 10 ms for cached /posts.
This commit is contained in:
@ -1,14 +1,12 @@
|
||||
from szurubooru import search
|
||||
from szurubooru.api.base_api import BaseApi
|
||||
from szurubooru.func import auth, snapshots
|
||||
from szurubooru.rest import routes
|
||||
|
||||
class SnapshotListApi(BaseApi):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._search_executor = search.Executor(
|
||||
search.configs.SnapshotSearchConfig())
|
||||
_search_executor = search.Executor(
|
||||
search.configs.SnapshotSearchConfig())
|
||||
|
||||
def get(self, ctx):
|
||||
auth.verify_privilege(ctx.user, 'snapshots:list')
|
||||
return self._search_executor.execute_and_serialize(
|
||||
ctx, snapshots.serialize_snapshot)
|
||||
@routes.get('/snapshots/?')
|
||||
def get_snapshots(ctx, _params=None):
|
||||
auth.verify_privilege(ctx.user, 'snapshots:list')
|
||||
return _search_executor.execute_and_serialize(
|
||||
ctx, snapshots.serialize_snapshot)
|
||||
|
Reference in New Issue
Block a user