Skip to content

Commit

Permalink
1. 剩余Key检测优化;
Browse files Browse the repository at this point in the history
2. GiveeClub愿望单任务识别优化
  • Loading branch information
HCLonely committed Jan 9, 2022
1 parent 418ebe2 commit afe87f7
Show file tree
Hide file tree
Showing 20 changed files with 997 additions and 165 deletions.
4 changes: 2 additions & 2 deletions dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

49 changes: 27 additions & 22 deletions dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

338 changes: 305 additions & 33 deletions dist/auto-task-v4.user.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "auto-task-new",
"version": "4.1.8-Beta",
"name": "auto-task-v4",
"version": "4.1.9-Beta",
"change": [
"油管、推特验证机制优化",
"白名单、任务历史、数据同步功能移动到设置页面",
"其他优化"
"剩余Key检测优化",
"GiveeClub愿望单任务识别优化"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
4 changes: 2 additions & 2 deletions page/dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

49 changes: 27 additions & 22 deletions page/dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

338 changes: 305 additions & 33 deletions page/dist/auto-task-v4.user.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions page/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "auto-task-new",
"version": "4.1.8-Beta",
"name": "auto-task-v4",
"version": "4.1.9-Beta",
"change": [
"油管、推特验证机制优化",
"白名单、任务历史、数据同步功能移动到设置页面",
"其他优化"
"剩余Key检测优化",
"GiveeClub愿望单任务识别优化"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
5 changes: 5 additions & 0 deletions src/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
// @connect google.com
// @connect www.vloot.io
// @connect givee.club
// @connect gleam.io
// @connect www.indiedb.com
// @connect key-hub.eu
// @connect opquests.com
// @connect itch.io
// @connect auto-task-v4.hclonely.com
// @connect *
// @require https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-10-26 15:44:54
* @LastEditTime : 2022-01-08 17:19:28
* @LastEditTime : 2022-01-09 13:20:03
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/index.ts
* @Description :
Expand All @@ -11,12 +11,12 @@ import Swal from 'sweetalert2';
import * as Cookies from 'js-cookie';
import style from './style/auto-task.scss';
import { Websites, WebsiteType } from './scripts/website/index';
import whiteListOptions from './scripts/social/whiteList';
// import whiteListOptions from './scripts/social/whiteList';
import websiteOptions from './scripts/website/options';
import __ from './scripts/tools/i18n';
import { globalOptions, changeGlobalOptions } from './scripts/globalOptions';
import keyboardJS from 'keyboardjs';
import syncOptions from './scripts/dataSync';
// import syncOptions from './scripts/dataSync';
import updateChecker from './scripts/updateChecker';
import echoLog from './scripts/echoLog';

Expand Down
7 changes: 6 additions & 1 deletion src/locales/en-US.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-12-30 17:08:27
* @LastEditTime : 2022-01-08 17:03:59
* @LastEditTime : 2022-01-09 13:19:55
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/locales/en-US.js
* @Description : i18n英文
Expand Down Expand Up @@ -164,6 +164,11 @@ const data = {
copySuccess: 'The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?',
copyFailed: 'Please copy the error information below and report back to the Keylol forum!',
updateText: 'Updates in version %0:',
Active: 'Active',
Ended: 'Ended',
Banned: 'Banned',
Paused: 'Paused',
notStart: 'notStart',

// Steam
groups: 'Group',
Expand Down
7 changes: 6 additions & 1 deletion src/locales/zh-CN.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-11-20 19:38:41
* @LastEditTime : 2022-01-07 10:03:36
* @LastEditTime : 2022-01-09 13:19:36
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/locales/zh-CN.js
* @Description : i18n中文
Expand Down Expand Up @@ -148,6 +148,11 @@ const data = {
copySuccess: '错误信息已复制到剪切板,是否前往其乐论坛反馈?',
copyFailed: '请复制下方错误信息后前往Keylol论坛反馈!',
updateText: '%0 版本更新内容:',
Active: '进行中',
Ended: '已结束',
Banned: '已封禁',
Paused: '已暂停',
notStart: '未开始',

// Steam
groups: '组',
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/website/Giveawaysu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-11-08 10:37:13
* @LastEditTime : 2022-01-07 10:04:58
* @LastEditTime : 2022-01-09 10:37:20
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/scripts/website/Giveawaysu.ts
* @Description : https://giveaway.su/
Expand Down Expand Up @@ -197,7 +197,7 @@ class GiveawaySu extends Website {
async #checkLeftKey(): Promise<boolean> {
try {
if (!globalOptions.other.checkLeftKey) return true;
if ($('.giveaway-ended').length > 0) {
if ($('.giveaway-ended').length > 0 && $('.giveaway-key').length === 0) {
await Swal.fire({
icon: 'warning',
title: __('notice'),
Expand Down
6 changes: 4 additions & 2 deletions src/scripts/website/GiveeClub.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-11-14 11:46:52
* @LastEditTime : 2022-01-02 12:44:47
* @LastEditTime : 2022-01-09 10:43:12
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/scripts/website/GiveeClub.ts
* @Description : https://givee.club/
Expand Down Expand Up @@ -86,6 +86,8 @@ class GiveeClub extends GiveawaySu {
this.undoneTasks.steam.announcementLinks.push(taskLink);
} else if (taskIcon.includes('plus') && /^https?:\/\/store\.steampowered\.com\/app\//.test(taskLink)) { // ok
this.undoneTasks.steam.wishlistLinks.push(taskLink);
} else if (taskIcon.includes('plus') && taskDes.attr('data-steam-wishlist-appid')) { // ok
this.undoneTasks.steam.wishlistLinks.push(`https://store.steampowered.com/app/${taskDes.attr('data-steam-wishlist-appid')}`);
} else if (/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)) { // ok
this.undoneTasks.steam.curatorLinks.push(taskLink);
} else if (taskIcon.includes('steam') && /follow|subscribe/gim.test(taskName)) { // 未识别
Expand Down Expand Up @@ -162,7 +164,7 @@ class GiveeClub extends GiveawaySu {
async #checkLeftKey(): Promise<boolean> {
try {
if (!globalOptions.other.checkLeftKey) return true;
if ($('.event-ended').length > 0) {
if ($('.event-ended').length > 0 && $('.event-winner').length === 0) {
await Swal.fire({
icon: 'warning',
title: __('notice'),
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/website/Indiedb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-11-08 14:37:33
* @LastEditTime : 2022-01-02 12:48:45
* @LastEditTime : 2022-01-09 13:00:52
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/scripts/website/Indiedb.ts
* @Description : https://www.indiedb.com/giveaways
Expand Down Expand Up @@ -268,7 +268,7 @@ class Indiedb {
async #checkLeftKey() {
try {
if (!globalOptions.other.checkLeftKey) return true;
if ($('a.buttonenter:contains("next time")').length > 0) {
if ($('a.buttonenter:contains("next time"),a.buttonenter:contains("Giveaway is closed")').length > 0) {
await Swal.fire({
icon: 'warning',
title: __('notice'),
Expand Down
24 changes: 23 additions & 1 deletion src/scripts/website/Keylol.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author : HCLonely
* @Date : 2021-11-15 13:58:41
* @LastEditTime : 2022-01-08 17:07:34
* @LastEditTime : 2022-01-09 13:50:08
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/scripts/website/Keylol.ts
* @Description : https://keylol.com/f319-1
Expand All @@ -12,6 +12,8 @@

import throwError from '../tools/throwError';
import Website from './Website';
import leftKeyChecker from './leftKeyChecker';
import __ from '../tools/i18n';

const defaultTasks: keylolSocialTasks = {
steam: {
Expand Down Expand Up @@ -162,6 +164,26 @@ class Keylol extends Website {
this.#addBtn(ytbLink, 'youtube', 'videoLinks', link);
}
}

// eslint-disable-next-line max-len
const giveawayLinks = mainPost.find('a[href*="giveaway.su/giveaway/view/"],a[href*="givee.club/"],a[href*="gleam.io/"],a[href*="www.indiedb.com/giveaways/"],a[href*="key-hub.eu/giveaway/"],a[href*="opquests.com/quests/"],a[href*="itch.io/s/"]');
if (giveawayLinks.length > 0) {
for (const giveawayLink of giveawayLinks) {
const link = $(giveawayLink).attr('href');
if (!link) continue;
leftKeyChecker.classify(link).then((status) => {
if (!status) return;
if (/^Active/.test(status)) {
$(`a[href="${link}"]`).after(`<font class="auto-task-giveaway-status active" title="${__('Active')}">${status}</font>`);
return;
}
$(`a[href="${link}"]`).after(`<font class="auto-task-giveaway-status not-active" title="${__(status)}">${status}</font>`);
})
.catch((error) => {
throwError(error, 'keylol.after -> leftKeyChecker');
});
}
}
} catch (error) {
throwError(error as Error, 'keylol.after');
}
Expand Down
Loading

1 comment on commit afe87f7

@vercel
Copy link

@vercel vercel bot commented on afe87f7 Jan 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.