新增 pc-client:畅联 PC 端工程(Electron+React,按确认效果图改造,B-59)
- 基于 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)与截图联调脚本
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import OpenIMSDKMain from "@openim/electron-client-sdk";
|
||||
import { WebContents } from "electron";
|
||||
|
||||
export const getLibSuffix = () => {
|
||||
const platform = process.platform;
|
||||
const arch = os.arch();
|
||||
if (platform === "darwin") {
|
||||
return path.join(`mac_${arch === "arm64" ? "arm64" : "x64"}`, "libopenimsdk.dylib");
|
||||
}
|
||||
if (platform === "win32") {
|
||||
return path.join(`win_${arch === "ia32" ? "ia32" : "x64"}`, "libopenimsdk.dll");
|
||||
}
|
||||
return path.join(`linux_${arch === "arm64" ? "arm64" : "x64"}`, "libopenimsdk.so");
|
||||
};
|
||||
|
||||
export const initIMSDK = (webContents: WebContents) =>
|
||||
new OpenIMSDKMain(
|
||||
path.join(global.pathConfig.imsdkLibPath, getLibSuffix()),
|
||||
webContents,
|
||||
);
|
||||
@@ -0,0 +1,4 @@
|
||||
export const isLinux = process.platform == "linux";
|
||||
export const isWin = process.platform == "win32";
|
||||
export const isMac = process.platform == "darwin";
|
||||
export const isProd = !process.env.VITE_DEV_SERVER_URL;
|
||||
@@ -0,0 +1,17 @@
|
||||
import log from "electron-log/main";
|
||||
import { join } from "node:path";
|
||||
import fs from "fs";
|
||||
|
||||
const getLogger = (logsPath: string) => {
|
||||
log.transports.file.level = "debug";
|
||||
log.transports.file.maxSize = 104857600; // max size 100M
|
||||
log.transports.file.format = "[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}";
|
||||
let date = new Date();
|
||||
// let dateStr = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
||||
// log.transports.file.resolvePathFn = () => join(logsPath, `log${dateStr}.log`);
|
||||
log.transports.file.resolvePathFn = () => join(logsPath, `OpenIM.log`);
|
||||
log.initialize({ preload: true });
|
||||
return log.scope("ipcMain");
|
||||
};
|
||||
|
||||
export { getLogger };
|
||||
Reference in New Issue
Block a user