90 Commits

Author SHA1 Message Date
f80b805a71 Merge branch 'feat/switch-to-uv' into 'master'
feat: switch to uv

See merge request rogs/cleanmedia!3
2025-03-28 16:07:32 -03:00
Christian Groschupp
684e0e84bc feat: readd python and fix default CLEANMEDIA_OPTS 2025-03-28 14:21:13 +01:00
Christian Groschupp
4c02b57672 docs: replace poetry by uv 2025-03-28 10:27:07 +01:00
Christian Groschupp
11d3079dbd feat: update dockerfile 2025-03-28 10:20:11 +01:00
Christian Groschupp
87276d9432 feat: switch to uv 2025-03-28 10:19:22 +01:00
93654d84e4
Prevent Poetry from installing packages globally 2025-03-27 20:30:08 -03:00
52fb1dc3de
Add Docker installation and usage instructions 2024-12-05 17:07:49 -03:00
dd69741c0a
Replace dcron with supercronic for improved scheduling 2024-12-05 17:03:24 -03:00
10a1331e22
Add scheduled task support to Dockerfile via cron 2024-12-05 16:00:57 -03:00
43db10c59e
Update Docker tag to include version in .gitlab-ci.yml 2024-12-04 17:34:44 -03:00
b81e295807
Maybe deploying to Gitlab 2024-12-04 17:30:05 -03:00
611d11292a
Add deploy stage to GitLab CI for DockerHub integration 2024-12-04 16:34:09 -03:00
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