kregfile - somewhat like volafile
kregfile is like volafile, except open source and you can host it yourself. In fact, you have to host it yourself, because I won't be doing it for you.
Prerequisites
- node (14+)
- yarn
- A working C++ compiler, to compile node extension modules
- Previews
- exiftool
- ffmpeg
- imagemagick and graphicsmagick (optional, for PDF previews)
- firejail (optional, but highly recommended, see 'jail' in the config to disable)
Instructions
- Start a redis
yarn- Fiddle with
.config.jsonif you must, usedefaults.jsas a reference. - Then run
yarn startfor maximum cancer - Navigate to
127.0.0.1:8080and enjoy.
If everything works, you may consider putting things into production, get TLS certificates on so on.
Configuration files
kregfile will load configuration data from all of these files, if they are present, in this order. The last value for any configuration option wins (much like CSS rules).
defaults.js(the defaults of kregfile, do not edit, but use as a reference of available options)$HOME/.config/kregfile.json$HOME/.config/kregfile.js$PWD/.config.js$PWD/.config.json
.js files will be require()d and the config options will be taken from the keys present in the exported object. .json files wil lbe parsed as JSON, and options taken from the top-level object.
Force-making specific rooms
Just use the redis-cli to set rooms:<alias> to some number (usually the timestamp), e.g. redis-cli set rooms:gentoomen 1.
Making moderators
Use the ./setRole.js script to set the mod role for a user (and make the user refresh the tab).
Code structure
commonhas code commonly shared between the frontend and backendclienthas most client-side codeentriescontains the entry points for client side code (for webppack)libcontains most server-side codestaticcontains static assets (and webpack generated bundles)uploadscontains the uploaded files (unless specified differently in the config)viewscontains the ejs templates (not many)
How to devel?
- Run
yarn run packin a shell. This will start webpack in watch mode and rebundle once the sources change automatically - Run
nodemonin another shell. This will trigger server restarts automatically when you change things.
The clients (browser tabs) should automatically reconnect and pull any new client code version automatically.
Troubleshooting FAQ
-
My previews do not work!
Make sure you have all the prerequites installed. Then it might be firejail that is broken, e.g. it refuses to run in another "sandbox" (which might be the VPS/linux container/docker your kregfile is running in). If that's the case, then consider turning off the "jail" config option and check if it then works for you.