From 2a2ab5ffff5e1eaad347746b05befa13e0cded60 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 2 Feb 2026 11:45:56 +0100 Subject: [PATCH] README.md aktualisiert --- README | 11 ----------- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 11 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 912656f..0000000 --- a/README +++ /dev/null @@ -1,11 +0,0 @@ -Hello World! - -This is a quote bot (shell script) which shows a random quote from a file every time it is invoked. - -Note: You need to make it executable to use it. - -The reason i use a file and not the web is hackability, at the moment. - -Please provide a quotes.txt file with one line per quote. - -Have fun! diff --git a/README.md b/README.md new file mode 100644 index 0000000..9af66ac --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +Hello World! + +This is a quote bot (shell script) which shows a random quote from a file every time it is invoked. + +Note: You need to make it executable to use it. + +```chmod u+x main.sh``` + +The reason i use a file and not the web is hackability, at the moment. + +Please provide a quotes.txt file with one line per quote. + +## REST-Version +The Rest-Version has functioning mastodon connection over REST-API. You need to run the full oauth user authentication before. I tried to use the "Development" section in Mastodon Preferences but it didnt work. What did work was the out of bounds creation of a new application and authenticating it with a user. It does not appear in the user Development section. + +Here's the documentation for the api: +https://docs.joinmastodon.org/client/intro/ + +You essentially need to run the following commands: + +``` +#test connection +curl https://mastodon.example/endpoint?q=test&n=0 + +# create app https://docs.joinmastodon.org/methods/apps/ this will return secrets, write them down! +curl -X POST -F 'client_name=Bot3' -F 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' -F 'scopes=read write push' -F 'website=https://myapp.example' https://mastodon.example.com/api/v1/apps + +#verify the app works https://docs.joinmastodon.org/methods/apps/#verify_credentials +curl -H 'Authorization: Bearer ****' https://mastodon.example.com/api/v1/accounts/verify_credentials + +#authorize a user https://docs.joinmastodon.org/methods/oauth/#authorize and https://docs.joinmastodon.org/client/authorized/#login you will have to input this in a browser then login and authorize the app, it will provide an authorization code +https://mastodon.example/oauth/authorize +?client_id=CLIENT_ID +&scope=read+write+push +&redirect_uri=urn:ietf:wg:oauth:2.0:oob +&response_type=code + +#obtain token https://docs.joinmastodon.org/methods/oauth/#token +curl -X POST -F 'grant_type=authorization_code' -F 'client_id=\*' -F 'client_secret=\*' -F 'redirect_uri=urn:ietf:wg:oauth:2.0:oob' -F 'code=\*' https://mastodon.example.com/oauth/token + + +#make your first post +curl -i -H 'Authorization: Bearer ***' -d 'status=Hello World!' https://mastodon.example.com/api/v1/statuses + +``` + +To find this out took me hours and hours. I'm writing it down to spare you time. + +Have fun!