Commit Graph

125 Commits

Author SHA1 Message Date
Bobby
d49c337dad
fix: special characters in album titles 2023-12-06 05:55:50 +07:00
Bobby
3d9c400cab
fix: animated thumbs in album pages 2023-09-06 18:58:15 +07:00
Bobby
95e5956313
feat: ConfigManager 2022-10-06 02:39:51 +07:00
Bobby
93621afe94
feat: allow stream download of album ZIPs
extend ServeStatic handler to allow programatically calling the handle()
function from within in-progress Requests

also use file's timestamp as file's modified time in the ZIP archive
2022-10-04 07:06:37 +07:00
Bobby
97ffa67975
fix: download of >2GiB album ZIPs 2022-10-04 06:15:37 +07:00
Bobby
34c060ec5e
feat: delete zip of empty albums on download req 2022-10-04 05:16:51 +07:00
Bobby
d5b1ad69d9
fix: await album zip jetpack.rename() 2022-10-04 05:16:15 +07:00
Bobby
afd81c965d
chore: comment out onHold debug messages
seem stable enough
but just comment out if needed in the future
2022-10-04 05:12:21 +07:00
Bobby
e4a3447a5e
feat: use fs-jetpack in albumsController.js 2022-10-04 04:34:44 +07:00
Bobby
c1bb2f5015
refactor: logic improvements 2022-09-28 10:14:08 +07:00
Bobby
518b29c8df
feat: better albums.onHold debugging messages 2022-09-24 06:35:41 +07:00
Bobby Wibowo
6ff735badb
feat: wrap add to album db query in transaction
additionally allow superadmins to arbitrarily add/remove files to/from
albums via manual API calls, instead of only allowing root user
2022-08-09 17:18:56 +07:00
Bobby Wibowo
4907ef9ad7
chore: indent albumsController.js 2022-08-09 17:00:26 +07:00
Bobby Wibowo
d7d6a29123
feat: cleaned up routes init
asserting auth and JSON body will now be done via route-specific
mini middlewares (authController's requireUser or optionalUser)
2022-08-04 21:59:06 +07:00
Bobby Wibowo
527498bb1e
perf: list albums db query 2022-07-31 15:55:27 +07:00
Bobby Wibowo
285e79c5a7
feat: configurable uploads/albums/users per page
please check sample.config.js for new options

if missing from config, defaults to 25 per page (old defaults)
2022-07-31 15:51:32 +07:00
Bobby
b7dcf30578
feat: console logs for identifiers on debug only 2022-07-30 08:35:26 +07:00
Bobby
c23bc90412
refactor: album random identifier generation 2022-07-30 08:01:19 +07:00
Bobby Wibowo
1b109e0dc0
feat: req content-type json -> application/json 2022-07-25 06:12:55 +07:00
Bobby
4ca64b141f
refactor: do not await assertRequestType
it's not an async function, lmao
2022-07-22 08:50:26 +07:00
Bobby
776ab8ab37
feat: assert request content-type in post apis 2022-07-22 08:40:40 +07:00
Bobby Wibowo
96d276b396
fix: check if req.path_parameters is set 2022-07-22 02:03:59 +07:00
Bobby Wibowo
07d0237031
refactor: res.query -> .query_parameters
direct hyper-express prop get
2022-07-22 02:02:59 +07:00
Bobby Wibowo
25f87b3a49
chore: albumsController.js 2022-07-22 01:44:53 +07:00
Bobby Wibowo
7b9fca0bc3
refactor: req.params -> .path_parameters
direct hyper-express prop get
2022-07-22 01:44:15 +07:00
Bobby Wibowo
38d86779ae
refactor: HUGE REFACTOR for hyper-express 2022-07-10 19:46:25 +07:00
Bobby Wibowo
99a7a2a677
refactor: albumsController pass errors
motivation: less try-catch
2022-07-10 14:11:29 +07:00
Bobby
2ca2fef301
feat: use SimpleDataStore for album pages cache
this should have better lifecycle and use less memory over time, since
we can define max items in cache
at the moment hard-coded to 10 cached pages (inclusive of nojs version
if ever generated)
2022-07-06 17:51:34 +07:00
Bobby Wibowo
9d4c08e460
feat: some env vars support 2022-06-22 13:27:38 +07:00
Bobby
8799189a04
feat: initiate db connection only once
db is now initiated via utilsController, and gets re-used by main
lolisafe.js script and the other controllers

this should now make sure we only have 1 active db connection pool ever

this is a pretty big refactor due to how we used to reference db,
but it should functionally be identical
2022-06-04 04:21:56 +07:00
Bobby
ecdeaa8b8a
chore: logger.inspect 2022-05-05 14:33:16 +07:00
Bobby
30b8f0040c
fix: delete album only worked for own albums 2022-05-05 14:30:41 +07:00
Bobby
450bf72e7a
feat: allow mods to actually delete albums 2022-05-05 13:58:54 +07:00
Bobby
39b7d96b8f
feat: static preview of album description markdown
in dashboard's edit album prompt
2022-05-05 13:17:32 +07:00
Bobby Wibowo
cf4a1af209
feat: list albums' total size and zip size 2021-02-12 15:48:40 +07:00
Bobby Wibowo
2addbb7b65
fix: album download throws set headers errors 2021-02-12 12:33:43 +07:00
Bobby Wibowo
991d743ef0
feat: add "files in albums" to albums stats 2021-01-08 11:18:50 +07:00
Bobby Wibowo
a5607c00f6
refactor: make use of improved utils.authorize() 2021-01-08 10:50:25 +07:00
Bobby Wibowo
a816aac1f1
fix: await instead of return in try-catch block
Otherwise uncaught exceptions on errors.
2021-01-08 09:27:38 +07:00
Bobby Wibowo
721c1c84a9
fix: proper status codes in some album apis 2021-01-08 09:22:31 +07:00
Bobby Wibowo
e2143b4d80
refactor: UserError -> ClientError, ServerError
ClientError will default to 400 HTTP error code.
ServerError will default to 500 HTTP error code.

Following the previous commit, these for now are only being used in
albumsController. More will soon follow.

Additionally fixed existing album names can sometimes be re-used when
editing an album.
2021-01-08 08:44:28 +07:00
Bobby Wibowo
ae31033c0c
refactor: init UserError, a custom Error object
This will be used for errors that are to be delivered to users, AND not
to be logged into the server (as in it stacktraces and all).
This will eventually remove the need to throw string literals.

In this commit, this has only been implemented on albumsController.js,
but more will soon to come.
2021-01-08 07:29:14 +07:00
Bobby Wibowo
e85e8e886d
added lolisafe upstream compat to /api/album/:id
it will re-map body of /api/album/get/:id into upstream-compatible body.
prep for lolisafe albums support for magane plugin.

/api/album/:id/:page will stil respond with the old format as that's
what the dashboard use and expect.

list views of uploads, users and albums in dashboard will now show
total items count on the table's top right corner.
2020-12-26 19:54:41 +07:00
Bobby Wibowo
c5647cb8bf
albums sidebar in dashboard is now collapsible
they'll also be collapsed on initial page load

this uses a new client-side dependency, bulma-collapsible
https://github.com/creativebulma/bulma-collapsible

/api/albums to fetch albums list now support simple reply, where only
their ids and names will be returned.
this simple reply will also return all of the user's albums, instead of
being limited to only 9 or 25 entires like before.

fixed add to album in dashboard, and album selector in homepage uploader
being limited to only 25 albums.
2020-12-26 18:49:51 +07:00
Bobby Wibowo
3a0810b0be
updated albumsController.js 2020-12-26 15:32:44 +07:00
Bobby Wibowo
f41e325273
fixed mods editing own albums also disable them 2020-11-01 16:38:36 +07:00
Bobby Wibowo
47dd512910
Removed custom ESLint curly rule
Sigh, why did you do this, past me..?

Also fixed "Delete uploads by names".
2020-10-31 01:12:09 +07:00
Bobby Wibowo
22e6c2c3c6
Updated
Replaced all Array.concat() with spread operator and/or push().
Fixed some faulty search logics when using exclusion filters.
Fixed capitalization of mac font in _variables.scss. Stylelint somehow
fricked up again in my previous commit.
2020-10-11 17:32:22 +07:00
Bobby Wibowo
8b4b0e79c5
Improved albums public page cache and more
Removed its dependency towards albums' editedAt property.
Editing album's metas (name, description, etc) will no longer update
its editedAt property.
Instead it will now ONLY be updated when adding/removing files to/from
it. Just like how it was meant to be, which was to be used to check
whether it's necessary to re-generate their downloadable ZIPs.

Albums public page cache will still be properly invalidated when
adding/removing files to/from it, as well as after editing their metas.

Added views/album-notice.njk to be used to render okay-ish notice when
an album's public page is still being generated.
I was originally thinking of using it for disabled albums as well, but
I refrained from it to reduce the possibility of disabled album IDs from
being easily scanned (as it just returns 404 now).

Removed invalidatedAt property from stats cache. Instead their caches
will immediately be nullified as they should (thus frees up memory
slightly as well).

Stats cache for albums will now only be cleared when truly necessary.
As in, adding/removing files to/from albums will no longer clear them.

Updated Nunjucks files to properly use h1, h2, h3 tags in actual
hierarchical orders.
Elements that don't need to use hX tags will now use P instead.
Nothing changes visually, only structurally.

Fixed some elements in Nunjucks using single quotes instead of
double quotes. They'd have worked the same, but consistency.

Added h1 title in FAQ page.

Make text for no JS warning a bit bigger, and improved the phrasing
a little bit.
2020-06-03 10:44:24 +07:00
Bobby Wibowo
5e5d5c5647
Manage albums admin page, and more!
Resolves #194.

Added pagination for Manage your albums page.

Albums sidebar will now only list 9 albums at most.
Use Manage your albums page to view the rest.
Albums in the list will now have View uploads button after all.

Delete album button for albums renamed to Disable album.
Since techincally the server would've always been disabling the albums
instead of deleting them.
It was something upstream dev's decided, and I haven't bothered changing
its behavior.

I'll work on actual Delete album feature some other days.

As the title says, added Manage albums admin page.

Viewing uploads of an album will hook into albumid: filter key.

I'll work on filter and bulk operations some other days.

Updated styling for disabled albums and users.
Instead of havine a line through them, they will be greyed out.
Disable public page of albums will still use line through however.

Links to album's disabled public page are now clickable.

Added a new button styling is-dangerish.
It'll be orange.

Renamed /api/albums/delete to /api/albums/disable.
For backwards compatibility, /api/albums/delete will still work
but automatically re-routed to /api/albums/disable.

/api/uploads/list will no longer print SQLite errors for moderators
or higher when encountering them.
It was originally used to inform moderators of non-existing colum names
when used for sorting.
But on one of the recent commits, I had added a check for allowed colum
names.

Improved some caching in dashboard page.

Added new entries to cookie policy.

Some other small things.

Bumped v1 version string and rebuilt client assets.
2020-06-01 11:44:16 +07:00