An index page generator written using Mojolicious that supports permissioned file uploading, renaming, and deletion.
Go to file
Sam Greytalon fb79915e7c Add an exception to the license
Messy attempt at letting users modify the configuration variables without making the software a "modified version".
2024-02-26 13:22:02 -06:00
app Make sure to actually check code returned from user_can_... before moving on! 2024-01-15 16:15:16 -08:00
examples/openbsd/etc Update OpenBSD config example. 2023-10-27 10:32:53 -07:00
LICENSE Initial commit. 2023-08-01 08:13:20 -07:00
README.md Add an exception to the license 2024-02-26 13:22:02 -06:00

README.md

Dexter

Dexter is a Mojolicious webapp that handles the generation of index pages under a directory and provides a method for authenticated users to upload files, delete files, create directories, and move files.

Setup

Dexter depends on these Perl modules:

  • Cwd
  • Encode
  • Readonly
  • File::Path
  • File::Spec
  • File::Find
  • File::Copy
  • Mojolicious::Lite
  • Module::Installed::Tiny

Install them using cpan or however else you get your Perl modules.

Once the proper modules are installed, clone this repository to wherever you want Dexter to reside. For me on my OpenBSD web server, that's /var/www/cgi-bin/.

After that, Dexter can be ran under any web server as a CGI or PSGI app, or via Mojolicious' builtin morbo and hypnotoad servers. See examples/openbsd/etc/dexter/ for the configuration files that I use on my OpenBSD web server to connect Dexter with httpd.

Configuration

Configuration is done by modifying the constant variables in dexter.pl.

Authentication

Dexter expects authentication to be done on the web server, and relies on the REMOTE_USER environment variable to determine which user is using the app and what their permissions are. If a user is not authenticated, Dexter assumes their username to be 'guest'.

Dexter determines authorization by applying the first match approach to a list of regex/number pairs (rules) stored under the authenticated user's username in the %USER_ACCESS_RULES hash defined in dexter.pl. When determining whether a user has the appropriate permissions to perform an action on a given path, Dexter iterates through the rules under a user's name until a regex matches the path. Dexter then performs a binary and of the corresponding permission number and the permission number required for the requested action. If the resulting number equals the number required for the requested action, the action is permitted.

If no rule matches, the requested action is denied.

Directories

Dexter needs to know about two directories you want it to use:

  • $ROOT_DIRECTORY: The directory that Dexter will be serving files from and saving uploaded files to. This is effectively the root directory of the website, and needs to be configured on the web server as well.
  • $SOCKET_DIRECTORY: The directory where Dexter's UNIX domain socket will be. This is only required if Dexter is running on OpenBSD, as Dexter needs to unveil the socket directory in order to be run as a PSGI daemon.

Other

  • $MAX_REQUEST_SIZE: The maximum size of POST requests that Dexter will process.
  • $FS_ENCODING: The character encoding that the underlying filesystem uses to store filenames. The default value of UTF-8 is most likely correct.

License

Dexter is released under Version 3 of the GNU Affero General Public License (see LICENSE). In the case of this software specifically, any changes made to the assigned values of the variables $ROOT_DIRECTORY, $SOCKET_DIRECTORY, $TEMP_DIRECTORY, $FS_ENCODING, $MAX_REQUEST_SIZE, or %USER_ACCESS_RULES do not qualify as modifying the software as defined in the terms of the GNU Affero General Public License, as these variables exist for configuration purposes. Any other changes made to the source code of this software still qualifies as "modifying" the software under those same terms. The default font- JetBrainsMono from NerdFonts- is released under Version 1.1 of the SIL Open Font License (see app/public/.assets/FONT-LICENSE).