feat(dsi): add scoped search keyboard routes

Provide separate native keyboard endpoints for creator and Flipnote searches.
This commit is contained in:
rekushi committed 2026-10-29 04:42:47 +00:00
1 parent 5699426df7
commit 6b28614794
1 file changed
+29
+29
View File
@@ -0,0 +1,29 @@
from twisted.web import resource
from hatena import NotFound, as_text
from reximemo import search_keyboard_response
class PyResource(resource.Resource):
isLeaf = False
def getChild(self, name, request):
scope = as_text(name)
if scope in {"flipnotes.kbd", "creators.kbd"}:
return SearchKeyboard(scope.split(".", 1)[0])
return NotFound
class SearchKeyboard(resource.Resource):
isLeaf = True
def __init__(self, scope):
super().__init__()
self.scope = scope
def render_POST(self, request):
return search_keyboard_response(request, self.scope)
def render_GET(self, request):
request.setResponseCode(405)
return b""