diff options
author | 2023-07-07 11:35:05 +0200 | |
---|---|---|
committer | 2023-07-07 11:35:05 +0200 | |
commit | 81f33c3b9f8ff8b7d5ff034527e5fbf2d1c74dc4 (patch) | |
tree | d56c6010a0aead6c7216f80576806bedaacd365d /docs/admin/cli.md | |
parent | [chore/bugfix] Domain block tidying up, Implement first pass of `207 Multi-St... (diff) | |
download | gotosocial-81f33c3b9f8ff8b7d5ff034527e5fbf2d1c74dc4.tar.xz |
[feature] Add media list command (#1943)
* [feature] Add media list command
This is an attempt to help alleviate #1776. Using admin media list
--local the full path to each local media file will be printed, with a
newline. The output of this should be feadable into backup tools in
order to allow to backup local media too. Together with the database
this should allow to fully recover from the loss of an instance.
The list command also gets a --remote flag for symmetry. In the case
of --remote we print the RemoteURL instead, the location the asset can
be retrieved from.
To get all media, you can run with --local and --remote.
* [bugfix] Fix the test failures
* [feature] Reimplement list media as top commands
This changes the implementation of admin media list --<variant> to two
separate top-level commands, list-local and list-remote.
The implementation now iterates over over the database in batches of 200
in order to avoid loading all media metadata into memory.
* [feature] Implement ListMedia with filter callback
This does away with the somewhat odd iterator-like structure we had
before and does away with most of the loop duplication in list-local and
list-remote. Instead they call GetAllMediaPaths with a filter func to
select the media they want. That's accumulated into a slice and
eventually returned.
* [bugfix] Simplify remote filter
Since we don't append the empty string anywhere, the remote filter can
be limited to returning RemoteURL, as that'll be an empty string for
local media.
* [docs] Add media list commands to CLI reference
---------
Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'docs/admin/cli.md')
-rw-r--r-- | docs/admin/cli.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/admin/cli.md b/docs/admin/cli.md index c7fcbbe63..d9178b24d 100644 --- a/docs/admin/cli.md +++ b/docs/admin/cli.md @@ -255,6 +255,18 @@ Example: gotosocial admin import --path example.json --config-path config.yaml ``` +### gotosocial admin media list-local + +This command can be used to list local media. Local media is media that belongs to posts by users with an account on the instance. + +The output will be a list of files. The list can be used to drive your backups. + +### gotosocial admin media list-remote + +This is the corollary to list-local, but instead lists media from remote instances. Remote media belongs to other instances, but was attached to a post we received over federation and have potentially cached locally. + +The output will be a list of URLs to retrieve the original content from. GoToSocial automatically retrieves remote media when it needs it, so you should never need to do so yourself. + ### gotosocial admin media prune orphaned This command can be used to prune orphaned media from your GoToSocial. |