diff --git a/README.md b/README.md index 8e5646f..e9e9846 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,9 @@

Frpc-Desktop

- 🎉 Frp 跨平台桌面客户端 支持所有frp版本 + 🎉 FRP跨平台桌面客户端,可视化配置,轻松实现内网穿透!
+ 支持所有frp版本 / 开机自启 / 可视化配置 / 免费开源

diff --git a/electron/api/common.ts b/electron/api/common.ts new file mode 100644 index 0000000..f7ac561 --- /dev/null +++ b/electron/api/common.ts @@ -0,0 +1,15 @@ +import {ipcMain, shell} from "electron"; +import log from "electron-log"; + +export const initCommonApi = () => { + + // 打开链接 + ipcMain.on("common.openUrl", async (event, args) => { + if (args) { + log.info(`打开链接:${args}`) + shell.openExternal(args).then(() => { + }); + + } + }) +} diff --git a/electron/api/github.ts b/electron/api/github.ts index 3c01417..f6adcb4 100644 --- a/electron/api/github.ts +++ b/electron/api/github.ts @@ -203,13 +203,39 @@ export const initGitHubApi = () => { }) /** - * 打开GitHub + * 获取最后版本 */ - ipcMain.on("github.open", () => { - shell.openExternal("https://github.com/luckjiawei/frpc-desktop/issues"); + ipcMain.on("github.getFrpcDesktopLastVersions", async event => { + const request = net.request({ + method: "get", + url: "https://api.github.com/repos/luckjiawei/frpc-desktop/releases/latest" + }); + request.on("response", response => { + let responseData: Buffer = Buffer.alloc(0); + response.on("data", (data: Buffer) => { + responseData = Buffer.concat([responseData, data]); + }); + response.on("end", () => { + versions = JSON.parse(responseData.toString()); + // const borderContent: Electron.WebContents = + // BrowserWindow.getFocusedWindow().webContents; + // const downloadPath = path.join(app.getPath("userData"), "download"); + // log.info(`开始获取frp版本 当前架构:${currArch} 对应frp架构:${frpArch}`) + // const returnVersionsData = versions + // .filter(f => getAdaptiveAsset(f.id)) + // .map(m => { + // const asset = getAdaptiveAsset(m.id); + // if (asset) { + // const absPath = `${downloadPath}/${asset.name}`; + // m.absPath = absPath; + // m.download_completed = fs.existsSync(absPath); + // } + // return m; + // }); + // log.debug(`获取到frp版本:${JSON.stringify(returnVersionsData)}`) + event.reply("github.getFrpcDesktopLastVersionsHook", versions); + }); + }); + request.end(); }) - - electron.ipcMain.on("github.openReleases", () => { - electron.shell.openExternal("https://github.com/luckjiawei/frpc-desktop/releases"); - }); }; diff --git a/electron/main/index.ts b/electron/main/index.ts index 88a9c9f..04c5c33 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -10,6 +10,7 @@ import {initFileApi} from "../api/file"; import {initUpdaterApi} from "../api/update"; import {getConfig} from "../storage/config"; import log from "electron-log"; +import {initCommonApi} from "../api/common"; // The built directory structure // // ├─┬ dist-electron @@ -170,6 +171,7 @@ app.whenReady().then(() => { initFrpcApi(); initLoggerApi(); initFileApi(); + initCommonApi(); // initUpdaterApi(win); }) }); diff --git a/package.json b/package.json index 4cf9376..925dc26 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "Frpc-Desktop", "version": "1.0.6", "main": "dist-electron/main/index.js", - "description": "一个frpc桌面客户端", + "description": "FRP跨平台桌面客户端,可视化配置,轻松实现内网穿透!", "repository": "github:luckjiawei/frpc-desktop", "author": "刘嘉伟 <8473136@qq.com>", "license": "MIT", diff --git a/src/layout/compoenets/LeftMenu.vue b/src/layout/compoenets/LeftMenu.vue index f09c6d6..14987b5 100644 --- a/src/layout/compoenets/LeftMenu.vue +++ b/src/layout/compoenets/LeftMenu.vue @@ -3,7 +3,7 @@ import {computed, defineComponent, onMounted, ref} from "vue"; import {Icon} from "@iconify/vue"; import router from "@/router"; import {RouteRecordRaw} from "vue-router"; -import {ipcRenderer} from "electron"; +import pkg from '../../../package.json'; defineComponent({ name: "AppMain" @@ -28,6 +28,13 @@ const handleMenuChange = (route: any) => { }); }; +const handleOpenGitHubReleases = () => { + // ipcRenderer.send("github.openReleases") + router.push({ + name: "About" + }) +} + onMounted(() => { routes.value = router.options.routes[0].children?.filter( @@ -39,7 +46,7 @@ onMounted(() => {