mergeok
This commit is contained in:
@@ -168,30 +168,36 @@
|
||||
method: 'GET',
|
||||
credentials: 'include' // 包含 Cookie,确保 Flask 可以识别 session
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) return response.json();
|
||||
throw new Error('Failed to fetch session');
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Session data:', data);
|
||||
|
||||
// 在成功获取 session 后创建并插入 iframe
|
||||
const iframe = document.createElement('iframe');
|
||||
const sessionInfo = data
|
||||
iframe.src = '{{vscode_web_url}}/?workspace={{workspace_path}}&folder={{workspace_path}}';
|
||||
iframe.style.width = '100%';
|
||||
iframe.style.height = '99%';
|
||||
|
||||
// 将 iframe 插入到指定的 div 中
|
||||
document.getElementById('vscodeWeb').appendChild(iframe);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching session:', error);
|
||||
});
|
||||
|
||||
|
||||
.then(response => {
|
||||
if (response.ok) return response.json();
|
||||
throw new Error('Failed to fetch session');
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Session data:', data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching session:', error);
|
||||
});
|
||||
|
||||
|
||||
let lastIframe = null;
|
||||
function OpenIframe(){
|
||||
// 在成功获取 session 后创建并插入 iframe
|
||||
const iframe = document.createElement('iframe');
|
||||
const div=document.getElementById('vscodeWeb')
|
||||
if (lastIframe){
|
||||
lastIframe.remove();
|
||||
}
|
||||
|
||||
lastIframe = iframe;
|
||||
|
||||
const sessionInfo = data
|
||||
iframe.src = '{{vscode_web_url}}/?workspace={{workspace_path}}&folder={{workspace_path}}';
|
||||
iframe.style.width = '100%';
|
||||
iframe.style.height = '99%';
|
||||
// 将 iframe 插入到指定的 div 中
|
||||
div.appendChild(iframe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -237,6 +243,8 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="/static/js/chatbox.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user