-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
962 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@comet/admin": minor | ||
--- | ||
|
||
Hide group title in `CrudMoreActionsMenu` when only one group is present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@comet/cli": minor | ||
--- | ||
|
||
Add option for base64 encoding in `inject-site-configs` command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* eslint-disable no-undef */ | ||
const express = require("express"); | ||
const compression = require("compression"); | ||
const helmet = require("helmet"); | ||
const fs = require("fs"); | ||
|
||
const app = express(); | ||
const port = process.env.APP_PORT ?? 3000; | ||
|
||
let indexFile = fs.readFileSync("./build/index.html", "utf8"); | ||
|
||
// Replace environment variables | ||
indexFile = indexFile.replace(/\$([A-Z_]+)/g, (match, p1) => { | ||
return process.env[p1] || ""; | ||
}); | ||
|
||
app.use(compression()); | ||
app.use( | ||
helmet({ | ||
contentSecurityPolicy: { | ||
directives: { | ||
"script-src": ["'self'", "'unsafe-inline'"], | ||
"img-src": ["'self'", "https:", "data:"], | ||
"default-src": ["'self'", "https:"], | ||
"media-src": ["'self'", "https:"], | ||
"style-src": ["'self'", "https:", "'unsafe-inline'"], | ||
"font-src": ["'self'", "https:", "data:"], | ||
}, | ||
}, | ||
xXssProtection: false, | ||
strictTransportSecurity: { | ||
maxAge: 63072000, | ||
includeSubDomains: true, | ||
preload: true, | ||
}, | ||
}), | ||
); | ||
|
||
app.get("/status/health", (req, res) => { | ||
res.send("OK!"); | ||
}); | ||
|
||
app.use( | ||
express.static("./build", { | ||
index: false, // Don't send index.html for requests to "/" as it will be handled by the fallback route (with replaced environment variables) | ||
setHeaders: (res, path, stat) => { | ||
if (path.endsWith(".js")) { | ||
// The js file is static and the index.html uses a parameter as cache buster | ||
// implemented as suggested by https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#caching_static_assets | ||
res.setHeader("cache-control", "public, max-age=31536000, immutable"); | ||
} else { | ||
// Icons and Fonts could be changed over time, cache for 7d | ||
res.setHeader("cache-control", "public, max-age=604800, immutable"); | ||
} | ||
}, | ||
}), | ||
); | ||
|
||
// As a fallback, route everything to index.html | ||
app.get("*", (req, res) => { | ||
// Don't cache the index.html at all to make sure applications updates are applied | ||
// implemented as suggested by https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#preventing_storing | ||
res.setHeader("cache-control", "no-store"); | ||
res.send(indexFile); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Admin app listening at http://localhost:${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
{ | ||
"name": "comet-demo-admin-server", | ||
"version": "1.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"compression": "^1.7.5", | ||
<<<<<<< HEAD | ||
"express": "^4.21.2", | ||
"helmet": "^7.2.0" | ||
}, | ||
"scripts": { | ||
"serve": "node server.js" | ||
======= | ||
"express": "^4.21.1", | ||
"helmet": "^7.2.0" | ||
}, | ||
"engines": { | ||
"node": "22" | ||
>>>>>>> main | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"use client"; | ||
import { PropsWithData, withPreview } from "@comet/cms-site"; | ||
import { TextLinkBlockData } from "@src/blocks.generated"; | ||
import { filesize } from "filesize"; | ||
import styled from "styled-components"; | ||
|
||
import { LinkBlock } from "./LinkBlock"; | ||
|
||
export const TextLinkBlock = withPreview( | ||
({ data: { link, text } }: PropsWithData<TextLinkBlockData>) => { | ||
if (link.block && link.block.type === "damFileDownload" && "file" in link.block.props && link.block.props.file) { | ||
return <Link data={link}>{`${text} (${filesize(link.block.props.file.size)})`}</Link>; | ||
} | ||
|
||
return <Link data={link}>{text}</Link>; | ||
}, | ||
{ label: "Link" }, | ||
); | ||
|
||
const Link = styled(LinkBlock)` | ||
color: ${({ theme }) => theme.palette.text.primary}; | ||
&:hover { | ||
color: ${({ theme }) => theme.palette.primary.main}; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.