From 3a0b6122391bf355df23a91074e7f8c32f63f27b Mon Sep 17 00:00:00 2001 From: sharevb Date: Sun, 25 Feb 2024 13:04:22 +0100 Subject: [PATCH 1/3] feat(new tool): htpasswd generator Fix #430 and #807 --- package.json | 1 + pnpm-lock.yaml | 20 +++++-- .../htpasswd-generator/htpasswd-generator.vue | 55 +++++++++++++++++++ src/tools/htpasswd-generator/index.ts | 12 ++++ src/tools/index.ts | 2 + 5 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 src/tools/htpasswd-generator/htpasswd-generator.vue create mode 100644 src/tools/htpasswd-generator/index.ts diff --git a/package.json b/package.json index 7c1bd24a..5a10f2bd 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@vueuse/core": "^10.3.0", "@vueuse/head": "^1.0.0", "@vueuse/router": "^10.0.0", + "apache-md5": "^1.1.8", "bcryptjs": "^2.4.3", "change-case": "^4.1.2", "colord": "^2.9.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f774d0d..dc35c32d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,9 @@ dependencies: '@vueuse/router': specifier: ^10.0.0 version: 10.0.0(vue-router@4.1.6)(vue@3.3.4) + apache-md5: + specifier: ^1.1.8 + version: 1.1.8 bcryptjs: specifier: ^2.4.3 version: 2.4.3 @@ -3378,7 +3381,7 @@ packages: dependencies: '@unhead/dom': 0.5.1 '@unhead/schema': 0.5.1 - '@vueuse/shared': 10.7.2(vue@3.3.4) + '@vueuse/shared': 10.8.0(vue@3.3.4) unhead: 0.5.1 vue: 3.3.4 transitivePeerDependencies: @@ -4020,10 +4023,10 @@ packages: - vue dev: false - /@vueuse/shared@10.7.2(vue@3.3.4): - resolution: {integrity: sha512-qFbXoxS44pi2FkgFjPvF4h7c9oMDutpyBdcJdMYIMg9XyXli2meFMuaKn+UMgsClo//Th6+beeCgqweT/79BVA==} + /@vueuse/shared@10.8.0(vue@3.3.4): + resolution: {integrity: sha512-dUdy6zwHhULGxmr9YUg8e+EnB39gcM4Fe2oKBSrh3cOsV30JcMPtsyuspgFCUo5xxFNaeMf/W2yyKfST7Bg8oQ==} dependencies: - vue-demi: 0.14.6(vue@3.3.4) + vue-demi: 0.14.7(vue@3.3.4) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -4129,6 +4132,11 @@ packages: normalize-path: 3.0.0 picomatch: 2.3.1 + /apache-md5@1.1.8: + resolution: {integrity: sha512-FCAJojipPn0bXjuEpjOOOMN8FZDkxfWWp4JGN9mifU2IhxvKyXZYqpzPHdnTSUpmPDy+tsslB6Z1g+Vg6nVbYA==} + engines: {node: '>=8'} + dev: false + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -9752,8 +9760,8 @@ packages: vue: 3.3.4 dev: false - /vue-demi@0.14.6(vue@3.3.4): - resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==} + /vue-demi@0.14.7(vue@3.3.4): + resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==} engines: {node: '>=12'} hasBin: true requiresBuild: true diff --git a/src/tools/htpasswd-generator/htpasswd-generator.vue b/src/tools/htpasswd-generator/htpasswd-generator.vue new file mode 100644 index 00000000..6638db22 --- /dev/null +++ b/src/tools/htpasswd-generator/htpasswd-generator.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/tools/htpasswd-generator/index.ts b/src/tools/htpasswd-generator/index.ts new file mode 100644 index 00000000..0559d546 --- /dev/null +++ b/src/tools/htpasswd-generator/index.ts @@ -0,0 +1,12 @@ +import { PasswordRound } from '@vicons/material'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Htpasswd/htaccess generator', + path: '/htpasswd-generator', + description: 'htpassword/htaccess user/password generator', + keywords: ['htpasswd', 'htaccess', 'bcrypt', 'password'], + component: () => import('./htpasswd-generator.vue'), + icon: PasswordRound, + createdAt: new Date('2024-02-20'), +}); diff --git a/src/tools/index.ts b/src/tools/index.ts index 2a477ed2..66e236fc 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter'; import { tool as base64StringConverter } from './base64-string-converter'; import { tool as basicAuthGenerator } from './basic-auth-generator'; import { tool as textToUnicode } from './text-to-unicode'; +import { tool as htpasswdGenerator } from './htpasswd-generator'; import { tool as pdfSignatureChecker } from './pdf-signature-checker'; import { tool as numeronymGenerator } from './numeronym-generator'; import { tool as macAddressGenerator } from './mac-address-generator'; @@ -113,6 +114,7 @@ export const toolsByCategory: ToolCategory[] = [ urlParser, deviceInformation, basicAuthGenerator, + htpasswdGenerator, metaTagGenerator, otpCodeGeneratorAndValidator, mimeTypes, From 3b7b0a45e6c9c8625d548daf0cc51677936780bf Mon Sep 17 00:00:00 2001 From: sharevb Date: Sun, 14 Apr 2024 14:43:40 +0200 Subject: [PATCH 2/3] feat(htpasswd generator): allow salt rounds input (if bcrypt) --- src/tools/htpasswd-generator/htpasswd-generator.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/htpasswd-generator/htpasswd-generator.vue b/src/tools/htpasswd-generator/htpasswd-generator.vue index 6638db22..6d947ca6 100644 --- a/src/tools/htpasswd-generator/htpasswd-generator.vue +++ b/src/tools/htpasswd-generator/htpasswd-generator.vue @@ -6,6 +6,7 @@ import TextareaCopyable from '@/components/TextareaCopyable.vue'; const username = ref(''); const password = ref(''); const hashMethod = ref('bcrypt'); +const saltCount = ref(10); const htpasswd = computed(() => { if (username.value === '' || password.value === '') { @@ -16,7 +17,7 @@ const htpasswd = computed(() => { hash = md5(password.value); } else { - hash = hashSync(password.value, 10); + hash = hashSync(password.value, saltCount.value); } return `${username.value}:${hash}`; }); @@ -46,6 +47,10 @@ const htpasswd = computed(() => { :options="['bcrypt', 'md5']" /> + + + + From 0de51a2dea2b7128c053ef29d5af107daa1afd33 Mon Sep 17 00:00:00 2001 From: ShareVB Date: Sat, 6 Apr 2024 11:56:09 +0200 Subject: [PATCH 3/3] chore(github workflows): ci and e2e tests: try updating to node 20 --- .github/workflows/ci.yml | 2 +- .github/workflows/e2e-tests.yml | 2 +- playwright.config.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5c67208..4dd9ffb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - run: corepack enable - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index b5b04096..13b787ef 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 cache: 'pnpm' - name: Get Playwright version diff --git a/playwright.config.ts b/playwright.config.ts index 3caa0612..5257c526 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -9,7 +9,7 @@ const useWebServer = process.env.NO_WEB_SERVER !== 'true'; */ export default defineConfig({ testDir: './src', - testMatch: /.*\.e2e\.(spec\.)?ts/, + testMatch: /\.e2e\.(spec\.)?ts$/, /* Run tests in files in parallel */ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ @@ -57,7 +57,7 @@ export default defineConfig({ && { webServer: { command: 'npm run preview', - url: 'http://127.0.0.1:5050', + url: 'http://localhost:5050', reuseExistingServer: !isCI, }, }