You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bobby Wibowo 51c5a81b18
!!! RUN "yarn migrate" !!!
Added "yarn migrate" as alias for "node ./database/migration.js".
Updated about it.

Added a new column to users database: registration.
It will be used to store user's registration timestamp.
Registration date will be displayed in Dashboard's Manage Users.
Since this is a new column,
existing users will not have registration dates.

Last token change date will now be displayed in Dashboard as well.

<code> elements will now properly have relative font size.

User ID will now be displayed in Edit user dialog for reference purpose.

Bumped v1 version string and rebuilt client assets.
3 years ago
.github Added FUNDING.yml 3 years ago
controllers !!! RUN "yarn migrate" !!! 3 years ago
database !!! RUN "yarn migrate" !!! 3 years ago
dist !!! RUN "yarn migrate" !!! 3 years ago
pages/error Updates 5 years ago
public Added retina/2x home logo 3 years ago
routes Added client assets update detection 3 years ago
scripts Updated 3 years ago
src !!! RUN "yarn migrate" !!! 3 years ago
views Added retina/2x home logo 3 years ago
.browserslistrc Updates (very important to read) 4 years ago
.editorconfig Updates 5 years ago
.eslintignore Updated 4 years ago
.eslintrc.json Initialize upload filters for regular users (WIP) 3 years ago
.gitignore Updated 4 years ago
.stylelintignore Updated 4 years ago
.stylelintrc.json Updated 4 years ago
AUTHORS Updated 4 years ago
Dockerfile update deps and add dockerfile 5 years ago
LICENSE De loli-safe (#77) 5 years ago !!! RUN "yarn migrate" !!! 3 years ago Checked DMCA request logs from TODO list 3 years ago
config.sample.js Updated Linux-only disk stats 3 years ago
gulpfile.js Enabled verbose output for gulp linter tasks 3 years ago
logger.js More improvements to uploads filtering! 3 years ago
lolisafe.js Updated 3 years ago
nginx-ssl.sample.conf Merged changes from master 5 years ago
nginx.sample.conf Merged changes from master 5 years ago
package.json !!! RUN "yarn migrate" !!! 3 years ago
real-ip-from-cf Updated IP's 5 years ago
yarn.lock Updated dependencies 3 years ago

lolisafe, a small safe worth protecting

GitHub license

JavaScript Style Guide

This fork is the one being used at If you are looking for the original, head to WeebDev/lolisafe.

If you want to use an existing lolisafe database with this fork, run node ./database/migration.js (or yarn migrate) at least once to create the new columns introduced in this branch (don't forget to make a backup).

Configuration file of lolisafe, 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.

Running in production mode

  1. Ensure you have at least Node v10.x installed (v12.x should also work just fine).
  2. Clone this repo.
  3. Copy config.sample.js as config.js.
  4. Modify port, domain and privacy options if desired.
  5. Run yarn install --production to install all production dependencies (Yes, use yarn).
  6. Run yarn start to start the service.

Default admin account:
Username: root
Password: changeme

You can also start it with yarn pm2 if you have PM2.

When running in production mode, the safe 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 were processed with postcss-preset-env, cssnano, bublé, and terser.

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 step 1 to 4 from the production instructions above.
  2. Run yarn install to install all dependencies (including development ones).
  3. Run yarn develop to start the service in development mode.

You can configure the Gulp tasks through gulpfile.js file.

During development, the rebuilt files will be saved in dist-dev directory instead of dist directory. The service will also automatically serve the files from dist-dev directory instead. This is to avoid your IDE's Git from unnecessarily rebuilding diff 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.

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 views/_globals.njk 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.

Afterwards, you can instead clone your fork in your production server and pull updates from there. You can then choose to only install production dependencies with yarn install --production there (hint: this is how I setup

Script for missing thumbnails

Thumbnails will not be automatically generated for existing files, that had been uploaded prior to enabling thumbnails in the config file.

To generate thumbnails for those files, you can use yarn thumbs.

$ yarn thumbs
$ node ./scripts/thumbs.js

Generate thumbnails.

Usage  :
node scripts/thumbs.js <mode=1|2|3> [force=0|1] [verbose=0|1] [cfcache=0|1]

mode   : 1 = images only, 2 = videos only, 3 = both images and videos
force  : 0 = no force (default), 1 = overwrite existing thumbnails
verbose: 0 = only print missing thumbs (default), 1 = print all
cfcache: 0 = do not clear cloudflare cache (default), 1 = clear cloudflare cache

For example, if you only want to generate thumbnails for image files without overwriting existing ones, you can run yarn thumbs 1.

Or if you want to generate thumbnails for both image and video files, while also overwriting existsing ones, you can run yarn thumbs 3 1.

ClamAV support

This fork has an optional virus scanning support using ClamAV, through clamdjs library.

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

Unfortunately, this will slow down uploads processing as it has to wait for scan results before responding the uploaders, however it's still highly recommended for public usage (or at least if you find Google Safe Search too annoying).

To enable this, make sure you have ClamAV daemon running, then fill in the daemon's IP and port into your config file.

From the config file you can also choose to exclude certain extensions from being scanned to lessen the burden on your server.