Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
import { Message, GroupMessage, Reaction } from "../models/index.js"; | ||
export declare function undoFactory(): (message: Message | GroupMessage | Reaction) => Promise<string | null>; | ||
import { Message, GroupMessage } from "../models/Message.js"; | ||
export declare function undoFactory(): (message: Message | GroupMessage) => Promise<string | null>; |
import { appContext } from "../context.js"; | ||
import { GroupMessage, MessageType } from "../models/index.js"; | ||
import { Message, GroupMessage, MessageType } from "../models/Message.js"; | ||
import { decodeAES, encodeAES, request } from "../utils.js"; | ||
@@ -24,14 +24,12 @@ import { Zalo } from "../index.js"; | ||
throw new Error("User agent is not available"); | ||
// if (!message.data.quote) throw new Error("Message does not have quote"); | ||
// if (message instanceof Message && message.data.uidFrom !== String(message.data.quote.ownerId)) | ||
// throw new Error("You can only undo your own messages"); | ||
console.log("undoing message", message); | ||
if (!message.data.quote) | ||
throw new Error("Message does not have quote"); | ||
if (message instanceof Message && message.data.uidFrom !== String(message.data.quote.ownerId)) | ||
throw new Error("You can only undo your own messages"); | ||
const params = { | ||
// msgId: message.data.quote.globalMsgId, | ||
msgId: message.data.content.rMsg[0].gMsgID, | ||
msgId: message.data.quote.globalMsgId, | ||
clientId: Date.now(), | ||
// cliMsgIdUndo: message.data.quote.cliMsgId, | ||
cliMsgIdUndo: message.data.content.rMsg[0].cMsgID, | ||
cliMsgIdUndo: message.data.quote.cliMsgId, | ||
}; | ||
if (message instanceof GroupMessage || message.isGroup) { | ||
if (message instanceof GroupMessage) { | ||
params["grid"] = message.threadId; | ||
@@ -46,3 +44,3 @@ params["visibility"] = 0; | ||
throw new Error("Failed to encrypt message"); | ||
const response = await request(URLType[message.isGroup ? MessageType.GroupMessage : MessageType.DirectMessage], { | ||
const response = await request(URLType[message.type], { | ||
method: "POST", | ||
@@ -49,0 +47,0 @@ body: new URLSearchParams({ |
import { compare } from "semver"; | ||
import { logger } from "./utils.js"; | ||
import { appContext } from "./context.js"; | ||
const VERSION = "1.1.0"; | ||
const VERSION = "1.1.1"; | ||
const NPM_REGISTRY = "https://registry.npmjs.org/zca-js"; | ||
@@ -6,0 +6,0 @@ export async function checkUpdate() { |
{ | ||
"name": "zca-js", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Unofficial Zalo API for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -27,3 +27,3 @@ # ZCA-JS | ||
{ | ||
selfListen: true, | ||
selfListen: false, | ||
checkUpdate: true, | ||
@@ -48,3 +48,3 @@ }, | ||
{ | ||
selfListen: true, | ||
selfListen: false, | ||
checkUpdate: true, | ||
@@ -58,3 +58,3 @@ }, | ||
- `cookies`: Your Zalo cookies. You can get it by using [J2TEAM Cookies](https://chromewebstore.google.com/detail/j2team-cookies/okpidcojinmlaakglciglbpcpajaibco) extension or by using browser developer tools. | ||
- `imei`: Your IMEI created by Zalo. You can get it using browser developer tools: `localStorage.getItem('z_uuid')`. | ||
- `imei`: Your IMEI created by Zalo. You can get it using browser developer tools: `localStorage.getItem('z_uuid')` or `localStorage.getItem('sh_z_uuid')`. | ||
- `userAgent`: Your browser user agent. Better be from the same browser you get cookies. | ||
@@ -61,0 +61,0 @@ - `selfListen`: Listen for messages sent by yourself. Default is `false`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2742