修复dify升级造成智能体编辑不能使用的bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
### VITE_h5_client_url=http://10.9.18.138:18900
|
VITE_h5_client_url=http://10.9.18.138:18900
|
||||||
VITE_h5_client_url=https://bqw-120.ii999.live:20038
|
### VITE_h5_client_url=https://bqw-120.ii999.live:20038
|
||||||
#VITE_h5_client_url=http://127.0.0.1:18901
|
#VITE_h5_client_url=http://127.0.0.1:18901
|
||||||
VITE_HsAppCode=1
|
VITE_HsAppCode=1
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ package-lock.json
|
|||||||
.cursor
|
.cursor
|
||||||
./.idea
|
./.idea
|
||||||
./.idea/**
|
./.idea/**
|
||||||
|
.idea/
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export function setupIPC() {
|
|||||||
setStoreValue("token", data.token);
|
setStoreValue("token", data.token);
|
||||||
setStoreValue("dify_access_token:", data.dify_access_token);
|
setStoreValue("dify_access_token:", data.dify_access_token);
|
||||||
setStoreValue("dify_refresh_token", data.dify_refresh_token);
|
setStoreValue("dify_refresh_token", data.dify_refresh_token);
|
||||||
|
setStoreValue("dify_csrf_token", data.dify_csrf_token);
|
||||||
setStoreValue("userInfo", data.userInfo);
|
setStoreValue("userInfo", data.userInfo);
|
||||||
|
|
||||||
setStoreValue("apiUrl", data.apiUrl);
|
setStoreValue("apiUrl", data.apiUrl);
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
|||||||
const origin_url = url
|
const origin_url = url
|
||||||
logger.info('==========createNewWindow')
|
logger.info('==========createNewWindow')
|
||||||
logger.info('==========createNewWindow sandbox',sandbox)
|
logger.info('==========createNewWindow sandbox',sandbox)
|
||||||
|
const csrf_token=getStoreValue("dify_csrf_token")
|
||||||
|
|
||||||
await checkAndApplyDeviceAccessPrivilege()
|
await checkAndApplyDeviceAccessPrivilege()
|
||||||
|
|
||||||
@@ -331,9 +332,24 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
|||||||
registerShortcuts(difyfullScreenWindow)
|
registerShortcuts(difyfullScreenWindow)
|
||||||
})
|
})
|
||||||
|
|
||||||
let code = `localStorage.setItem("IsHsAiApp","IsHsAiApp");localStorage.setItem("console_token","${access_token}");localStorage.setItem("refresh_token","12");`
|
|
||||||
const isAdmin = getStoreValue("isAdmin")
|
|
||||||
const hs_version = getStoreValue("hs_version")
|
const hs_version = getStoreValue("hs_version")
|
||||||
|
|
||||||
|
const cookieStatements = [
|
||||||
|
`document.cookie = "access_token=${access_token}";`,
|
||||||
|
`document.cookie = "refresh_token=${refresh_token}";`,
|
||||||
|
`document.cookie = "csrf_token=${csrf_token}";`,
|
||||||
|
`document.cookie = "hs_version=${hs_version}";`
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const localStorageStatements = [
|
||||||
|
`localStorage.setItem("IsHsAiApp", "IsHsAiApp");`,
|
||||||
|
`localStorage.setItem("console_token", "${access_token}");`,
|
||||||
|
`localStorage.setItem("refresh_token", "12");`
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
let code = `${localStorageStatements}\n${cookieStatements};`;
|
||||||
|
|
||||||
|
const isAdmin = getStoreValue("isAdmin")
|
||||||
let display='';
|
let display='';
|
||||||
|
|
||||||
if (isAdmin==true){
|
if (isAdmin==true){
|
||||||
@@ -356,7 +372,7 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
code=code+`document.cookie="hs_version=${hs_version}";`
|
code=code+`;document.cookie="hs_version=${hs_version}";`
|
||||||
|
|
||||||
difyfullScreenWindow.webContents.on('did-finish-load', () => {
|
difyfullScreenWindow.webContents.on('did-finish-load', () => {
|
||||||
difyfullScreenWindow.webContents
|
difyfullScreenWindow.webContents
|
||||||
|
|||||||
Reference in New Issue
Block a user