diff --git a/config/xy.json b/config/xy.json index 890214f..d551d7e 100644 --- a/config/xy.json +++ b/config/xy.json @@ -10,7 +10,7 @@ "publish": [ { "provider": "generic", - "url": "https://meeting-api.23544.com/meeting/update" + "url": "https://meeting-api.23544.com/meeting/update/syzh" } ], "files": [ diff --git a/main.js b/main.js index cd68e13..e1889b0 100644 --- a/main.js +++ b/main.js @@ -11,6 +11,7 @@ const { desktopCapturer, } = require('electron'); const path = require('node:path') +const updateJs = require('./src/utils/package/update') const fs = require('fs'); const Registry = require('winreg'); const { autoUpdater, CancellationToken } = require('electron-updater'); diff --git a/src/components/UpdateModal/index.tsx b/src/components/UpdateModal/index.tsx index e97819b..261327d 100644 --- a/src/components/UpdateModal/index.tsx +++ b/src/components/UpdateModal/index.tsx @@ -1,5 +1,6 @@ import styles from '@/components/UpdateModal/index.module.scss' import ImageUrl from '@/utils/package/imageUrl'; +import { getUpdateUrl } from '@/utils/package/public'; import { Button, Flex, Modal, Progress } from 'antd'; import { forwardRef, useImperativeHandle, useState } from "react"; @@ -22,7 +23,7 @@ const UpdateModal = forwardRef((props: any, ref: any) => { const [updateContent, setUpdateContent] = useState('') // 版本更新内容 function getContent() { - fetch(`https://meeting-api.23544.com/meeting/update/update.txt?t=${+new Date()}`) // 配置服务器地址 + fetch(`${getUpdateUrl(import.meta.env.VITE_ENV)}/update.txt?t=${+new Date()}`) // 配置服务器地址 .then(async response => { if (response.status === 200) { return setUpdateContent(await response.text()) diff --git a/src/utils/package/public.ts b/src/utils/package/public.ts index 82f5aba..0dba0e1 100644 --- a/src/utils/package/public.ts +++ b/src/utils/package/public.ts @@ -53,4 +53,13 @@ export const storageSeeting: any = { color: '0xFFFFFF', // 纯色 sourceIndex: '', // 背景图下标 }, +} + +export const getUpdateUrl = (env: string) => { + switch (env) { + case 'xy': + return 'https://meeting-api.23544.com/meeting/update/syzh' + default: + return 'https://meeting-api.23544.com/meeting/update' + } } \ No newline at end of file diff --git a/src/utils/package/update.js b/src/utils/package/update.js new file mode 100644 index 0000000..bc6fa47 --- /dev/null +++ b/src/utils/package/update.js @@ -0,0 +1,10 @@ +module.exports = { + getUpdateUrl(env) { + switch (env) { + case 'xy': + return 'https://meeting-api.23544.com/meeting/update/syzh' + default: + return 'https://meeting-api.23544.com/meeting/update' + } + } +} \ No newline at end of file