2 Commits 738556da2f ... 7d2a0d78c2

Author SHA1 Message Date
  Trevor Elliott 7d2a0d78c2 Handle weird android case in /add-link 3 years ago
  Trevor Elliott ae0eddb508 Add method and enctype 3 years ago
2 changed files with 12 additions and 1 deletions
  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",