mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
fix: add new setting item to disable/enable same site property
fixes #55 Signed-off-by: 孙世军 <1083433931@qq.com>
This commit is contained in:
65
.idea/workspace.xml
generated
Normal file
65
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="ALL" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="f1c18c4f-babc-4781-b43e-04591aa61a1f" name="Changes" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/app/api/utils/common.ts" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/utils/common.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/config/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/config/index.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/types/app.ts" beforeDir="false" afterPath="$PROJECT_DIR$/types/app.ts" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="GOROOT" url="file://$USER_HOME$/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.windows-amd64" />
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo"><![CDATA[{
|
||||||
|
"associatedIndex": 2
|
||||||
|
}]]></component>
|
||||||
|
<component name="ProjectId" id="2q3HNCSCdJeZZ7namsPcZjBg684" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||||
|
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||||
|
"RunOnceActivity.go.modules.automatic.dependencies.download": "true",
|
||||||
|
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||||
|
"git-widget-placeholder": "main",
|
||||||
|
"go.import.settings.migrated": "true",
|
||||||
|
"go.sdk.automatically.set": "true",
|
||||||
|
"last_opened_file_path": "D:/my-working-projects/ai-projects/webapp-conversation",
|
||||||
|
"node.js.detected.package.eslint": "true",
|
||||||
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"ts.external.directory.path": "D:\\my-working-projects\\ai-projects\\webapp-conversation\\node_modules\\typescript\\lib",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="bundled-gosdk-33c477a475b1-e0158606a674-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-241.18034.61" />
|
||||||
|
<option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-GO-241.18034.61" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
<component name="VgoProject">
|
||||||
|
<settings-migrated>true</settings-migrated>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { type NextRequest } from 'next/server'
|
import { type NextRequest } from 'next/server'
|
||||||
import { ChatClient } from 'dify-client'
|
import { ChatClient } from 'dify-client'
|
||||||
import { v4 } from 'uuid'
|
import { v4 } from 'uuid'
|
||||||
import { API_KEY, API_URL, APP_ID } from '@/config'
|
import { API_KEY, API_URL, APP_ID, APP_INFO } from '@/config'
|
||||||
|
|
||||||
const userPrefix = `user_${APP_ID}:`
|
const userPrefix = `user_${APP_ID}:`
|
||||||
|
|
||||||
@ -15,7 +15,10 @@ export const getInfo = (request: NextRequest) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const setSession = (sessionId: string) => {
|
export const setSession = (sessionId: string) => {
|
||||||
return { 'Set-Cookie': `session_id=${sessionId}` }
|
if (APP_INFO.disable_session_same_site)
|
||||||
|
return { 'Set-Cookie': `session_id=${sessionId}; SameSite=None; Secure` }
|
||||||
|
|
||||||
|
return { 'Set-Cookie': `session_id=${sessionId}` }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const client = new ChatClient(API_KEY, API_URL || undefined)
|
export const client = new ChatClient(API_KEY, API_URL || undefined)
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export const APP_INFO: AppInfo = {
|
|||||||
copyright: '',
|
copyright: '',
|
||||||
privacy_policy: '',
|
privacy_policy: '',
|
||||||
default_language: 'en',
|
default_language: 'en',
|
||||||
|
disable_session_same_site: false, // set it to true if you want to embed the chatbot in an iframe
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isShowPrompt = false
|
export const isShowPrompt = false
|
||||||
|
|||||||
@ -108,6 +108,7 @@ export type AppInfo = {
|
|||||||
default_language: Locale
|
default_language: Locale
|
||||||
copyright?: string
|
copyright?: string
|
||||||
privacy_policy?: string
|
privacy_policy?: string
|
||||||
|
disable_session_same_site?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Resolution {
|
export enum Resolution {
|
||||||
|
|||||||
Reference in New Issue
Block a user