mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 23:06:14 -04:00
refactor: fixed more sonarcloud issues
This commit is contained in:
parent
a866ac6070
commit
b34eb4c1ac
12 changed files with 32 additions and 109 deletions
|
@ -1,18 +1,12 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {Component, mixins} from 'nuxt-property-decorator'
|
import {Component, mixins} from 'nuxt-property-decorator'
|
||||||
import ToolWrapper from '~/components/ToolWrapper.vue'
|
import ToolWrapper from '~/components/ToolWrapper.vue'
|
||||||
import type {ToolConfig} from '~/types/ToolConfig'
|
|
||||||
import {ToolConfigMixin} from '~/mixins/tool-config.mixin'
|
import {ToolConfigMixin} from '~/mixins/tool-config.mixin'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {ToolWrapper}
|
components: {ToolWrapper}
|
||||||
})
|
})
|
||||||
export default class Tool extends mixins(ToolConfigMixin) {
|
export default class Tool extends mixins(ToolConfigMixin) {
|
||||||
config(): ToolConfig {
|
|
||||||
return {
|
|
||||||
title: 'ADD A <tool> TAG'
|
|
||||||
} as unknown as ToolConfig
|
|
||||||
};
|
|
||||||
|
|
||||||
public head() {
|
public head() {
|
||||||
const {title, description, keywords} = this.$toolConfig
|
const {title, description, keywords} = this.$toolConfig
|
||||||
|
|
|
@ -117,9 +117,6 @@
|
||||||
<nuxt />
|
<nuxt />
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-main>
|
</v-main>
|
||||||
<!--<v-footer app>-->
|
|
||||||
<!-- <span>© {{ new Date().getFullYear() }}</span>-->
|
|
||||||
<!--</v-footer>-->
|
|
||||||
</v-app>
|
</v-app>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -180,10 +177,6 @@ export default class DefaultLayout extends Vue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-navigation-drawer__content {
|
|
||||||
.pretty-scrollbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
.v-toolbar__content {
|
.v-toolbar__content {
|
||||||
a {
|
a {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
@ -235,6 +228,8 @@ export default class DefaultLayout extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-navigation-drawer__content {
|
.v-navigation-drawer__content {
|
||||||
|
.pretty-scrollbar;
|
||||||
|
|
||||||
.v-list-item--active {
|
.v-list-item--active {
|
||||||
color: var(--v-anchor-base);
|
color: var(--v-anchor-base);
|
||||||
border-left: 3px solid var(--v-primary-base);
|
border-left: 3px solid var(--v-primary-base);
|
||||||
|
|
|
@ -11,10 +11,5 @@ import {Component, Vue} from 'nuxt-property-decorator'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class HowToReportBugOrRequest extends Vue {
|
export default class HowToReportBugOrRequest extends Vue {
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ path: '/base-converter'
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import {Component, Ref} from 'nuxt-property-decorator'
|
import {Component, Ref} from 'nuxt-property-decorator'
|
||||||
import {CopyableMixin} from '~/mixins/copyable.mixin'
|
|
||||||
import Tool from '~/components/Tool.vue'
|
import Tool from '~/components/Tool.vue'
|
||||||
|
import {CopyableMixin} from '~/mixins/copyable.mixin'
|
||||||
import type {VForm} from '~/types/VForm'
|
import type {VForm} from '~/types/VForm'
|
||||||
|
|
||||||
const convertBase = (value: string, fromBase: number, toBase: number) => {
|
const convertBase = (value: string, fromBase: number, toBase: number) => {
|
||||||
|
@ -117,6 +117,3 @@ export default class BaseConverter extends Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -53,6 +53,3 @@ export default class Base64StringConverter extends Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -128,6 +128,3 @@ export default class DateConverter extends Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ export default class Bip39Generator extends Tool {
|
||||||
languageList = Object
|
languageList = Object
|
||||||
.keys(bip39.wordlists)
|
.keys(bip39.wordlists)
|
||||||
.filter(k => !k.match(/[A-Z]{2}/))
|
.filter(k => !k.match(/[A-Z]{2}/))
|
||||||
.map(k => ({
|
.map(v => ({
|
||||||
text: k.split('_').map(k => k.charAt(0).toUpperCase() + k.slice(1)).join(' '),
|
text: v.split('_').map(k => k.charAt(0).toUpperCase() + k.slice(1)).join(' '),
|
||||||
value: k
|
value: v
|
||||||
}))
|
}))
|
||||||
|
|
||||||
rules = {
|
rules = {
|
||||||
|
@ -103,6 +103,3 @@ export default class Bip39Generator extends Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -99,6 +99,3 @@ export default class CypherUncyferText extends Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -71,6 +71,3 @@ export default class HashText extends Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
<ToolWrapper :config="$toolConfig">
|
<ToolWrapper :config="$toolConfig">
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<v-col lg="6" md="12">
|
<v-col lg="6" md="12">
|
||||||
<v-switch v-model="withLowercase" label="Lowercase (abc...)" />
|
<v-switch v-model="config.withLowercase" label="Lowercase (abc...)"/>
|
||||||
<v-switch v-model="withUppercase" label="Uppercase (ABC...)" />
|
<v-switch v-model="config.withUppercase" label="Uppercase (ABC...)"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col lg="6" md="12">
|
<v-col lg="6" md="12">
|
||||||
<v-switch v-model="withNumbers" label="Numbers (123...)" />
|
<v-switch v-model="config.withNumbers" label="Numbers (123...)"/>
|
||||||
<v-switch v-model="withSpecials" label="Specials (#]-...)" />
|
<v-switch v-model="config.withSpecials" label="Specials (#]-...)"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<v-slider v-model="length" :label="`Length (${length})`" min="1" max="512" />
|
<v-slider v-model="config.length" :label="`Length (${config.length})`" min="1" max="512"/>
|
||||||
|
|
||||||
<v-textarea v-model="token" outlined />
|
<v-textarea v-model="token" outlined/>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<v-btn depressed class="mr-4" @click="refreshToken()">
|
<v-btn depressed class="mr-4" @click="refreshToken()">
|
||||||
|
@ -30,12 +30,12 @@
|
||||||
title: 'Token generator'
|
title: 'Token generator'
|
||||||
description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus distinctio dolor dolorum eaque eligendi, facilis impedit laboriosam odit placeat.'
|
description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus distinctio dolor dolorum eaque eligendi, facilis impedit laboriosam odit placeat.'
|
||||||
icon: 'mdi-key-chain-variant'
|
icon: 'mdi-key-chain-variant'
|
||||||
keywords: ['token', 'random', 'string', 'alphanumeric', 'symbols']
|
keywords: [ 'token', 'random', 'string', 'alphanumeric', 'symbols' ]
|
||||||
path: '/token-generator'
|
path: '/token-generator'
|
||||||
</tool>
|
</tool>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {Component} from 'nuxt-property-decorator'
|
import {Component, Watch} from 'nuxt-property-decorator'
|
||||||
import Tool from '~/components/Tool.vue'
|
import Tool from '~/components/Tool.vue'
|
||||||
import {CopyableMixin} from '~/mixins/copyable.mixin'
|
import {CopyableMixin} from '~/mixins/copyable.mixin'
|
||||||
import {shuffle} from '~/utils/string'
|
import {shuffle} from '~/utils/string'
|
||||||
|
@ -49,42 +49,36 @@ const specials = '.,;:!?./-"\'#{([-|\\@)]=}*+'
|
||||||
mixins: [CopyableMixin]
|
mixins: [CopyableMixin]
|
||||||
})
|
})
|
||||||
export default class TokenGenerator extends Tool {
|
export default class TokenGenerator extends Tool {
|
||||||
withNumbers = true;
|
token = '';
|
||||||
withLowercase = true;
|
config = {
|
||||||
withUppercase = true;
|
withNumbers: true,
|
||||||
withSpecials = false;
|
withLowercase: true,
|
||||||
length = 64;
|
withUppercase: true,
|
||||||
refreshBool = true;
|
withSpecials: false,
|
||||||
|
length: 64
|
||||||
refreshToken() {
|
|
||||||
this.refreshBool = !this.refreshBool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get token() {
|
created() {
|
||||||
if (this.refreshBool) {
|
this.refreshToken()
|
||||||
(() => {
|
}
|
||||||
})()
|
|
||||||
} // To force recomputation
|
|
||||||
|
|
||||||
|
@Watch('config', {deep: true})
|
||||||
|
refreshToken() {
|
||||||
let result = ''
|
let result = ''
|
||||||
if (this.withLowercase) {
|
if (this.config.withLowercase) {
|
||||||
result += lowercase
|
result += lowercase
|
||||||
}
|
}
|
||||||
if (this.withUppercase) {
|
if (this.config.withUppercase) {
|
||||||
result += uppercase
|
result += uppercase
|
||||||
}
|
}
|
||||||
if (this.withNumbers) {
|
if (this.config.withNumbers) {
|
||||||
result += numbers
|
result += numbers
|
||||||
}
|
}
|
||||||
if (this.withSpecials) {
|
if (this.config.withSpecials) {
|
||||||
result += specials
|
result += specials
|
||||||
}
|
}
|
||||||
|
|
||||||
return shuffle(result.repeat(this.length)).substring(0, this.length)
|
this.token = shuffle(result.repeat(this.config.length)).substring(0, this.config.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -65,39 +65,4 @@ export default class FileToBase64 extends Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// export default {
|
|
||||||
// name: 'FileToBase64',
|
|
||||||
// components: {FileUploader},
|
|
||||||
// data() {
|
|
||||||
// return {
|
|
||||||
// file: undefined,
|
|
||||||
// loading: false,
|
|
||||||
// base64: '',
|
|
||||||
// copyBase64() {
|
|
||||||
// copyToClipboard(this.base64)
|
|
||||||
// this.$toast.success('Copied to clipboard.')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// watch: {
|
|
||||||
// file() {
|
|
||||||
// this.loading = true
|
|
||||||
// this.base64 = ''
|
|
||||||
// const reader = new FileReader()
|
|
||||||
// reader.onload = () => this.handleBase64(reader.result)
|
|
||||||
// reader.onerror = () => this.handleBase64('[An error as occurred]')
|
|
||||||
// reader.readAsDataURL(this.file)
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// methods: {
|
|
||||||
// handleBase64(base64) {
|
|
||||||
// this.base64 = base64
|
|
||||||
// this.loading = false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import {random} from './random'
|
|
||||||
|
|
||||||
const capitalise = (s: string) => s.charAt(0).toUpperCase() + s.slice(1)
|
const capitalise = (s: string) => s.charAt(0).toUpperCase() + s.slice(1)
|
||||||
|
|
||||||
const shuffle = (s: string) => s.split('').sort(() => 0.5 - random()).join('')
|
const shuffle = (s: string) => s.split('').sort(() => 0.5 - Math.random()).join('')
|
||||||
|
|
||||||
export {capitalise, shuffle}
|
export {capitalise, shuffle}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue