This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch new-site-dev
in repository https://gitbox.apache.org/repos/asf/pinot-site.git
The following commit(s) were added to refs/heads/new-site-dev by this push:
new ca0e456e Revert "add trailingSlash in next config to handle the
trailing slash in the url (#130)"
ca0e456e is described below
commit ca0e456e5a210a72982cc5d7ea29dce51a8158b7
Author: Xiang Fu <[email protected]>
AuthorDate: Tue Aug 20 02:54:20 2024 -0700
Revert "add trailingSlash in next config to handle the trailing slash in
the url (#130)"
This reverts commit 6e5b8c3ddcf69d737327ddf9d03cebe4b90345eb.
---
app/lib/contentlayer.utils.ts | 4 +--
next.config.js | 63 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/app/lib/contentlayer.utils.ts b/app/lib/contentlayer.utils.ts
index 0eed97d2..25309edc 100644
--- a/app/lib/contentlayer.utils.ts
+++ b/app/lib/contentlayer.utils.ts
@@ -15,7 +15,7 @@ const generateStandardSlug = (doc: LocalDocument) => {
return slug;
};
-const generateStandardPath = (doc: LocalDocument) => {
+const geenrateStandardPath = (doc: LocalDocument) => {
return doc._raw.flattenedPath;
};
@@ -28,4 +28,4 @@ const generateCustomPath = (doc: LocalDocument) => {
return path;
};
-export { generateCustomSlug, generateStandardSlug, generateStandardPath,
generateCustomPath };
+export { generateCustomSlug, generateStandardSlug, geenrateStandardPath,
generateCustomPath };
diff --git a/next.config.js b/next.config.js
index 06b5fd89..37598825 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,8 +1,59 @@
const { withContentlayer } = require('next-contentlayer');
+
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
});
+// You might need to insert additional domains in script-src if you are using
external services
+const ContentSecurityPolicy = `
+ default-src 'self';
+ script-src 'self' 'unsafe-eval' 'unsafe-inline' giscus.app
analytics.umami.is www.youtube.com www.googletagmanager.com
www.google-analytics.com;
+ style-src 'self' 'unsafe-inline';
+ img-src * blob: data:;
+ media-src *.s3.amazonaws.com;
+ connect-src *;
+ font-src 'self';
+ frame-src www.youtube.com youtube.com giscus.app youtu.be;
+`;
+
+const securityHeaders = [
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
+ {
+ key: 'Content-Security-Policy',
+ value: ContentSecurityPolicy.replace(/\n/g, '')
+ },
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
+ {
+ key: 'Referrer-Policy',
+ value: 'strict-origin-when-cross-origin'
+ },
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
+ {
+ key: 'X-Frame-Options',
+ value: 'DENY'
+ },
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
+ {
+ key: 'X-Content-Type-Options',
+ value: 'nosniff'
+ },
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
+ {
+ key: 'X-DNS-Prefetch-Control',
+ value: 'on'
+ },
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
+ {
+ key: 'Strict-Transport-Security',
+ value: 'max-age=31536000; includeSubDomains'
+ },
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
+ {
+ key: 'Permissions-Policy',
+ value: 'camera=(), microphone=(), geolocation=()'
+ }
+];
+
/**
* @type {import('next/dist/next-server/server/config').NextConfig}
**/
@@ -10,7 +61,7 @@ module.exports = () => {
const plugins = [withContentlayer, withBundleAnalyzer];
return plugins.reduce((acc, next) => next(acc), {
output: 'export',
- trailingSlash: true,
+ // distDir: 'dist',
reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
eslint: {
@@ -24,7 +75,15 @@ module.exports = () => {
}
]
},
- webpack: (config) => {
+ // async headers() {
+ // return [
+ // {
+ // source: '/(.*)',
+ // headers: securityHeaders
+ // }
+ // ];
+ // },
+ webpack: (config, options) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack']
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]