diff options
| author | eltrac <hi@eltr.ac> | 2026-04-08 23:19:35 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-04-08 23:19:35 +0800 |
| commit | 3da048cc7216312c5fe33f4b4d8a3bf30ca063ec (patch) | |
| tree | 0d05ab48ebabdfc28268289c367427ecb579dc61 | |
| parent | 9278240c8fdb013076a766d90fda0130daa75e27 (diff) | |
remove: cancel route /api/mentions/:domain/:path
also refactor `by-url` since the remove `by-domain-path` was used by it
| -rw-r--r-- | src/weepinbell/handler.clj | 3 | ||||
| -rw-r--r-- | src/weepinbell/retriever.clj | 15 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/weepinbell/handler.clj b/src/weepinbell/handler.clj index 23dbc23..f224cb0 100644 --- a/src/weepinbell/handler.clj +++ b/src/weepinbell/handler.clj @@ -28,8 +28,7 @@ ;; query webmention list (context "/mentions" [] (GET "/" [url] (retriever/by-url url)) - (GET "/:domain" [domain] (retriever/by-domain domain)) - (GET "/:domain/:path" [domain path] (retriever/by-domain-path domain path))) + (GET "/:domain" [domain] (retriever/by-domain domain))) ;; query one specific webmention (context "/mention" [] (GET "/:id" [id] (retriever/by-id id)) diff --git a/src/weepinbell/retriever.clj b/src/weepinbell/retriever.clj index 7bc0818..5c052ed 100644 --- a/src/weepinbell/retriever.clj +++ b/src/weepinbell/retriever.clj @@ -34,20 +34,15 @@ wrap-response-list respond-json)) -(defn by-domain-path - "Get webmention sent to a particular path on a particular domain. More flexible than bare URL." - [domain path] - (-> (storage/get-wms-by-domain domain path) - wrap-response-list - respond-json)) - (defn by-url "Get webmention sent to a particular URL." [url] (if url - (let [domain (get-domain url) - path (get-path url)] - (by-domain-path domain path)) + (->> (get-domain url) + storage/get-wms-by-domain + (filter #(= url (get-in % [:webmention :target]))) + wrap-response-list + respond-json) ;; if no url query is passed (respond-json {:status 400 :message "Missing URL. Specify target URL whose webmentions you are querying."} |
