diff options
Diffstat (limited to 'bin/sup.sh')
-rw-r--r-- | bin/sup.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/bin/sup.sh b/bin/sup.sh index a261cb7f..32e282d1 100644 --- a/bin/sup.sh +++ b/bin/sup.sh @@ -110,6 +110,39 @@ discogs() { open 'https://discogs.com/login' } +gitea() { + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${giteaBase}/user/forgot_password" | + sed -n 's/.*name="_csrf" value="\([^"]*\)".*/\1/p' + ) + echo 'Submitting form...' + curl -Ss -X POST \ + -F "email=${email}" -F "_csrf=${csrf}" \ + "${giteaBase}/user/forgot_password" \ + >/dev/null + echo 'Waiting for email...' + code=$( + git fetch-email -i -M Trash \ + -F "${giteaFrom}" -T "${email}" -S 'Recover your account' | + unwrap | sed -n 's/.*code=3D\(.*\)/\1/p' | head -n 1 + ) + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${giteaBase}/user/recover_account" | + sed -n 's/.*name="_csrf" value="\([^"]*\)".*/\1/p' + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "_csrf=${csrf}" -F "code=${code}" \ + -F "password=${password}" \ + "${giteaBase}/user/recover_account" \ + >/dev/null + copy "${password}" + open "${giteaBase}/user/login" +} + liberapay() { echo 'Fetching CSRF token...' csrf=$( @@ -170,6 +203,34 @@ lobsters() { open "${lobstersBase}/login" } +lwn() { + username=$email + echo 'Submitting form...' + curl -Ss -X POST -F "username=${username}" \ + 'https://lwn.net/Login/MailPWLink' \ + >/dev/null + echo 'Waiting for email...' + key=$( + git fetch-email -i -M Trash \ + -F 'lwn@lwn.net' -S 'A link to set your LWN.net password' | + sed -n 's|.*/Login/SetPassword/.*/\(.*\)|\1|p' + ) + echo 'Retrieving UID...' + uid=$( + curl -Ss "https://lwn.net/Login/SetPassword/${username}/${key}" | + sed -n 's/.*name="uid" value="\([^"]*\)".*/\1/p' + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "uid=${uid}" -F "key=${key}" \ + -F "new1=${password}" -F "new2=${password}" \ + 'https://lwn.net/Login/DoSetPassword' \ + >/dev/null + copy "${password}" + open 'https://lwn.net/Login/' +} + patreon() { readonly patreonAPI='https://www.patreon.com/api' echo 'Submitting form...' @@ -207,6 +268,12 @@ patreon() { open 'https://www.patreon.com/login' } +tildegit() { + giteaBase='https://tildegit.org' + giteaFrom='git@tildegit.org' + gitea +} + tildenews() { lobstersBase='https://tilde.news' lobstersFrom='nobody@tilde.news' |