Commit Graph

48 Commits

Author SHA1 Message Date
Bobby Wibowo
02e2e402c3
!!! MASSIVE OVERHAUL !!!
As the title says, this commit is a massive overhaul.
I've rewritten/restrucuted almost everything in the controller scripts.
Because of that, there's a considerable possibility that I've broken
something somewhere.

Notable changes:

Added temporary uploads.

Removed file name length changer from dashboard,
in favor of an equivalent in homepage config tab.
This allows non-registered users to also set file name length.

A bunch of other undocmented stuff.
I don't know, I'm too tired to remember them all.
2019-09-08 08:56:29 +07:00
Bobby Wibowo
05b905bc9b
Updated
Upgraded dependencies.

Stop adding cache-control header to album zip files unless
config.cacheControl is enabled.

Updated CSS files.
Moved thumbnail-related styling to thumbs.css.
Various other fixes & improvements.

Moved render.js from public/js to public/js/s.

Removed sharex.js in favor of public/js/s/utils.js.
Moved getPrettyDate() & getPrettyBytes() to that JS file as well.

Added lsKeys global variable wherever applicable.
Previously the idea was only used in dashboard.js.

Added No-JS version of album public pages.
You'll only have to add ?nojs to the URL.
Viewing the regular version with JS disabled will show a notice with
a link to the No-JS version of the particular album.
Overall page size of the regular version will now be lower as well,
since there'll be no need to add noscript tag for each thumbs.

No longer show Administrator section to non-admin in the dashboard.
Moderators will ONLY be able to see manage users menu as well.

Simplified FAQ wherever applicable.
Added a new FAQ about bug report or feature request.

Updated link for Firefox extension.
Also pushed Firefox link before Chrome, cause I like it more.

Added browser settings menu to dashboard.
This allows you to choose file size unit (kilobyte vs kibibyte) for that
specific browser.
The preference will be used on homepage, dashboard and album pages.
This also allows you to set chunk size and maximum parallel uploads
for the homepage uploader.

All menu links in the dashboard will now scroll to the content once
loaded.
Previously it would only do so with manage uploads/users when
switching pages.

Refactored all instances of for-in & for-of loop from browser JS files.
For the sake of uniformity, for now.
2019-09-02 02:23:16 +07:00
Bobby Wibowo
7e3d177d00
Updated
Added logger.js to format console logs (adding timestamps).

Re-ordered modules loading in lolisafe.js, and a few other minor edits.

Updated dev dependencies.

A few other minor edits.
2019-08-27 00:02:06 +07:00
Bobby Wibowo
14d69bf1c1
Updated dev dependencies 2019-08-20 06:04:27 +07:00
Bobby Wibowo
63e26462ea
Updated
Pressing Enter on the auth form will now properly make it try to login.

Slightly better error messages on auth page.

Bumped v1 version string.

Updated dependencies (knex & sqlite).
2019-08-18 16:57:56 +07:00
Bobby Wibowo
6496b03b71
Updates
Updated deps.

Re-enabled eslint rule no-async-promise-executor.
Updated some codes to follow the said rule.
Though I had to disable the rule in a line at utilsController.js
due to complexity.
I'll give it more thoughts in the future.

Bumped v1 version string.
2019-08-04 06:37:55 +07:00
Bobby Wibowo
aab8058b28
Updated dependencies 2019-07-21 05:17:45 +07:00
Bobby Wibowo
1b79ee3e91
Updated dependencies 2019-07-18 06:02:45 +07:00
Bobby Wibowo
34347915ab
Updated dependencies 2019-07-14 17:04:31 +07:00
Bobby Wibowo
32604bc35e
Updated dependencies 2019-07-11 05:08:13 +07:00
Bobby Wibowo
e275ab16ae
Updated
yarn.lock:
+ Rebuild dependencies. I'm starting to think dependabot isn't quite reliable.

auth.js + home.js + _globals.njk:
+ Updated a few error handlings to handle error messages better.
2019-07-03 22:56:45 +07:00
dependabot-preview[bot]
1e0e4efc83 Bump eslint-plugin-promise from 4.1.1 to 4.2.1 (#20)
Bumps [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) from 4.1.1 to 4.2.1.
- [Release notes](https://github.com/xjamundx/eslint-plugin-promise/releases)
- [Changelog](https://github.com/xjamundx/eslint-plugin-promise/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xjamundx/eslint-plugin-promise/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-03 22:44:53 +07:00
dependabot-preview[bot]
762a3cadb7 Bump eslint-plugin-import from 2.17.3 to 2.18.0 (#19)
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-03 22:44:43 +07:00
dependabot-preview[bot]
5e42ce01e9 Bump knex from 0.17.6 to 0.18.1 (#22)
Bumps [knex](https://github.com/tgriesser/knex) from 0.17.6 to 0.18.1.
- [Release notes](https://github.com/tgriesser/knex/releases)
- [Changelog](https://github.com/tgriesser/knex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tgriesser/knex/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-03 22:44:27 +07:00
Bobby Wibowo
d2d41fc127
Rebuilt yarn.lock 2019-06-18 20:11:17 +07:00
dependabot-preview[bot]
ec6069d962 Bump express-rate-limit from 4.0.4 to 5.0.0 (#18)
Bumps [express-rate-limit](https://github.com/nfriedly/express-rate-limit) from 4.0.4 to 5.0.0.
- [Release notes](https://github.com/nfriedly/express-rate-limit/releases)
- [Commits](https://github.com/nfriedly/express-rate-limit/compare/v4.0.4...v5.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-14 20:32:30 +07:00
dependabot-preview[bot]
8eb3ff9a0d Bump sqlite3 from 4.0.8 to 4.0.9 (#16)
Bumps [sqlite3](https://github.com/mapbox/node-sqlite3) from 4.0.8 to 4.0.9.
- [Release notes](https://github.com/mapbox/node-sqlite3/releases)
- [Changelog](https://github.com/mapbox/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mapbox/node-sqlite3/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-14 20:32:14 +07:00
dependabot-preview[bot]
9f29335214 Bump knex from 0.17.3 to 0.17.6 (#17)
Bumps [knex](https://github.com/tgriesser/knex) from 0.17.3 to 0.17.6.
- [Release notes](https://github.com/tgriesser/knex/releases)
- [Changelog](https://github.com/tgriesser/knex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tgriesser/knex/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-14 20:31:29 +07:00
dependabot[bot]
677aa8f68e
Bump sshpk from 1.13.1 to 1.16.1
Bumps [sshpk](https://github.com/joyent/node-sshpk) from 1.13.1 to 1.16.1.
- [Release notes](https://github.com/joyent/node-sshpk/releases)
- [Commits](https://github.com/joyent/node-sshpk/compare/v1.13.1...v1.16.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-06-06 08:05:52 +00:00
Bobby Wibowo
5c41fc9249
Updates
utilsController.js:
+ /api/stats: Cache invalidation requests will now only store timestamp
of the request instead of purging the cache entirely.
Subsequent requests to the API will no longer attempt to generate stats
if a previous request before it is still generating, since it can
take a while in big sites.
So instead, the cached stats will be returned to them, regardless of
whether it's still valid.
This should avoid "race condition" in sites with multiple admins.

* dashboard.js:
+ Added an appendix into "Delete by names" feature in dashboard to
inform staffs that they can use the feature to delete files by other
users as well.
+ Added comments explaning the need of page.domClick() function.
+ Addition to the change regarding /api/stats route: If there is no
cached stats, but a previous request is still generating, inform
the user about it.

config.sample.js + lolisafe.js:
+ We now support configuring rate limits through config file.
No more hard-coded rate limits.
Don't forget to update your config.js accordingly.

package.json + yarn.lock:
+ Updated dependencies.
2019-06-04 02:40:24 +07:00
Bobby Wibowo
a8ae88babd
Updated dependencies 2019-05-07 19:35:56 +07:00
Bobby Wibowo
8c3fb78135
Upates
* Added Statistics menu to Administration items in dashboard.

* Added /api/stats route.

Imo, my implementation of this whole thing is rather dirty-ish, but hey
as long as it works.

I'll be using lolisafe2 for future devs tbh.
2019-04-06 00:32:52 +07:00
Bobby Wibowo
2b8f52ff72
Merge branch 'master' into safe.fiery.me 2019-03-28 03:42:27 +07:00
Bobby Wibowo
b2ed4deda8
Reinstall dependencies
Dependencies of dependencies (dependency-ception) were mostly outdated,
so we reinstalled them all to get all the latest versions available.
2019-01-10 16:06:28 +07:00
Bobby Wibowo
e5457d9dba
Updated dependencies 2019-01-10 15:56:09 +07:00
Bobby Wibowo
f0716c8ffd
Updated yarn.lock 2018-12-08 05:16:43 +07:00
Bobby Wibowo
6af52341c9
Init ids-cache branch 2018-12-03 16:18:52 +07:00
Bobby Wibowo
b6bd833110
Replace graphicsmagick with sharp 2018-12-03 14:20:13 +07:00
Bobby Wibowo
6af1f6f490
Removed chokidar resolution
I added the resolution since an issue was reported by Snyk.io.
But I recently noticed that it prevents installation on node 10.x.
I haven't checked whether the resolution is still necessary though.

Also removed .vscode settings.
I plan to add a cleaner way for this later.
2018-11-24 15:18:23 +07:00
Bobby Wibowo
e2831f2181
Updates
* uploadController.js: expect some multer error codes and don't log their stack traces to console when they occur.

* yarn.lock: added integrity field (yarn's new addition).
2018-10-08 23:14:10 +07:00
Bobby Wibowo
30c011ce5c
Replaced snekfetch with node-fetch 2018-09-23 23:28:15 +07:00
Bobby Wibowo
65442c18c5
Reworked extension parsing
Removed "path-complete-extname" module in favor of an in-house solution, utilsController.extname().

For now the function will attempt to preserve multi-archive extensions (.001, .002, and so on), as well as some known tarballs (.tar.gz and the likes).

The function will always return lower case extension. It should be fine, but do keep it in mind.
2018-09-18 02:32:27 +07:00
Bobby Wibowo
a207c4a806
Init 'clamdjs' branch (#8)
Use clamdjs module instead of clam-engine. This module connects to clam daemon server.
2018-09-04 22:48:24 +07:00
Bobby Wibowo
36da76357e
Updates
* Added an experimental virus scanning feature using ClamAV. This has only been tested with an Ubuntu machine.

* File extensions will now be parsed with path-complete-extname module. This will ensure extensions such as .tar.gz are properly parsed.

Notice: It may take a minute or so to start the safe with virus scanning, as apparently the module takes a while to create the engine. I'm guessing since it'll be loaded to memory? Either way, once the engine is created, everything should work fine. Virus scanning should also not have that much of an impact to the upload time.
2018-09-02 03:37:26 +07:00
Bobby Wibowo
f043f65ca1
Updates
* Added Cloudflare purge cache support. Check configuration sample at config.sample.js.
When it's enabled, whenever files are being deleted, it will send a POST request to Cloudflare's API to purge cache of the deleted files.
This adds a new dependency called "snekfetch". It's lightweight though.

* uploadsController.delete() will now wrap uploadsController.bulkDelete() instead.
2018-05-09 16:53:27 +07:00
Bobby Wibowo
6a25eaac05
Updates
* Updated yarn.lock.

* Added resolution for chokidar. This is going to be used by nunjucks if "watch" is set to true. Although we don't really use it, chokidar 1.x has a vulnerability.
2018-04-25 18:39:54 +07:00
Bobby Wibowo
c2db094e62
Updated dependencies
I forgot to remove handlebars completely, lmao.
Also updated vscode's settings. Temporarily only using "michelemelluso.code-beautifier" extension to beautify CSS until I find a better alternative.
2018-04-19 04:19:05 +07:00
Bobby Wibowo
09f51c8448
Updates~ 😉
Thanks to Zephyrrus for the hints about nunjucks, sort of (he did not really give out any specific hints to me, I stalked his fork, lmao).

* Replaced Handlebars with Nunjucks.

* Replaced all static HTML files with their NJK-equivalent (excluding error pages).

* Renamed "albumDomain" to "homeDomain" in config.sample.js (make sure you update your config.js too).

* Updated dependencies: knex and eslint-plugin-import (dev).

* Updated vscode's settings.json (I may update this again very soon).
2018-04-19 04:00:36 +07:00
Bobby Wibowo
7978325cd6
Updates
* Removed rimraf from dependency. Although really it'll still need to be used by other dependencies, such as eslint and bcrypt, so it'll still have to be downloaded by yarn either way.

* Updated dashboard.css. Added "overflow: hidden" to thumbnail container. Previously potrait thumbnails will be visible outside of their container.

* Removed notice about having "chunks" folder from config.sample.js. Added a line in lolisafe.js to create the folder if it doesn't exist instead.

* Updated bcrypt to v2.0.0. I'm not really sure whatever has changed, but I've tested that it didn't require any additional changes for our current usage.

* Chunks will no longer be saved with their original file's extension. Instead they'll only be saved as plain files named 0, 1, ..., n, without any extension whatsoever. Extension for joined chunks will be read from the original file's name in /api/upload/finishchunks. If the user doesn't pass that data when calling the API, the joined chunks will not have any extension.

* Since rimraf has been removed, uploadsController.actuallyFinishChunks() will now use a combination of fs.unlink() and fs.rmdir(). Promise.all() will be used when running fs.unlink() so that all chunks will be deleted at the same time through multiple instances of async tasks (probably).

* Some other small changes and tweaks in uploadController.js.
2018-04-09 01:30:25 +07:00
Bobby Wibowo
b1dbb931c1
Updates
* Updated eslint-plugin-import dev dependency.

* Added 2 new ESLint rules: "prefer-const" and "object-shorthand".

* Refactor all JS files to follow the new ESLint rules.

* Refactored all instances of for-i into for-of wherever applicable.
2018-04-05 17:52:57 +07:00
Bobby Wibowo
2dd724f88f
Updates
* Switched standard to eslint with eslint-config-standard (and 4 more eslint plugins needed by standard).

* Added "curly" eslint rule with "all" option. I like it.

* Refactored all JS files to apply the new "curly" eslint rule.

* Renewed axios.min.js, dropzone.min.js and sweetalert.min.js. Re-minified and added a small comment stating their version and copyright statement.

* Some buttons in dashboard will now show loading icon whenever they're waiting for response from the server.

* Updated README.md and .gitignore.
2018-03-29 00:40:50 +07:00
Bobby Wibowo
66a63ca6d6
Updates (YAY, CHUNKED UPLOADS!)
* Added new dependency: rimraf. This will be used by chunked upload support to bulk delete temporary chunk files.

* Added chunked uploads support :3

* Updated Dropzone to 5.2.0.

* More improvements to thumbnail view. Delete button will now only appear on hover. Some other details, such as file name, size and album/owner will also appear on hover. Touch devices will have all of those appear always visible by default.

* Image thumbnails will now appear on home page after successful uploads (only for WEBP, JPG, JPEG, BMP, GIF and PNG files). WEBP may not work properly in Firefox though.

* Refactored home.js to use const/let and some other stuff.

* Refactored album view. It will now display properly on mobile screen. Download Album button will also no longer be located at the top right, but right below the subtitle.

* Updated some version strings.

* And maybe some others that I can't remember.
2018-03-28 18:36:28 +07:00
Bobby Wibowo
076be2cfec
Updated dependencies and yarn.lock file 2018-03-17 03:17:32 +07:00
Bobby Wibowo
c2b2f5b14b
Updates
* Properly merged changes from master.

* database/migration.js will now exit after migartion.

* Replaced all instances of createTableIfNotExists() into a combination of hasTable() and createTable() in db.js.
2018-03-14 13:57:09 +07:00
iCrawl
8a75ab91a6
update deps and add dockerfile 2018-03-01 22:03:47 +01:00
Bobby Wibowo
bcdfcd7064
Various updates
* Switched ESLint + Aqua to Standard. I'm a big fan of Standard. Updated yarn.lock file too.

* Lots of refactors to follow the rules of Standard.

* Fixed issue with uploading as a not logged in user.
2018-01-24 03:06:30 +07:00
Bobby Wibowo
883a601358
Breaking changes
All of these changes are for safe.fiery.me.
2018-01-24 00:15:32 +07:00
Pitu
e6bd937879 Added handlebars dependency and yarn.lock 2017-09-20 03:02:14 -03:00