enbas/README.asciidoc

141 lines
5.2 KiB
Text

// SPDX-FileCopyrightText: 2024 Dan Anglin <d.n.i.anglin@gmail.com>
//
// SPDX-License-Identifier: CC-BY-4.0
= Enbas
:toc: left
:toclevels: 3
:toc-title: Table of Contents
== Overview
Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] client for your terminal written
in https://go.dev[Go].
The project is in its early stages of development so expect bugs, breaking changes and limited functionality at this time
It is **not** recommended for use this with your production GoToSocial servers.
This project is licensed under the GNU General Public License V3 or later which you can view link:LICENSES/GPL-3.0-or-later.txt[here].
=== Repository mirrors
Enbas is primarily developed in Code Flow https://codeflow.dananglin.me.uk/apollo/enbas[here] with the `main` branch pushed to
https://codeberg.org/dananglin/enbas[Codeberg] and https://github.com/dananglin/enbas[GitHub]
== Installation
(Moved)
== Configuration
Enbas uses Go's https://pkg.go.dev/os#UserConfigDir[os.UserConfigDir()] function to determine the
location of your configuration directory.
If you've set the `XDG_CONFIG_HOME` environment variable, the configuration files will be stored in the `$XDG_CONFIG_HOME/enbas` directory.
If this is not set:
- on Linux the configuration directory will be set to `$HOME/.config/enbas`.
- on Darwin (MacOS) the configuration directory will be set to `$HOME/Library/Application Support/enbas`.
- on Windows the configuration directory will be set within the `%AppData%` directory.
If, for whatever reason, any of the above cannot be determined the configuration directory will be set to
the current working directory.
== Usage
=== Log into your GoToSocial account
Enbas uses the Oauth2 authentication flow to log into your account on GoToSocial.
This process requires your input to give consent to allow Enbas access to your account.
[WARNING]
====
As of writing GoToSocial does not currently support scoped authorization tokens so even if we request read-only
tokens, the application will be able to perform any actions within the limitations of your account
(including admin actions if you are an admin).
You can read more about this https://docs.gotosocial.org/en/latest/api/authentication/[here].
====
The login flow is completed using the following steps:
1. You start by using the `login` command specifying the instance that you want to log into.
+
[source,console]
----
enbas login --instance gotosocial-01.social.example
----
2. The application will register itself and the GoToSocial server will create a new client ID and secret that the app needs for authentication.
3. The application will then generate a link to the consent form for you to access in your browser.
This link will be printed on your terminal screen along with a message explaining that you need to obtain the `out-of-band` token to continue.
If you have the `BROWSER` environment variable set or if you're using Linux, the link will open in a new browser tab for you to sign into your account.
If the browser tab doesn't open, you can manually copy and paste the link in your favourite browser.
4. Once you've signed into GoToSocial on your browser, you will be informed that Enbas would like to perform actions on your behalf.
If you're happy with this then click on the `Allow` button.
+
image::assets/images/consent_form.png[A screenshot of the consent form]
5. The `out-of-band` token will be printed for you at this point. Copy it and return to your terminal.
6. Paste the token into the prompt and press `ENTER`.
Enbas will then exchange the token for an access token which will be used to authentication to the
GoToSocial server on your behalf.
Enbas will then verify the access token, save the credentials to the `credentials.json` file in your configuration directory,
and confirm that you have successfully logged into your account.
+
[source,console]
----
$ enbas login --instance gotosocial-01.social.example
You'll need to sign into your GoToSocial's consent page in order to generate the out-of-band token to continue with
the application's login process. Your browser may have opened the link to the consent page already. If not, please
copy and paste the link below to your browser:
https://gotosocial-01.social.example/oauth/authorize?client_id=01RHK48N1KH9SFNH2VVZR414BJ&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code
Once you have the code please copy and paste it below.
Out-of-band token: ZGJKNDA2YWMTNGEYMS0ZZJLJLWJHNDITM2IZYJJLNJM3YJBK
Successfully logged into bobby@gotosocial-01.social.example
----
=== Common actions
* View your account information
+
[source,console]
----
enbas show --type account --my-account
----
* View a local or remote account
+
[source,console]
----
enbas show --type account --account teddy@gotosocial-01.social.example
----
* View your home timeline
+
[source,console]
----
enbas show --type timeline
----
* View the details of a status
+
[source,console]
----
enbas show --type status --status-id 01HQE43KT5YEDN4RGMT7BC63PF
----
== Inspirations
This project was inspired from the following projects:
* **madonctl:** https://github.com/McKael/madonctl[A Mastodon CLI client written in Go.]
* **toot:** https://pypi.org/project/toot/[A Mastodon CLI and TUI written in Python.]
* **tut:** https://github.com/RasmusLindroth/tut[A Mastodon TUI written in Go.]