Skip to content

Commit

Permalink
Merge branch 'feat/resource-add-integrity' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
douxc committed Sep 19, 2024
2 parents 0b257c0 + 88125aa commit 46a5c3c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 36 deletions.
16 changes: 0 additions & 16 deletions web/app/components/base/topbar/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Viewport } from 'next'
import I18nServer from './components/i18n-server'
import BrowserInitor from './components/browser-initor'
import SentryInitor from './components/sentry-initor'
import Topbar from './components/base/topbar'
import { getLocaleOnServer } from '@/i18n/server'
import './styles/globals.css'
import './styles/markdown.scss'
Expand Down Expand Up @@ -45,7 +44,6 @@ const LocaleLayout = ({
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}
>
<Topbar />
<BrowserInitor>
<SentryInitor>
<I18nServer>{children}</I18nServer>
Expand Down
13 changes: 8 additions & 5 deletions web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import { NextResponse } from 'next/server'
export function middleware(request: NextRequest) {
const nonce = Buffer.from(crypto.randomUUID()).toString('base64')
// style-src 'self' 'nonce-${nonce}';
const whiteList = 'https://cloud.dify.dev/ https://cloud.dify.ai/ https://analytics.google.com https://googletagmanager.com https://api.github.com'
const csp = process.env.NODE_ENV === 'production' ? `'nonce-${nonce}'` : '\'unsafe-eval\' \'unsafe-inline\''

const cspHeader = `
default-src 'self';
connect-src 'self' https://cloud.dify.dev/ https://cloud.dify.ai/ https://analytics.google.com ;
script-src 'self' ${csp} https://www.googletagmanager.com;
style-src 'self' ${csp};
img-src 'self' blob: data:;
default-src 'self' ${csp} blob: data: ${whiteList};
connect-src 'self' ${csp} blob: data: ${whiteList};
script-src 'self' ${csp} blob: ${whiteList};
style-src 'self' ${csp} ${whiteList};
worker-src 'self' ${csp} blob: ${whiteList};
media-src 'self' ${csp} blob: data: ${whiteList};
img-src 'self' ${csp} blob: data: ${whiteList};
font-src 'self';
object-src 'none';
base-uri 'self';
Expand Down
1 change: 0 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"mermaid": "10.4.0",
"negotiator": "^0.6.3",
"next": "^14.1.1",
"next-nprogress-bar": "^2.3.8",
"pinyin-pro": "^3.23.0",
"qrcode.react": "^3.1.0",
"qs": "^6.11.1",
Expand Down
12 changes: 0 additions & 12 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7271,13 +7271,6 @@ negotiator@^0.6.3:
resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==

next-nprogress-bar@^2.3.8:
version "2.3.11"
resolved "https://registry.npmjs.org/next-nprogress-bar/-/next-nprogress-bar-2.3.11.tgz"
integrity sha512-OjSvsQwgSWa2qBMYO478QreGG9Jt82tr4wTQptmiyzNqqjzHCyKZNkhANnzPrjuFAoelIvmruJuakODofSnvTQ==
dependencies:
nprogress "^0.2.0"

next@^14.1.1:
version "14.2.4"
resolved "https://registry.npmjs.org/next/-/next-14.2.4.tgz"
Expand Down Expand Up @@ -7360,11 +7353,6 @@ npm-run-path@^5.1.0:
dependencies:
path-key "^4.0.0"

nprogress@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz"
integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==

nth-check@^2.0.1:
version "2.1.1"
resolved "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz"
Expand Down

0 comments on commit 46a5c3c

Please sign in to comment.