Commit Graph

176 Commits

Author SHA1 Message Date
Bobby
0633f2c78e
chore: temp update client version in dev mode 2022-10-06 02:40:41 +07:00
Bobby
95e5956313
feat: ConfigManager 2022-10-06 02:39:51 +07:00
Bobby
0eb4c243c3
feat: use fs-jetpack in pathsController.js 2022-10-04 05:34:01 +07:00
Bobby
ffe6d6ed88
feat: console log incoming requests on dev mode 2022-09-21 07:44:40 +07:00
Bobby
0cb02a5c6c
feat: allow disabling built-in routes
intenteded for more advanced users
more of a shortcut, since they could always edit the codes themselves

please consult comments in sample config file
2022-09-21 05:53:45 +07:00
Bobby
14a340922c
fix: remove node: prefix in require()
this feature was only later backported to v14.18.0, meanwhile we want to
support the whole v14.x version range
2022-08-24 04:02:37 +07:00
Bobby
414afc7ae6
feat: allow specifying root path in serve classes
when used on non-root paths
2022-08-23 15:12:25 +07:00
Bobby
2b6fd37ba1
feat: use execFile() to parse git commit
does not pointlessly spawn a new shell
2022-08-21 22:16:24 +07:00
Bobby
82937b57db
feat: assert lolisafe process working directory
in case lolisafe is attempted to be ran from elsewhere
2022-08-21 22:15:19 +07:00
Bobby
09fea107f3
feat: env SERVE_STATIC_QUICK=0 yarn start
restore an older behavior of serving static files with
ServeLiveDirectory middleware instead of ServeStaticQuick, in case of
issues with streaming files from disk via createReadStream

if you do encounter this issue, serving uploaded files with node will
likely encounter issues as well, but you can choose to serve them
directly with nginx, etc., so i guess it's not beyond hope
2022-08-21 21:23:14 +07:00
Bobby Wibowo
a6e1943655
chore: init dist static assets before public 2022-07-31 14:49:58 +07:00
Bobby Wibowo
2389974c7d
feat: ServeStaticQuick
chokidar is now a production dependency

please read the comments in ServeStaticQuick.js for a description of
what the class does

public and dist directories are now served with that class by default

before starting hyper-express on the listen port, await for all
ServeLiveDirectory and ServeStaticQuick instances
2022-07-31 14:31:25 +07:00
Bobby Wibowo
bea63b07d8
fix: no-cache cache-control for static assets
when cacheControl is disabled in config

this behavior makes more sense, and will then properly rely on our
internal conditinal GETs handlers and whatnot
2022-07-31 14:10:44 +07:00
Bobby Wibowo
b1566c5abf
refactor: ServeLiveDirectory
ensure forward slashes path

refactored init method

ensure internal res.type is set before attempting to call external
setHeaders function, to allow overrides
2022-07-31 14:08:13 +07:00
Bobby
5fd6685e44
chore: lolisafe.js 2022-07-30 07:53:38 +07:00
Bobby Wibowo
fae28f9aa2
feat: deprecate uploads.cacheFileIdentifiers conf
maintaining it is an unnecessary complexity
it's a feature that doesn't scale too well anyways

also renamed "queryDbForFileCollisions" to
"queryDatabaseForIdentifierMatch"
and updated config description accordingly

this should also now properly free the internal onHold Set
2022-07-29 09:14:55 +07:00
Bobby Wibowo
b9a1604440
refactor: rename handler/middleware class files 2022-07-25 07:48:31 +07:00
Bobby Wibowo
235a1c56e1
refactor: move devmode flag to utils 2022-07-25 07:39:35 +07:00
Bobby Wibowo
6239b0c1e4
refactor: lolisafe.js fs 2022-07-25 07:35:26 +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
fc1783fa12
chore: lolisafe.js 2022-07-22 01:12:41 +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
06178cc2c4
chore: lolisafe.js 2022-07-22 01:09:34 +07:00
Bobby Wibowo
30e9227a78
feat: custom pages use ServeLiveDirectory
they now have conditional GET suppor too
2022-07-22 01:09:17 +07:00
Bobby Wibowo
d6020d81ae
feat: serveStatic with accept-ranges support
for streaming support

and with conditional GET support
2022-07-22 00:01:25 +07:00
Bobby Wibowo
33d0428e74
refactor: unset pattern in / middlewares
not having it set equals to having it be on / pattern to begin with
2022-07-21 23:59:46 +07:00
Bobby Wibowo
e7a15ecc47
feat: custom livedirectory middleware
with conditional gets support
2022-07-21 21:13:46 +07:00
Bobby Wibowo
ad22285661
refactor: res.set -> res.header
res.set() is an expressjs-compat function with unnecessary checks for
our use case
2022-07-21 20:28:10 +07:00
Bobby Wibowo
f0856239c3
feat: warn when deprecated rateLimits is in config 2022-07-14 18:34:50 +07:00
Bobby Wibowo
e82cf714dd
fix: cache-control broken with cloudflare setting 2022-07-12 14:52:46 +07:00
Bobby Wibowo
80d59ff2f0
feat: front-end pages middleware
custom pages may now override any built-in pages on the fly as lolisafe
is running

also added internal persistent cache feature into NunjucksRenderer
front-end pages will now be persistently cached during production
2022-07-12 10:31:59 +07:00
Bobby Wibowo
c95173b323
fix(deps): update hyper-express to ~6.2.5
this fixes headers can have duplicates
2022-07-12 08:56:24 +07:00
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
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
38d86779ae
refactor: HUGE REFACTOR for hyper-express 2022-07-10 19:46:25 +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
617dc6a056
feat: pre-hold content-disposition before db query 2022-07-06 16:38:35 +07:00
Bobby Wibowo
d31181b4be
refactor: SimpleDataStore.STRATEGIES 2022-07-03 11:08:00 +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
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
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
b17b24b159
feat: new page /file/:identifier
this will display all information recorded from the specified file, but
only to the users that own them (it requires token)

this page also has a delete file button, allowing us to provide link to
this page for sharex deletion url option

once again, this is only for authenticated users, and will only show
file that the users own, unless said user is a moderator or higher
2022-06-28 12:03:49 +07:00
Bobby
7463a72840
refactor: lolisafe.js file -> _file 2022-06-28 11:48:22 +07:00
Bobby Wibowo
f37313a84c
fix: verify database dir 2022-06-22 14:23:54 +07:00
Bobby Wibowo
66e44f5eb3
fix: relocate db scripts 2022-06-22 13:54:20 +07:00
Bobby Wibowo
9d4c08e460
feat: some env vars support 2022-06-22 13:27:38 +07:00