Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
chatroom-web-sdk
Advanced tools
npm install -S chatroom-web
import * as uuid from "uuid";
// 引用 SDK
import { SimpleSDK } from "chatroom-sdk/SimpleSDK";
// 引用麦位管理
import { SeatManager } from 'chatroom-sdk/SetaManager';
// 引用麦位类型及常数
import * as seatTypes from 'chatroom-sdk/SeatTypes';
// SDK, config 配置
const config = {
appId = 0, // 申请账号的 app id
signKey = "", // 申请账号的 sign key
isTestEnv = true // 是否使用测试环境
};
const userId = uuid.v4();
const userId2 = uuid.v4();
const token = "";
// SDK, 构建新 SDK 对象
const simpleSDK = new SimpleSDK({ appId: config.appId, isTestEnv: config.isTestEnv });
// 麦位, 构建新麦位管理对象
const manager = new SeatManager({ userId: userId });
// SDK, 设置用户名
simpleSDK.setConfig({ idName: userId });
// 麦位, 设置麦位状态更新回调
manager.onSeatsCenterChange = (seatsCenter, isRemote) => {
if (isRemote) {
console.log("update from remote");
} else {
console.log("update from local");
}
// 麦位, 美化麦位状态, 方便调试和查看
const res = manager.beautiful(seatsCenter);
console.log(res);
// 麦位, 获取当前用户麦位状态
const currSeatStatus = manager.getCurrSeatStatus();
console.log(currSeatStatus);
if (!isRemote) {
const content = JSON.stringify(seatsCenter);
// 麦位, 当本地更新时, 用可靠消息发送新的麦位状态
return simpleSDK.sendReliableMessage(manager.messageType, JSON.stringify(content));
} else {
// 麦位, 返回空 resolve 至回调
return Promise.resolve(0);
}
}
// SDK, 添加可靠消息回调
simpleSDK.addOnRecvReliableMessage((type, seq, data) => {
if (!data) return;
const seatsCenter = JSON.parse(data as string);
if (!seatsCenter[seatTypes.SEATS_Status_KEY]) return;
manager.updateSeatsCenter(seatsCenter);
});
// SDK, 登录房间
await simpleSDK.login({ roomId, token });
const useSeatControls = async () => {
// 上麦
await manager.takeSeat(1);
// 下麦
await manager.leaveSeat();
console.log(manager.getCurrSeatStatus());
// 锁麦
await manager.lockSeat(0);
// 解锁麦位
await manager.unlockSeat(0);
// 关闭麦位
await manager.closeSeat(0);
// 打开麦位
await manager.openSeat(0);
// 静音麦位
await manager.muteSeat(0);
// 取消静音
await manager.unmuteSeat(0);
// 静音所有麦位
await manager.muteAllSeat();
// 取消所有麦位静音
await manager.unmuteAllSeat();
// 抱人上麦
await manager.pickupSeat({ [seatTypes.USER_ID_KEY]: userId2, [seatTypes.USER_NAME_KEY]: userId2 }, 2);
// 抱人下麦
await manager.pickupDownSeat({ [seatTypes.USER_ID_KEY]: userId2, [seatTypes.USER_NAME_KEY]: userId2 }, 2);
};
useSeatControls();
FAQs
```sh npm install -S chatroom-web ```
We found that chatroom-web-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.