Skip to content

Commit

Permalink
修复:opquests任务无法验证(#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Jun 15, 2024
1 parent 30e1289 commit 3c2ee66
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 348 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
prerelease: false
tag_name: v4.4.2
name: 4.4.2
body: |-
- 修复:Tampermonkey更新导致Steam凭证刷新失败(#16)
- 修复:推特转推功能失效
tag_name: v4.4.3
name: 4.4.3
body: '- 修复:opquests任务无法验证(#17)'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
dist/auto-task-v4.compatibility.user.js
Expand Down
6 changes: 3 additions & 3 deletions dist/auto-task-v4-for-giveawaysu.all.user.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

108 changes: 36 additions & 72 deletions dist/auto-task-v4.all.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/auto-task-v4.compatibility.all.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

108 changes: 36 additions & 72 deletions dist/auto-task-v4.user.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions doc/docs/logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ lang: zh-CN

## V4.4

### V4.4.3

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

- 修复:opquests任务无法验证([#17](https://github.com/HCLonely/auto-task-v4/issues/17))

### V4.4.2

[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.4.2)
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "auto-task-v4",
"version": "4.4.2",
"version": "4.4.3",
"change": [
"修复:Tampermonkey更新导致Steam凭证刷新失败(#16)",
"修复:推特转推功能失效"
"修复:opquests任务无法验证(#17)"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
6 changes: 3 additions & 3 deletions page/dist/auto-task-v4-for-giveawaysu.all.user.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions page/dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

108 changes: 36 additions & 72 deletions page/dist/auto-task-v4.all.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions page/dist/auto-task-v4.compatibility.all.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions page/dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

108 changes: 36 additions & 72 deletions page/dist/auto-task-v4.user.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions page/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "auto-task-v4",
"version": "4.4.2",
"version": "4.4.3",
"change": [
"修复:Tampermonkey更新导致Steam凭证刷新失败(#16)",
"修复:推特转推功能失效"
"修复:opquests任务无法验证(#17)"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
52 changes: 31 additions & 21 deletions src/scripts/website/Opquests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Website from './Website';
import throwError from '../tools/throwError';
import echoLog from '../echoLog';
import __ from '../tools/i18n';
import { delay } from '../tools/tools';
// import { delay } from '../tools/tools';
import { globalOptions } from '../globalOptions';
import httpRequest from '../tools/httpRequest';

Expand All @@ -32,12 +32,32 @@ class Opquests extends Website {
undoneTasks: oqSocialTasks = { ...defaultTasks };
buttons: Array<string> = [
'doTask',
'verifyTask',
'getKey'
];

static test(): boolean {
return window.location.host === 'opquests.com';
}
async before(): Promise<void> {
const opquestsVerifyTasks = GM_getValue<Array<string>>('opquestsVerifyTasks') || [];
if (opquestsVerifyTasks.length > 0) {
const taskId = opquestsVerifyTasks.pop();
GM_setValue('opquestsVerifyTasks', opquestsVerifyTasks);
$(`#task_id[value="${taskId}"]`).parent()
.children('button[type="submit"]')[0].click();
} else {
if (GM_getValue<Array<string>>('opquestsVerifyTasks')) {
GM_deleteValue('opquestsVerifyTasks');
echoLog({}).success(__('allTasksComplete'));
if (await this.getKey()) {
return;
}
window.location.reload();
return;
}
}
}
async after(): Promise<void> {
try {
if (!this.#checkLogin()) {
Expand Down Expand Up @@ -115,27 +135,15 @@ class Opquests extends Website {
if (!this.initialized) {
this.init();
}
const tasks: Array<qpqTaskInfo> = $.makeArray($('div.w-full').find('.items-center')
.has('button.submit-loader')).map((ele) => ({
token: $(ele).find('input[name="_token"]')
.val() as string,
taskId: $(ele).find('input[name="task_id"]')
.val() as string,
title: $(ele).find('span.text-sm')
.text()
.trim() as string
}));
const tasks: Array<string> = $.makeArray($('div.w-full').find('.items-center')
.has('button.submit-loader')).map((ele) => $(ele).find('input[name="task_id"]')
.val() as string);
await this.#confirm();
for (const task of tasks) {
await this.#verify(task);
await delay(1000);
}
echoLog({}).success(__('allTasksComplete'));
if (await this.getKey()) {
return true;
}
window.location.reload();
return false;
const taskId = tasks.pop();
GM_setValue('opquestsVerifyTasks', tasks);
$(`#task_id[value="${taskId}"]`).parent()
.children('button[type="submit"]')[0].click();
return true;
} catch (error) {
throwError(error as Error, 'Opquests.verifyTask');
return false;
Expand Down Expand Up @@ -169,6 +177,7 @@ class Opquests extends Website {
return false;
}
}
/*
async #verify(task: qpqTaskInfo): Promise<boolean> {
try {
const logStatus = echoLog({ html: `<li>${__('verifyingTask')}${task.title.trim()}...<font></font></li>` });
Expand Down Expand Up @@ -209,6 +218,7 @@ class Opquests extends Website {
return false;
}
}
*/
async getKey(isButton?: boolean): Promise<boolean> {
try {
const logStatus = echoLog({ text: __('gettingKey') });
Expand Down

0 comments on commit 3c2ee66

Please sign in to comment.