Skip to content

Commit

Permalink
fix copy in macos and disguise this app to be edge, which pretends ed…
Browse files Browse the repository at this point in the history
…ge protcol
  • Loading branch information
lony2003 authored Jun 14, 2024
1 parent a9ddf28 commit e8495b9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Modified By Team Fangkehou.

You can try the new copilot website by microsoft to get the original experence of BingGPT: https://copilot.microsoft.com/

> __if you like this app, please give me a Star. Thanks!__
## Install

Please go to [Releases page of this repository](https://github.com/fangkehou-team/BingGPT/releases) to get the latest build.
Expand Down
2 changes: 2 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

微软现已推出网页版Copilot,推荐体验!https://copilot.microsoft.com/

> __如果你喜欢这个项目,请给这个项目点一个Star,秋梨膏!__
## 安装

请前往 [Releases 页面](https://github.com/fangkehou-team/BingGPT/releases) 获取最新版本
Expand Down
41 changes: 38 additions & 3 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function getWrapperUrl() {
return VITE_DEV_SERVER_URL;
} else {
return urlUtil.format({
protocol: 'file',
protocol: 'edge',
slashes: true,
pathname: path.join(process.env.DIST, 'index.html')
})
Expand Down Expand Up @@ -97,9 +97,38 @@ function createWindow() {
// Get always on top settings
const alwaysOnTop = config.get('alwaysOnTop')
mainWindow.setAlwaysOnTop(alwaysOnTop)

// Hide main menu (Windows)

// darwin表示macOS,针对macOS的设置 process.platform === 'darwin'
if (process.platform === 'darwin') {
const template = [{
label: '我的应用',
submenu: [
{ label: '关于', accelerator: 'CmdOrCtrl+I', role: 'about' },
{ type: 'separator' },
{ label: '隐藏', role: 'hide' },
{ label: '隐藏其他', role: 'hideOthers' },
{ type: 'separator' },
{ label: '服务', role: 'services' },
{ label: '退出', accelerator: 'Command+Q',role: 'quit' }
]
},
{
label: '编辑',
submenu: [
{ label: '复制', accelerator: 'CmdOrCtrl+C', role: 'copy' },
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', role: 'paste' },
{ label: '剪切', accelerator: 'CmdOrCtrl+X', role: 'cut' },
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', role: 'undo' },
{ label: '重做', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' },
{ label: '全选', accelerator: 'CmdOrCtrl+A', role: 'selectAll' }
]
}]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
} else {
// windows及linux系统 Hide main menu
Menu.setApplicationMenu(Menu.buildFromTemplate([]))
}
// Create context menu
contextMenu({
window: mainWindow.webContents,
Expand Down Expand Up @@ -408,6 +437,12 @@ function createWindow() {
}

app.whenReady().then(() => {

protocol.handle('edge', (request) => {
const filePath = request.url.slice('edge://'.length)
return net.fetch(url.pathToFileURL(path.join(__dirname, filePath)).toString())
})

autoUpdater.autoDownload = false;
autoUpdater.autoInstallOnAppQuit = true;

Expand Down

0 comments on commit e8495b9

Please sign in to comment.