Commit Graph

24 Commits

Author SHA1 Message Date
611c8d82b6
WIP thumbnail 2023-07-05 23:39:19 +02:00
5a6c92d69b
Implement search
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.
2023-06-06 03:52:16 +02:00
c4a3d54ac9
page.c: Apply minor fixes and improvements to stylesheet
- Rules applying to body already apply to input.
- input already had a "margin: auto" rule.
- Missing whitespace on "margin:auto" rule.
2023-06-06 03:48:36 +02:00
3102e0da4b
page.c: Call page_not_found on ENOTDIR
ENOTDIR is another non-fatal errno value that can be returned by
stat(2).
2023-06-06 02:22:28 +02:00
17502e7e32
page.c: Display login forms as grid
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.
2023-06-02 09:03:57 +02:00
800dde6838
page.c: Add padding to mkdir, logout, and upload forms 2023-06-02 08:59:19 +02:00
1ffba8f5f9
page.c: Do not display forms as grid
Otherwise, each element from the form would be stacked on top of
another, which is confusing to users.
2023-06-02 08:57:44 +02:00
759a16a460
page.c: Apply max-width to table
This will help users to read tables with long file names.
2023-05-30 08:34:05 +02:00
054f2a628d
page.c: Apply lightgray background to even cells
This will help users to navigate through large tables.
2023-05-30 08:16:06 +02:00
fa997aa2c1
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.
2023-04-23 05:19:27 +02:00
2e2c9b4c93
Improve CSS and apply to list_dir 2023-04-17 03:01:19 +02:00
b3ef22ac2a
Define _POSIX_C_SOURCE
This allows using the default compiler defined by make(1) (i.e.,
c99(1)), thus improving POSIX compatibility.
2023-03-24 02:49:11 +01:00
d9bb874591
Send response on quota exceeded
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.
2023-03-20 10:57:20 +01:00
27b8a69718
page.c: Set Content-Disposition when serving files
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).
2023-03-16 01:49:18 +01:00
69a059e0df
page.c: Fix wrong error message 2023-03-09 02:04:52 +01:00
2e1b131396
Implement public file sharing
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.
2023-03-09 02:02:40 +01:00
13f96054f6
page.c: Provide meaningful description on HTTP 404 2023-03-09 01:23:02 +01:00
8016f537ca
page.c: Implement function for common <head> nodes
This will be used by future commits.
2023-03-09 01:20:18 +01:00
c4488c5e81
page.c: Set common <head> parameters 2023-03-08 18:52:03 +01:00
0471658177
page.c: Show units for user quota 2023-03-08 00:33:55 +01:00
ba612d6621
page.c: Sort elements alphabetically 2023-03-08 00:33:20 +01:00
ff8da797a1
Implement user quota
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.
2023-03-06 05:51:49 +01:00
4cd577afa9
Perform some minor optimizations 2023-03-06 00:59:07 +01:00
d26f046fc9
Initial commit 2023-02-28 01:43:56 +01:00