omnivore/packages/web/next.config.js

288 lines
9.6 KiB
JavaScript
Raw Permalink Normal View History

2023-06-13 14:12:32 +00:00
const ContentSecurityPolicy = `
2023-06-14 04:31:19 +00:00
default-src 'self';
2023-06-13 14:12:32 +00:00
base-uri 'self';
Improving Self-Hosting and Removing 3rd Party dependencies. (#4513) * fix: Library Header layout shift * Bump Github Actions versions. * Self-Hosting Changes * Fix Minio Environment Variable * Just make pdfs successful, due to lack of PDFHandler * Fix issue where flag was set wrong * Added an NGINX Example file * Add some documentation for self-hosting via Docker Compose * Make some adjustments to Puppeteer due to failing sites. * adjust timings * Add start of Mail Service * Fix Docker Files * More email service stuff * Add Guide to use Zapier for Email-Importing. * Ensure that if no env is provided it uses the old email settings * Add some instructions for self-hosted email * Add SNS Endpoints for Mail Watcher * Add steps and functionality for using SES and SNS for email * Uncomment a few jobs. * Added option for Firefox for parser. Was having issues with Chromium on Docker. * Add missing space. Co-authored-by: Russ Taylor <729694+russtaylor@users.noreply.github.com> * Fix some wording on the Guide * update browser extension to handle self-hosted instances * add slight documentation to options page * Fix MV * Do raw handlers for Medium * Fix images in Medium * Update self-hosting/GUIDE.md Co-authored-by: Mike Baker <1426795+mbaker3@users.noreply.github.com> * Update Guide with other variables * Add The Verge to JS-less handlers * Update regex and image-proxy * Update self-hosting/nginx/nginx.conf Co-authored-by: Mike Baker <1426795+mbaker3@users.noreply.github.com> * Update regex and image-proxy * Update self-hosting/docker-compose/docker-compose.yml Co-authored-by: Mike Baker <1426795+mbaker3@users.noreply.github.com> * Fix Minio for Export * Merge to main * Update GUIDE with newer NGINX * Update nginx config to include api/save route * Enable Native PDF View for PDFS * Enable Native PDF View for PDFS * feat:lover packages test * feat:working build * feat:alpine build * docs:api dockerfile docs * Write a PDF.js wrapper to replace pspdfkit * Revert changes for replication, set settings to have default mode * build folder got removed due to gitignore on pdf * Add Box shadow to pdf pages * Add Toggle for Progress in PDFS, enabled native viewer toggle * Update node version to LTS * Update node version to LTS * Fix Linting issues * Fix Linting issues * Make env variable nullable * Add touchend listener for mobile * Make changes to PDF for mobile * fix(android): change serverUrl to selfhosted first * feat:2 stage alpine content fetch * feat:separated start script * fix:changed to node 22 * Add back youtube functionality and add guide * trigger build * Fix cache issue on YouTube * Allow empty AWS_S3_ENDPOINT * Allow empty AWS_S3_ENDPOINT * Add GCHR for all images * Add GCHR For self hosting. * Add GCHR For self hosting. * Test prebuilt. * Test prebuilt * Test prebuilt... * Fix web image * Remove Web Image (For now) * Move docker-compose to images * Move docker-compose files to correct locations * Remove the need for ARGS * Update packages, and Typescript versions * Fix * Fix issues with build on Web * Correct push * Fix Linting issues * Fix Trace import * Add missing types * Fix Tasks * Add information into guide about self-build * Fix issues with PDF Viewer --------- Co-authored-by: keumky2 <keumky2@woowahan.com> Co-authored-by: William Theaker <wtheaker@nvidia.com> Co-authored-by: Russ Taylor <729694+russtaylor@users.noreply.github.com> Co-authored-by: David Adams <david@dadams2.com> Co-authored-by: Mike Baker <1426795+mbaker3@users.noreply.github.com> Co-authored-by: m1xxos <66390094+m1xxos@users.noreply.github.com> Co-authored-by: Adil <mr.adil777@gmail.com>
2025-01-27 12:33:16 +00:00
connect-src 'self' ${process.env.NEXT_PUBLIC_SERVER_BASE_URL} https://proxy-prod.omnivore-image-cache.app https://accounts.google.com https://proxy-demo.omnivore-image-cache.app https://storage.googleapis.com https://widget.intercom.io https://api-iam.intercom.io https://static.intercomassets.com https://downloads.intercomcdn.com https://platform.twitter.com wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io wss://nexus-europe-websocket.intercom.io wss://nexus-australia-websocket.intercom.io https://uploads.intercomcdn.com https://tools.applemediaservices.com wss://www.tiktok.com *.sentry.io 127.0.0.1 http://localhost:1010;
2023-08-10 03:14:17 +00:00
font-src 'self' data: https://cdn.jsdelivr.net https://js.intercomcdn.com https://fonts.intercomcdn.com;
2024-03-13 10:45:26 +00:00
form-action 'self' ${process.env.NEXT_PUBLIC_SERVER_BASE_URL} https://getpocket.com/auth/authorize https://intercom.help https://api-iam.intercom.io https://api-iam.eu.intercom.io https://api-iam.au.intercom.io https://www.notion.so https://api.notion.com;
2023-06-13 14:12:32 +00:00
frame-ancestors 'none';
frame-src 'self' https://accounts.google.com https://platform.twitter.com https://www.youtube.com https://www.youtube-nocookie.com https://www.google.com/recaptcha/ https://recaptcha.google.com/recaptcha/ https://www.recaptcha.net https://www.tiktok.com;
2023-06-14 03:29:56 +00:00
manifest-src 'self';
2024-08-22 02:41:57 +00:00
script-src 'self' 'unsafe-inline' 'unsafe-eval' accounts.google.com https://widget.intercom.io https://js.intercomcdn.com https://platform.twitter.com https://cdnjs.cloudflare.com https://cdn.jsdelivr.net https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://www.recaptcha.net https://www.gstatic.cn/ https://*.neutral.ttwstatic.com https://www.tiktok.com/embed.js https://browser.sentry-cdn.com https://js.sentry-cdn.com;
style-src 'self' 'unsafe-inline' https://accounts.google.com https://cdnjs.cloudflare.com https://*.neutral.ttwstatic.com;
2023-06-14 04:31:19 +00:00
img-src 'self' blob: data: https:;
worker-src 'self' blob:;
2023-07-28 06:56:29 +00:00
media-src https://js.intercomcdn.com;
2023-06-13 14:12:32 +00:00
`
2022-02-11 17:24:33 +00:00
const moduleExports = {
fix(): Add network timeout to all yarn installs Bump image-size from 1.2.0 to 1.2.1 (#4567) Bumps [image-size](https://github.com/image-size/image-size) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/image-size/image-size/releases) - [Commits](https://github.com/image-size/image-size/compare/v1.2.0...v1.2.1) --- updated-dependencies: - dependency-name: image-size dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fix(): Add network timeout to all yarn installs fix(): remove node-buffer Bump brace-expansion from 1.1.11 to 1.1.12 in /pkg/admin (#4593) Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.11 to 1.1.12. - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](https://github.com/juliangruber/brace-expansion/compare/1.1.11...v1.1.12) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 1.1.12 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump @babel/runtime-corejs3 from 7.26.0 to 7.28.2 (#4592) Bumps [@babel/runtime-corejs3](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime-corejs3) from 7.26.0 to 7.28.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.28.2/packages/babel-runtime-corejs3) --- updated-dependencies: - dependency-name: "@babel/runtime-corejs3" dependency-version: 7.28.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump next from 13.5.8 to 14.2.30 (#4591) Bumps [next](https://github.com/vercel/next.js) from 13.5.8 to 14.2.30. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v13.5.8...v14.2.30) --- updated-dependencies: - dependency-name: next dependency-version: 14.2.30 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump axios from 0.27.2 to 0.30.0 (#4590) Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 0.30.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v0.30.0/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.27.2...v0.30.0) --- updated-dependencies: - dependency-name: axios dependency-version: 0.30.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump @babel/runtime from 7.14.6 to 7.28.2 in /pkg/admin (#4589) Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.14.6 to 7.28.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.28.2/packages/babel-runtime) --- updated-dependencies: - dependency-name: "@babel/runtime" dependency-version: 7.28.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump @radix-ui/react-separator from 0.1.4 to 1.1.6 (#4579) Bumps [@radix-ui/react-separator](https://github.com/radix-ui/primitives) from 0.1.4 to 1.1.6. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-separator" dependency-version: 1.1.6 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump http-proxy-middleware from 2.0.7 to 2.0.9 (#4574) Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.7 to 2.0.9. - [Release notes](https://github.com/chimurai/http-proxy-middleware/releases) - [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.9/CHANGELOG.md) - [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.7...v2.0.9) --- updated-dependencies: - dependency-name: http-proxy-middleware dependency-version: 2.0.9 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump @babel/helpers from 7.14.6 to 7.28.2 in /pkg/admin (#4594) Bumps [@babel/helpers](https://github.com/babel/babel/tree/HEAD/packages/babel-helpers) from 7.14.6 to 7.28.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.28.2/packages/babel-helpers) --- updated-dependencies: - dependency-name: "@babel/helpers" dependency-version: 7.28.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump pg and @types/pg (#4547) Bumps [pg](https://github.com/brianc/node-postgres/tree/HEAD/packages/pg) and [@types/pg](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/pg). These dependencies needed to be updated together. Updates `pg` from 8.13.1 to 8.13.3 - [Changelog](https://github.com/brianc/node-postgres/blob/master/CHANGELOG.md) - [Commits](https://github.com/brianc/node-postgres/commits/pg@8.13.3/packages/pg) Updates `@types/pg` from 8.11.10 to 8.11.11 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/pg) --- updated-dependencies: - dependency-name: pg dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: "@types/pg" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump @graphql-tools/utils from 9.2.1 to 10.8.6 (#4560) Bumps [@graphql-tools/utils](https://github.com/ardatan/graphql-tools/tree/HEAD/packages/utils) from 9.2.1 to 10.8.6. - [Release notes](https://github.com/ardatan/graphql-tools/releases) - [Changelog](https://github.com/ardatan/graphql-tools/blob/master/packages/utils/CHANGELOG.md) - [Commits](https://github.com/ardatan/graphql-tools/commits/@graphql-tools/utils@10.8.6/packages/utils) --- updated-dependencies: - dependency-name: "@graphql-tools/utils" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> chore(): update versions chore(): remove unused workload fix(): kbar dependency fix(): kbar dependency chore(): fix packages fix(): dependencies fix(): dependencies fix(): dependencies fix(): dependencies api fix(): dependencies api fix(): dependencies api chore(): fix order of github fix(): fix tsconfig for liqe
2025-07-29 10:11:08 +00:00
transpilePackages: ["antd", "@ant-design", "rc-util", "rc-pagination", "rc-picker", "rc-notification", "rc-tooltip", "rc-tree", "rc-table"],
2022-02-11 17:24:33 +00:00
images: {
formats: ['image/avif', 'image/webp'],
2022-02-11 17:24:33 +00:00
domains: [
'proxy-demo.omnivore-image-cache.app',
'proxy-dev.omnivore-image-cache.app',
'proxy.omnivore-image-cache.app',
],
},
rewrites: () => {
const rewrites = []
if (process.env.INCLUDE_LEGACY_REWRITES) {
rewrites.push(
{
source: '/api/graphql',
2025-09-24 10:37:39 +00:00
destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.work/api/graphql`,
},
{
source: '/api/auth/:path*',
2025-09-24 10:37:39 +00:00
destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.work/api/auth/:path*`,
},
{
source: '/api/article/save',
2025-09-24 10:37:39 +00:00
destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.work/api/article/save`,
},
{
source: '/api/mobile-auth/:path*',
2025-09-24 10:37:39 +00:00
destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.work/api/mobile-auth/:path*`,
}
)
}
2024-07-30 10:36:57 +00:00
rewrites.push({
source: '/home',
destination: '/l/home',
})
rewrites.push({
source: '/library',
destination: '/l/library',
})
rewrites.push({
source: '/subscriptions',
destination: '/l/subscriptions',
})
rewrites.push({
source: '/highlights',
destination: '/l/highlights',
})
rewrites.push({
source: '/subscriptions',
destination: '/l/subscriptions',
})
rewrites.push({
source: '/search',
destination: '/l/search',
})
2024-07-30 10:36:57 +00:00
rewrites.push({
source: '/archive',
destination: '/l/archive',
})
rewrites.push({
source: '/trash',
destination: '/l/trash',
})
return rewrites
},
2023-06-14 04:31:19 +00:00
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim(),
},
],
},
2023-10-27 02:55:47 +00:00
]
2023-06-14 04:31:19 +00:00
},
2022-02-11 17:24:33 +00:00
async redirects() {
return [
{
source: '/feedback',
destination: '/support',
permanent: true,
},
{
source: '/contact',
destination: '/support',
permanent: true,
},
{
2023-08-07 03:52:25 +00:00
source: '/settings/rss',
destination: '/settings/feeds',
permanent: true,
},
{
source: '/settings/rss/add',
destination: '/settings/feeds/add',
permanent: true,
},
{
source: '/settings/subscriptions/newsletters',
destination: '/settings/emails',
permanent: true,
},
2022-02-11 17:24:33 +00:00
{
2022-02-27 01:32:12 +00:00
source: '/static/icons/favicon-dark.ico',
2022-02-11 17:24:33 +00:00
destination: '/favicon-dark.ico',
permanent: true,
},
{
2022-02-27 01:32:12 +00:00
source: '/static/icons/favicon-light.ico',
2022-02-11 17:24:33 +00:00
destination: '/favicon.ico',
permanent: true,
},
{
source: '/static/icons/pwa/default-large.png',
destination: '/pwa-512.png',
permanent: true,
},
{
source: '/static/icons/pwa/default-maskable-large.png',
destination: '/pwa-maskable-512.png',
permanent: true,
},
{
source: '/static/icons/pwa/default-maskable.png',
destination: '/pwa-maskable-192.png',
permanent: true,
},
{
source: '/static/icons/pwa/default.png',
destination: '/pwa-192.png',
permanent: true,
},
{
source: '/static/icons/pwa/icon-default.png',
destination: '/pwa-maskable-192.png',
permanent: true,
},
{
source: '/SECURITY.md',
destination: '/.well-known/security.txt',
permanent: true,
},
{
source: '/security.md',
destination: '/.well-known/security.txt',
permanent: true,
},
{
source: '/security.txt',
destination: '/.well-known/security.txt',
permanent: true,
},
{
source: '/hackers.txt',
destination: '/.well-known/security.txt',
permanent: true,
},
{
source: '/.well-known/security.txt',
destination: '/static/well-known/security.txt',
permanent: true,
},
2023-04-26 14:03:19 +00:00
{
source: '/privacy',
2025-09-24 10:37:39 +00:00
destination: 'https://docs.omnivore.work/about/privacy-policy',
2023-04-26 14:03:19 +00:00
permanent: true,
},
2022-02-11 17:24:33 +00:00
{
source: '/install/chrome',
destination:
2024-05-20 05:52:07 +00:00
'https://chromewebstore.google.com/detail/omnivore/blkggjdmcfjdbmmmlfcpplkchpeaiiab',
2022-02-11 17:24:33 +00:00
permanent: true,
},
{
source: '/install/firefox',
destination: 'https://addons.mozilla.org/en-US/firefox/addon/omnivore/',
permanent: true,
},
{
source: '/install/edge',
destination:
'https://microsoftedge.microsoft.com/addons/detail/omnivore/ipebjboljeobckndaookadioffchlnih',
permanent: true,
},
{
source: '/install/ios',
destination:
'https://apps.apple.com/us/app/omnivore-read-highlight-share/id1564031042',
permanent: true,
},
{
source: '/install/mac',
destination:
'https://apps.apple.com/us/app/omnivore-read-highlight-share/id1564031042',
permanent: true,
},
2023-07-13 10:49:09 +00:00
{
source: '/install/macos',
destination:
'https://apps.apple.com/us/app/omnivore-read-highlight-share/id1564031042',
permanent: true,
},
2022-02-11 17:24:33 +00:00
{
source: '/install/safari',
destination:
'https://apps.apple.com/us/app/omnivore-read-highlight-share/id1564031042',
permanent: true,
},
{
source: '/install/apple',
destination:
'https://apps.apple.com/us/app/omnivore-read-highlight-share/id1564031042',
permanent: true,
},
2023-01-10 09:33:55 +00:00
{
source: '/install/android',
destination:
'https://play.google.com/store/apps/details?id=app.omnivore.omnivore&pli=1',
permanent: true,
},
2022-02-11 17:24:33 +00:00
]
},
}
2023-02-27 03:39:30 +00:00
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
module.exports = withBundleAnalyzer(moduleExports)
2024-08-20 07:39:35 +00:00
// Injected content via Sentry wizard below
const { withSentryConfig } = require('@sentry/nextjs')
module.exports = withSentryConfig(module.exports, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
org: 'omnivore',
project: process.env.SENTRY_PROJECT,
// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: '/monitoring',
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
})