Adding an expires date, one year from build date.

This commit is contained in:
Dessalines 2024-01-19 11:15:05 -05:00
parent 1a33cd09be
commit 02026ec661
4 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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
CMD node dist/js/server.js

View file

@ -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}
`,
);
};

1
src/shared/build-date.ts Normal file
View file

@ -0,0 +1 @@
export const BUILD_DATE_ISO8601 = "2025-01-19T16:08:27Z";