让客户端可以使用wss连接

This commit is contained in:
2025-07-20 16:52:48 -07:00
parent 855fc1643a
commit 37a72ec902
2 changed files with 1 additions and 6 deletions

5
app.js
View File

@ -124,11 +124,6 @@ function setupSocketListeners(socket) {
// 添加新服务器 // 添加新服务器
function addServer(name, address) { function addServer(name, address) {
// 验证地址格式
if (!address.startsWith("http://") && !address.startsWith("https://")) {
address = "http://" + address;
}
const newServer = { const newServer = {
name, name,
address: address.replace(/\/$/, ""), // 移除末尾的斜杠 address: address.replace(/\/$/, ""), // 移除末尾的斜杠

View File

@ -96,7 +96,7 @@
<span class="close-modal" id="closeModal">&times;</span> <span class="close-modal" id="closeModal">&times;</span>
<h2>添加服务器</h2> <h2>添加服务器</h2>
<input type="text" id="server-name" placeholder="服务器名称" /> <input type="text" id="server-name" placeholder="服务器名称" />
<input type="text" id="server-address" placeholder="IP地址或域名 (如: http://localhost:3001)" /> <input type="text" id="server-address" placeholder="IP地址或域名 (格式ws/wss://ip/域名)" />
<button class="submit-btn" id="add-server-btn">添加</button> <button class="submit-btn" id="add-server-btn">添加</button>
</div> </div>
</div> </div>