aboutsummaryrefslogtreecommitdiff
path: root/page.c
Commit message (Collapse)AuthorAgeFilesLines
* page.c: Apply max-width to tableXavier Del Campo Romero2023-05-301-0/+4
| | | | This will help users to read tables with long file names.
* page.c: Apply lightgray background to even cellsXavier Del Campo Romero2023-05-301-0/+4
| | | | This will help users to navigate through large tables.
* Implement file previewsXavier Del Campo Romero2023-04-231-18/+83
| | | | | | | | | | | | | 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.
* Improve CSS and apply to list_dirXavier Del Campo Romero2023-04-171-10/+54
|
* Define _POSIX_C_SOURCEXavier Del Campo Romero2023-03-241-0/+2
| | | | | This allows using the default compiler defined by make(1) (i.e., c99(1)), thus improving POSIX compatibility.
* Send response on quota exceededXavier Del Campo Romero2023-03-201-0/+90
| | | | | | | | | | | | | | | | | So far, slcl would just close the connection with a client when the Content-Length of an incoming request exceeded the user quota, without any meaningful information given back to the user. Now, slcl responds with a HTML file with meaningful information about the error. Limitations: - While this commits has been successfully tested on ungoogled-chromium, LibreWolf (and I assume Firefox and any other derivates too) does not seem to receive the response from the server. - However, this issue only occurred during local testing, but not on remote instances.
* page.c: Set Content-Disposition when serving filesXavier Del Campo Romero2023-03-161-5/+96
| | | | | | | | | | | | | | So far, slcl used the default browser behaviour (i.e., Content-Disposition: inline), which means files were typically shown on the web browser itself. However, this caused two issues: - Users would have to right-click -> "Save Link As..." to download a file, which might be inconvenient for some users. - The original file name would not be retrieved for publicly shared files. Now, file download is always requested to the browser, and the original file path is retrieved via readlink(2).
* page.c: Fix wrong error messageXavier Del Campo Romero2023-03-091-1/+1
|
* Implement public file sharingXavier Del Campo Romero2023-03-091-1/+185
| | | | | | | | | | | | | An HTML form is now added next to each regular file, that generates a POST request. Then, slcl replies with a HTML document with a link to the public resource (which are implemented as symlinks). Limitations: - For now, only regular files can be shared i.e., sharing directories is not possible. While feasible, it still requires a larger refactor to list_dir and resource_layout, so that read-only access to the directory is provided to anonymous users.
* page.c: Provide meaningful description on HTTP 404Xavier Del Campo Romero2023-03-091-8/+28
|
* page.c: Implement function for common <head> nodesXavier Del Campo Romero2023-03-091-34/+55
| | | | This will be used by future commits.
* page.c: Set common <head> parametersXavier Del Campo Romero2023-03-081-3/+7
|
* page.c: Show units for user quotaXavier Del Campo Romero2023-03-081-22/+52
|
* page.c: Sort elements alphabeticallyXavier Del Campo Romero2023-03-081-26/+64
|
* Implement user quotaXavier Del Campo Romero2023-03-061-3/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature allows admins to set a specific quota for each user, in MiB. This feature is particularly useful for shared instances, where unlimited user storage might be unfeasible or even dangerous for the server. Also, a nice HTML5 <progress> element has been added to the site that shows how much of the quota has been consumed. If no quota is set, slcl falls back to the default behaviour i.e., assume unlimited storage. Limitations: - While HTTP does specify a Content-Length, which determines the length of the whole request, it does not specify how many files are involved or their individual sizes. - Because of this, if multiple files are uploaded simultaneously, the whole request would be dropped if user quota is exceeded, even if not all files exceeded it. - Also, Content-Length adds the length of some HTTP boilerplate (e.g.: boundaries), but slcl must rely on this before accepting the whole request. In other words, this means some requests might be rejected by slcl because of the extra bytes caused by such boilerplate. - When the quota is exceeded, slcl must close the connection so that the rest of the transfer is cancelled. Unfortunately, this means no HTML can be sent back to the customer to inform about the situation.
* Perform some minor optimizationsXavier Del Campo Romero2023-03-061-6/+1
|
* Initial commitXavier Del Campo Romero2023-02-281-0/+832