aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sns/mastodon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sns/mastodon.sh')
-rwxr-xr-xtools/sns/mastodon.sh17
1 files changed, 0 insertions, 17 deletions
diff --git a/tools/sns/mastodon.sh b/tools/sns/mastodon.sh
deleted file mode 100755
index fb93bcd..0000000
--- a/tools/sns/mastodon.sh
+++ /dev/null
@@ -1,17 +0,0 @@
1#! /bin/bash
2
3# Restore mail in variable
4MAIL="$(cat)"
5
6# Only execute the following script when mail receiver is mastodon@topo.tw
7grep -qE "^X-Original-To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0
8# A little hacky way to check if mail is sent from me
9sed -nE '/^Received: /p;/^$/q' <<<"$(MAIL)" | wc -l | xargs -i test {} -lt 2 || exit 0
10
11# Leave log
12date >>~/Downloads/mastodon.log
13echo $$ >>~/Downloads/mastodon.log
14awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log
15
16# Use toot to send message on g0v.social
17awk -v RS= 'NR>1' <<<"$MAIL" | toot post >>/tmp/mastodon.log