Blazing fast file uploader and awesome bunker written in node! 🚀
Go to file
renovate[bot] eeea180784
chore(deps): update dependency browserslist to ~4.23.0 (#752)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-06 07:23:01 +07:00
.github/workflows chore(deps): update actions/setup-node action to v4 (#730) 2023-12-06 06:22:04 +07:00
controllers fix: content-type breaking with hyper-express updates 2024-03-06 07:19:36 +07:00
dist dist: rebuilt client assets and bumped v1 version string 2023-12-17 13:46:56 +00:00
docker fix: docker configuration 2022-10-08 15:30:02 +07:00
pages chore: pages/custom directory 2022-06-27 06:29:07 +07:00
public fix: album lightbox not working with GIFs 2023-09-06 23:57:46 +07:00
routes fix: special characters in album titles 2023-12-06 05:55:50 +07:00
scripts feat: support generating animated thumbnails 2023-09-06 18:45:50 +07:00
src dist: rebuilt client assets and bumped v1 version string 2023-12-17 13:46:56 +00:00
views fix: special characters in album titles 2023-12-06 05:55:50 +07:00
.browserslistrc Updates (very important to read) 2019-09-15 13:20:11 +07:00
.dockerignore feat: adapt docker config from upstream 2022-06-22 15:40:52 +07:00
.editorconfig feat: adapt docker config from upstream 2022-06-22 15:40:52 +07:00
.eslintignore Updated 2019-09-17 11:13:41 +07:00
.eslintrc.js fix: bump eslint to es2020 2022-06-08 21:47:30 +07:00
.gitignore chore: pages/custom directory 2022-06-27 06:29:07 +07:00
.stylelintignore chore: re-include src/libs to stylelint 2022-05-27 12:40:53 +07:00
.stylelintrc.json fix: stylelint rules 2023-12-06 06:34:24 +07:00
AUTHORS Updated 2019-09-12 14:44:31 +07:00
config.sample.js feat: support generating animated thumbnails 2023-09-06 18:45:50 +07:00
gulpfile.js feat(deps): update hyper-express to ~6.8.5 2023-09-06 18:17:37 +07:00
LICENSE fix: LICENSE 2022-07-25 09:44:23 +07:00
logger.js feat: ms time resolution in log when on dev mode 2022-08-03 17:26:09 +07:00
lolisafe.js fix: catch SIGINT signal 2023-02-25 18:16:21 +07:00
package.json chore(deps): update dependency browserslist to ~4.23.0 (#752) 2024-03-06 07:23:01 +07:00
README.md chore: README.md 2023-12-17 21:12:56 +07:00
renovate.json chore: set renovate on weekly schedule 2021-05-22 21:06:48 +07:00
yarn.lock chore(deps): update dependency browserslist to ~4.23.0 (#752) 2024-03-06 07:23:01 +07:00

lolisafe, a small safe worth protecting

safe.fiery.me

GitHub license

JavaScript Style Guide

Features

  • Powered by uWebSockets.js & HyperExpress for a much more performant web server, due to being a Node.js binding of uWebSockets written in C & C++.
  • Powered by better-sqlite3 for performant SQLite3 database (using Knex.js for abstraction, thus support for other database engines may also come in the future).
  • Faster file hashing for duplicates detection by using BLAKE3 hash function.
  • ClamAV virus scanning support for Linux/OS X servers (read more).
  • Front-end pages templating with Nunjucks.
  • A more integrated Cloudflare support (automatically purge files remote cache upon deletion, and more).
  • Chunked uploads to support 100MB+ files when hosted behind Cloudflare, or any other proxies with file upload size limits.
  • Upload remote URLs (have lolisafe download those remote files for you).
  • Performant & configurable rate limits powered by rate-limiter-flexible.
  • Albums with shareable pretty public pages.
  • User dashboard to manage own uploads and albums.
  • Admin dashboard to manage all uploads, albums, and users.
  • Robust files search/filters and sorting in the dashboard.
  • Usergroups-based permissions.
  • Configurable file retention periods per-usergroups.
  • Strip images EXIF tags if required (can be forced or toggleable by users, and with experimental support for stripping videos tags as well).
  • Various options configurable via header tags upon file uploads (selected file retention period, whether to strip EXIF tags, and more).
  • ShareX support with config file builder in the homepage.
  • Token-based authentication on all APIs, allowing you to easily integrate lolisafe with anything.
  • ... and more!

Differences with Upstream/Chibisafe

This fork is the one being used at https://safe.fiery.me.

It was originally based on WeebDev/lolisafe v3, but later have been so heavily rewritten that it is now simply its own thing.

Chibisafe is an upstream rewrite & rebrand, and technically is lolisafe v4.

If you want to use an existing lolisafe v3 database with this fork, copy over database/db file from your previous installation, then run yarn migrate at least once to create the new database columns introduced in this fork (don't forget to make a backup).

Caution

The migration script is NOT COMPATIBLE with Chibisafe's database.

Configuration file of lolisafe v3 (config.js) is also NOT fully compatible with this fork. There are some options that had been renamed and/or restructured

Please make sure your config matches the sample in config.sample.js before starting and/or migrating your previous database (hint: this fork's default config assumes your database file is named db.sqlite3 instead of db).

Running in production mode

  1. Ensure you have at least Node.js v18.x or newer, and Yarn v1.x installed (incompatible with Yarn v2.x).

Note

Compatible up to Node.js v20.x.
I recommend using Volta to ensure you will always have & use the correct Node.js and Yarn versions for lolisafe, even if the requirements change in future updates.

If you want to use this on Docker, please check out the docker directory instead.

  1. Clone this repo.
  2. Copy config.sample.js as config.js.
  3. Modify port, domain, and other options if desired.
  4. Copy views/_globals.sample.njk as views/_globals.njk.
  5. Modify front-end strings and options if desired.
  6. Run yarn install --production to install all production dependencies.
  7. Run yarn start to start lolisafe. Alternatively, you can also start lolisafe with yarn pm2 if you have PM2 installed.

Note

If you see errors related to sharp engines upon starting lolisafe, try to run yarn install --production --ignore-engines first.

Important

Default admin/root account:
Username: root
Password: changeme

When running in production mode, lolisafe will use pre-built client-side CSS/JS files from dist directory, while the actual source codes are in src directory.

The pre-built files are processed with postcss-preset-env, cssnano, bublé, and terser, and done automatically with GitHub Actions.

Running in development mode

This fork has a separate development mode, with which client-side CSS/JS files in src directory will be automatically rebuilt using Gulp tasks.

  1. Follow steps 1 to 6 from the production instructions above.
  2. Run yarn install to install all dependencies (by omitting --production option, Yarn will also install development dependencies).
  3. Run yarn dev to start lolisafe in development mode (or yarn dev:reload to also watch file changes).

You can further modify the Gulp tasks through gulpfile.js file.

During development, the rebuilt files will be saved in dist-dev directory instead of dist directory. Lolisafe will also automatically serve the files from dist-dev directory instead.
This is to ensure that your IDE's Git extension will not unnecessarily rebuild diffs of the modified files.

Once you feel like your modifications are ready for production usage, you can then run yarn build to build production-ready files that will actually go to dist directory.

Tip

If you are submitting a Pull Request, please do not stage any changes to files in dist directory.
GitHub Actions will automatically rebuild those assets if and when required.

Updating when you have modified some files

Try to use git stash.

Basically you'll be doing this:

  1. git stash to stash away your changes.
  2. git pull to pull updates.
  3. yarn install (or yarn install --production) to install dependencies matching the updated yarn.lock file.
  4. git stash pop (or git stash apply) to restore your changes.

Be warned that some files may have been updated too heavily that they will require manual merging.

If you only do some small modifications such as editing .njk files and not much else, it's generally safe to do this even in a live production environment. But it's still best practice to at least review just what have been updated, and whether you will need to do some manual merging beforehand.

Still, I heavily recommend simply forking this repository and manually merging upstream changes whenever you feel like doing so. Read more about syncing a fork. Especially if you intend to modify client-side CSS/JS files in src directory, since you will then need to rebuild assets that go into dist directory, which are guaranteed to always conflict with every updates from this fork that modify them.

Afterwards, you can instead clone your fork into your production server and pull updates from there. You can then choose to only install production dependencies with yarn install --production there to save some disk space (hint: this is the workflow I use for https://safe.fiery.me).

ClamAV support

This fork has an optional virus scanning support using ClamAV, utilizing clamscan library (Linux and OS X only).

It will scan new files right after they are uploaded, then alert the uploaders of the virus names in ClamAV's database if the files are dirty.

Unfortunately, this will slow down uploads processing as it has to wait for the scans before responding the uploaders. However, it's still highly recommended for public usage, or if you're like me who find the constant buzzing from Google Safe Search too annoying.

To enable this, make sure you have ClamAV installed, or additionally have ClamAV daemon running (using daemon is considerably faster). Afterwards, configure uploads.scan options, and more importantly its sub-option clamOptions. Read more about them in config.sample.js.

Additionally, you can also configure usergroups bypass, extensions whitelist, and max file size, to lessen the burden on your server.