Skip to content

Commit 01290cd

Browse files
committed
update
1 parent cadc62d commit 01290cd

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ql repo https://github.com/hex-ci/smzdm_script.git "" "env.js|bot.js|sendNotify.
5151
环境变量请使用环境变量列表直接添加,不要使用 `export xxx=""` 这种方式添加环境变量。
5252

5353
* `SMZDM_COOKIE`: 抓包抓到的 Cookie 内容,需要所有 Cookie 内容,多用户可以用 `&` 分隔,或者使用多个同名环境变量。
54-
* `SMZDM_SK`: 这个值是可选值,是从安卓 App 的 `https://user-api.smzdm.com/checkin` 请求参数中抓包抓到的,如果抓到这个值可以填写(强烈建议填写),如果没抓到可以忽略,多用户可以用 `&` 分隔,或者使用多个同名环境变量,顺序要保持与 `SMZDM_COOKIE` 多用户顺序一致。
54+
* `SMZDM_SK`: 这个值是可选值,会自动计算,如果你一定想用自己的,可以抓取,是从安卓 App 的 `https://user-api.smzdm.com/checkin` 请求参数中抓包抓到的,多用户可以用 `&` 分隔,或者使用多个同名环境变量,顺序要保持与 `SMZDM_COOKIE` 多用户顺序一致。
5555
* `SMZDM_USER_AGENT_APP`: 这个值是可选值,是指 APP 的 User-Agent,从 APP 的 API 请求头中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
5656
* `SMZDM_USER_AGENT_WEB`: 这个值是可选值,是指 APP 中访问网页的 User-Agent,一般在 APP 内的转盘网页中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
5757
* `SMZDM_COMMENT`: 如果要完成评论文章的任务请设置这个环境变量,环境变量的内容是评论的文案,文案要大于 10 个汉字,建议用比较个性化的文案,脚本发布评论后会删除这条评论,但是为防止删除失败的情况,请尽量用好一点的文案,防止被判定为恶意灌水。

smzdm_checkin.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,35 +195,42 @@ class SmzdmCheckinBot extends SmzdmBot {
195195
}
196196

197197
function random32() {
198-
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
199-
let result = "";
198+
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
199+
let result = '';
200+
200201
for (let i = 0; i < 32; i++) {
201202
result += chars.charAt(Math.floor(Math.random() * chars.length));
202203
}
204+
203205
return result;
204206
}
205207

206208
function getSk(cookie) {
207209
const matchUserId = cookie.match(/smzdm_id=([^;]*)/);
210+
208211
if (!matchUserId) {
209212
return ''
210213
}
214+
211215
const userId = matchUserId[1];
212216
const deviceId = getDeviceId(cookie);
213217
const key = CryptoJS.enc.Utf8.parse('geZm53XAspb02exN');
214218
const cipherText = CryptoJS.DES.encrypt(userId + deviceId, key, {
215219
mode: CryptoJS.mode.ECB,
216220
padding: CryptoJS.pad.Pkcs7
217221
});
222+
218223
return cipherText.toString();
219224
}
220225

221226
function getDeviceId(cookie) {
222227
const matchDeviceId = cookie.match(/device_id=([^;]*)/);
228+
223229
if (matchDeviceId) {
224-
return matchDeviceId[1]
230+
return matchDeviceId[1];
225231
}
226-
return random32()
232+
233+
return random32();
227234
}
228235

229236
!(async () => {

0 commit comments

Comments
 (0)