2 Commits 738556da2f ... 7d2a0d78c2

Auteur SHA1 Bericht Datum
  Trevor Elliott 7d2a0d78c2 Handle weird android case in /add-link 3 jaren geleden
  Trevor Elliott ae0eddb508 Add method and enctype 3 jaren geleden
2 gewijzigde bestanden met toevoegingen van 12 en 1 verwijderingen
  1. 10 1
      lc/app.py
  2. 2 0
      static/manifest.json

+ 10 - 1
lc/app.py

@@ -302,6 +302,15 @@ class AddLink(Endpoint):
     def html(self):
         if not self.user:
             raise e.LCRedirect("/login")
+
+        url = flask.request.args.get("text", None)
+        name = flask.request.args.get("name", None)
+        text = flask.request.args.get("text", None)
+
+        # Android sets the text field to the url only
+        if url is None and name is None and text is not None:
+            args = f"url={text}"
         else:
             args = "&".join(f"{key}={value}" for key, value in flask.request.args.items())
-            raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")
+
+        raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")

+ 2 - 0
static/manifest.json

@@ -18,6 +18,8 @@
   ],
   "share_target": {
     "action": "/add-link",
+    "method": "GET",
+    "enctype": "application/x-www-form-urlencoded",
     "params": {
       "title": "name",
       "text": "text",