diff --git a/Dockerfile b/Dockerfile index 54b6cc33..11a6def2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,7 @@ COPY .git .git # Set UI version RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts" +RUN echo "export const BUILD_DATE_ISO8601 = '$(date -d "+1 year" -u +"%Y-%m-%dT%H:%M:%SZ")';" > "src/shared/build-date.ts" RUN yarn --production --prefer-offline --network-timeout 100000 RUN yarn build:prod diff --git a/dev.dockerfile b/dev.dockerfile index 42d12400..71aa6be6 100644 --- a/dev.dockerfile +++ b/dev.dockerfile @@ -24,6 +24,7 @@ COPY .git .git # Set UI version RUN echo "export const VERSION = 'dev';" > "src/shared/version.ts" +RUN echo "export const BUILD_DATE_ISO8601 = 'dev-build-date';" > "src/shared/build-date.ts" RUN yarn --prefer-offline RUN yarn build:dev @@ -34,4 +35,4 @@ COPY --from=builder /usr/src/app/node_modules /app/node_modules EXPOSE 1234 WORKDIR /app -CMD node dist/js/server.js \ No newline at end of file +CMD node dist/js/server.js diff --git a/src/server/handlers/security-handler.ts b/src/server/handlers/security-handler.ts index 03fcf31a..b9b3bcdb 100644 --- a/src/server/handlers/security-handler.ts +++ b/src/server/handlers/security-handler.ts @@ -1,11 +1,12 @@ import type { Response } from "express"; +import { BUILD_DATE_ISO8601 } from "../../shared/build-date"; export default async ({ res }: { res: Response }) => { res.setHeader("content-type", "text/plain; charset=utf-8"); res.send( `Contact: https://github.com/LemmyNet/lemmy-ui/security/advisories/new - Expires: 2025-01-01T04:59:00.000Z + Expires: ${BUILD_DATE_ISO8601} `, ); }; diff --git a/src/shared/build-date.ts b/src/shared/build-date.ts new file mode 100644 index 00000000..d0aa547a --- /dev/null +++ b/src/shared/build-date.ts @@ -0,0 +1 @@ +export const BUILD_DATE_ISO8601 = "2025-01-19T16:08:27Z";