Pārlūkot izejas kodu

Add a synonym url for /u/<user>/l

Trevor Elliott 3 gadi atpakaļ
vecāks
revīzija
62d4157235
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      lc/app.py

+ 9 - 0
lc/app.py

@@ -296,3 +296,12 @@ class PinboardImport(Endpoint):
 class ServiceWorker(Endpoint):
     def route(self, *args, **kwargs):
         return flask.send_file("../js/serviceWorker.js", mimetype="text/javascript")
+
+@endpoint("/add-link")
+class AddLink(Endpoint):
+    def html(self):
+        if not self.user:
+            raise e.LCRedirect("/login")
+        else:
+            args = "&".join(f"{key}={value}" for key, value in flask.request.args.items())
+            raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")