Skip to content

Commit 4826eed

Browse files
committed
新增:Opquests Discord任务支持
修复:Gleam挂时长任务识别 优化:ASF挂时长完成后的弹窗
1 parent e178ff9 commit 4826eed

26 files changed

Lines changed: 371 additions & 137 deletions

.github/workflows/Release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
uses: softprops/action-gh-release@v1
2323
with:
2424
prerelease: false
25-
tag_name: v5.0.4
26-
name: 5.0.4
27-
body: '- 修复:Twitter任务报错'
25+
tag_name: v5.0.5
26+
name: 5.0.5
27+
body: "- 新增:Opquests Discord任务支持\r\n- 修复:Gleam挂时长任务识别\r\n- 优化:ASF挂时长完成后的弹窗"
2828
files: |-
2929
dist/auto-task.user.js
3030
dist/auto-task.min.user.js

dist/auto-task.all.user.js

Lines changed: 26 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 26 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task.compatibility.user.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task.compatibility
33
// @namespace auto-task.compatibility
4-
// @version 5.0.4
4+
// @version 5.0.5
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
@@ -13778,6 +13778,19 @@ if (missingDependencies.length > 0) {
1377813778
continue;
1377913779
}
1378013780
}
13781+
if (link.includes('//discord.gg/') && /join/gim.test(taskDes)) {
13782+
debug('获取重定向链接', {
13783+
link: link
13784+
});
13785+
const taskLink = await getRedirectLink(link, false);
13786+
if (!taskLink) {
13787+
debug('获取重定向链接失败');
13788+
continue;
13789+
}
13790+
debug('添加 Discord 加入任务');
13791+
this.undoneTasks.discord.serverLinks.push(taskLink);
13792+
continue;
13793+
}
1378113794
if (/clash\.gg/.test(link)) {
1378213795
debug('跳过不支持的 Clash.gg 任务');
1378313796
echoLog({}).warning(`${I18n('unSupporttedTaskType')}: ${taskDes}(${link})`);
@@ -14214,16 +14227,15 @@ if (missingDependencies.length > 0) {
1421414227
}
1421514228
continue;
1421614229
}
14217-
if (/play.*hours/gi.test(taskText)) {
14230+
if (/play[\w\W]*hours/gi.test(taskText)) {
1421814231
const link = $task.find('a[href^="https://steamcommunity.com/app/"],a[href^="https://store.steampowered.com/app/"]').attr('href');
14219-
if (!link) {
14232+
const time = [ ...taskText.matchAll(/(\d+?(\.\d+)?)\s*?hour/gi) ];
14233+
if (!link || !time[0]?.[1]) {
1422014234
continue;
1422114235
}
14222-
if (action === 'undo') {
14223-
this.socialTasks.steam.playTimeLinks.push(link);
14224-
}
14236+
const trueTime = parseFloat(time[0][1]) * 60;
1422514237
if (action === 'do') {
14226-
this.undoneTasks.steam.playTimeLinks.push(link);
14238+
this.undoneTasks.steam.playTimeLinks.push(`${trueTime}-${link}`);
1422714239
}
1422814240
continue;
1422914241
}
@@ -17979,12 +17991,17 @@ if (missingDependencies.length > 0) {
1797917991
return;
1798017992
}
1798117993
const stopPlayTimeMinutes = Math.floor((Date.now() - stopPlayTime) / 6e4);
17982-
await Swal.fire({
17994+
const {value: value} = await Swal.fire({
1798317995
title: I18n('stopPlayTimeTitle'),
1798417996
text: I18n('stopPlayTimeText', stopPlayTimeMinutes.toString()),
1798517997
icon: 'warning',
17986-
confirmButtonText: I18n('confirm')
17998+
confirmButtonText: I18n('confirm'),
17999+
cancelButtonText: I18n('cancel'),
18000+
showCancelButton: true
1798718001
});
18002+
if (!value) {
18003+
return;
18004+
}
1798818005
let steamASF = new SteamASF(globalOptions.ASF);
1798918006
try {
1799018007
const isInitialized = await steamASF.init();

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

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task.min.user.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task.user.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task
33
// @namespace auto-task
4-
// @version 5.0.4
4+
// @version 5.0.5
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
@@ -13690,6 +13690,19 @@ if (missingDependencies.length > 0) {
1369013690
continue;
1369113691
}
1369213692
}
13693+
if (link.includes('//discord.gg/') && /join/gim.test(taskDes)) {
13694+
debug('获取重定向链接', {
13695+
link: link
13696+
});
13697+
const taskLink = await getRedirectLink(link, false);
13698+
if (!taskLink) {
13699+
debug('获取重定向链接失败');
13700+
continue;
13701+
}
13702+
debug('添加 Discord 加入任务');
13703+
this.undoneTasks.discord.serverLinks.push(taskLink);
13704+
continue;
13705+
}
1369313706
if (/clash\.gg/.test(link)) {
1369413707
debug('跳过不支持的 Clash.gg 任务');
1369513708
echoLog({}).warning(`${I18n('unSupporttedTaskType')}: ${taskDes}(${link})`);
@@ -14126,16 +14139,15 @@ if (missingDependencies.length > 0) {
1412614139
}
1412714140
continue;
1412814141
}
14129-
if (/play.*hours/gi.test(taskText)) {
14142+
if (/play[\w\W]*hours/gi.test(taskText)) {
1413014143
const link = $task.find('a[href^="https://steamcommunity.com/app/"],a[href^="https://store.steampowered.com/app/"]').attr('href');
14131-
if (!link) {
14144+
const time = [ ...taskText.matchAll(/(\d+?(\.\d+)?)\s*?hour/gi) ];
14145+
if (!link || !time[0]?.[1]) {
1413214146
continue;
1413314147
}
14134-
if (action === 'undo') {
14135-
this.socialTasks.steam.playTimeLinks.push(link);
14136-
}
14148+
const trueTime = parseFloat(time[0][1]) * 60;
1413714149
if (action === 'do') {
14138-
this.undoneTasks.steam.playTimeLinks.push(link);
14150+
this.undoneTasks.steam.playTimeLinks.push(`${trueTime}-${link}`);
1413914151
}
1414014152
continue;
1414114153
}
@@ -17876,12 +17888,17 @@ if (missingDependencies.length > 0) {
1787617888
return;
1787717889
}
1787817890
const stopPlayTimeMinutes = Math.floor((Date.now() - stopPlayTime) / 6e4);
17879-
await Swal.fire({
17891+
const {value: value} = await Swal.fire({
1788017892
title: I18n('stopPlayTimeTitle'),
1788117893
text: I18n('stopPlayTimeText', stopPlayTimeMinutes.toString()),
1788217894
icon: 'warning',
17883-
confirmButtonText: I18n('confirm')
17895+
confirmButtonText: I18n('confirm'),
17896+
cancelButtonText: I18n('cancel'),
17897+
showCancelButton: true
1788417898
});
17899+
if (!value) {
17900+
return;
17901+
}
1788517902
let steamASF = new SteamASF(globalOptions.ASF);
1788617903
try {
1788717904
const isInitialized = await steamASF.init();

doc/docs/.vuepress/public/dist/auto-task.all.user.js

Lines changed: 26 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)