Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6114416b8b | |||
| 5771a182fe | |||
| dfc3f4cd87 | |||
| e0d8849bd1 |
@@ -1,3 +1,4 @@
|
|||||||
.env
|
.env
|
||||||
*/.env
|
*/.env
|
||||||
*.md
|
build
|
||||||
|
node_modules
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Server config
|
# Server config
|
||||||
ACCESS_TOKEN_PRIVATE_KEY=CHANGE_ME_TO_SOMETHING_RANDOM # Used to generate user tokens. Make sure this is pretty random.
|
ACCESS_TOKEN_PRIVATE_KEY=CHANGE_ME_TO_SOMETHING_RANDOM # Used to generate user tokens. Make sure this is pretty random.
|
||||||
TRUSTED_ORIGINS=http://localhost:6568 # Comma separated list of trusted origins. Make sure to include your PUBLIC_URL here.
|
TRUSTED_ORIGINS=http://localhost:6568,http://127.0.0.1:6568 # Comma separated list of trusted origins. Make sure to include your PUBLIC_URL here.
|
||||||
|
|
||||||
# TypeORM specific
|
# TypeORM specific
|
||||||
# Please make sure these match with docker-compose.yml, or your own postgres server.
|
# Please make sure these match with docker-compose.yml, or your own postgres server.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ FROM node:24-trixie-slim AS builder
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci --only=production && npm cache clean --force
|
RUN npm ci && npm cache clean --force
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
FROM node:24-trixie-slim AS production
|
FROM node:24-trixie-slim AS production
|
||||||
|
|||||||
@@ -94,7 +94,10 @@ export async function createLinkHandler(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
// Using locals to retrieve decoded user JWT.
|
// Using locals to retrieve decoded user JWT.
|
||||||
const decodedUser: jwt.JwtDecoded | undefined = res.locals.user?.decoded;
|
// jwt.JwtDecoded when JWT is supplied
|
||||||
|
// undefined if not
|
||||||
|
// null if is invalid (expired)
|
||||||
|
const decodedUser: jwt.JwtDecoded | undefined | null = res.locals.user?.decoded;
|
||||||
const linkService = new LinkService();
|
const linkService = new LinkService();
|
||||||
const subdomainsAllowed: boolean = env.getBool('useSubdomains', true)!;
|
const subdomainsAllowed: boolean = env.getBool('useSubdomains', true)!;
|
||||||
const rewriteStrings: env.RewriteStrings = env.getRewriteStrings();
|
const rewriteStrings: env.RewriteStrings = env.getRewriteStrings();
|
||||||
@@ -114,7 +117,7 @@ export async function createLinkHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let user: User | null = null;
|
let user: User | null = null;
|
||||||
if (decodedUser !== undefined) {
|
if (decodedUser !== undefined && decodedUser !== null) {
|
||||||
// If user is logged in, retrieve the account.
|
// If user is logged in, retrieve the account.
|
||||||
const userService = new UserService();
|
const userService = new UserService();
|
||||||
user = await userService.findById(decodedUser.sub);
|
user = await userService.findById(decodedUser.sub);
|
||||||
|
|||||||
@@ -29,4 +29,4 @@ export type ErrorDTO = {
|
|||||||
// Used to check against reserved names.
|
// Used to check against reserved names.
|
||||||
export const disallowedUriSchema = z
|
export const disallowedUriSchema = z
|
||||||
.string()
|
.string()
|
||||||
.regex(/^(about|assets|healthcheck|kttydocs|panel)/);
|
.regex(/^(about|assets|healthcheck|kttydocs|panel|robots\.txt)/);
|
||||||
|
|||||||
Reference in New Issue
Block a user