diff options
| author | 2026-01-06 11:02:36 +0100 | |
|---|---|---|
| committer | 2026-01-06 11:02:36 +0100 | |
| commit | 688c54c87355b5424f33f7b089814460a74af594 (patch) | |
| tree | 03bbe3779173b3d90aede93ea6e41e64869b415b /data.c | |
| parent | Version 2.86 RELEASED. (diff) | |
| download | snac2-688c54c87355b5424f33f7b089814460a74af594.tar.gz snac2-688c54c87355b5424f33f7b089814460a74af594.tar.xz snac2-688c54c87355b5424f33f7b089814460a74af594.zip | |
Implement configurable EXIF stripping for uploaded media
- Add `strip_exif` configuration option to enable metadata removal.
- Add `mogrify_path` configuration to specify external tool location.
- Implement strip_media using `mogrify -strip`.
- Support multiple image formats: jpg, png, webp, heic, heif, avif, tiff, gif, bmp.
- Add strict startup check: fail to start if `strip_exif` is enabled but `mogrify` is missing/broken.
- Update documentation in `doc/snac.8`.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 13 |
1 files changed, 11 insertions, 2 deletions
| @@ -89,8 +89,15 @@ int srv_open(const char *basedir, int auto_upgrade) | |||
| 89 | else { | 89 | else { |
| 90 | if (xs_number_get(xs_dict_get(srv_config, "layout")) < disk_layout) | 90 | if (xs_number_get(xs_dict_get(srv_config, "layout")) < disk_layout) |
| 91 | error = xs_fmt("ERROR: disk layout changed - execute 'snac upgrade' first"); | 91 | error = xs_fmt("ERROR: disk layout changed - execute 'snac upgrade' first"); |
| 92 | else | 92 | else { |
| 93 | ret = 1; | 93 | if (!check_strip_tool()) { |
| 94 | const char *mp = xs_dict_get(srv_config, "mogrify_path"); | ||
| 95 | if (mp == NULL) mp = "mogrify"; | ||
| 96 | error = xs_fmt("ERROR: strip_exif enabled but '%s' not found or not working (set 'mogrify_path' in server.json)", mp); | ||
| 97 | } | ||
| 98 | else | ||
| 99 | ret = 1; | ||
| 100 | } | ||
| 94 | } | 101 | } |
| 95 | } | 102 | } |
| 96 | 103 | ||
| @@ -2710,6 +2717,8 @@ void static_put(snac *snac, const char *id, const char *data, int size) | |||
| 2710 | if (fn && (f = fopen(fn, "wb")) != NULL) { | 2717 | if (fn && (f = fopen(fn, "wb")) != NULL) { |
| 2711 | fwrite(data, size, 1, f); | 2718 | fwrite(data, size, 1, f); |
| 2712 | fclose(f); | 2719 | fclose(f); |
| 2720 | |||
| 2721 | strip_media(fn); | ||
| 2713 | } | 2722 | } |
| 2714 | } | 2723 | } |
| 2715 | 2724 | ||