2
0
Fork 0
forked from zynk/zynk

Fix !weather returning HTML instead of weather data

wttr.in now serves a full HTML page when it detects a browser-like
User-Agent string. Replaced the fake Firefox UA in run_curl with
"zynk/VERSION" so weather, forecast, and stock requests all return
the expected format again.
This commit is contained in:
Johannes Findeisen 2026-07-19 16:47:49 +02:00
commit 61a6a95801
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2026.07.19 – Fix !weather returning HTML.
- Fixed `!weather` command returning `<!DOCTYPE html>` instead of weather data: wttr.in now returns HTML when it detects a browser User-Agent, so replaced the fake Firefox UA string with `zynk/VERSION`.
- Version bumped to 0.34.1.
2026.07.19 – Uptime command, remove !hello.
- Added `!uptime` command: displays bot uptime in a human-readable format (days/hours/minutes/seconds).

4
zynk.c
View file

@ -29,7 +29,7 @@ int asprintf(char **, const char *, ...);
/* ---- constants ---- */
#define VERSION "0.34.0"
#define VERSION "0.34.1"
#define DEFAULT_SERVER "irc.libera.chat"
#define OPENCODE_BIN "/usr/bin/opencode"
#define CLR_RESET "\033[0m"
@ -1412,7 +1412,7 @@ static char *run_curl(const char *url) {
close(fd[1]);
int dn = open("/dev/null", O_WRONLY);
if (dn >= 0) { dup2(dn, STDERR_FILENO); close(dn); }
execlp("curl", "curl", "-s", "--max-time", "10", "-A", "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0", url, (char *)NULL);
execlp("curl", "curl", "-s", "--max-time", "10", "-A", "zynk/" VERSION, url, (char *)NULL);
_exit(127);
}
close(fd[1]);