feat: 添加多个新项目及更新文档

- 新增 GPT_register+duckmail+CPA+autouploadsub2api (DuckMail + OAuth + Sub2Api 注册工具)
- 新增 team_all-in-one (ChatGPT Team 一键注册工具)
- 新增 Code-Patch 项目
- 新增 ABCard 子模块 (ChatGPT Business/Plus 自动开通)
- 新增 cloudflare_temp_email 子模块 (Cloudflare 临时邮箱服务)
- 添加 .gitignore 文件
- 更新 README.md (新增项目导航、子模块说明)
- 添加 CHANGELOG.md
This commit is contained in:
adminlove520
2026-03-19 23:25:34 +08:00
parent 69ba5ab3f5
commit cc691b9fca
43 changed files with 19047 additions and 10 deletions

View File

@@ -0,0 +1,40 @@
import { onUnmounted } from 'vue'
/**
* Composable for managing a WebSocket connection.
* Automatically closes the socket when the component is unmounted.
*
* @param {string} path - Path template, e.g. '/ws/sessions/{id}'
* @param {object} handlers - { onMessage(msg), onError(e) }
* @returns {{ open(id: string|number): void, close(): void }}
*/
export function useWebSocket(path, handlers = {}) {
let ws = null
function open(id) {
close()
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:'
const url = `${proto}//${location.host}${path.replace('{id}', id)}`
ws = new WebSocket(url)
ws.onmessage = (e) => {
const msg = JSON.parse(e.data)
if (msg.type !== 'ping') {
handlers.onMessage?.(msg)
}
}
ws.onerror = (e) => handlers.onError?.(e)
}
function close() {
if (ws) {
ws.close()
ws = null
}
}
onUnmounted(close)
return { open, close }
}