Skip to content

Commit e59ad06

Browse files
committed
测试: 尝试修复Indiedb入赠Key时返回403(#43)
1 parent dd1dba8 commit e59ad06

17 files changed

+175
-25
lines changed

.github/workflows/Release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
uses: softprops/action-gh-release@v1
2222
with:
2323
prerelease: false
24-
tag_name: v4.5.10
25-
name: 4.5.10
24+
tag_name: v4.5.11
25+
name: 4.5.11
2626
body: '- 测试: 尝试修复Indiedb入赠Key时返回403(#43)'
2727
files: |-
2828
dist/auto-task-v4-for-giveawaysu.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

+31-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.5.10
4+
// @version 4.5.11
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
@@ -7456,6 +7456,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74567456
logStatus.error(`Error${data.response?.text ? `:${data.response?.text}` : ''}`);
74577457
return false;
74587458
}
7459+
if (await this.#join2()) {
7460+
logStatus.success('Success');
7461+
return true;
7462+
}
74597463
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
74607464
return false;
74617465
}
@@ -7467,7 +7471,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74677471
scripts_echoLog({}).warning(i18n('needJoinGiveaway'));
74687472
return false;
74697473
} catch (error) {
7470-
throwError(error, 'Indiedb.init');
7474+
throwError(error, 'Indiedb.join');
7475+
return false;
7476+
}
7477+
}
7478+
async #join2() {
7479+
try {
7480+
return await new Promise(resolve => {
7481+
const targetNode = document.getElementById('giveawaysjoined');
7482+
const config = {
7483+
attributes: true
7484+
};
7485+
const observer = new MutationObserver(() => {
7486+
if ($('#giveawaysjoined').is(':visible')) {
7487+
resolve(true);
7488+
observer.disconnect();
7489+
}
7490+
});
7491+
observer.observe(targetNode, config);
7492+
$('a.buttonenter.buttongiveaway')[0]?.click();
7493+
setTimeout(() => {
7494+
resolve(false);
7495+
observer.disconnect();
7496+
}, 3e4);
7497+
});
7498+
} catch (error) {
7499+
throwError(error, 'Indiedb.join2');
74717500
return false;
74727501
}
74737502
}

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

+2-2
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

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

dist/auto-task-v4.user.js

+31-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.5.10
4+
// @version 4.5.11
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
@@ -7437,6 +7437,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74377437
logStatus.error(`Error${data.response?.text ? `:${data.response?.text}` : ''}`);
74387438
return false;
74397439
}
7440+
if (await this.#join2()) {
7441+
logStatus.success('Success');
7442+
return true;
7443+
}
74407444
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
74417445
return false;
74427446
}
@@ -7448,7 +7452,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74487452
scripts_echoLog({}).warning(i18n('needJoinGiveaway'));
74497453
return false;
74507454
} catch (error) {
7451-
throwError(error, 'Indiedb.init');
7455+
throwError(error, 'Indiedb.join');
7456+
return false;
7457+
}
7458+
}
7459+
async #join2() {
7460+
try {
7461+
return await new Promise(resolve => {
7462+
const targetNode = document.getElementById('giveawaysjoined');
7463+
const config = {
7464+
attributes: true
7465+
};
7466+
const observer = new MutationObserver(() => {
7467+
if ($('#giveawaysjoined').is(':visible')) {
7468+
resolve(true);
7469+
observer.disconnect();
7470+
}
7471+
});
7472+
observer.observe(targetNode, config);
7473+
$('a.buttonenter.buttongiveaway')[0]?.click();
7474+
setTimeout(() => {
7475+
resolve(false);
7476+
observer.disconnect();
7477+
}, 3e4);
7478+
});
7479+
} catch (error) {
7480+
throwError(error, 'Indiedb.join2');
74527481
return false;
74537482
}
74547483
}

doc/docs/logs/README.md

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

66
## V4.5
77

8+
### V4.5.11
9+
10+
[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.5.11)
11+
12+
- 测试: 尝试修复Indiedb入赠Key时返回403([#43](https://github.com/HCLonely/auto-task-v4/issues/43))
13+
814
### V4.5.10
915

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auto-task-v4",
3-
"version": "4.5.10",
3+
"version": "4.5.11",
44
"change": [
55
"测试: 尝试修复Indiedb入赠Key时返回403(#43)"
66
],

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.

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

+31-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.5.10
4+
// @version 4.5.11
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
@@ -7456,6 +7456,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74567456
logStatus.error(`Error${data.response?.text ? `:${data.response?.text}` : ''}`);
74577457
return false;
74587458
}
7459+
if (await this.#join2()) {
7460+
logStatus.success('Success');
7461+
return true;
7462+
}
74597463
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
74607464
return false;
74617465
}
@@ -7467,7 +7471,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74677471
scripts_echoLog({}).warning(i18n('needJoinGiveaway'));
74687472
return false;
74697473
} catch (error) {
7470-
throwError(error, 'Indiedb.init');
7474+
throwError(error, 'Indiedb.join');
7475+
return false;
7476+
}
7477+
}
7478+
async #join2() {
7479+
try {
7480+
return await new Promise(resolve => {
7481+
const targetNode = document.getElementById('giveawaysjoined');
7482+
const config = {
7483+
attributes: true
7484+
};
7485+
const observer = new MutationObserver(() => {
7486+
if ($('#giveawaysjoined').is(':visible')) {
7487+
resolve(true);
7488+
observer.disconnect();
7489+
}
7490+
});
7491+
observer.observe(targetNode, config);
7492+
$('a.buttonenter.buttongiveaway')[0]?.click();
7493+
setTimeout(() => {
7494+
resolve(false);
7495+
observer.disconnect();
7496+
}, 3e4);
7497+
});
7498+
} catch (error) {
7499+
throwError(error, 'Indiedb.join2');
74717500
return false;
74727501
}
74737502
}

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

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

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

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

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

+31-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.5.10
4+
// @version 4.5.11
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
@@ -7437,6 +7437,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74377437
logStatus.error(`Error${data.response?.text ? `:${data.response?.text}` : ''}`);
74387438
return false;
74397439
}
7440+
if (await this.#join2()) {
7441+
logStatus.success('Success');
7442+
return true;
7443+
}
74407444
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
74417445
return false;
74427446
}
@@ -7448,7 +7452,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
74487452
scripts_echoLog({}).warning(i18n('needJoinGiveaway'));
74497453
return false;
74507454
} catch (error) {
7451-
throwError(error, 'Indiedb.init');
7455+
throwError(error, 'Indiedb.join');
7456+
return false;
7457+
}
7458+
}
7459+
async #join2() {
7460+
try {
7461+
return await new Promise(resolve => {
7462+
const targetNode = document.getElementById('giveawaysjoined');
7463+
const config = {
7464+
attributes: true
7465+
};
7466+
const observer = new MutationObserver(() => {
7467+
if ($('#giveawaysjoined').is(':visible')) {
7468+
resolve(true);
7469+
observer.disconnect();
7470+
}
7471+
});
7472+
observer.observe(targetNode, config);
7473+
$('a.buttonenter.buttongiveaway')[0]?.click();
7474+
setTimeout(() => {
7475+
resolve(false);
7476+
observer.disconnect();
7477+
}, 3e4);
7478+
});
7479+
} catch (error) {
7480+
throwError(error, 'Indiedb.join2');
74527481
return false;
74537482
}
74547483
}

page/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auto-task-v4",
3-
"version": "4.5.10",
3+
"version": "4.5.11",
44
"change": [
55
"测试: 尝试修复Indiedb入赠Key时返回403(#43)"
66
],

src/scripts/website/Indiedb.ts

+29-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ class Indiedb {
174174
logStatus.error(`Error${data.response?.text ? (`:${data.response?.text}`) : ''}`);
175175
return false;
176176
}
177+
if (await this.#join2()) {
178+
logStatus.success('Success');
179+
return true;
180+
}
177181
logStatus.error(`Error:${data?.statusText}(${data?.status})`);
178182
return false;
179183
}
@@ -185,7 +189,31 @@ class Indiedb {
185189
echoLog({}).warning(__('needJoinGiveaway'));
186190
return false;
187191
} catch (error) {
188-
throwError(error as Error, 'Indiedb.init');
192+
throwError(error as Error, 'Indiedb.join');
193+
return false;
194+
}
195+
}
196+
197+
async #join2(): Promise<boolean> {
198+
try {
199+
return await new Promise((resolve) => {
200+
const targetNode = document.getElementById('giveawaysjoined') as HTMLElement;
201+
const config = { attributes: true };
202+
const observer = new MutationObserver(() => {
203+
if ($('#giveawaysjoined').is(':visible')) {
204+
resolve(true);
205+
observer.disconnect();
206+
}
207+
});
208+
observer.observe(targetNode, config);
209+
$('a.buttonenter.buttongiveaway')[0]?.click();
210+
setTimeout(() => {
211+
resolve(false);
212+
observer.disconnect();
213+
}, 30000);
214+
});
215+
} catch (error) {
216+
throwError(error as Error, 'Indiedb.join2');
189217
return false;
190218
}
191219
}

0 commit comments

Comments
 (0)