22 Commits

Author SHA1 Message Date
Yiran Lu
402d84e9ee change to more logical environment variable name 2025-04-16 01:01:29 +02:00
Yiran Lu
07955daa1c Allow setting CORS headers 2025-04-15 23:14:01 +02:00
Panagiotis Papadopoulos
a979e87a7f refactor(cookiePath): remove non-working cookiePath option
this option will currently not work => the cookie will never
be set by the server, if you use a different path other than "/"

in order for this to work we would need to introduce some kind of
"custom route prefix", that would make express serve the routes with
the custom prefix — but that kinda falls more into a reverse proxy
job territory.

So let's remove this feature for now and amend the docs on how to
correctly handle the cookies per instance via the reverse proxy.
2025-04-13 10:53:34 +02:00
Jin
c217ccd347 feat: 🎸 remove totp from config 2025-03-28 03:05:04 +01:00
Jin
ae794a562f feat: 🎸 Use config.ini configure 2025-03-25 22:44:59 +01:00
Jin
94cd54f17e feat: 🎸 Use ini file to configure MFA 2025-03-25 22:30:14 +01:00
Panagiotis Papadopoulos
2beaaa95bf chore(prettier): fix code style 2025-03-02 20:47:57 +01:00
Panagiotis Papadopoulos
b692c00b8d feat(config): improve typesafety by definitely returning a number
previously it was either a number like string (in case env or config.ini was used) or a number (the fallback value)

we now parseInt the value -> if any value is NaN (e.g. because it was incorrectly set) it will try with the next, before it uses the fallback value

the strange looking `parseInt(String(process.env.TRILIUM_SESSION_COOKIEMAXAGE))` is required to make TypeScript happy, other variants of trying to get the value into a string were not good enough for typescript :-)

The `String(process.env.TRILIUM_SESSION_COOKIEMAXAGE)` will now either return a number like value or 'undefined' (as string), which parseInt parses into NaN, which is falsy.
2025-02-13 09:46:49 +01:00
Panagiotis Papadopoulos
2a740781cb feat(session_parser): use seconds for setting maxAge and update default value to 21 days
21 days was used in the login route previously, when "remember me" was set
2025-02-13 08:52:05 +01:00
Panagiotis Papadopoulos
53576f5578 feat(config): add Session.cookieMaxAge
allows users to control how long their session will be live, before it expires and they are forced to login again

defaults to 1 day  ("24 * 60 * 60 * 1000") as previously set in sessionParser
2025-02-13 08:21:29 +01:00
Panagiotis Papadopoulos
62f8f8f1a7 refactor(config): rename Cookies to Session
as requested in PR #1155
2025-02-10 19:44:19 +01:00
Panagiotis Papadopoulos
3c8723a404 feat(config): add Cookies.cookiePath option to config
defaults to "/" as previously set by default options
2025-02-10 08:33:31 +01:00
Panagiotis Papadopoulos
2c2a404056 feat(services/config): rename syncProxy to syncServerProxy for naming consistency
backwards compatibility ensured, by still checking the iniConfig for the old value first
2025-01-24 07:45:47 +01:00
Panagiotis Papadopoulos
85c6764864 feat(services/config): add Sync config block and fallback values
original idea of using config-sample.ini for default values
is not backwards compatible unfortunately

fallback values taken from config-sample.ini and directly from other code in this codebase, where these values were set
2025-01-23 23:58:46 +01:00
Panagiotis Papadopoulos
c7bd5e2c67 feat(services/config): add TriliumConfig Type 2025-01-23 23:50:16 +01:00
Panagiotis Papadopoulos
edeaca6d1f feat(services/config): add missing config values
these are used in the codebase, but are not defined in the sample.ini
2025-01-23 20:32:45 +01:00
Panagiotis Papadopoulos
279aa156cf feat(services/config): add possibility to read config from ENV
envToBoolean used to turn "string booleans" into JS booleans
2025-01-23 20:23:31 +01:00
Elian Doran
4cbb529fd4
chore(prettier): fix all files 2025-01-09 18:07:02 +02:00
Elian Doran
ecb8a7f394
server-esm: Change single export to export default 2024-07-18 21:50:12 +03:00
Elian Doran
2750df04a3
server-esm: Change simple library import statements 2024-07-18 21:37:45 +03:00
Elian Doran
35d11cc0d2
server-esm: Change simple local import statements 2024-07-18 21:35:17 +03:00
Elian Doran
cf18e61a33
server-ts: Port ws service & dependencies 2024-02-17 13:32:42 +02:00