Skip to content

Commit

Permalink
修复获取Discord凭证失败的BUG(#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Jan 20, 2022
1 parent 6ad6931 commit e37e9b7
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: v4.1.16-beta
name: 4.1.16-beta
body: '- 添加steam请求访问权限功能'
tag_name: v4.1.17-beta
name: 4.1.17-beta
body: '- 修复获取Discord凭证失败的BUG(#2)'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
dist/auto-task-v4.compatibility.user.js
Expand Down
2 changes: 1 addition & 1 deletion dist/auto-task-v4-for-giveawaysu.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

34 changes: 22 additions & 12 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.1.16-beta
// @version 4.1.17-beta
// @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 @@ -10622,21 +10622,31 @@ ${$.makeArray($('#auto-task-info>li')).map(element => element.innerText).join('\
const scripts_updateChecker = updateChecker;
window.STYLE = GM_addStyle(auto_task.Z + GM_getResourceText('style'));
if (window.location.hostname === 'discord.com') {
var _window$localStorage, _window$localStorage$;
const discordAuth = (_window$localStorage = window.localStorage) === null || _window$localStorage === void 0 ? void 0 : (_window$localStorage$ = _window$localStorage.getItem('token')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
if (window.location.hash === '#auth') {
const LocalStorage = window.localStorage;
if (window.location.hash === '#auth') {
var _LocalStorage$getItem;
window.localStorage.removeItem = () => true;
const discordAuth = LocalStorage === null || LocalStorage === void 0 ? void 0 : (_LocalStorage$getItem = LocalStorage.getItem('token')) === null || _LocalStorage$getItem === void 0 ? void 0 : _LocalStorage$getItem.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
window.close();
external_Swal_default().fire('', i18n('closePageNotice'));
} else {
external_Swal_default().fire({
text: i18n('getDiscordAuthFailed'),
icon: 'error'
});
}
} else {
external_Swal_default().fire({
text: i18n('getDiscordAuthFailed'),
icon: 'error'
});
var _LocalStorage$getItem2;
const discordAuth = LocalStorage === null || LocalStorage === void 0 ? void 0 : (_LocalStorage$getItem2 = LocalStorage.getItem('token')) === null || _LocalStorage$getItem2 === void 0 ? void 0 : _LocalStorage$getItem2.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
}
}
}
const loadScript = async () => {
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.1

### V4.1.17-beta

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

- 修复获取Discord凭证失败的BUG([#2](https://github.com/HCLonely/auto-task-v4/issues/2))

### V4.1.16-beta

[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.1.16-beta)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "auto-task-v4",
"version": "4.1.16-beta",
"version": "4.1.17-beta",
"change": [
"添加steam请求访问权限功能"
"修复获取Discord凭证失败的BUG(#2)"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
2 changes: 1 addition & 1 deletion page/dist/auto-task-v4-for-giveawaysu.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Large diffs are not rendered by default.

34 changes: 22 additions & 12 deletions page/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.1.16-beta
// @version 4.1.17-beta
// @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 @@ -10622,21 +10622,31 @@ ${$.makeArray($('#auto-task-info>li')).map(element => element.innerText).join('\
const scripts_updateChecker = updateChecker;
window.STYLE = GM_addStyle(auto_task.Z + GM_getResourceText('style'));
if (window.location.hostname === 'discord.com') {
var _window$localStorage, _window$localStorage$;
const discordAuth = (_window$localStorage = window.localStorage) === null || _window$localStorage === void 0 ? void 0 : (_window$localStorage$ = _window$localStorage.getItem('token')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
if (window.location.hash === '#auth') {
const LocalStorage = window.localStorage;
if (window.location.hash === '#auth') {
var _LocalStorage$getItem;
window.localStorage.removeItem = () => true;
const discordAuth = LocalStorage === null || LocalStorage === void 0 ? void 0 : (_LocalStorage$getItem = LocalStorage.getItem('token')) === null || _LocalStorage$getItem === void 0 ? void 0 : _LocalStorage$getItem.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
window.close();
external_Swal_default().fire('', i18n('closePageNotice'));
} else {
external_Swal_default().fire({
text: i18n('getDiscordAuthFailed'),
icon: 'error'
});
}
} else {
external_Swal_default().fire({
text: i18n('getDiscordAuthFailed'),
icon: 'error'
});
var _LocalStorage$getItem2;
const discordAuth = LocalStorage === null || LocalStorage === void 0 ? void 0 : (_LocalStorage$getItem2 = LocalStorage.getItem('token')) === null || _LocalStorage$getItem2 === void 0 ? void 0 : _LocalStorage$getItem2.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', {
auth: discordAuth
});
}
}
}
const loadScript = async () => {
Expand Down
4 changes: 2 additions & 2 deletions page/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "auto-task-v4",
"version": "4.1.16-beta",
"version": "4.1.17-beta",
"change": [
"添加steam请求访问权限功能"
"修复获取Discord凭证失败的BUG(#2)"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
25 changes: 16 additions & 9 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-17 10:45:01
* @LastEditTime : 2022-01-20 14:01:10
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/index.ts
* @Description : 入口文件
Expand Down Expand Up @@ -29,18 +29,25 @@ declare const commonOptions: {
};

if (window.location.hostname === 'discord.com') {
const discordAuth = window.localStorage?.getItem('token')?.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', { auth: discordAuth });
if (window.location.hash === '#auth') {
const LocalStorage = window.localStorage;
if (window.location.hash === '#auth') {
window.localStorage.removeItem = () => true;
const discordAuth = LocalStorage?.getItem('token')?.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', { auth: discordAuth });
window.close();
Swal.fire('', __('closePageNotice'));
} else {
Swal.fire({
text: __('getDiscordAuthFailed'),
icon: 'error'
});
}
} else {
Swal.fire({
text: __('getDiscordAuthFailed'),
icon: 'error'
});
const discordAuth = LocalStorage?.getItem('token')?.replace(/^"|"$/g, '');
if (discordAuth && /^mfa\./.test(discordAuth)) {
GM_setValue('discordAuth', { auth: discordAuth });
}
}
}

Expand Down

1 comment on commit e37e9b7

@vercel
Copy link

@vercel vercel bot commented on e37e9b7 Jan 20, 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.