mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-28 23:31:14 +00:00
Add a year to the build date in code.
This commit is contained in:
parent
1934be7cfc
commit
533a36ffd8
3 changed files with 11 additions and 3 deletions
|
@ -32,7 +32,7 @@ COPY .git .git
|
||||||
|
|
||||||
# Set UI version
|
# Set UI version
|
||||||
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
|
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 echo "export const BUILD_DATE_ISO8601 = '$(date -u +"%Y-%m-%dT%H:%M:%SZ")';" > "src/shared/build-date.ts"
|
||||||
|
|
||||||
RUN yarn --production --prefer-offline --network-timeout 100000
|
RUN yarn --production --prefer-offline --network-timeout 100000
|
||||||
RUN yarn build:prod
|
RUN yarn build:prod
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
import type { Response } from "express";
|
import type { Response } from "express";
|
||||||
import { BUILD_DATE_ISO8601 } from "../../shared/build-date";
|
import { BUILD_DATE_ISO8601 } from "../../shared/build-date";
|
||||||
|
import { parseISO } from "date-fns";
|
||||||
|
|
||||||
export default async ({ res }: { res: Response }) => {
|
export default async ({ res }: { res: Response }) => {
|
||||||
|
const buildDatePlusYear = parseISO(BUILD_DATE_ISO8601);
|
||||||
|
|
||||||
|
// Add a year to the build date
|
||||||
|
buildDatePlusYear.setFullYear(new Date().getFullYear() + 1);
|
||||||
|
|
||||||
|
const yearFromNow = buildDatePlusYear.toISOString();
|
||||||
|
|
||||||
res.setHeader("content-type", "text/plain; charset=utf-8");
|
res.setHeader("content-type", "text/plain; charset=utf-8");
|
||||||
|
|
||||||
res.send(
|
res.send(
|
||||||
`Contact: https://github.com/LemmyNet/lemmy-ui/security/advisories/new
|
`Contact: https://github.com/LemmyNet/lemmy-ui/security/advisories/new
|
||||||
Expires: ${BUILD_DATE_ISO8601}
|
Expires: ${yearFromNow}
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const BUILD_DATE_ISO8601 = "2025-01-19T16:08:27Z";
|
export const BUILD_DATE_ISO8601 = "2024-01-22T13:58:48Z";
|
||||||
|
|
Loading…
Reference in a new issue