diff --git a/.env.production b/.env.production index 8ce19de..8cb9be6 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VITE_API_BASE_URL = "http://localhost:4444" \ No newline at end of file +VITE_API_BASE_URL = "https://smapi.test.7games.store" \ No newline at end of file diff --git a/.gitignore b/.gitignore index a547bf3..4fff125 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +*.zip diff --git a/package-lock.json b/package-lock.json index 1e2d48f..625c5ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,13 +13,17 @@ "@vueuse/core": "^13.4.0", "axios": "^1.10.0", "dayjs": "^1.11.13", + "flv.js": "^1.6.2", + "md5": "^2.3.0", "pinia": "^3.0.3", "primevue": "^4.3.5", + "recordrtc": "^5.6.2", "vue": "^3.5.13", "vue-router": "^4.5.1" }, "devDependencies": { "@types/node": "^24.0.3", + "@vitejs/plugin-basic-ssl": "^2.0.0", "@vitejs/plugin-vue": "^5.2.3", "@vue/tsconfig": "^0.7.0", "sass-loader": "^16.0.5", @@ -1395,6 +1399,19 @@ "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0" } }, + "node_modules/@vitejs/plugin-basic-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-2.0.0.tgz", + "integrity": "sha512-gc9Tjg8bUxBVSTzeWT3Njc0Cl3PakHFKdNfABnZWiUgbxqmHDEn7uECv3fHVylxoYgNzAcmU7ZrILz+BwSo3sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "peerDependencies": { + "vite": "^6.0.0" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz", @@ -1790,6 +1807,15 @@ "node": ">= 0.4" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -1866,6 +1892,15 @@ "url": "https://github.com/sponsors/mesqueeb" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, "node_modules/css-tree": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", @@ -2018,6 +2053,12 @@ "node": ">= 0.4" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmmirror.com/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT" + }, "node_modules/esbuild": { "version": "0.25.5", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", @@ -2085,6 +2126,16 @@ "node": ">=8" } }, + "node_modules/flv.js": { + "version": "1.6.2", + "resolved": "https://registry.npmmirror.com/flv.js/-/flv.js-1.6.2.tgz", + "integrity": "sha512-xre4gUbX1MPtgQRKj2pxJENp/RnaHaxYvy3YToVVCrSmAWUu85b9mug6pTXF6zakUjNP2lFWZ1rkSX7gxhB/2A==", + "license": "Apache-2.0", + "dependencies": { + "es6-promise": "^4.2.8", + "webworkify-webpack": "^2.1.5" + } + }, "node_modules/follow-redirects": { "version": "1.15.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", @@ -2304,6 +2355,12 @@ "node": ">=8" } }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "license": "MIT" + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -2402,6 +2459,17 @@ "node": ">= 0.4" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/mdn-data": { "version": "2.12.2", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", @@ -2721,6 +2789,12 @@ "node": ">=8.10.0" } }, + "node_modules/recordrtc": { + "version": "5.6.2", + "resolved": "https://registry.npmmirror.com/recordrtc/-/recordrtc-5.6.2.tgz", + "integrity": "sha512-1QNKKNtl7+KcwD1lyOgP3ZlbiJ1d0HtXnypUy7yq49xEERxk31PHvE9RCciDrulPCY7WJ+oz0R9hpNxgsIurGQ==", + "license": "MIT" + }, "node_modules/rfdc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", @@ -3226,6 +3300,12 @@ "peerDependencies": { "typescript": ">=5.0.0" } + }, + "node_modules/webworkify-webpack": { + "version": "2.1.5", + "resolved": "https://registry.npmmirror.com/webworkify-webpack/-/webworkify-webpack-2.1.5.tgz", + "integrity": "sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==", + "license": "MIT" } } } diff --git a/package.json b/package.json index 45a5d77..d6fae92 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,11 @@ "@vueuse/core": "^13.4.0", "axios": "^1.10.0", "dayjs": "^1.11.13", + "flv.js": "^1.6.2", + "md5": "^2.3.0", "pinia": "^3.0.3", "primevue": "^4.3.5", + "recordrtc": "^5.6.2", "vue": "^3.5.13", "vue-router": "^4.5.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9b3e475..97792bf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,12 +23,21 @@ importers: dayjs: specifier: ^1.11.13 version: 1.11.13 + flv.js: + specifier: ^1.6.2 + version: 1.6.2 + md5: + specifier: ^2.3.0 + version: 2.3.0 pinia: specifier: ^3.0.3 version: 3.0.3(typescript@5.8.3)(vue@3.5.17(typescript@5.8.3)) primevue: specifier: ^4.3.5 version: 4.3.5(vue@3.5.17(typescript@5.8.3)) + recordrtc: + specifier: ^5.6.2 + version: 5.6.2 vue: specifier: ^3.5.13 version: 3.5.17(typescript@5.8.3) @@ -638,6 +647,9 @@ packages: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} + charenc@0.0.2: + resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -663,6 +675,9 @@ packages: resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} engines: {node: '>=12.13'} + crypt@0.0.2: + resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} + css-tree@3.1.0: resolution: {integrity: sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} @@ -722,6 +737,9 @@ packages: resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} engines: {node: '>= 0.4'} + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + esbuild@0.25.5: resolution: {integrity: sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==} engines: {node: '>=18'} @@ -745,6 +763,9 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} + flv.js@1.6.2: + resolution: {integrity: sha512-xre4gUbX1MPtgQRKj2pxJENp/RnaHaxYvy3YToVVCrSmAWUu85b9mug6pTXF6zakUjNP2lFWZ1rkSX7gxhB/2A==} + follow-redirects@1.15.9: resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} engines: {node: '>=4.0'} @@ -813,6 +834,9 @@ packages: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} + is-buffer@1.1.6: + resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -847,6 +871,9 @@ packages: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} + md5@2.3.0: + resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==} + mdn-data@2.12.2: resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==} @@ -952,6 +979,9 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + recordrtc@5.6.2: + resolution: {integrity: sha512-1QNKKNtl7+KcwD1lyOgP3ZlbiJ1d0HtXnypUy7yq49xEERxk31PHvE9RCciDrulPCY7WJ+oz0R9hpNxgsIurGQ==} + rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} @@ -1109,6 +1139,9 @@ packages: typescript: optional: true + webworkify-webpack@2.1.5: + resolution: {integrity: sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==} + snapshots: '@ampproject/remapping@2.3.0': @@ -1669,6 +1702,8 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 + charenc@0.0.2: {} + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -1697,6 +1732,8 @@ snapshots: dependencies: is-what: 4.1.16 + crypt@0.0.2: {} + css-tree@3.1.0: dependencies: mdn-data: 2.12.2 @@ -1743,6 +1780,8 @@ snapshots: has-tostringtag: 1.0.2 hasown: 2.0.2 + es6-promise@4.2.8: {} + esbuild@0.25.5: optionalDependencies: '@esbuild/aix-ppc64': 0.25.5 @@ -1783,6 +1822,11 @@ snapshots: dependencies: to-regex-range: 5.0.1 + flv.js@1.6.2: + dependencies: + es6-promise: 4.2.8 + webworkify-webpack: 2.1.5 + follow-redirects@1.15.9: {} form-data@4.0.3: @@ -1846,6 +1890,8 @@ snapshots: dependencies: binary-extensions: 2.3.0 + is-buffer@1.1.6: {} + is-extglob@2.1.1: {} is-glob@4.0.3: @@ -1872,6 +1918,12 @@ snapshots: math-intrinsics@1.1.0: {} + md5@2.3.0: + dependencies: + charenc: 0.0.2 + crypt: 0.0.2 + is-buffer: 1.1.6 + mdn-data@2.12.2: {} mime-db@1.52.0: {} @@ -1970,6 +2022,8 @@ snapshots: dependencies: picomatch: 2.3.1 + recordrtc@5.6.2: {} + rfdc@1.4.1: {} rollup@4.44.0: @@ -2114,3 +2168,5 @@ snapshots: '@vue/shared': 3.5.17 optionalDependencies: typescript: 5.8.3 + + webworkify-webpack@2.1.5: {} diff --git a/src/App.vue b/src/App.vue index acdce28..f0dc5ec 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,17 +1,192 @@ - + diff --git a/src/api/api.ts b/src/api/api.ts index b9b3efe..224aabf 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,15 +1,4 @@ import request from "@/http/request"; -export const getStreamAnswer = async (streamName: string, data: string) => { - return request.post( - `/index/api/webrtc?app=live&stream=${streamName}&type=play`, - data, - { - headers: { - "Content-Type": "text/plain;charset=UTF-8", - }, - } - ); -}; export const openDoorApi = async (port: number, sid: number, token: string) => { return request.post( "/pc/v1/operate/open/door", @@ -38,3 +27,55 @@ export const lockDoorApi = async (type: number, sid: number, token: string) => { } ); }; +export const voiceList = async ( + token +) => { + return request.post( + "/pc/operate/intercom", + { }, + { + headers: { + Authorization: "Bearer " + token, + }, + } + ); +}; +export const setVoiceApi = async (sid,id,cid) => { + return request.get( + "/pc/voice/set", + { + params:{sid,id,cid} + }, + ); +}; +export const exitServerApi = async ( + client_id: number, + store_id: number, + token +) => { + return request.post( + "/pc/v1/end/service", + { client_id, store_id }, + { + headers: { + Authorization: "Bearer " + token, + }, + } + ); +}; +export const speechToTextLogApi = async ( + sid: number, + cid: number, + content: string, + token +) => { + return request.post( + "/pc/speech/to/text", + { sid, cid,content }, + { + headers: { + Authorization: "Bearer " + token, + }, + } + ); +}; \ No newline at end of file diff --git a/src/api/talk.ts b/src/api/talk.ts new file mode 100644 index 0000000..a05f846 --- /dev/null +++ b/src/api/talk.ts @@ -0,0 +1,34 @@ +import talkRequest from "@/http/talkRequest"; + +export function talkLogin(params) { + return talkRequest({ + url: '/api/user/login', + method: 'get', + params: params + }) +} +export function audioStartPlay({deviceId, channelId}) { + return talkRequest({ + method: 'get', + url: '/api/play/start/' + deviceId + '/' + channelId + }) +} +export function broadcastStart({deviceId, channelId, broadcastMode}, accessToken) { + return talkRequest({ + method: 'get', + url: '/api/play/broadcast/' + deviceId + '/' + channelId + "?timeout=30&broadcastMode=" + broadcastMode, + headers:{ + 'access-token': accessToken + } + }) +} + +export function broadcastStop({deviceId, channelId, accessToken}) { + return talkRequest({ + method: 'get', + url: '/api/play/broadcast/stop/' + deviceId + '/' + channelId, + headers:{ + 'access-token': accessToken + } + }) +} \ No newline at end of file diff --git a/src/assets/images/icon_gb.png b/src/assets/images/icon_gb.png new file mode 100644 index 0000000..3c00c4f Binary files /dev/null and b/src/assets/images/icon_gb.png differ diff --git a/src/assets/images/icon_ht.png b/src/assets/images/icon_ht.png new file mode 100644 index 0000000..2a42158 Binary files /dev/null and b/src/assets/images/icon_ht.png differ diff --git a/src/assets/images/icon_km@2x.png b/src/assets/images/icon_km@2x.png new file mode 100644 index 0000000..fdbfbcf Binary files /dev/null and b/src/assets/images/icon_km@2x.png differ diff --git a/src/assets/images/icon_ks@2x.png b/src/assets/images/icon_ks@2x.png new file mode 100644 index 0000000..e2cf2a2 Binary files /dev/null and b/src/assets/images/icon_ks@2x.png differ diff --git a/src/assets/images/icon_yy@2x.png b/src/assets/images/icon_yy@2x.png new file mode 100644 index 0000000..632d650 Binary files /dev/null and b/src/assets/images/icon_yy@2x.png differ diff --git a/src/components/talk.vue b/src/components/talk.vue new file mode 100644 index 0000000..5c0c199 --- /dev/null +++ b/src/components/talk.vue @@ -0,0 +1,180 @@ + + + + \ No newline at end of file diff --git a/src/http/talkRequest.ts b/src/http/talkRequest.ts new file mode 100644 index 0000000..55d44bc --- /dev/null +++ b/src/http/talkRequest.ts @@ -0,0 +1,15 @@ +import axios from 'axios' + +const talkUrl = 'https://audio.test.7games.store' + +// create an axios instance +const service = axios.create({ + baseURL: talkUrl, // url = base url + request url + // withCredentials: true, // send cookies when cross-domain requests + timeout: 30000, // request timeout + headers:{ + 'Access-Control-Allow-Origin':'*' + } +}) + +export default service \ No newline at end of file diff --git a/src/testKey/localhost+2-key.pem b/src/testKey/localhost+2-key.pem new file mode 100644 index 0000000..1f17eb0 --- /dev/null +++ b/src/testKey/localhost+2-key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQD2XjO7qYpeZANM +4F+/kDWkTDBEJkbXeVg8Scix6DY+xxi4pYDpux5frP8eb/0NouGPyfRLf3NXri/8 +wQxHuxjaa1uvDkk2ogV1rCwnfmxbeiUY/fKt6U9ukSP4+mt7mBQxnRxPmoAaD7Vc +09LsL/N7wsnaSOOap9jK9M9lIOnKOdwZbGwT+eemye1b4N+jIAtm6M630vZ0czbL +xmnff8Yp7ibBvQzb8OIj3zJ4GhhZTKYIW+1R1jyY29h+OfYZu2kWseuLCQc7IXGL +5MFZ6N1euCo3RD+hcGo+zQl5ikzPL2CikTyqH/Da1cTzjUnMb02UbH0dCj00zgIe +2j5K9XIXAgMBAAECggEBALDj3EMerOGu74uwAi9ZzJoFthYIYY7uakMHOxk5wFD8 +xKw28MNg/aL2ZEqnX8r9qvSBrWzTuq42u++/cCDEnkidErwzBrA6Tq85io5kwEpB +/gbetvLVdJnPjkODEc8w1zb0NlKVfOq5Yp+e22+H0kuHBUU8VmdBom++rHZQ1mvC +DLb40+XDRLzosGDnZxaTqrbeSOwLBumdmo6RMA2340vgUrnnGroLHgeI1HJZ+rn/ +wEjLseyvGOxS9LPZ9NMWzzBMnerT4dFgPYypG6HvPQ3euSPcqwOmys49Ou6GAdGZ +Fg5AQJCj+wrc9TiZpCdQlOlRNht3qn5o3DO5z4YJIRECgYEA+PJD2GFNpnejkE0U +QCMVZx7T4zLO2+sPEtUbclUzeLJVMRUWY837BonNUatpAALNTbWanP+gDYmzRfAN +Q5Ul/VP/vTO/uWBpWXNhZm4m5eIHuQrcxk4EhzTBTQhsoBBA5TaTvCVdWHD/8Ci2 +nmTAUMMTZf3eRS9VCqzTyf228YkCgYEA/Vk8HUGdOE9SgtluBO0q02ddQHcB1dIG +EaDaCMarxBYfh/pBIJ5KbHSbk2iGhe+KOArKAPAFvohCCJpmsFM9qN9XTBkG6pTK +9N/3jlPSupNGEgyxYgzHQbEfIsL3uzVrYrs087cQn7iFOEBf5o3B18kEnUCON84B +WupO0PbUfp8CgYEAph5jj3w+qJqlFqGYpcPDgHBdy/oXd0C/aj2ydvTLx/qYRoxf +yHGm1JIX5CuRgWRdQ0Gvzpv1XZNJgZ3R/AsGsqjeuo5RnY3sPrhzgjp20mel56CL ++fgNpXtakeDRO24dH9bvdlkolN+yqbtBQSjR/BJwW1qwe1I+WUVCfkNDVKECgYAz +mI/QmYNOa4EvWt64LCDzqvJn5ZS/GiXYQz0EWomyxpqnU8Udwn7/tYPVsozrDAzH +OxNGu5s/4XopTGCrelhtYwbhXZt1/NWUp2RAXTvmeYXkuScLA/U0oMDpkHFpdAip +s9yl4duF28tt2FZvmuEmdC73Y6VTIiZOgLeKgSpnmwKBgQDmqXROzaeXUVM0QZwW +ijwMsgKschvfPvI+6rFstIS22iBbq1SEltiZ2gs2jaRojvWqdaI9y0XojL+jMMB1 +J8OkzFZDszXVwkmBwrv3crUwNiXRTHcjLDEFOsKw0QwH6HSMMlDB4/2uecArT/QL +F0VxBVe6zK9v1Hlbp8NZARTGfw== +-----END PRIVATE KEY----- diff --git a/src/testKey/localhost+2.pem b/src/testKey/localhost+2.pem new file mode 100644 index 0000000..ac5edfe --- /dev/null +++ b/src/testKey/localhost+2.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEgDCCAuigAwIBAgIRANK8atzwJapubUcr/m+aJvkwDQYJKoZIhvcNAQELBQAw +gZsxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTE4MDYGA1UECwwvREVT +S1RPUC00STJPSkJSXFpodWFuWkBERVNLVE9QLTRJMk9KQlIgKFpodWFuWikxPzA9 +BgNVBAMMNm1rY2VydCBERVNLVE9QLTRJMk9KQlJcWmh1YW5aQERFU0tUT1AtNEky +T0pCUiAoWmh1YW5aKTAeFw0yNTA3MDEwMTI4MDZaFw0yNzEwMDEwMTI4MDZaMGMx +JzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTE4MDYGA1UE +CwwvREVTS1RPUC00STJPSkJSXFpodWFuWkBERVNLVE9QLTRJMk9KQlIgKFpodWFu +WikwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD2XjO7qYpeZANM4F+/ +kDWkTDBEJkbXeVg8Scix6DY+xxi4pYDpux5frP8eb/0NouGPyfRLf3NXri/8wQxH +uxjaa1uvDkk2ogV1rCwnfmxbeiUY/fKt6U9ukSP4+mt7mBQxnRxPmoAaD7Vc09Ls +L/N7wsnaSOOap9jK9M9lIOnKOdwZbGwT+eemye1b4N+jIAtm6M630vZ0czbLxmnf +f8Yp7ibBvQzb8OIj3zJ4GhhZTKYIW+1R1jyY29h+OfYZu2kWseuLCQc7IXGL5MFZ +6N1euCo3RD+hcGo+zQl5ikzPL2CikTyqH/Da1cTzjUnMb02UbH0dCj00zgIe2j5K +9XIXAgMBAAGjdjB0MA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcD +ATAfBgNVHSMEGDAWgBQoaqXU0ZpMm2M3AEdr+rOiND9aMTAsBgNVHREEJTAjggls +b2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAEwDQYJKoZIhvcNAQELBQAD +ggGBAESPMqHz9OMSgNk4uiTHUxtEnDnmrGN1rNHSz+5ZvVexIt4OPlhh+X/TDmQ3 +vjkdF1UyG8RIqJ7N3sNgPIBj4fW48skWhLU1NZtrUWCxRmveZXsDqPDmx+AErSCR +/XySMr4dn07GLh/cbWr6mLn5/2PMaSC8YJtMLMkmEHiBttaTNAnC7JUu3epu0iQY +shCEpu+UKpX3WiTDitS5KzcPTgH7xLuLVFANwnkP+KGge96WrZ5AA10Uq41eW2Ir +JHkQfKqt+k2gK0donZTbCRoWoI//uirnNcWtybZegVAgzv75UdlDkOfdQMNSYzBR +qfvb7YcBv/2f+YKoGxGPjilIxg7cphPhX4SH1EzuTY6zxLHrOdGRzks701R3D15g +Xv37oOJTcjpqWWCVPnGreNfAR9W3Hl8WMPHfnSxid4823XwFEjDnHvGOFBcKLp1P +zSAWZnQp0vgfpMrCwPx3QH0ZxM7gN/Ff2rhrYzmdXn1vdGmO2NDeU6Lw/ScP1qKl +G72f4w== +-----END CERTIFICATE----- diff --git a/src/utils/utils.ts b/src/utils/utils.ts new file mode 100644 index 0000000..033fa8e --- /dev/null +++ b/src/utils/utils.ts @@ -0,0 +1,10 @@ +export function chunkArray(arr: T[], size: number): T[][] { + const result: T[][] = []; + let index = 0; + + while (index < arr.length) { + result.push(arr.slice(index, index + size)); + index += size; + } + return result; +} \ No newline at end of file diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index 842f18b..302549a 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -5,6 +5,7 @@ export class WebSocketClient { oncelisteners: any; breathCount: number; eventKey: string; + breathTimer: any; constructor(url: string, eventKey: string = "type") { this.breathCount = 0; this.ws = null; @@ -21,6 +22,7 @@ export class WebSocketClient { this.ws = new WebSocket(this.url); this.ws.onopen = () => { console.log("WebSocket connected"); + this.breath() resolve("连接成功"); call&&call(this); // this.breath(); @@ -90,8 +92,21 @@ export class WebSocketClient { this.send(types, data); await this.once(types, call); } - + breath(){ + if(this.breathTimer){ + clearInterval(this.breathTimer) + } + this.breathTimer = setInterval(()=>{ + if(this.ws.readyState===WebSocket.OPEN){ + console.log(11) + this.send('breath',{}) + }else{ + this.connect() + } + },5000) + } disconnect() { this.ws.close(); + clearInterval(this.breathTimer) } } diff --git a/uno.config.ts b/uno.config.ts index 9013e22..7f7e177 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -2,4 +2,10 @@ import { defineConfig } from 'unocss' export default defineConfig({ // ...UnoCSS options + theme:{ + breakpoints:{ + md:'1000px', + sm:"600px" + } + } }) \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 3ec8153..b909c43 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,18 +3,36 @@ import vue from "@vitejs/plugin-vue"; import UnoCSS from "unocss/vite"; // import basicSsl from "@vitejs/plugin-basic-ssl"; import { resolve } from "path"; +import fs from 'fs' // https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()); console.log(env); + + return { + build: { + chunkSizeWarningLimit: 1500, + rollupOptions: { + output: { + manualChunks: { + flv: ['flv.js'], + primevue: ['primevue'], + webrtc: ['@/utils/websocket'] + } + } + } + }, plugins: [vue(), UnoCSS(), // basicSsl() ], server: { port: 4444, host: "0.0.0.0", - // https: true as unknown as any, + https: { + key: fs.readFileSync(resolve(__dirname, 'src/testKey/localhost+2-key.pem')), + cert: fs.readFileSync(resolve(__dirname, 'src/testKey/localhost+2.pem')) + }, proxy: { "/index/api/webrtc": { target: "http://webrtc.test.7games.store",