Go to file
Bobby Wibowo dd43acecea
Updates
* Added VSCode settings to git repo. Now you can match yours with mine, if you want.

* Added .jsbeautifyrc for js-beautify (to be used by VSCode's Beautify extension).

* Refactored all instances of require('**/*.js') with require('**/*') wherever applicable (basically gotten rid of the .js extension).

* Refactored path in all instances of require() wherever applicable.

* Sorted instances of require() wherever applicable.

* Fixed 500 HTTP error trying to load an error page for 505 HTTP error.

* Removed special treatement of NoJS page from uploadsController.processFilesForDisplay().

* Updated version string of all static files.

* Beautified all HTML, HANDLEBARS and CSS files.

* Refactored the structure of footer links in homepage and No-JS uploader. This should now fix homepage going out-of-bound in smaller screens.

* Added CSS prefixes wherever applicable.

* Improved back-end side of No-JS uploader. This will now handle errors properly.

* No-JS uploader will now show max file size.

* No-JS uploader will now show a proper message when private mode is enabled and/or registration is disabled.
2018-04-13 23:20:57 +07:00
.vscode Updates 2018-04-13 23:20:57 +07:00
controllers Updates 2018-04-13 23:20:57 +07:00
database Updates 2018-04-13 23:20:57 +07:00
pages Updates 2018-04-13 23:20:57 +07:00
public Updates 2018-04-13 23:20:57 +07:00
routes Updates 2018-04-13 23:20:57 +07:00
views Updates 2018-04-13 23:20:57 +07:00
.editorconfig Updates 2018-04-13 23:20:57 +07:00
.gitignore Updates 2018-04-13 23:20:57 +07:00
.jsbeautifyrc Updates 2018-04-13 23:20:57 +07:00
Dockerfile update deps and add dockerfile 2018-03-01 22:03:47 +01:00
LICENSE Added license 2017-01-30 05:10:46 -03:00
README.md Updated screenshot in README.md 2018-04-12 21:41:57 +07:00
config.sample.js Updates 2018-04-09 01:30:25 +07:00
lolisafe.js Updates 2018-04-13 23:20:57 +07:00
nginx-ssl.sample.conf Merge branch 'master' into safe.fiery.me 2018-04-03 22:05:27 +07:00
nginx.sample.conf Merge branch 'master' into safe.fiery.me 2018-04-03 22:05:27 +07:00
package.json Updates 2018-04-09 01:30:25 +07:00
real-ip-from-cf Updated IP's 2018-04-01 23:51:25 -07:00
yarn.lock Updates 2018-04-09 01:30:25 +07:00

README.md

lolisafe, a small safe worth protecting

safe.fiery.me

GitHub license Chat / Support

safe.fiery.me branch

JavaScript Style Guide

This branch is the one being used at https://safe.fiery.me. If you are looking for the original, head to master branch, or even better to WeebDev/lolisafe.

If you want to use an existing lolisafe database with this branch, make sure to run node database/migration.js at least once to create some new columns introduced in this branch. You can ignore any errors about duplicate columns.

Configuration file of lolisafe, config.js, is not 100% compatible with this branch. 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

  1. Ensure you have at least version 7.6.0 of node installed
  2. Clone the repo
  3. Rename config.sample.js to config.js
  4. Modify port, domain and privacy options if desired
  5. run npm install to install all dependencies
  6. run pm2 start lolisafe.js or node lolisafe.js to start the service

Getting started

This service supports running both as public and private. The only difference is that one needs a token to upload and the other one doesn't. If you want it to be public so anyone can upload files either from the website or API, just set the option private: false in the config.js file. In case you want to run it privately, you should set private: true.

Upon running the service for the first time, it's gonna create a user account with the username root and password root. This is your admin account and you should change the password immediately. This account will let you manage all uploaded files and remove any if necessary.

The option serveFilesWithNode in the config.js dictates if you want lolisafe to serve the files or nginx/apache once they are uploaded. The main difference between the two is the ease of use and the chance of analytics in the future. If you set it to true, the uploaded files will be located after the host like: https://lolisafe.moe/yourFile.jpg

If you set it to false, you need to set nginx to directly serve whatever folder it is you are serving your downloads in. This also gives you the ability to serve them, for example, like this: https://files.lolisafe.moe/yourFile.jpg

Both cases require you to type the domain where the files will be served on the domain key below. Which one you use is ultimately up to you. Either way, I've provided a sample config files for nginx that you can use to set it up quickly and painlessly!

If you set enableUserAccounts: true, people will be able to create accounts on the service to keep track of their uploaded files and create albums to upload stuff to, pretty much like imgur does, but only through the API. Every user account has a token that the user can use to upload stuff through the API. You can find this token on the section called Change your token on the administration dashboard, and if it gets leaked or compromised you can renew it by clicking the button titled Request new token.

Cloudflare Support

If you are running lolisafe behind Cloudflare there is support to make the NGINX logs have the users IP instead of Cloudflares IP. You will need to compile NGINX from source with --with-http_realip_module as well as uncomment the following line in the NGINX config: include /path/to/lolisafe/real-ip-from-cf;

Using lolisafe

Once the service starts you can start hitting the upload endpoint at /api/upload with any file. If you're using the frontend to do so then you are pretty much set, but if using the API to upload make sure the form name is set to files[] and the form type to multipart/form-data. If the service is running in private mode, dont forget to send a header of type token: YOUR-CLIENT-TOKEN to validate the request.

A sample of the returning json from the endpoint can be seen below:

{
  "name": "EW7C.png",
  "size": "71400",
  "url": "https://i.kanacchi.moe/EW7C.png"
}

To make it easier and better than any other service, you can download our Chrome extension that will let you configure your hostname and tokens, so that you can simply right click -> send to loli-safe to any image/audio/video file on the web.

Because of how nodejs apps work, if you want it attached to a domain name you will need to make a reverse proxy for it.

Here is a tutorial on how to do this with nginx. Keep in mind that this is only a requirement if you want to access your lolisafe service by using a domain name (ex: https://i.kanacchi.moe), otherwise you can use the service just fine by accessing it from your server's IP.

Sites using lolisafe

  • lolisafe.moe: A small safe worth protecting.
  • safe.moe: The world's most unsafe pomf clone
  • updx.xyz: A shitty clone. At least the files are more secure!
  • safe.fiery.me: Just another clone.
  • kayo.pics: File hosting for all~
  • Feel free to add yours here.

Author

lolisafe © Pitu, Released under the MIT License.

Authored and maintained by Pitu.

lolisafe.moe · GitHub @Pitu