From 28a9fd48e2e7907bdd7660bd6ed3b38c6e4351a5 Mon Sep 17 00:00:00 2001 From: SKANKHUNTER <31552675+MrBurrBurr@users.noreply.github.com> Date: Thu, 30 Jul 2020 00:27:15 +0200 Subject: [PATCH 1/8] Initial commit --- src/components/BotCard.vue | 10 +++++ src/i18n/locale/default.json | 3 ++ src/models/Bot.js | 1 + src/router/routes.js | 9 ++++ src/store/modules/asf.js | 4 ++ src/utils/getUserInputType.js | 14 ++++++ src/views/modals/Bot.vue | 14 +++++- src/views/modals/BotInput.vue | 81 +++++++++++++++++++++++++++++++++++ 8 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/utils/getUserInputType.js create mode 100644 src/views/modals/BotInput.vue diff --git a/src/components/BotCard.vue b/src/components/BotCard.vue index 22063efa1..086181013 100644 --- a/src/components/BotCard.vue +++ b/src/components/BotCard.vue @@ -27,6 +27,7 @@ + + From 5631a25bed5f3a912bc850273a5c4abf73693ffa Mon Sep 17 00:00:00 2001 From: SKANKHUNTER <31552675+MrBurrBurr@users.noreply.github.com> Date: Thu, 30 Jul 2020 23:00:13 +0200 Subject: [PATCH 2/8] Handle all input types --- src/components/BotCard.vue | 7 +++-- src/i18n/locale/default.json | 13 ++++++++-- src/plugins/icons.js | 4 +-- src/router/routes.js | 2 +- src/views/modals/Bot.vue | 5 ++-- src/views/modals/BotInput.vue | 49 ++++++++++++++++++++++++++--------- 6 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/components/BotCard.vue b/src/components/BotCard.vue index 086181013..be8addf36 100644 --- a/src/components/BotCard.vue +++ b/src/components/BotCard.vue @@ -80,12 +80,11 @@ try { const inputType = getUserInputType(this.bot.requiredInput); - // todo: check for other input types - if (headless && inputType === 'TwoFactorAuthentication') { - this.$router.push({ name: 'bot-input', params: { bot: this.bot.name } }); + if (this.headless && inputType !== 'None') { + this.$router.push({ name: 'bot-input', params: { bot: this.bot.name, type: inputType } }); return; } - + await this.$http.botAction(this.bot.name, 'start'); await this.$store.dispatch('bots/updateBot', { name: this.bot.name, active: true }); } catch (err) { diff --git a/src/i18n/locale/default.json b/src/i18n/locale/default.json index bb2311a13..c0e9127bb 100644 --- a/src/i18n/locale/default.json +++ b/src/i18n/locale/default.json @@ -79,9 +79,18 @@ "global-config": "Global Config", "info": "Info", "input-all-selected": "All values selected", - "input-info": "This account is currently using a Steam authenticator app.", - "input-label": "Please enter your 2FA code from your Steam authenticator app:", + "input-info-login": "You have not set a login name for this account.", + "input-info-password": "You have not set a password for this account.", + "input-info-steamguard": "FIX ME: Missing steamguard text", + "input-info-steamparentalcode": "FIX ME: Need steam parental code", + "input-info-twofactorauthentication": "This account is currently using a Steam authenticator app.", + "input-label-login": "Please enter your Steam login name:", + "input-label-password": "Please enter your Steam password:", + "input-label-steamguard": "FIX ME: Please enter your steamguard code from your mail", + "input-label-steamparentalcode": "FIX ME: Please enter your steam parental code", + "input-label-twofactorauthentication": "Please enter your 2FA code from your Steam authenticator app:", "input-submit": "Submit", + "input-switch-visibility": "Switch input field visibility", "input-unknown-type": "Unknown field type", "keep-unchanged": "", "keys-copied": "Copied keys to clipboard!", diff --git a/src/plugins/icons.js b/src/plugins/icons.js index 857733c4c..2ad337ef5 100644 --- a/src/plugins/icons.js +++ b/src/plugins/icons.js @@ -6,7 +6,7 @@ import { faTimesCircle, faCheckCircle, faEdit, faTimes, faSquare, faMoon, faPalette, faPlay, faQuestion, faPlus, faSpinner, faKey, faTrash, faCloudDownloadAlt, faSignOutAlt, faAngleDown, faLanguage, faGamepad, faClone, faCalendarCheck, faLock, faBookOpen, faExclamation, faCodeBranch, faHourglassEnd, faHourglassHalf, faHourglassStart, - faRedoAlt, faClipboard, faPuzzlePiece, faUndoAlt, + faRedoAlt, faClipboard, faPuzzlePiece, faUndoAlt, faEye, faEyeSlash, } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome'; @@ -15,7 +15,7 @@ library.add(faWrench, faBars, faLaptop, faUsers, faFileAlt, faTachometerAlt, faP faClock, faTimesCircle, faCheckCircle, faEdit, faTimes, faSquare, faMoon, faPalette, faPlay, faQuestion, faPlus, faSpinner, faKey, faTrash, faCloudDownloadAlt, faSignOutAlt, faAngleDown, faLanguage, faGamepad, faClone, faCalendarCheck, faLock, faGithub, faBookOpen, faExclamation, faCodeBranch, faHourglassEnd, faHourglassHalf, - faHourglassStart, faRedoAlt, faClipboard, faPuzzlePiece, faUndoAlt); + faHourglassStart, faRedoAlt, faClipboard, faPuzzlePiece, faUndoAlt, faEye, faEyeSlash); export default { install(Vue) { diff --git a/src/router/routes.js b/src/router/routes.js index 924f02bff..ec6b44874 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -102,7 +102,7 @@ export default [ meta: { modal: true } }, { - path: '/page/bot/:bot/input', + path: '/page/bot/:bot/input/:type', name: 'bot-input', components: { default: () => import('../views/Bots.vue'), diff --git a/src/views/modals/Bot.vue b/src/views/modals/Bot.vue index 397c503e9..2982bd964 100644 --- a/src/views/modals/Bot.vue +++ b/src/views/modals/Bot.vue @@ -106,9 +106,8 @@ async start() { const inputType = getUserInputType(this.bot.requiredInput); - // todo: check for other input types - if (headless && inputType === 'TwoFactorAuthentication') { - this.$router.push({ name: 'bot-input', params: { bot: this.bot.name } }); + if (this.headless && inputType !== 'None') { + this.$router.push({ name: 'bot-input', params: { bot: this.bot.name, type: inputType } }); return; } diff --git a/src/views/modals/BotInput.vue b/src/views/modals/BotInput.vue index e9aecc27c..fc9d6bc3a 100644 --- a/src/views/modals/BotInput.vue +++ b/src/views/modals/BotInput.vue @@ -4,10 +4,18 @@ {{ bot.name }} - {{ $t('input-info') }} + {{ $t(`input-info-${inputType}`) }} - {{ $t('input-label') }} - + + {{ $t(`input-label-${inputType}`) }} + + + + + + + + @@ -28,6 +36,7 @@ return { submitting: false, code: '', + inputHidden: true, }; }, computed: { @@ -35,14 +44,24 @@ bot() { return this.$store.getters['bots/bot'](this.$route.params.bot); }, + inputType() { + return this.$route.params.type.toLowerCase(); + }, }, async created() { - if (!this.bot) this.$router.replace({ name: 'bots' }); + if (!this.bot || !this.$route.params.type) this.$router.replace({ name: 'bots' }); }, mounted() { document.getElementById('input').focus(); }, methods: { + switchInputType() { + this.inputHidden = !this.inputHidden; + const field = document.getElementById('input'); + + if (field.getAttribute('type') === 'password') field.setAttribute('type', 'text'); + else field.setAttribute('type', 'password'); + }, async submit() { if (this.submitting) return; @@ -53,8 +72,7 @@ await this.$http.botAction(this.bot.name, 'start'); await this.$store.dispatch('bots/updateBot', { name: this.bot.name, active: true }); - // todo: redirect to bot modal or bots page depending on from where user started bot - this.$parent.back(); + this.$router.back(); } catch (err) { this.$error(err.message); } finally { @@ -70,12 +88,19 @@ padding-bottom: 1em; } - .form-item__code { - justify-content: center; + .form-item__code { + display: grid; + grid-column-gap: 0.5em; + grid-template-columns: 1fr auto; + align-items: flex-end; padding-bottom: 1em; - :focus { - outline: none; - } - } + :focus { + outline: none; + } + } + + .button--helper { + max-width: 2em; + } From 1ca55a52ab59b1dafb994b572340b6e573a5eb81 Mon Sep 17 00:00:00 2001 From: SKANKHUNTER <31552675+MrBurrBurr@users.noreply.github.com> Date: Fri, 31 Jul 2020 02:18:26 +0200 Subject: [PATCH 3/8] Fix info and label text --- src/i18n/locale/default.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/i18n/locale/default.json b/src/i18n/locale/default.json index c0e9127bb..81105094d 100644 --- a/src/i18n/locale/default.json +++ b/src/i18n/locale/default.json @@ -81,13 +81,13 @@ "input-all-selected": "All values selected", "input-info-login": "You have not set a login name for this account.", "input-info-password": "You have not set a password for this account.", - "input-info-steamguard": "FIX ME: Missing steamguard text", - "input-info-steamparentalcode": "FIX ME: Need steam parental code", + "input-info-steamguard": "This account is currently using Steam Guard.", + "input-info-steamparentalcode": "This account is currently using Steam Family View.", "input-info-twofactorauthentication": "This account is currently using a Steam authenticator app.", "input-label-login": "Please enter your Steam login name:", "input-label-password": "Please enter your Steam password:", - "input-label-steamguard": "FIX ME: Please enter your steamguard code from your mail", - "input-label-steamparentalcode": "FIX ME: Please enter your steam parental code", + "input-label-steamguard": "Please enter the Steam Guard code that has been sent to you:", + "input-label-steamparentalcode": "Please enter your Steam Parental code:", "input-label-twofactorauthentication": "Please enter your 2FA code from your Steam authenticator app:", "input-submit": "Submit", "input-switch-visibility": "Switch input field visibility", From 802c9ac96a2cde5d7db771cd53cc69cc9069b922 Mon Sep 17 00:00:00 2001 From: SKANKHUNTER <31552675+MrBurrBurr@users.noreply.github.com> Date: Fri, 31 Jul 2020 15:39:23 +0200 Subject: [PATCH 4/8] Misc --- src/views/modals/BotInput.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/modals/BotInput.vue b/src/views/modals/BotInput.vue index fc9d6bc3a..4454d40a4 100644 --- a/src/views/modals/BotInput.vue +++ b/src/views/modals/BotInput.vue @@ -48,7 +48,7 @@ return this.$route.params.type.toLowerCase(); }, }, - async created() { + created() { if (!this.bot || !this.$route.params.type) this.$router.replace({ name: 'bots' }); }, mounted() { From aea93a604b3d6d0b652c18e6299ffa0f929f80b3 Mon Sep 17 00:00:00 2001 From: SKANKHUNTER <31552675+MrBurrBurr@users.noreply.github.com> Date: Fri, 31 Jul 2020 15:41:10 +0200 Subject: [PATCH 5/8] Verify that requiredInput has not changed --- src/views/modals/BotInput.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/modals/BotInput.vue b/src/views/modals/BotInput.vue index 4454d40a4..6ec67d4d9 100644 --- a/src/views/modals/BotInput.vue +++ b/src/views/modals/BotInput.vue @@ -29,6 +29,7 @@