diff --git a/src/api/api.ts b/src/api/api.ts index 329a340..b9b3efe 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -10,15 +10,31 @@ export const getStreamAnswer = async (streamName: string, data: string) => { } ); }; -export const openDoor = async (port: number, sid: number) => { - return request.post("/pc/v1/operate/open/door", { - port, - sid, - }); +export const openDoorApi = async (port: number, sid: number, token: string) => { + return request.post( + "/pc/v1/operate/open/door", + { + port, + sid, + }, + { + headers: { + Authorization: "Bearer " + token, + }, + } + ); }; -export const closeDoor = async (port: number, sid: number) => { - return request.post("/pc/v1/operate/close/door", { - port, - sid, - }); +export const lockDoorApi = async (type: number, sid: number, token: string) => { + return request.post( + "/pc/v1/operate/close/door", + { + type, + sid, + }, + { + headers: { + Authorization: "Bearer " + token, + }, + } + ); }; diff --git a/vite.config.ts b/vite.config.ts index bfbc8ff..3ec8153 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,31 +1,37 @@ import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; import UnoCSS from "unocss/vite"; -import basicSsl from "@vitejs/plugin-basic-ssl"; +// import basicSsl from "@vitejs/plugin-basic-ssl"; import { resolve } from "path"; // https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()); console.log(env); return { - plugins: [vue(), UnoCSS(), basicSsl()], + plugins: [vue(), UnoCSS(), + // basicSsl() + ], server: { port: 4444, host: "0.0.0.0", - https: true as unknown as any, + // https: true as unknown as any, proxy: { "/index/api/webrtc": { - target: "https://webrtc.test.7games.store", + target: "http://webrtc.test.7games.store", secure: false, changeOrigin: true, rewrite: (path) => { console.log(path); return path; }, - "^/test": { - // 改用新前缀测试 - target: "https://www.baidu.com", - changeOrigin: true, + }, + "/pc": { + target: "http://smapi.test.7games.store", + secure: false, + changeOrigin: true, + rewrite: (path) => { + console.log(path); + return path; }, }, },