返回提交历史
Modified
g4f/gui/client/qrcode.html
+7
-4
XFEstudio/gpt4free
Fix read qrcode
47fc29a8
代码差异
1 个文件
+7
-4
@@ -69,13 +69,13 @@
69
69
document.getElementById('generateQRCode').addEventListener('click', () => {
70
70
const chat_id = generate_uuid();
71
71
72
const url = `/backend-api/v2/chat/${chat_id}`;
72
const url = `/backend-api/v2/chat/${encodeURI(chat_id)}`;
73
73
fetch(url, {
74
74
method: 'POST',
75
75
headers: {'content-type': 'application/json'},
76
76
body: localStorage.getItem(`conversation:${conversation_id}`)
77
77
});
78
const share = `${new URL(window.location.href).origin}/chat/${encodeURI(chat_id)}/${encodeURI(conversation_id)}`;
78
const share = `${window.location.origin}/chat/${encodeURI(chat_id)}/${encodeURI(conversation_id)}`;
79
79
document.getElementById('qrcode-status').innerText = share;
80
80
document.getElementById("qrcode").innerHTML = '';
81
81
const qrcode = new QRCode(
@@ -114,8 +114,11 @@
114
114
video.srcObject = stream;
115
115
116
116
qrScanner = new QrScanner(videoElem, result => {
117
camStatus.innerText = 'Camera Success: ' + result;
118
console.log('decoded QR code:', result);
117
camStatus.innerText = 'Camera Success: ', result;
118
console.log('decoded QR code:', result.data);
119
if (result.data.startsWith(window.location.origin)) {
120
location.href = result.data;
121
}
119
122
}, {
120
123
highlightScanRegion: true,
121
124
highlightCodeOutline: true,