diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-12-24 11:52:50 +0100 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-12-26 10:49:13 +0100 |
commit | 2e04b2c23c66a42372d0ecaea2b0f4b2c7b7c7e5 (patch) | |
tree | 9249bb0e9792a11bb27df78a4d93a0b3c0be0b33 /browse.c | |
parent | 878cd6e8792d5ac03eea59fec9fe8e325440d50c (diff) |
delete files
Diffstat (limited to 'browse.c')
-rw-r--r-- | browse.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -197,7 +197,8 @@ header_template_callback(size_t index, void *arg) return 1; } -static const char *const file_template_keys[] = {"icon", "name", "url", "size"}; +static const char *const file_template_keys[] = {"icon", "name", "url", "size", +"delete_url"}; static int file_template_callback(size_t index, void *arg) @@ -253,6 +254,16 @@ file_template_callback(size_t index, void *arg) size_read[i - 1]), r); } break; + case 4: + /* delete url */ + if (build_delete_url(r, data->f) == 0) { + kutil_warnx(r, NULL, + "unable to build delete url for file %s", + data->f->path); + break; + } + K_OK(khtml_puts(html, data->f->action_url), r); + break; default: kutil_warnx(r, NULL, "Invalid key index for browse file template: %zd", @@ -352,7 +363,7 @@ browse(struct kreq * r) /* print file list */ template.key = file_template_keys; - template.keysz = 4; + template.keysz = 5; template.cb = file_template_callback; SLIST_FOREACH(file, &list, files) { |