Merge branch 'main' of github.com:binwiederhier/ntfy

This commit is contained in:
Philipp Heckel 2022-11-26 13:35:19 -05:00
commit e0024e59f3

View file

@ -1316,7 +1316,7 @@ Here's an example using the [`X-Actions` header](#using-a-header):
=== "Command line (curl)" === "Command line (curl)"
``` ```
curl \ curl \
-d "Somebody retweetet your tweet." \ -d "Somebody retweeted your tweet." \
-H "Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \ -H "Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \
ntfy.sh/myhome ntfy.sh/myhome
``` ```
@ -1326,7 +1326,7 @@ Here's an example using the [`X-Actions` header](#using-a-header):
ntfy publish \ ntfy publish \
--actions="view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \ --actions="view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \
myhome \ myhome \
"Somebody retweetet your tweet." "Somebody retweeted your tweet."
``` ```
=== "HTTP" === "HTTP"
@ -1335,14 +1335,14 @@ Here's an example using the [`X-Actions` header](#using-a-header):
Host: ntfy.sh Host: ntfy.sh
Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392 Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392
Somebody retweetet your tweet. Somebody retweeted your tweet.
``` ```
=== "JavaScript" === "JavaScript"
``` javascript ``` javascript
fetch('https://ntfy.sh/myhome', { fetch('https://ntfy.sh/myhome', {
method: 'POST', method: 'POST',
body: 'Somebody retweetet your tweet.', body: 'Somebody retweeted your tweet.',
headers: { headers: {
'Actions': 'view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392' 'Actions': 'view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392'
} }
@ -1351,7 +1351,7 @@ Here's an example using the [`X-Actions` header](#using-a-header):
=== "Go" === "Go"
``` go ``` go
req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("Somebody retweetet your tweet.")) req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("Somebody retweeted your tweet."))
req.Header.Set("Actions", "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392") req.Header.Set("Actions", "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392")
http.DefaultClient.Do(req) http.DefaultClient.Do(req)
``` ```
@ -1360,14 +1360,14 @@ Here's an example using the [`X-Actions` header](#using-a-header):
``` powershell ``` powershell
$uri = "https://ntfy.sh/myhome" $uri = "https://ntfy.sh/myhome"
$headers = @{ Actions="view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" } $headers = @{ Actions="view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" }
$body = "Somebody retweetet your tweet." $body = "Somebody retweeted your tweet."
Invoke-RestMethod -Method 'Post' -Uri $uri -Headers $headers -Body $body -UseBasicParsing Invoke-RestMethod -Method 'Post' -Uri $uri -Headers $headers -Body $body -UseBasicParsing
``` ```
=== "Python" === "Python"
``` python ``` python
requests.post("https://ntfy.sh/myhome", requests.post("https://ntfy.sh/myhome",
data="Somebody retweetet your tweet.", data="Somebody retweeted your tweet.",
headers={ "Actions": "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" }) headers={ "Actions": "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" })
``` ```
@ -1379,7 +1379,7 @@ Here's an example using the [`X-Actions` header](#using-a-header):
'header' => 'header' =>
"Content-Type: text/plain\r\n" . "Content-Type: text/plain\r\n" .
"Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392", "Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392",
'content' => 'Somebody retweetet your tweet.' 'content' => 'Somebody retweeted your tweet.'
] ]
])); ]));
``` ```
@ -1391,7 +1391,7 @@ And the same example using [JSON publishing](#publish-as-json):
curl ntfy.sh \ curl ntfy.sh \
-d '{ -d '{
"topic": "myhome", "topic": "myhome",
"message": "Somebody retweetet your tweet.", "message": "Somebody retweeted your tweet.",
"actions": [ "actions": [
{ {
"action": "view", "action": "view",
@ -1413,7 +1413,7 @@ And the same example using [JSON publishing](#publish-as-json):
} }
]' \ ]' \
myhome \ myhome \
"Somebody retweetet your tweet." "Somebody retweeted your tweet."
``` ```
=== "HTTP" === "HTTP"
@ -1423,7 +1423,7 @@ And the same example using [JSON publishing](#publish-as-json):
{ {
"topic": "myhome", "topic": "myhome",
"message": "Somebody retweetet your tweet.", "message": "Somebody retweeted your tweet.",
"actions": [ "actions": [
{ {
"action": "view", "action": "view",
@ -1440,7 +1440,7 @@ And the same example using [JSON publishing](#publish-as-json):
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
topic: "myhome", topic: "myhome",
message": "Somebody retweetet your tweet.", message": "Somebody retweeted your tweet.",
actions: [ actions: [
{ {
action: "view", action: "view",
@ -1459,7 +1459,7 @@ And the same example using [JSON publishing](#publish-as-json):
body := `{ body := `{
"topic": "myhome", "topic": "myhome",
"message": "Somebody retweetet your tweet.", "message": "Somebody retweeted your tweet.",
"actions": [ "actions": [
{ {
"action": "view", "action": "view",
@ -1477,7 +1477,7 @@ And the same example using [JSON publishing](#publish-as-json):
$uri = "https://ntfy.sh" $uri = "https://ntfy.sh"
$body = @{ $body = @{
topic = "myhome" topic = "myhome"
message = "Somebody retweetet your tweet." message = "Somebody retweeted your tweet."
actions = @( actions = @(
@{ @{
"action"="view" "action"="view"
@ -1494,7 +1494,7 @@ And the same example using [JSON publishing](#publish-as-json):
requests.post("https://ntfy.sh/", requests.post("https://ntfy.sh/",
data=json.dumps({ data=json.dumps({
"topic": "myhome", "topic": "myhome",
"message": "Somebody retweetet your tweet.", "message": "Somebody retweeted your tweet.",
"actions": [ "actions": [
{ {
"action": "view", "action": "view",
@ -1514,7 +1514,7 @@ And the same example using [JSON publishing](#publish-as-json):
'header' => "Content-Type: application/json", 'header' => "Content-Type: application/json",
'content' => json_encode([ 'content' => json_encode([
"topic": "myhome", "topic": "myhome",
"message": "Somebody retweetet your tweet.", "message": "Somebody retweeted your tweet.",
"actions": [ "actions": [
[ [
"action": "view", "action": "view",