Skip to content

Commit

Permalink
修复:Steam换区失败
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Mar 15, 2024
1 parent 9b98a1f commit 3905808
Show file tree
Hide file tree
Showing 18 changed files with 2,523 additions and 2,373 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
uses: softprops/action-gh-release@v1
with:
prerelease: false
tag_name: v4.2.35
name: 4.2.35
tag_name: v4.2.36
name: 4.2.36
body: '- 修复:Steam换区失败'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
Expand Down
4 changes: 2 additions & 2 deletions dist/auto-task-v4-for-giveawaysu.all.user.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

58 changes: 40 additions & 18 deletions dist/auto-task-v4.all.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name auto-task-v4
// @namespace auto-task-v4
// @version 4.2.35
// @version 4.2.36
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
// @author HCLonely
Expand Down Expand Up @@ -4438,9 +4438,31 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma5;
const currentArea = (_data$responseText$ma5 = data.responseText.match(/<input id="usercountrycurrency".*?value="(.+?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
const areas = [ ...data.responseText.matchAll(/<div class="currency_change_option .*?" data-country="(.+?)" >/g) ].map(search => search[1]);
var _data$responseText$ma5, _data$responseText$ma6;
const cartConfigRaw = (_data$responseText$ma5 = data.responseText.match(/data-cart_config="(.*?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
const temp = document.createElement('div');
temp.innerHTML = cartConfigRaw || '{}';
const cartConfigStr = temp.textContent || temp.innerText;
let cartConfig;
try {
cartConfig = JSON.parse(cartConfigStr);
} catch (error) {
logStatus.error('Error: get country info filed');
console.error(error);
}
const userInfoRaw = (_data$responseText$ma6 = data.responseText.match(/data-userinfo="(.*?)"/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1];
const temp1 = document.createElement('div');
temp1.innerHTML = userInfoRaw || '{}';
const userInfoStr = temp1.textContent || temp1.innerText;
let userInfo;
try {
userInfo = JSON.parse(userInfoStr);
} catch (error) {
logStatus.error('Error: get country info filed');
console.error(error);
}
const currentArea = userInfo.country_code;
const areas = Object.keys(cartConfig.rgUserCountryOptions).filter(area => area !== 'help');
if (currentArea && areas.length > 0) {
this.#area = currentArea;
logStatus.success();
Expand Down Expand Up @@ -4664,8 +4686,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma6;
const groupId = (_data$responseText$ma6 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1];
var _data$responseText$ma7;
const groupId = (_data$responseText$ma7 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1];
if (groupId) {
this.#setCache('group', groupName, groupId);
logStatus.success();
Expand Down Expand Up @@ -4704,10 +4726,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('id="publicGroupJoin"')) {
var _data$responseText$ma7;
var _data$responseText$ma8;
logStatus.success();
this.tasks.officialGroups = unique([ ...this.tasks.officialGroups, gameId ]);
const groupId = (_data$responseText$ma7 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1];
const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1];
if (groupId) {
this.#setCache('officialGroup', gameId, groupId);
}
Expand Down Expand Up @@ -4818,8 +4840,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma8;
const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1];
var _data$responseText$ma9;
const groupId = (_data$responseText$ma9 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1];
if (groupId) {
this.#setCache('officialGroup', gameId, groupId);
logStatus.success();
Expand Down Expand Up @@ -5137,8 +5159,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText, _data$responseText$ma9;
const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma9 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1];
var _data$responseText, _data$responseText$ma10;
const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma10 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1];
if (forumId) {
this.#setCache('forum', gameId, forumId);
logStatus.success();
Expand Down Expand Up @@ -5233,8 +5255,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma10;
const appId = (_data$responseText$ma10 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1];
var _data$responseText$ma11;
const appId = (_data$responseText$ma11 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1];
if (appId) {
this.#setCache('workshop', id, appId);
logStatus.success();
Expand Down Expand Up @@ -5366,8 +5388,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma11;
const curatorId = (_data$responseText$ma11 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1];
var _data$responseText$ma12;
const curatorId = (_data$responseText$ma12 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1];
if (curatorId) {
this.#setCache('curator', `${path}/${name}`, curatorId);
logStatus.success();
Expand Down Expand Up @@ -5531,7 +5553,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma12;
var _data$responseText$ma13;
if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) {
logStatus.warning(i18n('changeAreaNotice'));
const result = await this.#changeArea();
Expand All @@ -5540,7 +5562,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
return await this.#appid2subid(id);
}
const subid = (_data$responseText$ma12 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1];
const subid = (_data$responseText$ma13 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma13 === void 0 ? void 0 : _data$responseText$ma13[1];
if (subid) {
logStatus.success();
return subid;
Expand Down
4 changes: 2 additions & 2 deletions dist/auto-task-v4.compatibility.all.user.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

58 changes: 40 additions & 18 deletions dist/auto-task-v4.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name auto-task-v4
// @namespace auto-task-v4
// @version 4.2.35
// @version 4.2.36
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
// @author HCLonely
Expand Down Expand Up @@ -4419,9 +4419,31 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma5;
const currentArea = (_data$responseText$ma5 = data.responseText.match(/<input id="usercountrycurrency".*?value="(.+?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
const areas = [ ...data.responseText.matchAll(/<div class="currency_change_option .*?" data-country="(.+?)" >/g) ].map(search => search[1]);
var _data$responseText$ma5, _data$responseText$ma6;
const cartConfigRaw = (_data$responseText$ma5 = data.responseText.match(/data-cart_config="(.*?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
const temp = document.createElement('div');
temp.innerHTML = cartConfigRaw || '{}';
const cartConfigStr = temp.textContent || temp.innerText;
let cartConfig;
try {
cartConfig = JSON.parse(cartConfigStr);
} catch (error) {
logStatus.error('Error: get country info filed');
console.error(error);
}
const userInfoRaw = (_data$responseText$ma6 = data.responseText.match(/data-userinfo="(.*?)"/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1];
const temp1 = document.createElement('div');
temp1.innerHTML = userInfoRaw || '{}';
const userInfoStr = temp1.textContent || temp1.innerText;
let userInfo;
try {
userInfo = JSON.parse(userInfoStr);
} catch (error) {
logStatus.error('Error: get country info filed');
console.error(error);
}
const currentArea = userInfo.country_code;
const areas = Object.keys(cartConfig.rgUserCountryOptions).filter(area => area !== 'help');
if (currentArea && areas.length > 0) {
this.#area = currentArea;
logStatus.success();
Expand Down Expand Up @@ -4645,8 +4667,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma6;
const groupId = (_data$responseText$ma6 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1];
var _data$responseText$ma7;
const groupId = (_data$responseText$ma7 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1];
if (groupId) {
this.#setCache('group', groupName, groupId);
logStatus.success();
Expand Down Expand Up @@ -4685,10 +4707,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('id="publicGroupJoin"')) {
var _data$responseText$ma7;
var _data$responseText$ma8;
logStatus.success();
this.tasks.officialGroups = unique([ ...this.tasks.officialGroups, gameId ]);
const groupId = (_data$responseText$ma7 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1];
const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1];
if (groupId) {
this.#setCache('officialGroup', gameId, groupId);
}
Expand Down Expand Up @@ -4799,8 +4821,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma8;
const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1];
var _data$responseText$ma9;
const groupId = (_data$responseText$ma9 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1];
if (groupId) {
this.#setCache('officialGroup', gameId, groupId);
logStatus.success();
Expand Down Expand Up @@ -5118,8 +5140,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText, _data$responseText$ma9;
const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma9 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1];
var _data$responseText, _data$responseText$ma10;
const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma10 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1];
if (forumId) {
this.#setCache('forum', gameId, forumId);
logStatus.success();
Expand Down Expand Up @@ -5214,8 +5236,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma10;
const appId = (_data$responseText$ma10 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1];
var _data$responseText$ma11;
const appId = (_data$responseText$ma11 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1];
if (appId) {
this.#setCache('workshop', id, appId);
logStatus.success();
Expand Down Expand Up @@ -5347,8 +5369,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma11;
const curatorId = (_data$responseText$ma11 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1];
var _data$responseText$ma12;
const curatorId = (_data$responseText$ma12 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1];
if (curatorId) {
this.#setCache('curator', `${path}/${name}`, curatorId);
logStatus.success();
Expand Down Expand Up @@ -5512,7 +5534,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma12;
var _data$responseText$ma13;
if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) {
logStatus.warning(i18n('changeAreaNotice'));
const result = await this.#changeArea();
Expand All @@ -5521,7 +5543,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
return await this.#appid2subid(id);
}
const subid = (_data$responseText$ma12 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1];
const subid = (_data$responseText$ma13 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma13 === void 0 ? void 0 : _data$responseText$ma13[1];
if (subid) {
logStatus.success();
return subid;
Expand Down
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.2

### V4.2.36

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

- 修复:Steam换区失败

### V4.2.35

[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.2.35)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-task-v4",
"version": "4.2.35",
"version": "4.2.36",
"change": [
"修复:Steam换区失败"
],
Expand Down
Loading

0 comments on commit 3905808

Please sign in to comment.