Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cubewhy committed Jul 5, 2024
1 parent b512c94 commit 36ef08c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,18 @@ <h2>选择服务器</h2>
protocol = "ws://"
}
try {
let ws = new WebSocket(`${protocol}${token}@${host}/ws/messenger`);
ws.onopen(() => {
alert("connected")
})
let socket = new WebSocket(`${protocol}${host}/ws/messenger`);
socket.addEventListener('open', (event) => {
socket.send('Authorization: Bearer ' + token);
});

socket.addEventListener('message', (event) => {
console.log('Received:', event.data);
});
} catch (e) {
localStorage.clear();
sessionStorage.clear();
// window.location.reload();
window.location.reload();
}
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions select-server.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ <h2>Server is unreachable</h2>

<mdui-card class="login-card" variant="filled" style="width: 600px;height: 400px">
<h2 style="text-align: left;padding: 1.2rem">QMessenger Server</h2>
<p>TIP: You must have encrypted connection on Google Chrome.</p>
<p>TIP: 在某些浏览器中你必须使用加密的连接</p>
<mdui-text-field class="login-text-field" style="width: 50%" label="Server address"
helper="Example: qmsg.dev; Lock Icon: use https/wss" helper-on-focus>
helper="不知道填什么就填 backend.lunarclient.top; 锁: 使用加密协议 (wss/https) 进行通信" helper-on-focus>
<mdui-button-icon slot="icon" icon="dns"></mdui-button-icon>
<mdui-button-icon selected class="is-encrypted" selectable icon="lock" slot="end-icon" onClick="document.querySelector('.encrypt-snackbar').open = true"></mdui-button-icon>
</mdui-text-field>
<br>
<mdui-button end-icon="arrow_forward" onClick="checkServer()">
Continue Login
前往登录
</mdui-button>
<!-- <mdui-button variant="outlined" end-icon="help">Help</mdui-button>-->
</mdui-card>
Expand Down

0 comments on commit 36ef08c

Please sign in to comment.