Skip to content

Commit

Permalink
添加Discord相关提醒(#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed May 13, 2022
1 parent cf4b93b commit 99a318b
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 101 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
prerelease: false
tag_name: v4.2.6
name: 4.2.6
body: '- 优化Steam凭证获取逻辑'
tag_name: v4.2.7
name: 4.2.7
body: '- [重要]目前使用Discord相关功能可能会强制退出帐号,请谨慎使用!'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
dist/auto-task-v4.compatibility.user.js
Expand Down
14 changes: 7 additions & 7 deletions dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

86 changes: 63 additions & 23 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.6
// @version 4.2.7
// @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 @@ -1361,6 +1361,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
leavingDiscordServer: '正在退出Discord服务器',
gettingDiscordGuild: '正在获取Discord服务器Id',
getDiscordAuthFailed: '获取Discord凭证失败,请检测Discord帐号是否已登录',
discordImportantNotice: '重要提醒!!!',
discordImportantNoticeText: '由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!',
continue: '继续',
skipDiscordTask: '跳过Discord任务',
continueAndDontRemindAgain: '继续且不再提醒',
users: '用户',
loginIns: '请先<a href="https://www.instagram.com/accounts/login/" target="_blank">登录Instagram</a>',
insBanned: '您的Instagram账户已被封禁',
Expand Down Expand Up @@ -1622,6 +1627,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
leavingDiscordServer: 'Leaving Discord Server',
gettingDiscordGuild: 'Getting Discord server Id',
getDiscordAuthFailed: 'Failed to get Discord token, please check whether the Discord account is logged in',
discordImportantNotice: 'Important Reminder! ! !',
discordImportantNoticeText: 'Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !',
continue: 'Continue',
skipDiscordTask: 'Skip',
continueAndDontRemindAgain: 'Continue without Reminders',
users: 'User',
loginIns: 'Please <a href="https://www.instagram.com/accounts/login/" target="_blank">log in to Instagram</a>',
insBanned: 'Your Instagram account has been banned',
Expand Down Expand Up @@ -1801,21 +1811,6 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
return obj;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'set');
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError('attempted to set read only private field');
}
descriptor.value = value;
}
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) {
throw new TypeError('attempted to get private field on non-instance');
Expand All @@ -1826,17 +1821,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'get');
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'set');
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError('attempted to ' + action + ' private field on non-instance');
}
return privateMap.get(receiver);
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError('attempted to set read only private field');
}
descriptor.value = value;
}
return descriptor.value;
}
const defaultTasksTemplate = {
servers: []
Expand Down Expand Up @@ -1881,6 +1891,34 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
async init() {
try {
if (!GM_getValue('dontRemindDiscordAgain')) {
const result = await external_Swal_default().fire({
title: i18n('discordImportantNotice'),
text: i18n('discordImportantNoticeText'),
showCancelButton: true,
showDenyButton: true,
confirmButtonText: i18n('continue'),
cancelButtonText: i18n('skipDiscordTask'),
denyButtonText: i18n('continueAndDontRemindAgain')
}).then(_ref => {
let {
isConfirmed,
isDenied
} = _ref;
if (isConfirmed) {
return true;
}
if (isDenied) {
GM_setValue('dontRemindDiscordAgain', true);
return true;
}
return false;
});
if (!result) {
_classPrivateFieldSet(this, _initialized, false);
return false;
}
}
if (_classPrivateFieldGet(this, _initialized)) {
return true;
}
Expand Down Expand Up @@ -1912,11 +1950,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
return false;
}
}
async toggle(_ref) {
async toggle(_ref2) {
let {
doTask = true,
serverLinks = []
} = _ref;
} = _ref2;
try {
if (!_classPrivateFieldGet(this, _initialized)) {
scripts_echoLog({
Expand Down Expand Up @@ -2032,7 +2070,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
method: 'POST',
dataType: 'json',
headers: {
authorization: _classPrivateFieldGet(this, _auth).auth
authorization: _classPrivateFieldGet(this, _auth).auth,
origin: 'https://discord.com',
referer: `https://discord.com/invite/${inviteId}`
}
});
if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) {
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.7

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

- [重要]目前使用Discord相关功能可能会强制退出帐号,请谨慎使用!

### V4.2.6

[Release](https://github.com/HCLonely/auto-task-v4/releases/tag/v4.2.6)
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.2.6",
"version": "4.2.7",
"change": [
"优化Steam凭证获取逻辑"
"[重要]目前使用Discord相关功能可能会强制退出帐号,请谨慎使用!"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
14 changes: 7 additions & 7 deletions page/dist/auto-task-v4-for-giveawaysu.user.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

86 changes: 63 additions & 23 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.2.6
// @version 4.2.7
// @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 @@ -1361,6 +1361,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
leavingDiscordServer: '正在退出Discord服务器',
gettingDiscordGuild: '正在获取Discord服务器Id',
getDiscordAuthFailed: '获取Discord凭证失败,请检测Discord帐号是否已登录',
discordImportantNotice: '重要提醒!!!',
discordImportantNoticeText: '由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!',
continue: '继续',
skipDiscordTask: '跳过Discord任务',
continueAndDontRemindAgain: '继续且不再提醒',
users: '用户',
loginIns: '请先<a href="https://www.instagram.com/accounts/login/" target="_blank">登录Instagram</a>',
insBanned: '您的Instagram账户已被封禁',
Expand Down Expand Up @@ -1622,6 +1627,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
leavingDiscordServer: 'Leaving Discord Server',
gettingDiscordGuild: 'Getting Discord server Id',
getDiscordAuthFailed: 'Failed to get Discord token, please check whether the Discord account is logged in',
discordImportantNotice: 'Important Reminder! ! !',
discordImportantNoticeText: 'Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !',
continue: 'Continue',
skipDiscordTask: 'Skip',
continueAndDontRemindAgain: 'Continue without Reminders',
users: 'User',
loginIns: 'Please <a href="https://www.instagram.com/accounts/login/" target="_blank">log in to Instagram</a>',
insBanned: 'Your Instagram account has been banned',
Expand Down Expand Up @@ -1801,21 +1811,6 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
return obj;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'set');
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError('attempted to set read only private field');
}
descriptor.value = value;
}
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) {
throw new TypeError('attempted to get private field on non-instance');
Expand All @@ -1826,17 +1821,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'get');
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'set');
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError('attempted to ' + action + ' private field on non-instance');
}
return privateMap.get(receiver);
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError('attempted to set read only private field');
}
descriptor.value = value;
}
return descriptor.value;
}
const defaultTasksTemplate = {
servers: []
Expand Down Expand Up @@ -1881,6 +1891,34 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
}
async init() {
try {
if (!GM_getValue('dontRemindDiscordAgain')) {
const result = await external_Swal_default().fire({
title: i18n('discordImportantNotice'),
text: i18n('discordImportantNoticeText'),
showCancelButton: true,
showDenyButton: true,
confirmButtonText: i18n('continue'),
cancelButtonText: i18n('skipDiscordTask'),
denyButtonText: i18n('continueAndDontRemindAgain')
}).then(_ref => {
let {
isConfirmed,
isDenied
} = _ref;
if (isConfirmed) {
return true;
}
if (isDenied) {
GM_setValue('dontRemindDiscordAgain', true);
return true;
}
return false;
});
if (!result) {
_classPrivateFieldSet(this, _initialized, false);
return false;
}
}
if (_classPrivateFieldGet(this, _initialized)) {
return true;
}
Expand Down Expand Up @@ -1912,11 +1950,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
return false;
}
}
async toggle(_ref) {
async toggle(_ref2) {
let {
doTask = true,
serverLinks = []
} = _ref;
} = _ref2;
try {
if (!_classPrivateFieldGet(this, _initialized)) {
scripts_echoLog({
Expand Down Expand Up @@ -2032,7 +2070,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
method: 'POST',
dataType: 'json',
headers: {
authorization: _classPrivateFieldGet(this, _auth).auth
authorization: _classPrivateFieldGet(this, _auth).auth,
origin: 'https://discord.com',
referer: `https://discord.com/invite/${inviteId}`
}
});
if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) {
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.2.6",
"version": "4.2.7",
"change": [
"优化Steam凭证获取逻辑"
"[重要]目前使用Discord相关功能可能会强制退出帐号,请谨慎使用!"
],
"description": "赠Key站自动任务脚本",
"main": "package.json",
Expand Down
8 changes: 7 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-02-13 22:18:23
* @LastEditTime : 2022-05-13 11:14:35
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/locales/en-US.js
* @Description : i18n英文
Expand Down Expand Up @@ -234,6 +234,12 @@ const data = {
leavingDiscordServer: 'Leaving Discord Server',
gettingDiscordGuild: 'Getting Discord server Id',
getDiscordAuthFailed: 'Failed to get Discord token, please check whether the Discord account is logged in',
discordImportantNotice: 'Important Reminder! ! !',
// eslint-disable-next-line max-len
discordImportantNoticeText: 'Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !',
continue: 'Continue',
skipDiscordTask: 'Skip',
continueAndDontRemindAgain: 'Continue without Reminders',

// Instagram
users: 'User',
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-02-13 22:18:01
* @LastEditTime : 2022-05-13 11:12:00
* @LastEditors : HCLonely
* @FilePath : /auto-task-new/src/locales/zh-CN.js
* @Description : i18n中文
Expand Down Expand Up @@ -216,6 +216,11 @@ const data = {
leavingDiscordServer: '正在退出Discord服务器',
gettingDiscordGuild: '正在获取Discord服务器Id',
getDiscordAuthFailed: '获取Discord凭证失败,请检测Discord帐号是否已登录',
discordImportantNotice: '重要提醒!!!',
discordImportantNoticeText: '由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!',
continue: '继续',
skipDiscordTask: '跳过Discord任务',
continueAndDontRemindAgain: '继续且不再提醒',

// Instagram
users: '用户',
Expand Down
Loading

1 comment on commit 99a318b

@vercel
Copy link

@vercel vercel bot commented on 99a318b May 13, 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.