aboutsummaryrefslogtreecommitdiff
path: root/page.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement file/directory removalremoveXavier Del Campo Romero2023-07-081-1/+359
| | | | | | | | | | | | | | | The following workflow has been implemented: - A new checkbox for each object inside a directory is shown. - When one or more objects are selected, the user submits a request through a HTML5 form. - Then, slcl will ask the user for confirmation, listing the selected objects, while reminding the user about the effects. - The user confirms the selection. - slcl removes the selected objects. All objects from non-empty directories are removed, too. - Finally, slcl redirects the user to the directory the request was made from.
* page.c: Return HTTP_STATUS_OK on successful page_searchXavier Del Campo Romero2023-07-081-1/+1
| | | | | This was probably a copy-paste issue when implementing page_search based on page_quota_exceeded.
* Implement searchXavier Del Campo Romero2023-06-061-1/+239
| | | | | | This new feature adds a HTML form on each directory listing that allows to search files recursively, starting from the current user directory. Wildcard patterns are also allowed.
* page.c: Apply minor fixes and improvements to stylesheetXavier Del Campo Romero2023-06-061-3/+3
| | | | | | - Rules applying to body already apply to input. - input already had a "margin: auto" rule. - Missing whitespace on "margin:auto" rule.
* page.c: Call page_not_found on ENOTDIRXavier Del Campo Romero2023-06-061-1/+1
| | | | | ENOTDIR is another non-fatal errno value that can be returned by stat(2).
* page.c: Display login forms as gridXavier Del Campo Romero2023-06-021-1/+5
| | | | | | While commit 1ffba8f5 fixed a wrong display of the mkdir, upload and logout forms, it did not take login forms into consideration, which must displayed as grid.
* page.c: Add padding to mkdir, logout, and upload formsXavier Del Campo Romero2023-06-021-0/+24
|
* page.c: Do not display forms as gridXavier Del Campo Romero2023-06-021-4/+0
| | | | | Otherwise, each element from the form would be stacked on top of another, which is confusing to users.
* 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