
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@wisdomgarden/cloak-plugin-jpush
Advanced tools
CloakPluginJpush 是 Cloak 框架的插件之一,用于在 Cloak 应用中集成极光推送,实现消息推送功能。
本插件底层使用极光官方的 @jg/push
安装 Cloak 框架
@wisdomgarden/cloak
具体细节参考 @wisdomgarden/cloak
安装 CloakPluginJpush 插件
ohpm install @wisdomgarden/cloak-plugin-jpush
npm install @wisdomgarden/cloak-plugin-jpush # optional
在 entry/src/main/ets/entryability/EntryAbility.ets
中引入插件
new Cloak(this, [new CloakPluginJpush(
{
channel: isDebug ? "Development" : "Production",
appKey: "xxxxxx", // 极光 appKey
isDebug,
want: jpushMessageWant ? want : null
}
)]);
在 entry/src/main/module.json5
中配置
{
// ...
"module": {
"abilities": [
{
// ...
"metadata": [
{
"name": "client_id",
// 在 hmos 平台获取到项目下所在应用对应的 client_id(注意不是项目的client_id)
"value": "xxxxx"
}
],
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
},
{
"actions": [
"action.ohos.push.listener"
]
}
]
}
],
}
// ...
}
在 H5 逻辑代码中就可以直接调用该插件
// 示例代码
await Cloak.plugins.Jpush.init();
await Cloak.plugins.Jpush.setAlias(1, 'user123');
如果你使用 Typescript,安装 NPM 包获取类型支持
npm install @wisdomgarden/cloak-plugin-jpush
// 初始化插件
await Cloak.plugins.Jpush.init();
// 设置调试模式
Cloak.plugins.Jpush.setDebugMode(true);
// 监听通知点击事件
Cloak.plugins.Jpush.addEventListener('jpush.openNotification', (event) => {
console.log('用户点击通知:', event);
});
// 监听自定义消息接收事件
Cloak.plugins.Jpush.addEventListener('jpush.receiveMessage', (event) => {
console.log('收到自定义消息:', event);
});
// 获取注册ID
const registrationId = await Cloak.plugins.Jpush.getRegistrationId();
console.log('注册ID:', registrationId);
// 设置别名
const aliasResult = await Cloak.plugins.Jpush.setAlias(1, 'user123');
console.log('设置别名结果:', aliasResult);
// 添加标签
const tagsResult = await Cloak.plugins.Jpush.addTags(1, ['vip', 'level1']);
console.log('添加标签结果:', tagsResult);
interface JpushPlugin extends Plugin {
addEventListener(event: string, handler: (event: ESObject) => void): string;
init(): Promise<boolean>;
setDebugMode(isDebug: boolean): void;
setBadge(badgeNumber: number): void;
getRegistrationId(): Promise<string>;
resumePush(): void;
stopPush(): void;
isPushStopped(): boolean;
setAlias(sequence: number, alias: string): Promise<any>;
getAlias(sequence: number): Promise<any>;
deleteAlias(sequence: number): Promise<any>;
addTags(sequence: number, tags: string[]): Promise<any>;
cleanTags(sequence: number): Promise<any>;
getTags(sequence: number, curr?: number): Promise<any>;
checkTagBindState(sequence: number, tag: string): Promise<any>;
setProcessTimeout(timeout: number): void;
}
jpush.openNotification
: 用户点击通知时触发jpush.receiveMessage
: 收到自定义消息时触发Cloak 是专为 HarmonyOS 设计的混合开发框架,类似 Cordova 和 Capacitor,但具备 更轻量、更高性能 的特性。
该框架可将 Web 应用快速转换为原生应用,同时通过插件机制访问 HarmonyOS 原生能力。
更多关于 Cloak 框架信息,请查看: https://github.com/WisdomGardenInc/Cloak
FAQs
Send HarmonyOS Notification using JPush
The npm package @wisdomgarden/cloak-plugin-jpush receives a total of 2 weekly downloads. As such, @wisdomgarden/cloak-plugin-jpush popularity was classified as not popular.
We found that @wisdomgarden/cloak-plugin-jpush demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.