Skip to content

Commit 79e26b3

Browse files
authored
Create go-to-outine.sh
1 parent 70df90c commit 79e26b3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

_enabled-commands/go-to-outine.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# @raycast.author Ronan Rodrigo Nunes
4+
# @raycast.authorURL https://ronanrodrigo.dev
5+
# @raycast.packageName Browsing
6+
# @raycast.schemaVersion 1
7+
# @raycast.title Go to Outline
8+
# @raycast.description Open the website at Outline
9+
# @raycast.mode compact
10+
# @raycast.argument1 { "type": "text", "placeholder": "URL" }
11+
# @raycast.icon images/outline.png
12+
13+
address=$1
14+
15+
if ! command -v jq &> /dev/null; then
16+
echo "Please, install jq: brew install jq"
17+
exit 1
18+
fi
19+
20+
regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
21+
if ! [[ $address =~ $regex ]] ; then
22+
echo "Invalid URL"
23+
exit 1
24+
fi
25+
26+
function outline_request() {
27+
curl -s "https://api.outline.com/v3/parse_article?source_url=${address}"\
28+
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0'\
29+
-H 'Accept: */*'\
30+
-H 'Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3' --compressed\
31+
-H 'Origin: https://outline.com'\
32+
-H 'DNT: 1' -H 'Connection: keep-alive'\
33+
-H 'Referer: https://outline.com/'\
34+
-H 'Sec-GPC: 1'
35+
}
36+
short_code=$(outline_request | jq -r '.data.short_code')
37+
open "https://outline.com/${short_code}"

0 commit comments

Comments
 (0)