- 基于 openim-electron-demo 改造:工号+密码登录(自研账号服务)、会话列表/聊天窗/通讯录界面重做
- 文字/语音/文件/图片消息、文件拖拽发送、表情面板、一对一语音通话(LiveKit)
- RTC 令牌对接账号服务带鉴权版 /api/rtc_token(Bearer imToken + {room,identity})
- account-service: CORS Allow-Headers 补 authorization(浏览器/渲染进程跨域调 rtc_token 需要)
- 附本地 mock 账号服务(scripts/mock-account-server.js)与截图联调脚本
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { app, Menu } from "electron";
|
|
import { t } from "i18next";
|
|
import { isMac } from "../utils";
|
|
|
|
const createAppMenu = () => {
|
|
if (isMac) {
|
|
const template: Electron.MenuItemConstructorOptions[] = [
|
|
{
|
|
label: app.getName(),
|
|
submenu: [
|
|
{ label: t("system.about"), role: "about" },
|
|
{ type: "separator" },
|
|
{ label: t("system.hide"), role: "hide" },
|
|
{ type: "separator" },
|
|
{
|
|
label: t("system.quit"),
|
|
click: () => {
|
|
global.forceQuit = true;
|
|
app.quit();
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: t("system.fastKeys"),
|
|
submenu: [
|
|
{ label: t("system.copy"), role: "copy", accelerator: "CmdOrCtrl+C" },
|
|
{ label: t("system.paste"), role: "paste", accelerator: "CmdOrCtrl+V" },
|
|
{ label: t("system.cut"), role: "cut", accelerator: "CmdOrCtrl+X" },
|
|
{ label: t("system.undo"), role: "undo", accelerator: "CmdOrCtrl+Z" },
|
|
{ label: t("system.redo"), role: "redo", accelerator: "CmdOrCtrl+Y" },
|
|
{
|
|
label: t("system.selectAll"),
|
|
role: "selectAll",
|
|
accelerator: "CmdOrCtrl+A",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: t("system.window"),
|
|
role: "window",
|
|
submenu: [
|
|
{ label: t("system.minimize"), role: "minimize", accelerator: "CmdOrCtrl+W" },
|
|
{ label: t("system.close"), role: "close" },
|
|
],
|
|
},
|
|
];
|
|
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
|
} else {
|
|
Menu.setApplicationMenu(null);
|
|
}
|
|
};
|
|
|
|
export default createAppMenu;
|