-
-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralize definition of the content security policy and add in-app chat
- in-app chat is meant for support requests and currently is only in the settings page, where users are most likely to go if confused IMO
- Loading branch information
Showing
9 changed files
with
78 additions
and
63 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function ContentSecurityPolicy() { | ||
return ( | ||
<meta | ||
httpEquiv="Content-Security-Policy" | ||
content="default-src 'self' https://assets.khoj.dev; | ||
media-src * blob:; | ||
script-src 'self' https://assets.khoj.dev https://app.chatwoot.com 'unsafe-inline' 'unsafe-eval'; | ||
connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; | ||
style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; | ||
img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; | ||
font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; | ||
child-src 'self' https://app.chatwoot.com; | ||
object-src 'none';" | ||
></meta> | ||
); | ||
} |
35 changes: 35 additions & 0 deletions
35
src/interface/web/app/components/chatWoot/ChatwootWidget.tsx
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,35 @@ | ||
"use client"; | ||
|
||
import Script from "next/script"; | ||
|
||
export function ChatwootWidget() { | ||
return ( | ||
<Script | ||
id="chatwoot-widget" | ||
strategy="afterInteractive" | ||
dangerouslySetInnerHTML={{ | ||
__html: ` | ||
window.chatwootSettings = { | ||
position: "right", | ||
type: "standard", | ||
launcherTitle: "Chat with us" | ||
}; | ||
(function(d,t) { | ||
var BASE_URL="https://app.chatwoot.com"; | ||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; | ||
g.src=BASE_URL+"/packs/js/sdk.js"; | ||
g.defer = true; | ||
g.async = true; | ||
s.parentNode.insertBefore(g,s); | ||
g.onload=function(){ | ||
window.chatwootSDK.run({ | ||
websiteToken: '5uV59Ay2pvMJenJary2hvvVM', | ||
baseUrl: BASE_URL | ||
}) | ||
} | ||
})(document,"script"); | ||
`, | ||
}} | ||
/> | ||
); | ||
} |
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