diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 37a67b34..8fa8e781 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -4,6 +4,8 @@ module.exports = { root: true, extends: ['@antfu', './.eslintrc-auto-import.json', '@unocss'], + + ignorePatterns: ['src/libs/*'], rules: { 'curly': ['error', 'all'], diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..94e13c15 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ dev ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ dev ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + config: | + paths-ignore: + - src/libs + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/package.json b/package.json index ecb1c53e..e28b48af 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "@types/arr-diff": "^4.0.3", "@types/markdown-it": "^13.0.7", "@types/pdfjs-dist": "^2.10.378", + "@types/emscripten": "^1.39.10", "@types/figlet": "^1.5.8", "@types/markdown-it": "^13.0.7", "@vicons/material": "^0.12.0", @@ -173,6 +174,7 @@ "pinia": "^2.0.34", "plausible-tracker": "^0.3.8", "pretty-ms": "^9.1.0", + "qpdf-wasm-esm-embedded": "^1.1.1", "qrcode": "^1.5.1", "randexp": "^0.5.3", "regex": "^4.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60cfdc16..43840985 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,6 +80,9 @@ dependencies: '@types/arr-diff': specifier: ^4.0.3 version: 4.0.3 + '@types/emscripten': + specifier: ^1.39.10 + version: 1.39.13 '@types/figlet': specifier: ^1.5.8 version: 1.5.8 @@ -374,6 +377,9 @@ dependencies: pretty-ms: specifier: ^9.1.0 version: 9.1.0 + qpdf-wasm-esm-embedded: + specifier: ^1.1.1 + version: 1.1.1 qrcode: specifier: ^1.5.1 version: 1.5.1 @@ -4139,6 +4145,10 @@ packages: '@types/trusted-types': 2.0.3 dev: true + /@types/emscripten@1.39.13: + resolution: {integrity: sha512-cFq+fO/isvhvmuP/+Sl4K4jtU6E23DoivtbO4r50e3odaxAiVdbfSYRDdJ4gCdxx+3aRjhphS5ZMwIH4hFy/Cw==} + dev: false + /@types/estree@0.0.39: resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} dev: true @@ -5289,7 +5299,7 @@ packages: /@vueuse/shared@10.0.0(vue@3.3.4): resolution: {integrity: sha512-Zh3LgJqvUBWVY3SiMvXanTcfAneGbt63QPczBRDNgQ6jd/ehodO9a1lCFzaA6SWJJoI+ugVTjHFYJdoR656DVQ==} dependencies: - vue-demi: 0.14.10(vue@3.3.4) + vue-demi: 0.14.5(vue@3.3.4) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -10814,6 +10824,12 @@ packages: engines: {node: '>=6'} dev: true + /qpdf-wasm-esm-embedded@1.1.1: + resolution: {integrity: sha512-e6Pb8jRw+VflZQvsS+eOfYF9BqjubvTBnxJc44LhI1btg2WYNKE5/lGMmzWZ2gd9YrdWByf8IdNZw6S7+7t27w==} + dependencies: + '@types/emscripten': 1.39.13 + dev: false + /qrcode@1.5.1: resolution: {integrity: sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg==} engines: {node: '>=10.13.0'} diff --git a/src/tools/index.ts b/src/tools/index.ts index 79a9e81e..b2cf7651 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -145,6 +145,7 @@ import { tool as uuidGenerator } from './uuid-generator'; import { tool as macAddressLookup } from './mac-address-lookup'; import { tool as xmlFormatter } from './xml-formatter'; import { tool as dockerComposeToDockerRunConverter } from './docker-compose-to-docker-run-converter'; +import { tool as pdfEncrypt } from './pdf-encrypt'; import { tool as yamlViewer } from './yaml-viewer'; import { tool as barcodeReader } from './barcode-reader'; import { tool as barcodeGenerator } from './barcode-generator'; @@ -170,6 +171,9 @@ export const toolsByCategory: ToolCategory[] = [ certificateKeyParser, passwordStrengthAnalyser, pdfSignatureChecker, + passwordStrengthAnalyser, + pdfSignatureChecker, + pdfEncrypt, ], }, { diff --git a/src/tools/pdf-encrypt/index.ts b/src/tools/pdf-encrypt/index.ts new file mode 100644 index 00000000..89febf4d --- /dev/null +++ b/src/tools/pdf-encrypt/index.ts @@ -0,0 +1,12 @@ +import { Lock } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Pdf Encrypt', + path: '/pdf-encrypt', + description: 'Encrypt and add protection to a PDF File', + keywords: ['pdf', 'encrypt'], + component: () => import('./pdf-encrypt.vue'), + icon: Lock, + createdAt: new Date('2024-01-09'), +}); diff --git a/src/tools/pdf-encrypt/pdf-encrypt.vue b/src/tools/pdf-encrypt/pdf-encrypt.vue new file mode 100644 index 00000000..6b6e4d94 --- /dev/null +++ b/src/tools/pdf-encrypt/pdf-encrypt.vue @@ -0,0 +1,208 @@ + + +