Commit Graph

19 Commits

Author SHA1 Message Date
Bobby
5d3fc64e3b
fix: content-type breaking with hyper-express updates 2024-03-06 07:19:36 +07:00
Bobby
25ca7a6bb7
feat(deps): update hyper-express to ~6.8.5 2023-09-06 18:17:37 +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
65d9a76071
feat: slowly transition to fs-jetpack
controllers/handlers/ServeStatic.js
controllers/middlewares/ServeStaticQuick.js
2022-10-04 04:20:38 +07:00
Bobby
bf077f4aa3
fix: typos in ServeStatic.js 2022-09-21 06:09:27 +07:00
Bobby Wibowo
323c107f64
fix: ServeStatic
init setContentDisposition and setContentType functions immediately as
private functions to reduce complexity

so instead check for the required map/store before using them

also fixed content-type override ending up with duplicate headers
2022-08-01 07:29:49 +07:00
Bobby Wibowo
21ec4a7479
fix: 416 status code handling 2022-07-31 16:46:35 +07:00
Bobby Wibowo
0598a63989
refactor: serve handlers/middlewares
moved shared codes into serveUtils to reduce complexity
2022-07-31 16:34:06 +07:00
Bobby Wibowo
d40d1e396f
fix: ServeStatic with zero bytes files 2022-07-31 14:17:06 +07:00
Bobby Wibowo
b9badcc944
fix: ServeStatic ensure forward slashes path 2022-07-31 14:06:17 +07:00
Bobby Wibowo
681a3ca32f
fix: ServeStatic content-length transfer-encoding
both headers cannot co-exist at the same time, so we pass the expected
content-length value into 2nd param of Response.stream(), so that the
internal can decide to add it only when required
2022-07-29 10:16:49 +07:00
Bobby Wibowo
b9a1604440
refactor: rename handler/middleware class files 2022-07-25 07:48:31 +07:00
Bobby Wibowo
76a73b7e83
refactor: ServeStatic.middleware -> .handler
also moved it from middlewares to handlers directory

reasoning is that this class is better suited to handle routes directly
instead of being a global middleware
since IO stat to check if request path matches a physical file in the
disk every single time is not very performant
2022-07-22 01:12:35 +07:00
Bobby Wibowo
b89945d693
chore: remove controllers/handlers 2022-07-10 19:43:46 +07:00
Bobby
b35f4ae6eb
fix: remove token from local storage if invalid
this required expanding our custom error classes with support for
arbitrary internal api error codes

however it'll only be used for invalid token errors for now (10001)

no plan to assign codes to other existing api errors
at that point it's probably better to redo the whole api infrastructure
2022-05-06 21:58:23 +07:00
Bobby Wibowo
dd55d69612
fix: headers already sent errors 2021-01-09 03:50:03 +07:00
Bobby Wibowo
59efef2d18
refactor: Client/ServerError on authController 2021-01-08 10:11:56 +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