8go / matrix-commander

simple but convenient CLI-based Matrix client app for sending and receiving
GNU General Public License v3.0
550 stars 59 forks source link

Question: a "delete media" option e.g. for clean-up purposes #3

Open 8go opened 3 years ago

8go commented 3 years ago
8go commented 3 years ago

Anyone wanting to contribute? Anyone willing to provide a PR? Any contributions are :heart: appreciated!

8go commented 2 years ago

Which matrix-nio AsyncClient API calls or logic would do such a media delete?

8go commented 2 years ago

See also:

HTTP API:

or

curl -XDELETE "https://SERVER_HERE/_synapse/admin/v1/media/SERVER_HERE/XMC_ID_HERE?access_token=ACCESS_TOKEN_HERE" SERVER_HERE something like matrix.org This curl requires ACCESS_TOKEN to have server admin rights (not room admin rights). Otherwise it returns: curl -XDELETE "https://matrix.com/_synapse/admin/v1/media/matrix.com/XMCIDHERE?access_token=ACCESS_TOKEN_HERE" {"errcode":"M_FORBIDDEN","error":"You are not a server admin"}

Building something around this REST API? But obly useable by server admins!

8go commented 2 years ago

--delete-mxc was implemented in commit 583a2bd

But as required by the Matrix API it requires user to have server admin permissions. See documentation.

Closing issue.

8go commented 2 years ago

Just wanted to add that I looked at the Client API (not the Admin API) and confirm that there is no "delete" operation for the content repository. So, I think what was implemented was the only available option.

See: Matrix Client API documentation: https://spec.matrix.org/latest/client-server-api

opk12 commented 1 year ago

Yes, this is not in the specification. This issue asks to add it to the spec.

The Synapse endpoints may change in the future, because this issue asks for simplification.

Also note that Synapse supports media retention configuration since 1.61 and documented here. It auto-deletes based on the last accessed time and other configurable criteria.

For clarity / posterity, this github issue is about local media, not local copies (cache) of remote media received through federation.

8go commented 1 year ago

Thank you @opk12 for sharing this very relevant information.

If https://github.com/matrix-org/matrix-spec/issues/226 gets implemented and (ideally) is available via matrix-nio API than it makes a lot of sense to add this new functionality to matrix-commander. I re-open the issue in the hope that there is some future development on the Matrix.org side to advance this issue.