Skip to content

Commit fa6e5df

Browse files
committed
优化: Gleam任务识别
1 parent 4e175d3 commit fa6e5df

19 files changed

+136
-34
lines changed

.github/workflows/Release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
uses: softprops/action-gh-release@v1
2222
with:
2323
prerelease: false
24-
tag_name: v4.6.3
25-
name: 4.6.3
26-
body: '- 优化: opquests无法自动连续验证(#38)'
24+
tag_name: v4.6.4
25+
name: 4.6.4
26+
body: '- 优化: Gleam任务识别'
2727
files: |-
2828
dist/auto-task-v4-for-giveawaysu.user.js
2929
dist/auto-task-v4.compatibility.user.js

dist/auto-task-v4-for-giveawaysu.all.user.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4-for-giveawaysu.user.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.all.user.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task-v4
33
// @namespace auto-task-v4
4-
// @version 4.6.3
4+
// @version 4.6.4
55
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
66
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
77
// @author HCLonely
@@ -1006,6 +1006,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
10061006
return '#fff';
10071007
}
10081008
};
1009+
const debug = (log, data) => {
1010+
if (!window.DEBUG) {
1011+
return;
1012+
}
1013+
console.log('%c%s', 'color:#a7a7a7', `Auto-Task[Debug]: ${log}`);
1014+
if (data) {
1015+
console.log('%c%s', 'color:#a7a7a7', 'Auto-Task[Debug]: ', data);
1016+
}
1017+
};
10091018
const defaultGlobalOptions = {
10101019
doTask: {
10111020
discord: {
@@ -6900,21 +6909,25 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
69006909
const logStatus = scripts_echoLog({
69016910
text: i18n('initing')
69026911
});
6912+
debug('检测登录按钮');
69036913
if ($('a[href="#/login"]').length > 0) {
69046914
window.open('/#/login', '_self');
69056915
logStatus.warning(i18n('needLogin'));
69066916
return false;
69076917
}
6918+
debug('检测是否为登录页面');
69086919
if (window.location.href.includes('/login')) {
69096920
logStatus.warning(i18n('needLogin'));
69106921
return false;
69116922
}
6923+
debug('检测url是否包含额外参数');
69126924
if (!/^https?:\/\/freeanywhere\.net\/#\/giveaway\/[\d]+/.test(window.location.href)) {
69136925
const id = window.location.href.match(/https?:\/\/freeanywhere\.net\/.*?#\/giveaway\/([\d]+)/)?.[1];
69146926
if (!id) {
69156927
logStatus.error(i18n('getFailed', 'Id'));
69166928
return false;
69176929
}
6930+
debug('重定向到不包含额外参数的url');
69186931
window.location.href = `https://freeanywhere.net/#/giveaway/${id}`;
69196932
}
69206933
if (!this.#getGiveawayId()) {
@@ -6960,6 +6973,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
69606973
this.tasks = [];
69616974
}
69626975
for (const task of tasks) {
6976+
debug('任务分类', task);
69636977
const type = task.challenge;
69646978
const social = task.challenge_provider;
69656979
const taskInfo = {
@@ -7041,6 +7055,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70417055
});
70427056
return true;
70437057
}
7058+
debug('返回的数据中不包含任务信息', data?.response);
70447059
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
70457060
return false;
70467061
}
@@ -7054,9 +7069,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70547069
async verifyTask() {
70557070
try {
70567071
if (!this.initialized && !this.init()) {
7072+
debug('未初始化');
70577073
return false;
70587074
}
70597075
if (this.tasks.length === 0 && !await this.classifyTask('verify')) {
7076+
debug('任务列表为空', this.tasks);
70607077
return false;
70617078
}
70627079
const pro = [];
@@ -7075,6 +7092,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70757092
async getKey(initialized) {
70767093
try {
70777094
if (!initialized && !this.initialized && !this.init()) {
7095+
debug('未初始化');
70787096
return false;
70797097
}
70807098
const logStatus = scripts_echoLog({
@@ -7154,6 +7172,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
71547172
logStatus.success();
71557173
return true;
71567174
}
7175+
debug('任务验证结果', data?.response);
71577176
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
71587177
return false;
71597178
}
@@ -7169,6 +7188,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
71697188
if (!globalOptions.other.checkLeftKey) {
71707189
return true;
71717190
}
7191+
debug('检测剩余Key');
71727192
const {
71737193
data
71747194
} = await tools_httpRequest({
@@ -9590,7 +9610,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
95909610
this.undoneTasks.steam.curatorLinks.push(link);
95919611
}
95929612
}
9593-
} else if (socialIcon.hasClass('fa-bullhorn') && /Complete/gi.test(taskText)) {
9613+
} else if (socialIcon.hasClass('fa-bullhorn') && /Complete|Increase/gi.test(taskText)) {
95949614
if (action !== 'do') {
95959615
continue;
95969616
}

dist/auto-task-v4.compatibility.all.user.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.compatibility.user.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.user.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task-v4
33
// @namespace auto-task-v4
4-
// @version 4.6.3
4+
// @version 4.6.4
55
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
66
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
77
// @author HCLonely
@@ -987,6 +987,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
987987
return '#fff';
988988
}
989989
};
990+
const debug = (log, data) => {
991+
if (!window.DEBUG) {
992+
return;
993+
}
994+
console.log('%c%s', 'color:#a7a7a7', `Auto-Task[Debug]: ${log}`);
995+
if (data) {
996+
console.log('%c%s', 'color:#a7a7a7', 'Auto-Task[Debug]: ', data);
997+
}
998+
};
990999
const defaultGlobalOptions = {
9911000
doTask: {
9921001
discord: {
@@ -6881,21 +6890,25 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
68816890
const logStatus = scripts_echoLog({
68826891
text: i18n('initing')
68836892
});
6893+
debug('检测登录按钮');
68846894
if ($('a[href="#/login"]').length > 0) {
68856895
window.open('/#/login', '_self');
68866896
logStatus.warning(i18n('needLogin'));
68876897
return false;
68886898
}
6899+
debug('检测是否为登录页面');
68896900
if (window.location.href.includes('/login')) {
68906901
logStatus.warning(i18n('needLogin'));
68916902
return false;
68926903
}
6904+
debug('检测url是否包含额外参数');
68936905
if (!/^https?:\/\/freeanywhere\.net\/#\/giveaway\/[\d]+/.test(window.location.href)) {
68946906
const id = window.location.href.match(/https?:\/\/freeanywhere\.net\/.*?#\/giveaway\/([\d]+)/)?.[1];
68956907
if (!id) {
68966908
logStatus.error(i18n('getFailed', 'Id'));
68976909
return false;
68986910
}
6911+
debug('重定向到不包含额外参数的url');
68996912
window.location.href = `https://freeanywhere.net/#/giveaway/${id}`;
69006913
}
69016914
if (!this.#getGiveawayId()) {
@@ -6941,6 +6954,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
69416954
this.tasks = [];
69426955
}
69436956
for (const task of tasks) {
6957+
debug('任务分类', task);
69446958
const type = task.challenge;
69456959
const social = task.challenge_provider;
69466960
const taskInfo = {
@@ -7022,6 +7036,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70227036
});
70237037
return true;
70247038
}
7039+
debug('返回的数据中不包含任务信息', data?.response);
70257040
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
70267041
return false;
70277042
}
@@ -7035,9 +7050,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70357050
async verifyTask() {
70367051
try {
70377052
if (!this.initialized && !this.init()) {
7053+
debug('未初始化');
70387054
return false;
70397055
}
70407056
if (this.tasks.length === 0 && !await this.classifyTask('verify')) {
7057+
debug('任务列表为空', this.tasks);
70417058
return false;
70427059
}
70437060
const pro = [];
@@ -7056,6 +7073,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
70567073
async getKey(initialized) {
70577074
try {
70587075
if (!initialized && !this.initialized && !this.init()) {
7076+
debug('未初始化');
70597077
return false;
70607078
}
70617079
const logStatus = scripts_echoLog({
@@ -7135,6 +7153,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
71357153
logStatus.success();
71367154
return true;
71377155
}
7156+
debug('任务验证结果', data?.response);
71387157
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
71397158
return false;
71407159
}
@@ -7150,6 +7169,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
71507169
if (!globalOptions.other.checkLeftKey) {
71517170
return true;
71527171
}
7172+
debug('检测剩余Key');
71537173
const {
71547174
data
71557175
} = await tools_httpRequest({
@@ -9571,7 +9591,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
95719591
this.undoneTasks.steam.curatorLinks.push(link);
95729592
}
95739593
}
9574-
} else if (socialIcon.hasClass('fa-bullhorn') && /Complete/gi.test(taskText)) {
9594+
} else if (socialIcon.hasClass('fa-bullhorn') && /Complete|Increase/gi.test(taskText)) {
95759595
if (action !== 'do') {
95769596
continue;
95779597
}

doc/docs/logs/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ lang: zh-CN
55

66
## V4.6
77

8+
### V4.6.4
9+
10+
[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.6.4)
11+
12+
- 优化: Gleam任务识别
13+
814
### V4.6.3
915

1016
[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.6.3)

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "auto-task-v4",
3-
"version": "4.6.3",
3+
"version": "4.6.4",
44
"change": [
5-
"优化: opquests无法自动连续验证(#38)"
5+
"优化: Gleam任务识别"
66
],
77
"description": "赠Key站自动任务脚本",
88
"engines": {

page/dist/auto-task-v4-for-giveawaysu.all.user.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

page/dist/auto-task-v4-for-giveawaysu.user.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)