Commit graph

144 commits

Author SHA1 Message Date
5043c2a4d1
chore: bump golang.org/x/net from 0.26.0 to 0.28.0
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
2024-08-29 19:04:11 +01:00
e3a0436027
docs: updated installation guide
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
2024-08-29 08:31:12 +01:00
fa58e5b719
ci: use remote mage-ci action
All checks were successful
Tests / test (pull_request) Successful in 17s
REUSE Compliance Check / check (push) Successful in 13s
Replace the local mage action with the remote mage-ci action.
2024-08-29 08:13:49 +01:00
e898a1ded5
fix: fixed error when using --help flag
All checks were successful
REUSE Compliance Check / check (push) Successful in 8s
Parse the flags before loading the configuration to fix the error where
using the --help flag caused the app to return an error if the
configuration file does not exist.
2024-08-23 02:47:36 +01:00
987f8caa1c
fix: update the user agent 2024-08-23 02:40:13 +01:00
cc5e3f0044
refactor: move information values to info package
- Move the build and application information to the internal info
  package.
- Move the user agent and redirect URI string to the internal client
  package.
2024-08-23 02:35:30 +01:00
89e53bcc9f
refactor: update the executor lookup table
All checks were successful
Tests / test (pull_request) Successful in 16s
REUSE Compliance Check / check (push) Successful in 6s
Updated the executor lookup table by changing the map type from
map[string]Executor to map[string]func(string, bool, []string) error in
order to reduce the cost of initialising the map.

Previously the map initialised all the executors despite only needing
to run the single executor called by the command. The map now instead
maps the command to the function of type
'func(string, bool, []string) error' that will initialise and run the
executor called by the command. As a result of the change, the
Executor interface is no longer needed and has been removed.

PR: #57
2024-08-21 18:44:04 +01:00
74f32aab53
test: add more tests for the internal flag package
All checks were successful
REUSE Compliance Check / check (push) Successful in 6s
2024-08-20 04:25:29 +01:00
0ad02e0af4
feat(BREAKING): new parser for the TDV
All checks were successful
Tests / test (pull_request) Successful in 18s
REUSE Compliance Check / check (push) Successful in 5s
This commit adds a new parser for the internal time duration flag value
(TimeDurationValue). Previously this used the parser from the time
package from the standard library but this was limited to parsing units
of time up to hours.

The new parser allows users to specify duration in days, hours, minutes,
seconds and a combination of the above. It is quite flexible in the way
users format their string input.

Additonal changes:

- Added unit tests for the command-line parsing of the
  TimeDurationValue type.
- Updated the unit tests for the BoolPtrValue type.
- Updated documentation.

PR: #55
2024-08-20 03:32:54 +01:00
b558c5adff
fix: fixed the BoolPtrValue in internal flag pkg
All checks were successful
Tests / test (pull_request) Successful in 16s
REUSE Compliance Check / check (push) Successful in 5s
- Fixed the BoolPtrValue type in the internal flag package by adding the
  IsBoolFlag() bool method to indicate to the command-line parser that
  the flag is a boolean flag.
- Added unit tests for the BoolPtrValue type.

PR: #56
2024-08-20 00:55:05 +01:00
61a00d7a5b
docs: update the getting started guide
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
2024-08-19 07:10:38 +01:00
d38431d9e8
fix: error if home config directory not found
All checks were successful
Tests / test (pull_request) Successful in 17s
REUSE Compliance Check / check (push) Successful in 6s
Summary:

If the user hasn't supplied the path to a configuration directory and
Enbas fails to find the user's default home configuration directory,
Enbas will now return an error message back to the user. Previously
Enbas would try to, instead, calculate the configuration directory
using the user's current directory.

Changes:

- Return an error if the user's home configuration directory cannot
  be found.
- Add tests to the internal.config package.
- Update the tests in internal.utilities package.

PR: #54
2024-08-18 21:13:08 +01:00
15b9761497
refactor: clean up unused const
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
2024-08-18 09:57:48 +01:00
277bec49ef
fix: add MissingIDError type
Add the MissingIDError type for when the ID of a resource is not
provided where required.
2024-08-18 08:59:44 +01:00
3c8633ff04
refactor: minimise the main package
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
Minimise the main package by moving all flag parsing to the Execute
function.
2024-08-18 07:18:57 +01:00
6e5e0c4c5a
fix(BREAKING): rename spoiler-text flag to summary
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
Rename the spoiler-text flag to summary as the text represents the
status' summary. The usage message and manual indicates that the text is
also known as the spoiler text or content warning.
2024-08-18 06:48:15 +01:00
7e4b8bb05f
fix: fixed the calculations in cache directories
All checks were successful
Tests / test (pull_request) Successful in 17s
REUSE Compliance Check / check (push) Successful in 6s
Changes:

- Fixed the issue where the instance's FQDN was not included in the
  cache directories' path when the user sets a custom path to the root
  cache directory.

- Added unit tests for the cache directory calculations.

- Updated REUSE.toml to fix compliance failures.

- Added small changes/fixes based on feedback from golangci-lint.

PR: #53
Resolves: #51
2024-08-18 00:06:18 +01:00
7fd93e8778
ci: add a workflow for tests
Some checks failed
Tests / test (pull_request) Successful in 15s
REUSE Compliance Check / check (push) Failing after 13s
- Added an action for running mage targets
- Added a workflow for running tests
- Add our first unit test

PR: #52
2024-08-17 19:15:12 +01:00
009515ddb4
[skip ci] chore: set minimum go version to 1.23.0 2024-08-17 11:45:40 +01:00
dd6c21afe8
refactor: clean up errors
All checks were successful
REUSE Compliance Check / check (push) Successful in 6s
- Created generic Error types to remove the need to import the errors
  package.
- Used the generic Error types in place of the single use custom Error
  types that have no fields.
- Created new Error types where necessary.

PR: #50
2024-08-17 11:31:06 +01:00
f223e0417c
fix: view the summary of a status
All checks were successful
REUSE Compliance Check / check (push) Successful in 6s
View the status' summary/spoiler/content warning text if it exists.
2024-08-17 03:49:17 +01:00
ee13dcde00
chore: update .golangci.yaml
All checks were successful
REUSE Compliance Check / check (push) Successful in 6s
2024-08-16 23:12:17 +01:00
39d9ef1a38
fix(BREAKING): remove the from-file flag
All checks were successful
REUSE Compliance Check / check (push) Successful in 8s
The from-file flag was used to read text from a file for creating
statuses. This flag is now removed and replaced with the file@ prefix
with the content flag.

For example, --from-file status.md is now replaced with
--content file@status.md
2024-08-16 19:57:44 +01:00
c0f1f7d03a
feat: deleting statuses
All checks were successful
REUSE Compliance Check / check (push) Successful in 11s
This commit adds support for deleting statuses.

Before sending the delete request to the instance, Enbas will first
verify that the status that the user wants to delete actually belongs to
them.

The user has the option to save the text of the deleted status. This
will be written to a text file within the cache directory.

PR: #48
Resolves: #44
2024-08-16 18:53:08 +01:00
9bcb924ac0
ci: add workflow for REUSE Compliance Check
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
For now the compliance checks will be performed whenever a change is
made on the main branch.
2024-08-16 16:07:53 +01:00
0a41516ae9
chore: update REUSE.toml 2024-08-16 15:03:16 +01:00
3037af60ed
feat: mute and unmute statuses
This commit adds support for muting and unmuting statuses. When viewing
a status the user can now see whether they've muted the status or not.
A status can only be muted by the user if they own it or are mentioned
in it.

PR: apollo/enbas#47
Resolves: apollo/enbas#46
2024-08-16 14:42:57 +01:00
42f54c6020
feat: add more support for media attachments
This commit adds more support for interacting with media attachments.
Now users can:

- Upload media to their instances and create media attachments.
- Edit existing media attachments.
- Attach one or more existing media to a new status.
- Upload and attach one or more media files to a new status.

PR: apollo/enbas#42
Resolves: apollo/enbas#29
2024-08-15 21:40:17 +01:00
4e76d20a7a
fix: strip trailing empty line when reading files
Updated the ReadFile function in 'utilities' by using the Scanner from
the bufio package to read lines from a text file. The trailing empty
line is stripped after scanning and before returning back to the caller.
2024-08-15 15:24:25 +01:00
eb016b96e9
fix(BREAKING): update poll interaction
Summary:

This commit updates and enhances poll interaction. From now on users
will interact with a poll via the status that contains it. Direct
interaction with the poll (via the poll's ID) is no longer supported.
This helps resolve an issue where it wasn't possible to find the owner
of the poll when interacting with it directly.

Changes:

- Users can no longer view a poll directly using the Poll ID.
  Instead polls can be viewed when viewing statuses or timelines.
- More details about a poll is shown in statuses and timelines.
- Votes are now added to polls via statuses.
- Poll results are hidden unless the following conditions are met.
    - The user is the owner of the poll.
    - The poll has expired.
    - The user has already voted in the poll.
- Enbas can now detect and stop a poll owner from voting in their own
  poll.
- When a status is created Enbas will now only print the ID of the
  created status instead of the whole thing.

PR: apollo/enbas#43

Resolves apollo/enbas#39
2024-08-14 11:29:30 +01:00
a0eab3b6ae
refactor: clean up the getAccountID function sig
The getAccountID function no longer needs the path to the credentials
file.
2024-08-13 23:51:16 +01:00
878a898d4c
fix: use VerifyCredentials to get account info
Use the clients VerifyCredentials method to get the user's account
information.
2024-08-13 23:41:12 +01:00
b77bbaa6e0
fix: updated internal/executor/executors.go 2024-08-13 17:18:55 +01:00
84091f398d
feat: add Enbas CLI schema and code generator
Summary:

- Created a custom CLI schema for Enbas which will act as the Source
  of Truth for code and document generation.
- Created a code generator which uses the schema to generate the
  executor definitions and code in the internal usage package.

Changes:

- Created the Enbas CLI schema as the Source of Truth for Enbas.
- Created the code generator that generates the executor
  definitions and code in the usage package.
- Regenerated the executor definitions using the code generator.
- Moved the custom flag value types to the new internal flag
  package.
- Created a new flag value type for the bool pointer to replace the
  flag.BoolFunc() used for the sensitive and no-color flags.
- Moved the version and build variables to the new internal version
  package to simplify the version executor.
- Created a new usage package and moved the usage functions there.
- Changed the type of the account-name flag from string to the
  internal StringSliceValue type.
2024-08-13 14:53:26 +01:00
299b134b58
chore: set minimum go version to 1.22.6 2024-08-09 09:31:51 +01:00
cb7ac4175d
style: ran gofmt 2024-08-02 13:04:40 +01:00
2ccfdc4336
refactor: update client package
- add a type for the parameters of the sendRequest method
- contentType is now a parameter for the sendRequest method.
2024-08-02 08:15:15 +01:00
bad22ecd70
feat: add all-images and all-videos flags
When viewing media attachments from a status, the all-images and
all-videos flags will allow users to view all images or videos,
respectively.
2024-08-01 04:24:47 +01:00
3d20adfa57
chore: REUSE.toml
- Replace .reuse/dep5 with the new REUSE.toml file.
- Add licensing information to REUSE.toml and remove the licensing
  headers from the source files.
2024-08-01 04:01:38 +01:00
60aeec06f9
feat: add all-images and all-videos flags
When viewing media attachments from a status, the all-images and
all-videos flags will allow users to view all images or videos
respectively.
2024-08-01 00:54:27 +01:00
6bc00138ab
feat: show statuses created from an account
When viewing an account's information the user can now optionally view
the statuses that the account has created.
2024-08-01 00:24:31 +01:00
c468d1fb62
refactor: create constant values for base paths
Created constant values for the Accounts and Follow Requests base API
paths.
2024-07-10 12:06:36 +01:00
6e260266b1
fix: update the status list printer function
- Show whether a status is a boost, a reply to another status or a
  normal post.
- Move the "Created At" field to a new line.
- Show the date and time when a status was boosted.
2024-07-10 09:14:13 +01:00
2bb801b6d0
feat: add ability to reply to statuses 2024-07-09 03:13:54 +01:00
ec282e207f
refactor: use baseListPath where necessary
Replace the static string of the base list API path with the
baseListPath constant.
2024-07-09 00:25:43 +01:00
28bf902599
fix: improve how lists are displayed
Improve how ordered and unordered lists are displayed within the
contents of a status by adding indentation when a list item is wrapped.

Changes:

- fix: improve how ordered and unordered lists are displayed in status
  and status list views.
- fix: improve how media attachments are displayed in status list views.
- refactor: move the line wrapping and HTML converting functions from
  utilities to the internal printer package.
- refactor: the convertHTMLToText now (optionally) applies line
  wrapping after conversion.
2024-07-08 22:53:13 +01:00
c72340490d
fix: user's boosted action in status list view
Correctly use status.Reblogged instead of status.Bookmarked value when
showing if a user has boosted a status or not in the status list view.
2024-07-07 19:15:23 +01:00
e0b4174a76
chore: add missing license annotation 2024-07-06 18:11:15 +01:00
181384fea3
docs: add the user manual
The user manual: a page that users can reference when playing with
Enbas.
2024-07-06 17:36:42 +01:00
d52bb3fdf4
fix: print error messages from instance
If an error occurs when sending a request to an instance, try and decode
and print the error message back to the user.
2024-07-04 11:27:00 +01:00