diff options
| author | default <nobody@localhost> | 2024-11-12 05:47:11 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2024-11-12 05:47:11 +0100 |
| commit | bbe061ca1995ac3aa2da2f88726e9e9723dd1dde (patch) | |
| tree | 72b4b2c39d73dcf68dee2f4d6a54df05e2bcf4bf /data.c | |
| parent | af92863ebbfc040909b6dbb89b887cecd3371508 (diff) | |
make_url() now accepts generating proxied urls by token.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -3676,7 +3676,17 @@ xs_str *make_url(const char *href, const char *proxy, int by_token) xs_str *url = NULL; if (proxy && !xs_startswith(href, srv_baseurl)) { - xs *p = xs_str_cat(xs_dup(proxy), "/x/"); + xs *p = NULL; + + if (by_token) { + xs *tks = xs_fmt("%s:%s", xs_dict_get(srv_config, "proxy_token_seed"), proxy); + xs *tk = xs_md5_hex(tks, strlen(tks)); + + p = xs_fmt("y/%s/", tk); + } + else + p = xs_str_cat(xs_dup(proxy), "/x/"); + url = xs_replace(href, "https:/" "/", p); } else |