-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add short link generation #4
base: master
Are you sure you want to change the base?
Conversation
reviewing it! |
src/klipse/utils.cljs
Outdated
:headers {"accept" "application/json" "content-type" "application/json"} | ||
:query-params {:format "simple" :url "https://google.com"}}))] | ||
(if-not (= (:status response) 200) | ||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to move alert and print into a separate function outside of fetch-shortened-url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, although I can't seem to get the URL to output on to the Klipse output. Is there another function I need to call besides print
to make that happen?
@jayhoogle I am not able to generate a short link when testing locally.
|
@viebel that's because |
What we should do is to provide a way to disable the shortening url feature via a url parameter named klipse-app/src/klipse/utils.cljs Line 22 in 46809aa
|
@@ -9,6 +9,31 @@ | |||
[cljs.core.async :refer [timeout <! chan put!]] | |||
[cemerick.url :refer [url]])) | |||
|
|||
(defn show-url | |||
[url] | |||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary wrapping parentheses
@jayhoogle What are the license terms of is.gd ? I am not comfortable with the CORS hack that you used. |
{:with-credentials? false | ||
:headers {"accept" "application/json" "content-type" "application/json"} | ||
:query-params {:format "simple" :url current}}))] | ||
(if-not (= (:status response) 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destructure status
and body
@@ -29,9 +54,18 @@ | |||
(assoc-in [:query (name key)] value) | |||
str)) | |||
|
|||
(defn process-url [base-url input] | |||
(let [a (add-url-parameter base-url :cljs_in input)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a thread macro ->
(add-url-parameter :cljs_in input))) | ||
(-> | ||
(if base-url (url base-url) (current-url)) | ||
(process-url input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always close parentheses on the above line
Moved across changes from the main repo PR @viebel.