ca78223d8e
Add Docker support with .dockerignore and Dockerfile
2024-12-04 16:28:34 -03:00
194ae55cbd
Add logo to README and include new logo.png file
2024-12-04 16:10:01 -03:00
830ce6690d
Add Codecov badge to README.md for coverage status
2024-12-04 16:00:30 -03:00
1214158b4a
Update README.md to enhance installation and usage guide
2024-12-04 15:59:14 -03:00
65d09ee787
Increased test coverage
2024-12-04 15:55:11 -03:00
9e791e184d
Refactored the cleanmedia script
2024-12-04 15:39:35 -03:00
c9dd733989
Refactor to improve clarity
2024-12-04 15:05:11 -03:00
71a4299f83
Add testing stage with coverage reporting to CI setup
2024-12-04 14:45:14 -03:00
67725d44a1
Add tests for MediaRepository and File classes
2024-12-04 14:40:08 -03:00
e089fb224c
Remove unnecessary comments from cleanmedia.py
2024-12-04 14:39:46 -03:00
27bb320d14
Refactor MediaRepository method calls to use 'self'
2024-12-04 14:36:19 -03:00
4ebedc05f5
Add a comprehensive .gitignore for Python projects
2024-12-04 14:27:19 -03:00
13ad36a807
Add pytest and pytest-mock to testing suite configuration
2024-12-04 14:26:11 -03:00
08aa96fce1
Added types-psycopg and pyyaml to dependencies
2024-12-04 11:59:14 -03:00
7106991a04
Enable specific LSP plugins in Emacs dir-locals
2024-12-04 11:45:23 -03:00
d177812270
Update CI to use poetry for dependency management
2024-12-04 11:42:48 -03:00
a203ce904e
Added pyproject.toml and updated dev experience
2024-12-04 11:42:22 -03:00
Sebastian Spaeth
7a4d497353
Optimize Sanity Check SQL
...
Instead of
SELECT COUNT(media_id) from mediaapi_thumbnail WHERE media_id NOT IN (SELECT media_id FROM mediaapi_media_repository);
we do
SELECT COUNT(media_id) from mediaapi_thumbnail WHERE NOT EXISTS (SELECT media_id FROM mediaapi_media_repository);
Per Till's (@s7evink:matrix.org) suggestion. All credit to him
2024-03-12 18:02:44 +01:00
Sebastian Spaeth
0a03429abf
Maintainership notice
2024-02-01 06:23:36 +00:00
Sebastian Spaeth
4ddec53928
Merge branch 'deluser' into 'main'
...
Add deletion of local user media
See merge request sspaeth/cleanmedia!8
v0.3
2023-12-13 12:45:06 +00:00
Sebastian Spaeth
d6fd2f97e3
Add deletion of local user media
...
Unfortunately, the database only stores the orginating server, and not the specific user id
for remote media, so we can only delete media from our users with the new
-u option. For more, we need to change the database, or dig much deeper. Also,
this will not work for E2E encrypted chats, I think.
2023-12-13 13:42:18 +01:00
Sebastian Spaeth
b3d857e245
Delete stray debug leftover
2023-12-11 15:03:15 +01:00
Sebastian Spaeth
320af39f35
only log when we actually find a corresponding media
2023-12-11 14:40:04 +01:00
Sebastian Spaeth
3b8751c6de
hotfix: Print all arguments in logging string
2023-12-11 14:37:39 +01:00
Sebastian Spaeth
f3ef851c74
Merge branch 'singlemedia' into 'main'
...
add deletion of single media
See merge request sspaeth/cleanmedia!7
2023-12-11 13:34:29 +00:00
Sebastian Spaeth
5dd80a77b0
add deletion of single media
2023-12-11 14:16:07 +01:00
Sebastian Spaeth
6dc86c9ac1
Merge branch 'refactor' into 'main'
...
refactor main function
See merge request sspaeth/cleanmedia!6
2023-12-11 12:32:55 +00:00
Sebastian Spaeth
f297f20394
refactor main function
2023-12-11 12:32:55 +00:00
Sebastian Spaeth
3e12ef1b1a
More robustness against flawed config files
...
1) Don't bail out with an unset CONN_STR if we don't have
ANY connection_string set in our config file.
2) No need to guard against missing section [media_api], we
verify its existance a few lines above.
v0.2
2023-12-04 08:57:03 +01:00
Sebastian Spaeth
cf1eb36aa6
Merge branch 'neetzsche/fix-media-api-config' into 'main'
...
Fix getting connection_string from media_api
See merge request sspaeth/cleanmedia!4
2023-12-04 07:38:37 +00:00
NEETzsche
9f36cfc8b3
Fix getting connection_string from media_api
...
We were looking for [media_api][connection_string] and not for [media_api][database][connection_string]
Credits to https://gitlab.com/NEETzsche
2023-12-04 07:38:37 +00:00
Sebastian Spaeth
a35d3ad5fb
Merge branch 'neetzsche/filter-blank-avatar-urls' into 'main'
...
Filter blank avatar urls
See merge request sspaeth/cleanmedia!5
2023-12-04 07:32:32 +00:00
NEETzsche
0ceefedceb
Filter blank avatar urls
...
credit to https://gitlab.com/NEETzsche
2023-12-04 07:32:32 +00:00
Sebastian Spaeth
2f2eee20d6
Add --quiet mode
...
Add a mode that decreases the log level to WARNING. In case the
conflicting options -d and -q are given simultaneously, -d will win.
2023-11-15 10:13:49 +01:00
Sebastian Spaeth
7b62b49df4
README: Update readme
...
Now that we can also purge local media (optional!), we need to adapt the README.
v0.1
2023-09-18 14:01:38 +02:00
Sebastian Spaeth
c1ee679f9e
Merge branch 'save_avatars' into 'main'
...
Also allow to delete local media
Closes #1
See merge request sspaeth/cleanmedia!1
2023-09-18 11:53:15 +00:00
Sebastian Spaeth
b26435d4cc
cleanmedia: break up long line
2023-09-18 13:52:13 +02:00
Sebastian Spaeth
055d9b4202
cleanmedia: Allow to also delete local media files
...
Using the --local option we can also delete local media.
We check which media files are used for avatar images
and never purge those though.
Local media means here, media that have been upload by
users from our home server.
Fixes : #1
2023-09-18 13:50:59 +02:00
Sebastian Spaeth
1cb7dad3c2
Merge branch 'mypy' into 'main'
...
CI: Add mypy check
See merge request sspaeth/cleanmedia!3
2023-09-18 11:45:15 +00:00
Sebastian Spaeth
b01eb97a47
CI: flake8 the file
2023-09-18 13:44:09 +02:00
Sebastian Spaeth
9eea97f1e1
CI: Make mypy happy
...
cleanmedia:133: error: Value of type "tuple[Any, ...] | None" is not indexable [index]
So we do sanity check that row is not None now before doing something with row[0].
2023-09-18 13:39:13 +02:00
Sebastian Spaeth
7d6dc981e3
CI: Fix cleanmedia:107: error: Name "psycopg2.extensions.connection" is not defined [name-defined]
2023-09-18 13:35:41 +02:00
Sebastian Spaeth
3e063e92d4
CI: Add mypy check
2023-09-18 13:30:47 +02:00
Sebastian Spaeth
edae37dc06
CI: Don't keep artifacts around
...
The script is available from the repo, no need for an artifact.
2023-09-18 13:13:46 +02:00
Sebastian Spaeth
7c60a9037c
flake8: This is it. Green!
2023-09-18 13:11:12 +02:00
Sebastian Spaeth
329981fe49
flake8: Is this the end?
2023-09-18 13:10:08 +02:00
Sebastian Spaeth
65dff450c3
CI: Make flake8 less grumpy
2023-09-18 13:06:12 +02:00
Sebastian Spaeth
0fcf538a93
flake8: make pylinter a little more happy
2023-09-18 12:59:27 +02:00
Sebastian Spaeth
4cd9bc6136
Merge branch 'CI' into 'main'
...
Add CI
See merge request sspaeth/cleanmedia!2
2023-09-18 10:56:02 +00:00
Sebastian Spaeth
d222eba15a
CI: add one
2023-09-18 12:55:00 +02:00