Commit Graph

758 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
c33affa68f
Updated
Removed browser settings from dashboard,
in favor of config tab in homepage.
With this even non-registered users can configure the uploader.

Fixed homepage breaking when URL uploader is disabled.

Updated fontello.
Added link, cog-alt, and floppy icons.

Better tabs design in homepage.

Bumped v1 & v3 version strings.
2019-09-02 17:24:04 +07:00
Bobby Wibowo
a9c6ed3915
Updated nojs.njk 2019-09-02 02:35:10 +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
b77d4b7c65
Updated
Make ellipsis in pagination clickable.
It will set focus to the jump to page input, and "select" its value.
Allowing user to simply type in any numbers and press Enter to navigate.

Bumped v1 version string.
2019-08-27 05:23:54 +07:00
Bobby Wibowo
dcc393e7e0
Updated
Trim user & pass upon login / registration, on both client & server.
Users that might have already had whitespace prefix/suffix will need to
have their usernames manually updated in the database.

Warp various text inputs in the dashboard into HTML form.
This will make them be submittable when pressing Enter on the keyboard.

Switching page using the prev/next buttons, pagination, and jump to page
input, will now scroll the view to the top of the page element.

Bumped v1 version string.
2019-08-27 05:00:57 +07:00
Bobby Wibowo
826286d13d
Updated db.js 2019-08-27 00:46:56 +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
51f12ad900
Updated utilsController.js
Used .some() instead of .find().
Probably a tiny bit more efficient.
2019-08-23 20:35:28 +07:00
Bobby Wibowo
f4fa6b6a96
Updated
On video thumbnails generation, skip video files that do not have any
video streams/channels.
This will prevent unnecessary spawning of ffmpeg for those files.

Also suppress error logging when video streams/channels are not found.
2019-08-23 20:31:44 +07:00
Bobby Wibowo
e45d854c09
Updated
* Updated path resolving for upload folder option.
This SHOULD now allow using an absolute path, even those outside of
the lolisafe installation.

* Added a config option at uploads -> generateThumbs, named placeholder.
It's a string option that lets you set path of the placeholder image
for files whose thumbnail could not be generated.
It defaults to the old hard-coded path when set to falsy value.

* Fixed thumbs script not using upload folder from config file.

* Added filters for thumb generation error handling.
This is used to ignore some common error messages,
such as file formats not being supported.
2019-08-23 16:49:53 +07:00
Bobby Wibowo
3a398721b5
Updated
* Replaced all instances of getElementById and getElementsByClassName
with querySelector or querySelectorAll.

* Updated utilsController.js to stop disabling
no-async-promise-executor eslint rule.

* Removed unused lines in dashboard.njk.

* Refactored maxFileSize to maxSize in home.{css,js,njk}.

* Updated ClamAV codes in lolisafe.js. No more pinging.
Since querying version will also check connection anyway.

* Option "Upload to album" in homepage is now selectable.
Selecting this option will restore the uploader to not associate files
with an album.

* Fixed uploader to properly respect server's max file size.
Also updated error message of file size to use MB instead of MiB.

* Creating an album from homepage will automatically select the album.

* Updated Dropzone.js to v5.5.0.

* Bumped v1 & v3 version strings.

* Various other small fixes.
2019-08-20 09:16:34 +07:00
Bobby Wibowo
14d69bf1c1
Updated dev dependencies 2019-08-20 06:04:27 +07:00
Bobby Wibowo
72f58e6eec
Updated
Updated random render script.

Added a new render category (miku). Choice is currently hard-coded.

Added 50 renders for miku category.

Bumped v1 & v4 version strings.
2019-08-18 21:52:19 +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
e6bb94692b
Oversights 2019-08-04 06:42:35 +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
62b00210dc
Updated uploadController.js
Removed unnecessary slash from thumb URLs.
2019-07-26 23:54:45 +07:00
Bobby Wibowo
0e64942a6f
Updated package.json
Added an "echo" at the end of yarn pull script to avoid yarn recognizing
error from "git stash pop" if there were no local changes stashed.
2019-07-21 05:29:22 +07:00
Bobby Wibowo
6adf982fb6
Updated package.json
Use --production option by default for yarn pull shortcut.
2019-07-21 05:20:02 +07:00
Bobby Wibowo
aab8058b28
Updated dependencies 2019-07-21 05:17:45 +07:00
Bobby Wibowo
83eb4872e9
Updated utilsController.js
* Simplified some logics.

* Try to unlink thumbnail when failing to generate video thumbnail,
since ffmpeg may have already created an incomplete thumbnail.
2019-07-21 05:15:59 +07:00
Bobby Wibowo
cf20bdbd1a
Updated albumsController.js
Allow JSZip to be configured from config.js file.
2019-07-18 06:22:47 +07:00
Bobby Wibowo
1b79ee3e91
Updated dependencies 2019-07-18 06:02:45 +07:00
Bobby Wibowo
caafe1ac63
Updated .eslintrc.json
Temporarily disabled new eslint rule "no-async-promise-executor".
I'll fix the bits that emit the error at a later date.
2019-07-15 23:12:14 +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
0516ec2f2f
Updated
tokenController.js + authController.js:
+ Added a standalone function to generate unique token.
Despite tokens being 64 characters long, meaning the chance to generate
the same token twice have very small chances, I would rather not leave
it to chances.
+ Some spacings.

config.sample.js:
+ Self-explanatory.
2019-06-19 04:04:14 +07:00
Bobby Wibowo
add2970ae6
Updated
uploadController.js:
+ Close connection earlier when there are no upload when querying them.

dashboard.css + style.css:
+ Updated styling involving pagination and progress bar.

dashboard.js:
+ Fixed dashboard failing to handle cases where a user attemp to load
a next page when there are not enough uploads available.
+ Added a simple loading message as a placeholder when trying to view
Stastistics menu, since it may take a while in big servers.

bulma.min.css + LICENSE:
+ Updated bulma from 0.7.2 to 0.7.5.

_globals.njk:
+ Bumped v1 and v3 version strings.
2019-06-19 01:48:30 +07:00
Bobby Wibowo
d2d41fc127
Rebuilt yarn.lock 2019-06-18 20:11:17 +07:00
Bobby Wibowo
f6cef67d9f
Updated
+ Do not query users table twice when filtering by usernames.
+ Removed redundant logic.
2019-06-18 02:48:42 +07:00
Bobby Wibowo
06ac31d02e
Updates (dashboard)
+ Better pagination.
+ Added more advanced filtering system in Manage Uploads.
It now supports filtering with multiple usernames and/or IPs.
It also supports refining the matches with wildcards.

Todo?
Perhaps add simple file name filtering for regular users in the future?
2019-06-18 02:34:15 +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
Kana
60c9f36374
Merge pull request #194 from WeebDev/dependabot/npm_and_yarn/sshpk-1.16.1
Bump sshpk from 1.13.1 to 1.16.1
2019-06-06 17:06:31 +09: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
f48cbd1960
Updates
config.sample.js + uploadController.js:
+ Added option uploads > storeIP to toggle whether to store uploader's
IPs into the database.

uploadController.js + dashboard.js:
+ Added IP column when listing all uploads.
+ Improved album query when listing uploads. In addition, no longer
query album when listing all uploads.
+ Delegate some tasks to client when listing uploads to save server's
processing power, kek.
Such as building the file's full URLs, and assigning album/user names.

_globals.njk:
+ Bumped v1 version string.
2019-06-04 07:57:37 +07:00
Bobby Wibowo
4bee2ef376
Updated _globals.njk
I forgot I need to bump this version after updating dashboard.js
in a previous commit.
2019-06-04 02:47:05 +07:00
Bobby Wibowo
d185265c0d
Updated config.sample.js
I blame vscode for weird paste behavior
when I copied-pasted this from my config.js.
2019-06-04 02:43:54 +07: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
cbbebcf829
Updated unicorn_6.png
Forgot to remove render watermark, lmao
2019-04-20 17:08:40 +07:00
Bobby Wibowo
b754470630
Updated albums public page
File size when JavaScript is disabled will now properly use B suffix.
It's referring to the fact that their unit is bytes.

Disclaimer about this. Back-end will only return the file size in bytes,
front-end is supposed to convert them into prettier units (KB, MB, ...).

Nothing much can be done if front-end have JavaScript disabled.
I don't want to defer the task, prettying the units, to back-end.
2019-04-19 11:56:57 +07:00
Bobby Wibowo
ecb8afbe40
Updates
Updated fontello (added block and doc-inv icons).

Upload results will now show either doc or block icon on top of the
file name depending on the status of the upload
(unless the uploads are images, in which case they will still show
thumbnails instead).

Added support for customizable timeout and chunkSize options for ClamAV
scanning to the config file.

Bumped v1 and v3 version strings.
2019-04-18 16:06:14 +07:00
Bobby Wibowo
9b1cb06825
Updated dashboard.js
Oversight.
2019-04-12 07:53:44 +07:00