diff --git a/config.example.yml b/config.example.yml index 0c8ed323..fe73e4d0 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,14 +1,15 @@ app: - base_url: http://localhost:3000 + base_url: https://fossorial.io log_level: debug save_logs: false server: external_port: 3000 internal_port: 3001 - internal_hostname: localhost + internal_hostname: pangolin secure_cookies: false session_cookie_name: session + resource_session_cookie_name: resource_session traefik: cert_resolver: letsencrypt @@ -16,16 +17,12 @@ traefik: https_entrypoint: websecure prefer_wildcard_cert: true -badger: - session_query_parameter: __pang_sess - resource_session_cookie_name: resource_session - gerbil: start_port: 51820 - base_endpoint: localhost + base_endpoint: fossorial.io + use_subdomain: false block_size: 16 subnet_group: 10.0.0.0/8 - use_subdomain: true rate_limit: window_minutes: 1 diff --git a/package.json b/package.json index 26a7d454..45a1ad21 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "db:hydrate": "npx tsx scripts/hydrate.ts", "db:studio": "drizzle-kit studio", "build": "mkdir -p dist && next build && node scripts/esbuild.mjs -e server/index.ts -o dist/server.mjs", - "start": "ENVIRONMENT=prod node dist/server.mjs", + "start": "NODE_ENV=development ENVIRONMENT=prod node dist/server.mjs", "email": "email dev --dir server/emails/templates --port 3002" }, "dependencies": { diff --git a/server/config.ts b/server/config.ts index 1314208a..ee1cc3ea 100644 --- a/server/config.ts +++ b/server/config.ts @@ -25,9 +25,6 @@ const environmentSchema = z.object({ secure_cookies: z.boolean(), signup_secret: z.string().optional(), session_cookie_name: z.string(), - }), - badger: z.object({ - session_query_parameter: z.string(), resource_session_cookie_name: z.string(), }), traefik: z.object({ @@ -136,8 +133,6 @@ process.env.FLAGS_EMAIL_VERIFICATION_REQUIRED = parsedConfig.data.flags : "false"; process.env.SESSION_COOKIE_NAME = parsedConfig.data.server.session_cookie_name; process.env.RESOURCE_SESSION_COOKIE_NAME = - parsedConfig.data.badger.resource_session_cookie_name; -process.env.RESOURCE_SESSION_QUERY_PARAM_NAME = - parsedConfig.data.badger.session_query_parameter; + parsedConfig.data.server.resource_session_cookie_name; export default parsedConfig.data; diff --git a/server/routers/badger/verifySession.ts b/server/routers/badger/verifySession.ts index 042713bf..25b212fa 100644 --- a/server/routers/badger/verifySession.ts +++ b/server/routers/badger/verifySession.ts @@ -121,7 +121,7 @@ export async function verifyResourceSession( const resourceSessionToken = sessions[ - `${config.badger.resource_session_cookie_name}_${resource.resourceId}` + `${config.server.resource_session_cookie_name}_${resource.resourceId}` ]; if ((pincode || password) && resourceSessionToken) { diff --git a/server/routers/resource/authWithPassword.ts b/server/routers/resource/authWithPassword.ts index b2a42572..4e1ae35e 100644 --- a/server/routers/resource/authWithPassword.ts +++ b/server/routers/resource/authWithPassword.ts @@ -132,7 +132,7 @@ export async function authWithPassword( token, passwordId: definedPassword.passwordId, }); - const cookieName = `${config.badger.resource_session_cookie_name}_${resource.resourceId}`; + const cookieName = `${config.server.resource_session_cookie_name}_${resource.resourceId}`; const cookie = serializeResourceSessionCookie( cookieName, token, diff --git a/server/routers/resource/authWithPincode.ts b/server/routers/resource/authWithPincode.ts index a89b1584..8d69ede1 100644 --- a/server/routers/resource/authWithPincode.ts +++ b/server/routers/resource/authWithPincode.ts @@ -128,7 +128,7 @@ export async function authWithPincode( token, pincodeId: definedPincode.pincodeId, }); - const cookieName = `${config.badger.resource_session_cookie_name}_${resource.resourceId}`; + const cookieName = `${config.server.resource_session_cookie_name}_${resource.resourceId}`; const cookie = serializeResourceSessionCookie( cookieName, token, diff --git a/server/routers/traefik/getTraefikConfig.ts b/server/routers/traefik/getTraefikConfig.ts index dc2ecb56..b73bc8f7 100644 --- a/server/routers/traefik/getTraefikConfig.ts +++ b/server/routers/traefik/getTraefikConfig.ts @@ -55,11 +55,9 @@ export async function traefikConfigProvider( `http://${config.server.internal_hostname}:${config.server.internal_port}`, ).href, resourceSessionCookieName: - config.badger.resource_session_cookie_name, + config.server.resource_session_cookie_name, userSessionCookieName: config.server.session_cookie_name, - sessionQueryParameter: - config.badger.session_query_parameter, }, }, }, diff --git a/src/app/[orgId]/settings/resources/[resourceId]/connectivity/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/connectivity/page.tsx index 1d8aa2eb..a9df5ae1 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/connectivity/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/connectivity/page.tsx @@ -233,6 +233,24 @@ export default function ReverseProxyTargets(props: { } const columns: ColumnDef[] = [ + { + accessorKey: "method", + header: "Method", + cell: ({ row }) => ( + + ), + }, { accessorKey: "ip", header: "IP Address", @@ -262,24 +280,6 @@ export default function ReverseProxyTargets(props: { /> ), }, - { - accessorKey: "method", - header: "Method", - cell: ({ row }) => ( - - ), - }, // { // accessorKey: "protocol", // header: "Protocol", @@ -368,7 +368,7 @@ export default function ReverseProxyTargets(props: { -
+
- ( - - - IP Address - - - - - - Enter the IP address of the - target. - - - - )} - /> )} /> + ( + + + IP Address + + + + + + Enter the IP address of the + target. + + + + )} + /> { + try { + await api.get(`/resource/${props.resource.id}`); + } catch (e) { setAccessDenied(true); - }); + } if (!accessDenied) { - window.location.href = props.redirect; + window.location.href = constructRedirect(props.redirect); } } diff --git a/src/app/auth/resource/[resourceId]/page.tsx b/src/app/auth/resource/[resourceId]/page.tsx index 6327970f..1c436171 100644 --- a/src/app/auth/resource/[resourceId]/page.tsx +++ b/src/app/auth/resource/[resourceId]/page.tsx @@ -65,9 +65,7 @@ export default async function ResourceAuthPage(props: { if (res && res.data.data.valid) { doRedirect = true; } - } catch (e) { - console.error(e); - } + } catch (e) {} if (doRedirect) { redirect(redirectUrl); @@ -91,7 +89,6 @@ export default async function ResourceAuthPage(props: { console.log(res.data); doRedirect = true; } catch (e) { - console.error(e); userIsUnauthorized = true; } @@ -100,30 +97,28 @@ export default async function ResourceAuthPage(props: { } } - if (userIsUnauthorized && isSSOOnly) { - return ( -
- -
- ); - } - return ( <> -
- -
+ {userIsUnauthorized && isSSOOnly ? ( +
+ +
+ ) : ( +
+ +
+ )} ); }