Skip to content

Commit

Permalink
修复: Steam社区凭证无法更新(#34,#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Nov 20, 2024
1 parent b17382e commit dc23ca9
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 121 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.5.0
name: 4.5.0
body: |-
- 修复: 浏览器弹窗拦截导致登录凭证无法更新(#34)
- 优化: 开发文档
tag_name: v4.5.1
name: 4.5.1
body: '- 修复: Steam社区凭证无法更新(#34,#24)'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
dist/auto-task-v4.compatibility.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.

44 changes: 28 additions & 16 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.5.0
// @version 4.5.1
// @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 @@ -32,8 +32,7 @@
// @include *://*.reddit.com/*
// @include *://twitter.com/settings/account?k*
// @include *://x.com/settings/account*
// @include *://steamcommunity.com/id/*
// @include *://steamcommunity.com/profiles/*
// @include *://steamcommunity.com/*
// @include *://store.steampowered.com/*
// @include https://auto-task-v4.hclonely.com/setting.html
// @include https://auto-task-v4.hclonely.com/history.html
Expand Down Expand Up @@ -4802,13 +4801,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
return await new Promise(resolve => {
GM_deleteValue('steamStoreAuth');
GM_setValue('ATv4_updateStoreAuth', true);
const newTab = GM_openInTab('https://store.steampowered.com/', {
active: true,
setParent: true
});
newTab.name = 'ATv4_updateStoreAuth';
const listenerId = GM_addValueChangeListener('steamStoreAuth', (key, oldValue, newValue) => {
GM_removeValueChangeListener(listenerId);
GM_deleteValue('ATv4_updateStoreAuth');
newTab?.close();
if (newValue && JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
this.#auth.storeSessionID = newValue.storeSessionID;
Expand All @@ -4819,6 +4820,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
logStatus.error('Failed');
resolve(false);
});
newTab.onclose = () => {
GM_deleteValue('ATv4_updateStoreAuth');
};
});
} catch (error) {
throwError(error, 'Steam.updateStoreAuthTab');
Expand All @@ -4832,13 +4836,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
return await new Promise(resolve => {
GM_deleteValue('steamCommunityAuth');
GM_setValue('ATv4_updateCommunityAuth', true);
const newTab = GM_openInTab('https://steamcommunity.com/my', {
active: true,
setParent: true
});
newTab.name = 'ATv4_updateCommunityAuth';
const listenerId = GM_addValueChangeListener('steamCommunityAuth', (key, oldValue, newValue) => {
GM_removeValueChangeListener(listenerId);
GM_deleteValue('ATv4_updateCommunityAuth');
newTab?.close();
if (newValue && JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
this.#auth.steam64Id = newValue.steam64Id;
Expand All @@ -4850,6 +4856,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
logStatus.error('Failed');
resolve(false);
});
newTab.onclose = () => {
GM_deleteValue('ATv4_updateCommunityAuth');
};
});
} catch (error) {
throwError(error, 'Steam.updateCommunityAuthTab');
Expand Down Expand Up @@ -10964,13 +10973,14 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
} else if (window.location.hostname === 'opquests.com') {
loadScript();
} else if (window.name === 'ATv4_updateStoreAuth' && window.location.host === 'store.steampowered.com') {
} else if ((window.name === 'ATv4_updateStoreAuth' || GM_getValue('ATv4_updateStoreAuth')) && window.location.host === 'store.steampowered.com') {
$(() => {
if ($('[data-miniprofile]').length === 0) {
return;
}
const storeSessionID = document.body.innerHTML.match(/g_sessionID = "(.+?)";/)?.[1];
if (storeSessionID) {
GM_deleteValue('ATv4_updateStoreAuth');
GM_setValue('steamStoreAuth', {
storeSessionID: storeSessionID
});
Expand All @@ -10983,23 +10993,25 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
}
});
} else if (window.name === 'ATv4_updateCommunityAuth' && window.location.host === 'steamcommunity.com') {
} else if ((window.name === 'ATv4_updateCommunityAuth' || GM_getValue('ATv4_updateCommunityAuth')) && window.location.host === 'steamcommunity.com') {
$(() => {
const steam64Id = document.body.innerHTML.match(/g_steamID = "(.+?)";/)?.[1];
const communitySessionID = document.body.innerHTML.match(/g_sessionID = "(.+?)";/)?.[1];
const data = {};
if (steam64Id) {
data.steam64Id = steam64Id;
}
if (communitySessionID) {
data.communitySessionID = communitySessionID;
GM_setValue('steamCommunityAuth', data);
if (steam64Id && communitySessionID) {
GM_deleteValue('ATv4_updateCommunityAuth');
GM_setValue('steamCommunityAuth', {
steam64Id: steam64Id,
communitySessionID: communitySessionID
});
window.close();
external_Swal_default().fire('', i18n('closePageNotice'));
} else {
external_Swal_default().fire({
title: 'Error: Get "sessionID" failed',
icon: 'error'
});
setTimeout(() => {
external_Swal_default().fire({
title: 'Error: Get "sessionID" failed',
icon: 'error'
});
}, 3e3);
}
});
} else {
Expand Down
9 changes: 4 additions & 5 deletions dist/auto-task-v4.compatibility.all.user.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

44 changes: 28 additions & 16 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.5.0
// @version 4.5.1
// @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 @@ -32,8 +32,7 @@
// @include *://*.reddit.com/*
// @include *://twitter.com/settings/account?k*
// @include *://x.com/settings/account*
// @include *://steamcommunity.com/id/*
// @include *://steamcommunity.com/profiles/*
// @include *://steamcommunity.com/*
// @include *://store.steampowered.com/*
// @include https://auto-task-v4.hclonely.com/setting.html
// @include https://auto-task-v4.hclonely.com/history.html
Expand Down Expand Up @@ -4783,13 +4782,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
return await new Promise(resolve => {
GM_deleteValue('steamStoreAuth');
GM_setValue('ATv4_updateStoreAuth', true);
const newTab = GM_openInTab('https://store.steampowered.com/', {
active: true,
setParent: true
});
newTab.name = 'ATv4_updateStoreAuth';
const listenerId = GM_addValueChangeListener('steamStoreAuth', (key, oldValue, newValue) => {
GM_removeValueChangeListener(listenerId);
GM_deleteValue('ATv4_updateStoreAuth');
newTab?.close();
if (newValue && JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
this.#auth.storeSessionID = newValue.storeSessionID;
Expand All @@ -4800,6 +4801,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
logStatus.error('Failed');
resolve(false);
});
newTab.onclose = () => {
GM_deleteValue('ATv4_updateStoreAuth');
};
});
} catch (error) {
throwError(error, 'Steam.updateStoreAuthTab');
Expand All @@ -4813,13 +4817,15 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
return await new Promise(resolve => {
GM_deleteValue('steamCommunityAuth');
GM_setValue('ATv4_updateCommunityAuth', true);
const newTab = GM_openInTab('https://steamcommunity.com/my', {
active: true,
setParent: true
});
newTab.name = 'ATv4_updateCommunityAuth';
const listenerId = GM_addValueChangeListener('steamCommunityAuth', (key, oldValue, newValue) => {
GM_removeValueChangeListener(listenerId);
GM_deleteValue('ATv4_updateCommunityAuth');
newTab?.close();
if (newValue && JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
this.#auth.steam64Id = newValue.steam64Id;
Expand All @@ -4831,6 +4837,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
logStatus.error('Failed');
resolve(false);
});
newTab.onclose = () => {
GM_deleteValue('ATv4_updateCommunityAuth');
};
});
} catch (error) {
throwError(error, 'Steam.updateCommunityAuthTab');
Expand Down Expand Up @@ -10945,13 +10954,14 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
} else if (window.location.hostname === 'opquests.com') {
loadScript();
} else if (window.name === 'ATv4_updateStoreAuth' && window.location.host === 'store.steampowered.com') {
} else if ((window.name === 'ATv4_updateStoreAuth' || GM_getValue('ATv4_updateStoreAuth')) && window.location.host === 'store.steampowered.com') {
$(() => {
if ($('[data-miniprofile]').length === 0) {
return;
}
const storeSessionID = document.body.innerHTML.match(/g_sessionID = "(.+?)";/)?.[1];
if (storeSessionID) {
GM_deleteValue('ATv4_updateStoreAuth');
GM_setValue('steamStoreAuth', {
storeSessionID: storeSessionID
});
Expand All @@ -10964,23 +10974,25 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
});
}
});
} else if (window.name === 'ATv4_updateCommunityAuth' && window.location.host === 'steamcommunity.com') {
} else if ((window.name === 'ATv4_updateCommunityAuth' || GM_getValue('ATv4_updateCommunityAuth')) && window.location.host === 'steamcommunity.com') {
$(() => {
const steam64Id = document.body.innerHTML.match(/g_steamID = "(.+?)";/)?.[1];
const communitySessionID = document.body.innerHTML.match(/g_sessionID = "(.+?)";/)?.[1];
const data = {};
if (steam64Id) {
data.steam64Id = steam64Id;
}
if (communitySessionID) {
data.communitySessionID = communitySessionID;
GM_setValue('steamCommunityAuth', data);
if (steam64Id && communitySessionID) {
GM_deleteValue('ATv4_updateCommunityAuth');
GM_setValue('steamCommunityAuth', {
steam64Id: steam64Id,
communitySessionID: communitySessionID
});
window.close();
external_Swal_default().fire('', i18n('closePageNotice'));
} else {
external_Swal_default().fire({
title: 'Error: Get "sessionID" failed',
icon: 'error'
});
setTimeout(() => {
external_Swal_default().fire({
title: 'Error: Get "sessionID" failed',
icon: 'error'
});
}, 3e3);
}
});
} else {
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.5

### V4.5.1

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

- 修复: Steam社区凭证无法更新(#34,#24)

### V4.5.0

[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.5.0)
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.5.0",
"version": "4.5.1",
"change": [
"修复: 浏览器弹窗拦截导致登录凭证无法更新(#34)",
"优化: 开发文档"
"修复: Steam社区凭证无法更新(#34,#24)"
],
"description": "赠Key站自动任务脚本",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions page/dist/auto-task-v4-for-giveawaysu.all.user.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Loading

0 comments on commit dc23ca9

Please sign in to comment.