Commit Graph

1612 Commits

Author SHA1 Message Date
Bobby Wibowo
79631ce624
feat: RateLimiter custom middleware class
this adds new production dependency rate-limiter-flexible

this deprecates old rateLimits option in config

to use the new rate limiters, the new option is named rateLimiters and
rateLimitersWhitelist
please consult config.sample.js

rate limiters will also be now processed before any other middlewares,
as only makes sense
2022-07-12 08:48:09 +07:00
Bobby Wibowo
26ae853362
fix: errorsController
not properly printing errors when headers already sent
2022-07-12 08:05:45 +07:00
Bobby Wibowo
eb4057d10c
chore: don't call next on async middleware
you're not supposed to do that, lmao
2022-07-12 08:04:50 +07:00
Bobby Wibowo
1727499bb1
chore(deps): remove @bobbywibowo/serve-static
said library doesn't really work out of the box with hyper-express

i tried modifying my fork, but it really didn't go well
most likely the required underlying internals are just too different
2022-07-12 06:31:03 +07:00
Bobby Wibowo
b0913eaf59
refactor: ServeStatic custom middleware (WIP)
currently when enabled will force-close lolisafe

i still need to find a decent backend library to make life easier
2022-07-12 06:29:21 +07:00
Bobby Wibowo
21d75f71f3
refactor: some cache-control headers related 2022-07-12 06:27:02 +07:00
Bobby Wibowo
af754d7d71
feat: NunjucksRenderer custom middleware class 2022-07-12 06:24:04 +07:00
Bobby Wibowo
7733967624
refactor: errorsController func names 2022-07-12 06:21:21 +07:00
Bobby Wibowo
8267c60863
chore: merge branch 'safe.fiery.me' into safe.fiery.me-feat/hyper-express 2022-07-10 19:56:21 +07:00
Bobby Wibowo
38d86779ae
refactor: HUGE REFACTOR for hyper-express 2022-07-10 19:46:25 +07:00
Bobby Wibowo
b89945d693
chore: remove controllers/handlers 2022-07-10 19:43:46 +07:00
Bobby Wibowo
5800ec2ad6
feat: init safe.fiery.me-feat/hyper-express 2022-07-10 19:43:26 +07:00
BobbyWibowo
df1cf89a1c dist: rebuilt client assets and bumped v1 version string 2022-07-10 09:28:02 +00:00
Robert Pendell
4324fbccee
fix: correct typo in generated ShareX config (#533)
Should be MultipartFormData instead of MultipartFromData.
2022-07-10 16:27:00 +07:00
Bobby Wibowo
59c023588e
refactor: authController pass errors 2022-07-10 14:24:18 +07:00
Bobby Wibowo
b3a304729f
refactor: uploadController pass errors 2022-07-10 14:20:49 +07:00
Bobby Wibowo
0f47ed76b0
feat: tokenController pass errors 2022-07-10 14:17:59 +07:00
Bobby Wibowo
3a415165b4
feat: utilsController pass errors 2022-07-10 14:15:14 +07:00
Bobby Wibowo
99a7a2a677
refactor: albumsController pass errors
motivation: less try-catch
2022-07-10 14:11:29 +07:00
Bobby Wibowo
d970f1d0a5
feat: errorsController
errors should instead be passed along to express via next(), to let
express call the errorsController
2022-07-10 14:10:59 +07:00
Bobby Wibowo
0977bb3a93
chore: default db file name to db.sqlite3 2022-07-10 12:59:22 +07:00
renovate[bot]
3dfb0bec37
chore(deps): update dependency eslint to ~8.19.0 (#532)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-10 11:56:59 +07:00
renovate[bot]
dcd7e42734
chore(deps): update dependency eslint-plugin-n to ~15.2.4 (#531)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-10 11:56:42 +07:00
renovate[bot]
b99253e78b
chore(deps): update dependency browserslist to ~4.21.1 (#529)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-10 11:56:22 +07:00
renovate[bot]
112cc7c4f1
fix(deps): update dependency systeminformation to v5.11.23 (#530)
https://github.com/sebhildebrandt/systeminformation/issues/705

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-10 11:56:05 +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
b9d0f787d7
feat: improved SimpleDataStore.hold() again
this time uses an internal Set()

this should hopefully be the final iteration of this helper class until
a new "strategy" needs to be added
2022-07-06 17:49:13 +07:00
Bobby
17c863f724
feat: SimpleDataStore.hold() no longer use up size
this means internal Map-store may actually contain more keys than limit,
but only if the extraenous keys are held-keys (i.e. has null value)

this expects that you don't manually set keys with null values into the
store however
2022-07-06 17:14:00 +07:00
Bobby
617dc6a056
feat: pre-hold content-disposition before db query 2022-07-06 16:38:35 +07:00
Bobby
ecb30cd159
feat: SimpleDataStore allow pre-holding key 2022-07-06 16:37:54 +07:00
Bobby Wibowo
d31181b4be
refactor: SimpleDataStore.STRATEGIES 2022-07-03 11:08:00 +07:00
Bobby Wibowo
39aaa25f3f
perf: SimpleDataStore 2022-07-03 11:00:48 +07:00
Bobby Wibowo
8a1ff434d9
feat: in-memory caching of content-disposition
please read config.sample.js
ignore if not serving files with node or not having the option turned on
2022-07-03 10:35:36 +07:00
Bobby Wibowo
ad4c2c2e96
refactor: overrideContentTypes 2022-07-03 10:23:55 +07:00
Bobby Wibowo
1404cf9328
fix: utf-8 filename breaks
https://github.com/expressjs/multer/issues/1104
2022-07-03 10:18:04 +07:00
BobbyWibowo
bd797f2c27 dist: rebuilt client assets and bumped v1 version string 2022-06-30 12:43:03 +00:00
Bobby Wibowo
6ef911538e
fix: home not showing pretty bytes when private 2022-06-30 19:41:47 +07:00
Bobby Wibowo
ab96bd5d99
feat: queue cloudflare purge cache with fastq 2022-06-29 17:52:16 +07:00
Bobby Wibowo
3d2651f07b
fix(deps): temp bind systeminformation@5.11.20
https://github.com/sebhildebrandt/systeminformation/issues/705
2022-06-29 15:47:37 +07:00
Bobby Wibowo
38e673226f
fix: inconsistent size field in DB !! yarn migrate
we used to store number directly into the string size field, and
during the conversion it seemed to always add ".0" at the final string,
probably because the driver or sqlite3 itself assumes float

please run yarn migrate after pulling this commit
if you skip converting the DB, file duplicates check will fail to
function

and in the future im planning to do size statistics in bigint, which
will also fail if not converted
2022-06-29 14:35:00 +07:00
Bobby Wibowo
9d38c431dc
fix: statistics failing to respond on errors 2022-06-29 14:29:47 +07:00
Bobby Wibowo
b117fa9ad1
feat: expose utils to nunjucks templates
also fix nunjucks templates not adhering to env vars overrides for
domains config options, because they attempted to read config directly
2022-06-29 13:58:09 +07:00
BobbyWibowo
de54eb92f2 dist: rebuilt client assets and bumped v1 version string 2022-06-28 06:39:35 +00:00
Bobby
cb2d7b99f7
fix: cache-control was set to all frontend pages
this now properly sets only on the specific pages that deserves to be
cached in cdn

additionally update sample config file to remove warning about
cacheControl option
this is now mature enough to be simply toggled on/off depending on
your own necessity
2022-06-28 13:38:55 +07:00
Bobby
7c4206a4e2
fix: src/js/file.js 2022-06-28 13:36:17 +07:00
BobbyWibowo
4f2cf3123b dist: rebuilt client assets and bumped v1 version string 2022-06-28 06:03:46 +00:00
Bobby
8cbdca4efc
fix: always try to load file as image in info page 2022-06-28 13:02:38 +07:00
renovate[bot]
e55be5ee0a
fix(deps): update dependency sharp to ~0.30.7 (#524)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-28 12:59:13 +07:00
renovate[bot]
bdd17ba103
chore(deps): update dependency postcss-preset-env to ~7.7.2 (#523)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-28 12:57:41 +07:00
renovate[bot]
8da197166d
fix(deps): update dependency systeminformation to ~5.11.22 (#525)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-28 12:57:27 +07:00