aboutsummaryrefslogtreecommitdiff
path: root/page.h
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-04-23 05:19:27 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-04-23 05:19:27 +0200
commitfa997aa2c153cef50941b4d4036694485259ac2a (patch)
tree7a8ae9d450a4a6737277de86f950de2f73d5e268 /page.h
parent011807e1d69d196cd0b9fd39a9899eb335c81abf (diff)
downloadslcl-fa997aa2c153cef50941b4d4036694485259ac2a.tar.gz
Implement file previews
When using HTTP "Content-Disposition: attachment;", users are forced to download files in order to use them, whereas others might prefer to open them in the browser. Therefore, now that URL parameters are supported by http.h, previews can be forced by adding "preview=1" or "preview=true" (case-insensitive) as a URL parameters. Any other parameters are ignored by slcl. For users, a "Preview" link has been added next to the "Share" button for each file.
Diffstat (limited to 'page.h')
-rw-r--r--page.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/page.h b/page.h
index 094a21e..bd47138 100644
--- a/page.h
+++ b/page.h
@@ -8,13 +8,21 @@ struct page_quota
unsigned long long cur, max;
};
+struct page_resource
+{
+ struct http_response *r;
+ const char *dir, *root, *res;
+ const struct page_quota *q;
+ const struct http_arg *args;
+ size_t n_args;
+};
+
int page_login(struct http_response *r);
int page_style(struct http_response *r);
int page_failed_login(struct http_response *r);
int page_forbidden(struct http_response *r);
int page_bad_request(struct http_response *r);
-int page_resource(struct http_response *r, const char *dir, const char *root,
- const char *res, const struct page_quota *q);
+int page_resource(const struct page_resource *r);
int page_public(struct http_response *r, const char *res);
int page_share(struct http_response *r, const char *path);
int page_quota_exceeded(struct http_response *r, unsigned long long len,