Commit Graph

326 Commits

Author SHA1 Message Date
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
Bobby Wibowo
4923cf9800
Updates
* Added No-JS uploader page (it's on /nojs).

* Updated uploadsController.processFilesForDisplay() to support requests from No-JS uploader page.

* Added "Bash uploader" link to footer.

* Updated icons (added terminal icon for "Bash uploader" footer link).
2018-04-12 21:37:42 +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
3ca692d8c7
Updates
* Refactored all instances of "failedIds" and "albumIds" to "failedids" and "albumids" respectively. Abandoning camel case for these ones.

* Refactored the way it looks into which albums the files are supposed to be added into.
For /api/upload/finishchunks, you can add "albumid" to each object in files[] to specify which album you want the finsihed chunks to be added into. Each object may have different album IDs.
For /api/upload, which is regular uploads, unfortunately you can only choose one album at a time (by adding "albumid" to the request headers, like usual). It uses the same function as the one used for finishchunks to add the files into album, so it shouldn't be hard to extend this ability to regular uploads, someday in the future.

* Fixed a bug in /api/upload/finishchunks. Previously you couldn't ever get it to work.

* Updated error message when successful uploads could not be added to album.

* "albumid" will no longer be added to request headers if they are chunked uploads. They'd have been ignored anyways.
2018-04-05 19:54:24 +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
0f3551c3bd
Updated uploadController.js
Refactored all instances of forEach() to for-loop (there were 3 instances).
To be honest I kinda liked forEach() better in terms of readability, but oh well, let's aim for that likely tiny performance boost.
2018-04-05 17:31:07 +07:00
Bobby Wibowo
95de5ee3fd
Updates
* New uploads that can NOT be added to an album, for whatever reason, will print out message that they can not be added to the said album, but their links will still also be shown underneath the message. Previously it would only print out the message but not the link.

* Improved uploadController.processFilesForDisplay(). Previously it would loop through all uploaded files and update album info for EVERY file, even though to begin with it was designed so that every call would only have to access ONE album. So yeah, this time it will only update album info ONCE no matter how many files are being processed in that session.
2018-04-05 17:21:51 +07:00
Bobby Wibowo
aea89ecbd4
Updates and merged changes from 'master'
* Removing files from an album will now update the state of the said album. Which means, the Download Album as zip feature will properly make a new zip instead of re-using the old one which would obviously still have the said files.

* "migration.js" will no longer try to create column if it already exists.

* Changed type of all columns that used to be DATETIME to INTEGER. Apparently SQLite would have stored them as INTEGER anyways, so you don't have to change anything else.
2018-04-05 10:10:10 +07:00
Bobby Wibowo
7f10cccf70
Updates
* If files have to be added to an album on upload, it will now wait until they have either been succesfully added to the album or errored.

* File names in thumb view will now show their full URL on their tooltip.
2018-04-05 00:38:15 +07:00
Bobby Wibowo
a61060249f
Updates
* Updated README.md to get rid of all the warnings from linter. Just because.

* Removed an unnecessary logic check in albumsController.addFiles().

* Refactored "successIds" to "updateDbIds" in utilsController.bulkDeleteFilesByIds().
2018-04-03 22:01:19 +07:00
Bobby Wibowo
8724d45ce0
Updates
* Refactored all instances of "An error occurred" by appending an exclamation mark.

* Added the ability to add/remove files to/from album (API route: /api/albums/addfiles - https://s.fiery.me/dCAqLEQ9.mp4).

* Added the ability to purge files associated with an album when deleting the said album (set "purge" key to true in the JSON POST request to /api/albums/delete).

* Updated icons.

* Some other refactors, probably.
2018-03-30 09:39:53 +07:00
Bobby Wibowo
0067c8fe83
Updates
* Refactored all instances of "err" into "error".

* Added bulk delete feature (API route: /api/uploads/bulkdelete). It accepts an array of IDs (its key must be "ids" in the JSON POST request). Don't forget it still requires a token in the headers. (https://s.fiery.me/6rjMAYoC.mp4)

* Removed fontello.css from auth.html.

* Updated a bunch of styling.

* Added "copy link to clipboard" button to thumbs view.

* Added "view thumbnail" button to list view. Clicking the row will no longer trigger thumb view, instead you have to press that button.

* Updated icons.

* ... and perhaps some others that I can't remember?
2018-03-30 06:22:08 +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
e81e706914
Bug fix for chunked uploads support
Previously chunks merging would end up with corrupted files if the files were chunked into more than 10 chunks. It had something to do with incorrect file names sorting. This commit would fix it by prepending zeros to the file names depending on the amount of chunks.
2018-03-28 21:10:20 +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
3fa5b24ee5
Updates
* Better auth handling.

* Deleting a file will no longer cause the dashboard to load the very first page of uploaded files list. It will instead reload the currently viewed page.

* Updated dropzone (I guess).
2018-03-25 02:47:41 +07:00
Bobby Wibowo
83f3b36f15
Updates
* Added "Size" column to list view of uploaded files. The size will be use 'pretty' view (kB, MB, etc).

* Added delete button to thumbs view of uploaded files.

* All instances of "file length" in public views renamed to "file name length". The latter makes more sense.
2018-03-24 23:45:51 +07:00
Bobby Wibowo
616124446f
Updates (WARNING!)
WARNING: Please turn off lolisafe before upgrading, then run "node database/migration.js" once after upgrading. Ignore all errors/warnings about duplicate column name. Afterwards make sure your config.js follows the new format in config.sample.js (specifically fileLength and generateThumbnails options).

* generateImageThumbnails and generateVideoThumbnails options in config.js is now renamed to an object named generateThumbnails, with image and video as its properties.

* fileLength option is now an object with min, max, default and userChangeable as its properties.

* User may now change their preferred file length (following the previous option, of course).

* Updated a bunch of responses messages. Mainly appending a dot to the messages.

* New APIs:
/fileLength/config to get an object of the current fileLength config (exactly what is in the config.js file).
/fileLength/change to change user's preferred file length.

* And maybe some others ...?
2018-03-24 20:52:47 +07:00
Bobby Wibowo
288795c6e3
Merge branch 'pr-retry-names' into safe.fiery.me 2018-03-18 23:59:03 +07:00
Bobby Wibowo
5be27c129d
Uses async 2018-03-18 23:32:59 +07:00
Bobby Wibowo
070f4bdafd
Updates
* Updated file name checker to use for-loop instead of do-while-loop.

* Replaced all instances of eslint-disable-line with eslint-disable-next-line.
2018-03-18 20:13:08 +07:00
Bobby Wibowo
dcb72734fe
Patch to allow "retries" when generating random name 2018-03-18 19:21:04 +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
Bobby Wibowo
cb0295e732
Updates
* Patched delete function to continue deleting the file from the database if the physical file is missing from the expected path.

* Patched delete function to not print any error message if the file does not have any thumbnail.

* Patched uploader to check the existence of file with the same name, then try to generate a new random name if true, up to 3 times. If it still can not generate a unique random name after 3 times, it will throw an error saying that it can not allocate a name to the client.
This will be useful when shortening file name in the config file.
2018-03-13 21:51:39 +07:00
Kana
496575dea0
Whoops 2018-03-05 01:40:45 -03:00
Kana
939b5c52f7 In theory this will enable us to disable users and not break already running instances 2018-02-16 23:50:23 -03:00
Bobby Wibowo
677d8717e7
Fixes to albums
* It will now properly create "editedAt" and "zipGeneratedAt" columns into "albums" table, which will then be used for the "Download Album" feature. Previously, due to the lack of those columns, people could not download albums. Existing installation will have to do some manual patches, which I will describe further in the commit's comments.

* Thumbnail-less files will properly show the extensions in albums. Previously it would have two dots.
2018-02-07 23:56:32 +07:00
Bobby Wibowo
62f142a046
Updates
Patching albums for installations which serve files through a different domain (experimental).
2018-02-07 13:45:18 +07:00
Bobby Wibowo
efbaa24b30
Updates
More experimental changes to compliment the previous commit.
2018-02-07 13:32:26 +07:00
Bobby Wibowo
66f3b0739d
Updates
Experimental changes to allow generating thumbnails only for EITHER images or videos.
2018-02-07 13:22:31 +07:00
Bobby Wibowo
fb63ed50ea
Sorry.
At first I was concerned due to a particular ESLint rule called "no-undefined", but then after looking more deeply into it, I realized using typeof was unnecessary since "no-global-assign" and "no-shadow-restricted-names" were enabled and thus the previous method surely would not cause any problems.
2018-01-24 19:57:17 +07:00
Bobby Wibowo
5052cd2651
Sorry.
At first I was concerned due to a particular ESLint rule called "no-undefined", but then after looking more deeply into it, I realized using typeof was unnecessary since "no-global-assign" and "no-shadow-restricted-names" were enabled and thus the previous method surely would not cause any problems.
2018-01-24 19:53:31 +07:00
Bobby Wibowo
8598001ee3
Proper undefined check 2018-01-24 19:39:22 +07:00
Bobby Wibowo
7de25210ce
Proper undefined check 2018-01-24 19:38:32 +07:00
Bobby Wibowo
d5fcb2ee26
Updated uploadController.js
Stricter comparison.
2018-01-24 05:29:52 +07:00
Bobby Wibowo
38d77fdfbb
Fix 2018-01-24 05:29:13 +07: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
Pitu
3c2ba4868a ugh, little mistake 2017-10-04 15:20:07 -03:00
Pitu
759943f798 whoops 2017-10-04 15:13:23 -03:00
Pitu
76d48602c6 Async who? 2017-10-04 02:51:55 -03:00
Pitu
09a5c6bf1e Added a little bit of logging 2017-10-04 02:46:31 -03:00
Pitu
149742ab61 Bypass file if not found when zipping an album 2017-10-04 02:45:45 -03:00
Pitu
992b632d1a Added album downloading through front-end 2017-10-04 02:05:38 -03:00
Pitu
e56ef97975 Return 404 for deleted albums 2017-10-04 00:59:05 -03:00
Pitu
702075b66d ES6 rewrite 2017-10-03 21:13:38 -03:00
Kel
8427d23807 Delete thumbnails when file deletes
Tested working with a couple file types. Fixed some coding errors from earlier revision.
2017-10-01 23:33:32 -06:00
Pascal Temel
b05dac6743 cleanup 2017-09-24 05:54:13 +02:00
Pascal Temel
4b63ea2d1b add wmv, avi and mov thumbnail support 2017-09-24 05:35:09 +02:00
Pitu
ad4eeb5eaa Fixed last night's fuckup 2017-08-30 19:35:40 -03:00
Pitu
80117235f9 Added album check to uploads 2017-08-30 04:48:17 -03:00
EpikPhailure
daf8f0130c Update uploadController.js
* fixed blacklist from being bypassed due to case insensitive extension names
2017-06-22 17:35:56 -07:00
Kanacchi
e2885bd37c Made it so user doesn't need to specify blockedExtensions.
This is useful if there are people already running lolisafe and updated to latest version
2017-04-03 18:45:56 -03:00
Pitu
14cf45c168 Fixed bug that caused people to upload as anon even if running private 2017-04-03 17:29:10 -03:00
Crawl
72c38749ca Update uploadController.js 2017-03-28 07:44:31 +02:00
Onestay
ad6b7d25de added array with blocked file extensions
Added an option to add file extensions to the config which will be rejected (https://github.com/WeebDev/loli-safe/issues/19)
2017-03-27 23:07:00 +02:00
Pitu
026e0a3ef0 Derps were made, and now fixed 2017-03-18 01:36:50 -03:00
Pitu
72fb9ec938 whoops 2017-03-17 01:19:33 -03:00
Pitu
1db1b06a48 Refactor 2017-03-17 01:14:24 -03:00
Pitu
8a96a0df1d Moved thumbnail processing to it's own utils file 2017-03-17 01:14:10 -03:00
Pitu
dd3b47ebc8 Added thumbnail processing while uploading 2017-03-16 21:53:29 -03:00
Pitu
7cf8b6899d Added ability to see who uploaded a file as root 2017-02-13 21:55:07 -03:00
Pitu
61a4e984de Little fix 2017-02-07 04:54:58 -03:00
Pitu
36e17b0372 Album stuff 2017-02-07 04:52:53 -03:00
Pitu
e05a7c751e Added public album sharing 👌 2017-02-07 04:32:55 -03:00
Kanacchi
f6869ff7c5 Merge pull request #11 from PascalTemel/master
support thumbnails for .webm and .mp4 files
2017-02-07 03:20:12 -03:00
Pitu
6396d42409 Changed the way repeated files work
From now on, same file upload is restricted per user. Meaning same user cant upload the same file twice, and upon trying to do so they will get the original link instead of an updated one. This works the same way for anonymous uploads, only 1 file of the same kind will be uploaded
2017-02-07 03:18:41 -03:00
Pascal Temel
b008f77d36 Remove unused parameter 2017-02-07 01:15:39 +01:00
Pascal Temel
facf4a29fc support thumbnails for .webm and .mp4 files 2017-02-07 00:53:22 +01:00
Pitu
d5c9b15ab9 Added username display on dashboard 2017-01-31 03:43:00 -03:00
Pitu
0540b0775d Fixed wrong error text 2017-01-30 05:16:08 -03:00
Pitu
418f4ffe79 Stuff 2017-01-30 05:10:39 -03:00
Pitu
4a4ca06366 Forgot it was an array 2017-01-30 04:42:15 -03:00
Pitu
0258c290ff WIP 2017-01-29 22:51:54 -03:00
Pitu
4cd076b4f6 derp 2017-01-29 22:50:44 -03:00
Pitu
c64aa8fa2e Added change password for users 2017-01-29 22:30:00 -03:00
Pitu
751a876360 Updated albumsController to use new auth 2017-01-29 22:17:49 -03:00
Pitu
16164115aa New token shananigans 2017-01-29 22:06:52 -03:00
Pitu
b3cdc406d2 Removed blank lines 2017-01-29 04:18:46 -03:00
Pitu
3a58b5b4b9 WIP changing from auth to just 1 token 2017-01-29 04:18:31 -03:00
Pitu
5f0ff7f6aa Created login/register controller 2017-01-29 04:16:56 -03:00
Pitu
3f4b879144 List and thumb view on uploads 2017-01-22 18:01:39 -03:00
Pitu
4d83ff5a28 Crawl :') 2017-01-21 17:24:20 -03:00
Pitu
cd123b4c11 Forced resolve, updated config.sample.js 2017-01-21 17:21:29 -03:00
Pitu
1b2af2282f Pagination is gucci 2017-01-21 05:17:29 -03:00
Pitu
6f06bc930b Made deleting files a promise-thingy 2017-01-21 03:57:25 -03:00
Pitu
cfba738995 Ignore file if it exists already, return its url 2017-01-21 03:49:04 -03:00
Pitu
bae03cdc25 File delete, album delete and album rename. Sugoooi! 2017-01-20 03:28:26 -03:00
Pitu
bb0f746598 Album delete WIP 2017-01-19 17:14:28 -03:00
Pitu
a8121f5d7c Small fix for listing 2017-01-19 03:34:48 -03:00
Pitu
0f058724f3 Reverse sorted links list to show newers first 2017-01-19 03:11:20 -03:00
Pitu
5d09892ec1 Ohboi 2017-01-19 03:04:22 -03:00
Pitu
83aaef0f82 Changed request system and post data
Changed from XMLHttpRequest to Axiios and made every POST call to look for params or json and not pass the values as headers. Token is still a header though
2017-01-19 02:37:35 -03:00
Pitu
93891ae1e5 Small fixes 2017-01-19 00:31:01 -03:00
Pitu
f55e9809b7 Yep, multi-domains is a thing 2017-01-18 21:52:24 -03:00
Pitu
d6c7aff21b Multi-domain fixes. Maybe it's ready? 2017-01-18 21:50:40 -03:00
Pitu
aae56e91c9 Added multi-domain support. Maybe 2017-01-18 21:35:31 -03:00
Pitu
368b40c9d1 Camelcased the config 2017-01-18 20:38:13 -03:00
Pitu
02be558683 Added enabled flag to create/list of albums 2017-01-18 05:07:20 -03:00
Pitu
de130602f9 Added changing of tokens from the dashboard 2017-01-18 04:51:42 -03:00
Pitu
0dcaf36332 Added browsing galleries from dashboard 2017-01-18 04:05:56 -03:00
Pitu
512e9f46eb lowercased headers 2017-01-18 03:40:16 -03:00
Pitu
0483684de5 removed debug messages 2017-01-18 03:30:02 -03:00
Pitu
cf98005c4f Better tables and showing album on upload view 2017-01-18 03:29:46 -03:00
Pitu
7e82e4304f added admin auth for uploading to an album 2017-01-18 03:00:36 -03:00
Pitu
84ff2241ba Shit ton of things on this update 2017-01-18 02:40:14 -03:00
Pitu
ddb6d0df7d Database now saves album 2017-01-17 19:05:00 -03:00
Pitu
c4b5457891 Change from gallery to album 2017-01-17 18:55:35 -03:00
kanadeko
a114d298d0 Rewrote token handling and upload.js 2017-01-17 16:54:25 -03:00
pitu
bdfd512c10 token handling and verification 2017-01-17 00:37:54 -03:00
kanadeko
14ddf495b3 Fixed frontend upload 2017-01-16 05:35:36 -03:00
kanadeko
f42202259d Changed upload from single file to array 2017-01-16 05:22:19 -03:00
kanadeko
3777c01465 Little fix 2017-01-16 04:56:56 -03:00
kanadeko
570f6c3ce3 Print and save tokens 2017-01-16 04:45:29 -03:00
kanadeko
9688c5ee52 Removed error code because is stupid 2017-01-16 04:22:26 -03:00
kanadeko
55e2d17636 Admin panel, pomf-standarization and stuff 2017-01-16 04:21:46 -03:00
pitu
0e0a1c6f35 Updated readme 2017-01-14 18:42:38 -03:00
kanadeko
b81cf72ac4 Changed from ip whitelist to token based auth 2017-01-14 18:13:58 -03:00
kanadeko
3b648ab45e Frontend ip blocking 2017-01-14 06:06:01 -03:00
kanadeko
d25193bb31 IP whitelisting 2017-01-14 05:51:56 -03:00
kanadeko
a246fc8365 Frontend done 2017-01-14 05:50:18 -03:00
kanadeko
07ba404dcb Frontend WIP 2017-01-14 03:01:23 -03:00
kanadeko
3f3505dee7 Gallery WIP 2017-01-13 18:40:08 -03:00
kanadeko
9bb621a773 Gallery WIP 2017-01-13 18:38:18 -03:00
kanadeko
dec004cc0a Gallery WIP 2017-01-13 18:36:54 -03:00
kanadeko
633948660c Gallery WIP 2017-01-13 18:33:49 -03:00
Pitu
376cf10663 First version 2017-01-13 04:34:21 -03:00