Commit graph

118 commits

Author SHA1 Message Date
49b734f925
small edit
All checks were successful
Tests / test (pull_request) Successful in 18s
2024-08-21 12:17:37 +01:00
5576a8c986
Done: I'm so happy 2024-08-21 12:01:41 +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
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
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
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
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
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
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
f64f8a43a6
fix: command line format for showing followers
CHANGES:

- When viewing followers and followings from an account, the from flag
  must now be set by the user.
    - enbas show --type followers --from account --my-account
    - enbas show --type following --from account --account-name john

- New error type for unsupported show operations: Return an error if
  enbas detects an unsupported show operation (e.g. showing media from a
  list).
2024-07-03 14:20:25 +01:00
a8aeec2fbf
fix: update description for the vote flag 2024-07-03 13:34:27 +01:00
5ec1cc0e18
fix: rename the choose flag.
Rename to choose flag to vote for voting in polls.
2024-07-03 13:21:32 +01:00
4d0a42ba23
fix: mute accounts indefinitely by default 2024-07-01 21:27:04 +01:00
e4cce2cae4
refactor: update structure of switch executor 2024-07-01 21:12:20 +01:00
23ec6048b5
docs: updated documentation
- Converted documentation from Asciidoc to Markdown
- Updated the installation instructions and moved to a separate
  file in the docs directory.
- Updated the login instructions and moved to the Getting Started guide
  in the docs directory.
- Updated the licensing information in the main README.
- Created a page for changelog.
- Create a page for the user manual.
2024-07-01 13:49:11 +01:00
b03b3c31cc
fix: set absolute path to the credentials file
When creating the configuration file during the initialisation process
calculate the absolute path to the credentials file instead of the
relative path.
2024-06-29 16:02:19 +01:00
c8892a6535
feat: show user's actions on a status
Show whether the user has liked, boosted or bookmarked a status within
both the status and status list views.
2024-06-27 09:10:18 +01:00
b4cb362a7c
fix: use browser setting in config for URLs
Use the browser specified in the configuration file to open URLs. If the
browser is not specified the link will not be opened and an error is
returned to the user in most cases. This replaces the use of the BROWSER
environment variable and the xdg-open command (on linux).
2024-06-26 12:38:27 +01:00
42251f6df8
feat: add configuration support to enbas
SUMMARY

This commit adds configuration support to enbas. The configuration is
stored as a JSON file in the user specified configuration directory.

When using enbas for the first time, the user will first need to
execute the new init command in order to generate the configuration.
Once this has been generated the user can edit the settings to
personalise their experience, login to their account and use enbas as
normal.

For now the configurable settings included in the configuration
are as follows:

- The path to the credentials file (by default this is set to a file in
  the same directory as the configuration file).
- The path to the cache directory.
- The character limit used for line wrapping.
- The programs used for integrations such as paging, media viewing,
  opening URLs, etc.

CHANGES

- added the new config type.
- added the new init executor for generating a new configuration file.
- removed the following top level flags in favour of the new
  configration support.
    - cache-dir
    - pager
    - image-viewer
    - video-player
    - max-terminal-width
- added a new error type for use when an unknown media attachment ID
  is specified.
- updated the usage function for the executors to support a case
  where a flagsets has no flags.
- update .golangci.yaml to disable some linters
2024-06-25 12:39:39 +01:00
63f0526f39
fix: ensure no errors when specifying media flags
Fix the issue where users specify flags/arguments when specifying their
media players.
2024-06-25 04:45:05 +01:00
632a620180
feat: view media with external applications
This commit adds integration to external image viewers and video players
to allow users to view image and video attachments.

Enbas creates a cache directory where the media is downloaded to before
opening the external program for viewing.

Users can view one or more media attachments from a single status.
2024-06-22 01:16:24 +01:00