81 Commits
Author SHA1 Message Date
Eric Ireland 47e8b5f5a7 Fix ImageMagick argument vector in strip_media
Assisted-by: OpenAI Codex (GPT-5)
Reviewed-by: Eric Ireland
2026-09-11 11:41:55 +10:00
grunfink c38ad28d5d New function text_browser_friendly() (still unused). 2026-09-01 14:25:12 +02:00
default f13cc6e954 Fixed warning in NetBSD evbarm. 2026-08-30 17:06:09 +02:00
Sergio Durigan Junior 2c9f5956b5 Drop PATH_MAX usage
Strict POSIX systems (such as GNU Hurd) don't define PATH_MAX, which
results in a build failure:

https://buildd.debian.org/status/fetch.php?pkg=snac2&arch=hurd-amd64&ver=2.91-1&stamp=1774482136&raw=0

This commit replaces PATH_MAX with a dynamically-allocated buffer,
which is the usual way of fixing these failures.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
2026-03-27 10:08:33 -04:00
Alvar Penning ea81780895 strip_exif support for the OpenBSD sandbox
Change the strip_exif logic to work with the already existing OpenBSD
sandbox and allow ffmpeg and mogrify to be executed.

The previous strip_exif implementation relied on system(3), effectively
starting "/bin/sh" and executing the required tool within a shell
session. Making this work in the sandbox would require to allow
executing "/bin/sh", rendering the sandbox useless.

Thus, the code now starts determining the absolute path of the tools -
unless they are given as ffmpeg_path or mogrify_path - and allowing them
to be executed via unveil(2). Then, instead of the system(3) call, the
good old fork(2) and execve(2) dance is performed.

The sbox_enter code was made aware of strip_exif, which resulted in a
pledge(2) violation before when disable_email_notifications was set to
false. Furthermore, the detected paths of the tools are now allowed.
2026-02-05 21:17:44 +01:00
grunfink 7d24c6ff94 Added translatable month names. 2026-02-02 17:51:40 +01:00
grunfink 3ffdf91a4c Merge pull request 'Implement metadata stripping for uploaded photos and videos' (#515) from draga79/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/515
2026-01-12 14:27:05 +01:00
grunfink fdd2217be4 New file xs_list_tools.h. 2026-01-10 20:40:13 +01:00
Stefano Marinelli 03d270a56b Implement metadata stripping for uploaded videos
- Extend `strip_media` to support video files using `ffmpeg`.
- Use `ffmpeg -map_metadata -1 -c copy` to strip global metadata.
- Support formats: mp4, m4v, mov, webm, mkv, avi.
- Add `ffmpeg_path` configuration option.
- Implement robust relative path handling (`user/` heuristic) to support jailed environments.
- Enforce strict checks on startup: fail if tools (mogrify/ffmpeg) are missing when enabled.
2026-01-06 12:18:00 +01:00
Stefano Marinelli 688c54c873 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`.
2026-01-06 11:02:36 +01:00
grunfink 11af00194e Bumped copyright year. 2026-01-01 17:01:03 +01:00
grunfink 212284c792 xs_http.h: new file. 2025-10-13 13:07:06 +02:00
grunfink 64d99af19c xs_webmention.h new file. 2025-05-04 11:05:47 +02:00
default 985374ab9a Fixed typo. 2025-03-11 09:50:38 +01:00
default 3844bbf04f Add fake HTTP status error 399 to http_status_text(). 2025-02-17 07:53:06 +01:00
default e020ca8471 xs_po.h new file. 2025-02-14 10:24:13 +01:00
default 9a56475f4c New function lang_str(). 2025-02-14 09:54:58 +01:00
default 3db7d9f58a Fixed function tid() for some architectures. 2025-02-09 18:12:58 +01:00
default 932227bbac Bumped copyright year. 2025-01-08 16:59:14 +01:00
default 19b9998f8c The proxy token seed is created on startup and never stored. 2024-11-12 09:01:30 +01:00
default 1370d6b64e Searches are now case-insensitive for all alphabets. 2024-08-23 20:27:07 +02:00
default 972c3dc5d4 Added support for listening on unix sockets. 2024-08-05 06:01:21 +02:00
Louis Brauer 26fbda787d Translate status codes to canonical status texts
Use those in HTTP responses instead of "OK"/"ERROR".
Apps like Tokodon show only the status text in unexpected responses.
2024-05-27 19:01:04 +02:00
default 755d997fb1 Updated copyright year. 2024-01-04 09:22:03 +01:00
default bc5d0d4ed0 Replaced encode_html_strict() with xs_html_encode(). 2023-11-20 18:33:24 +01:00
default 80c5bac826 Backport from xs. 2023-11-17 08:51:53 +01:00
default 6cd3e76890 Added FastCGI support. 2023-10-17 20:02:08 +02:00
default 253e7f9eaa Don't allow creating users which user name strings only differ in case. 2023-10-13 06:33:12 +02:00
default 9cce2ee119 Some tweaks to the logging system. 2023-09-27 13:19:46 +02:00
default c314e995a4 Backport from xs. 2023-09-25 18:25:09 +02:00
default 952da47c6d Backport from xs. 2023-09-17 02:52:44 +02:00
default 0f8c0cd694 Updated comment in headers. 2023-07-28 11:34:18 +02:00
default d2aa5727ba Fixed failed mkdir() in restricted environments. 2023-07-09 20:23:38 +02:00
default 14b2f69768 If a ~/log/ folder exists, also write the log there. 2023-06-15 06:15:39 +02:00
default 71855e87e3 If ~/error/ exists, also log messages to a file there. 2023-06-11 19:49:56 +02:00
default fafdbbf815 Replaced usage of random() with xs_rnd_buf(). 2023-06-05 18:29:25 +02:00
default e788a5bf8f Some prototype tweaks. 2023-06-05 18:22:04 +02:00
default 65f5173c2a Moved srv_running variable to httpd.c. 2023-06-05 18:18:50 +02:00
default 970ad7a540 Got rid of xs_encdec.h. 2023-05-17 10:08:57 +02:00
default d562c3cfed Backport from xs. 2023-05-09 14:18:15 +02:00
default 3ccf4e3759 arc4random() does not exist in not-so-old systems, so revert this.
Revert "Replaced random() with arc4random()."

This reverts commit f658f345ca.
2023-04-16 20:27:38 +02:00
default f658f345ca Replaced random() with arc4random(). 2023-04-16 20:19:25 +02:00
default 105683d4d2 Moved srv_archive() to data.c. 2023-03-01 08:09:56 +01:00
default 67f2d4318d New utility function mkdirx(). 2023-02-07 09:25:01 +01:00
default fabe6a5006 Tweaked user and group permissions for new files and dirs. 2023-02-07 09:01:57 +01:00
default 463439283a Minor header tweaks. 2023-02-02 03:49:38 +01:00
default a38c7aeadc Updated year in copyright notices. 2023-01-17 09:50:16 +01:00
default 645e7ec43e Some code reordering to placate scan-build's wrath. 2022-12-14 04:55:47 +01:00
default 7787a2ded9 New function new_password(). 2022-12-04 21:14:18 +01:00
default 3acc70b270 Fixed a nasty macro expansion bug. 2022-10-26 06:43:47 +02:00