Merge 2dac7fd04c into 76a19d218d
				
					
				
			This commit is contained in:
		
						commit
						9e52831c63
					
				| @ -4,6 +4,8 @@ | ||||
| module.exports = { | ||||
|   root: true, | ||||
|   extends: ['@antfu', './.eslintrc-auto-import.json', '@unocss'], | ||||
|    | ||||
|   ignorePatterns: ['src/libs/*'], | ||||
| 
 | ||||
|   rules: { | ||||
|     'curly': ['error', 'all'], | ||||
|  | ||||
							
								
								
									
										72
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -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 | ||||
							
								
								
									
										10
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -127,27 +127,25 @@ declare module '@vue/runtime-core' { | ||||
|     MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default'] | ||||
|     MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default'] | ||||
|     NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default'] | ||||
|     NCode: typeof import('naive-ui')['NCode'] | ||||
|     NCheckbox: typeof import('naive-ui')['NCheckbox'] | ||||
|     NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] | ||||
|     NConfigProvider: typeof import('naive-ui')['NConfigProvider'] | ||||
|     NDivider: typeof import('naive-ui')['NDivider'] | ||||
|     NEllipsis: typeof import('naive-ui')['NEllipsis'] | ||||
|     NFormItem: typeof import('naive-ui')['NFormItem'] | ||||
|     NGi: typeof import('naive-ui')['NGi'] | ||||
|     NGrid: typeof import('naive-ui')['NGrid'] | ||||
|     NH1: typeof import('naive-ui')['NH1'] | ||||
|     NH3: typeof import('naive-ui')['NH3'] | ||||
|     NIcon: typeof import('naive-ui')['NIcon'] | ||||
|     NInputNumber: typeof import('naive-ui')['NInputNumber'] | ||||
|     NLabel: typeof import('naive-ui')['NLabel'] | ||||
|     NInput: typeof import('naive-ui')['NInput'] | ||||
|     NLayout: typeof import('naive-ui')['NLayout'] | ||||
|     NLayoutSider: typeof import('naive-ui')['NLayoutSider'] | ||||
|     NMenu: typeof import('naive-ui')['NMenu'] | ||||
|     NScrollbar: typeof import('naive-ui')['NScrollbar'] | ||||
|     NSpace: typeof import('naive-ui')['NSpace'] | ||||
|     NSpin: typeof import('naive-ui')['NSpin'] | ||||
|     NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default'] | ||||
|     OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default'] | ||||
|     PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default'] | ||||
|     PdfEncrypt: typeof import('./src/tools/pdf-encrypt/pdf-encrypt.vue')['default'] | ||||
|     PdfSignatureChecker: typeof import('./src/tools/pdf-signature-checker/pdf-signature-checker.vue')['default'] | ||||
|     PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default'] | ||||
|     PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default'] | ||||
|  | ||||
| @ -41,6 +41,7 @@ | ||||
|     "@tiptap/pm": "2.1.6", | ||||
|     "@tiptap/starter-kit": "2.1.6", | ||||
|     "@tiptap/vue-3": "2.0.3", | ||||
|     "@types/emscripten": "^1.39.10", | ||||
|     "@types/figlet": "^1.5.8", | ||||
|     "@vicons/material": "^0.12.0", | ||||
|     "@vicons/tabler": "^0.12.0", | ||||
| @ -64,7 +65,7 @@ | ||||
|     "highlight.js": "^11.7.0", | ||||
|     "iarna-toml-esm": "^3.0.5", | ||||
|     "ibantools": "^4.3.3", | ||||
|     "js-base64": "^3.7.6", | ||||
|     "js-base64": "^3.7.7", | ||||
|     "json5": "^2.2.3", | ||||
|     "jwt-decode": "^3.1.2", | ||||
|     "libphonenumber-js": "^1.10.28", | ||||
| @ -80,6 +81,7 @@ | ||||
|     "pdf-signature-reader": "^1.4.2", | ||||
|     "pinia": "^2.0.34", | ||||
|     "plausible-tracker": "^0.3.8", | ||||
|     "qpdf-wasm-esm-embedded": "^1.1.1", | ||||
|     "qrcode": "^1.5.1", | ||||
|     "sql-formatter": "^13.0.0", | ||||
|     "ua-parser-js": "^1.0.35", | ||||
|  | ||||
							
								
								
									
										186
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										186
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							| @ -23,6 +23,9 @@ dependencies: | ||||
|   '@tiptap/vue-3': | ||||
|     specifier: 2.0.3 | ||||
|     version: 2.0.3(@tiptap/core@2.1.12)(@tiptap/pm@2.1.6)(vue@3.3.4) | ||||
|   '@types/emscripten': | ||||
|     specifier: ^1.39.10 | ||||
|     version: 1.39.13 | ||||
|   '@types/figlet': | ||||
|     specifier: ^1.5.8 | ||||
|     version: 1.5.8 | ||||
| @ -93,7 +96,7 @@ dependencies: | ||||
|     specifier: ^4.3.3 | ||||
|     version: 4.3.3 | ||||
|   js-base64: | ||||
|     specifier: ^3.7.6 | ||||
|     specifier: ^3.7.7 | ||||
|     version: 3.7.7 | ||||
|   json5: | ||||
|     specifier: ^2.2.3 | ||||
| @ -140,6 +143,9 @@ dependencies: | ||||
|   plausible-tracker: | ||||
|     specifier: ^0.3.8 | ||||
|     version: 0.3.8 | ||||
|   qpdf-wasm-esm-embedded: | ||||
|     specifier: ^1.1.1 | ||||
|     version: 1.1.1 | ||||
|   qrcode: | ||||
|     specifier: ^1.5.1 | ||||
|     version: 1.5.1 | ||||
| @ -2904,6 +2910,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 | ||||
| @ -3354,7 +3364,7 @@ packages: | ||||
|     dependencies: | ||||
|       '@unhead/dom': 0.5.1 | ||||
|       '@unhead/schema': 0.5.1 | ||||
|       '@vueuse/shared': 10.8.0(vue@3.3.4) | ||||
|       '@vueuse/shared': 10.11.0(vue@3.3.4) | ||||
|       unhead: 0.5.1 | ||||
|       vue: 3.3.4 | ||||
|     transitivePeerDependencies: | ||||
| @ -3987,19 +3997,19 @@ packages: | ||||
|       - vue | ||||
|     dev: false | ||||
| 
 | ||||
|   /@vueuse/shared@10.3.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-kGqCTEuFPMK4+fNWy6dUOiYmxGcUbtznMwBZLC1PubidF4VZY05B+Oht7Jh7/6x4VOWGpvu3R37WHi81cKpiqg==} | ||||
|   /@vueuse/shared@10.11.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A==} | ||||
|     dependencies: | ||||
|       vue-demi: 0.14.5(vue@3.3.4) | ||||
|       vue-demi: 0.14.8(vue@3.3.4) | ||||
|     transitivePeerDependencies: | ||||
|       - '@vue/composition-api' | ||||
|       - vue | ||||
|     dev: false | ||||
| 
 | ||||
|   /@vueuse/shared@10.8.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-dUdy6zwHhULGxmr9YUg8e+EnB39gcM4Fe2oKBSrh3cOsV30JcMPtsyuspgFCUo5xxFNaeMf/W2yyKfST7Bg8oQ==} | ||||
|   /@vueuse/shared@10.3.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-kGqCTEuFPMK4+fNWy6dUOiYmxGcUbtznMwBZLC1PubidF4VZY05B+Oht7Jh7/6x4VOWGpvu3R37WHi81cKpiqg==} | ||||
|     dependencies: | ||||
|       vue-demi: 0.14.7(vue@3.3.4) | ||||
|       vue-demi: 0.14.5(vue@3.3.4) | ||||
|     transitivePeerDependencies: | ||||
|       - '@vue/composition-api' | ||||
|       - vue | ||||
| @ -4116,7 +4126,7 @@ packages: | ||||
|   /array-buffer-byte-length@1.0.0: | ||||
|     resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       is-array-buffer: 3.0.2 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -4130,10 +4140,10 @@ packages: | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       array-buffer-byte-length: 1.0.0 | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       is-array-buffer: 3.0.2 | ||||
|       is-shared-array-buffer: 1.0.2 | ||||
|     dev: true | ||||
| @ -4300,12 +4310,15 @@ packages: | ||||
|     engines: {node: '>=8'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /call-bind@1.0.5: | ||||
|     resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} | ||||
|   /call-bind@1.0.7: | ||||
|     resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       es-define-property: 1.0.0 | ||||
|       es-errors: 1.3.0 | ||||
|       function-bind: 1.1.2 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       set-function-length: 1.1.1 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       set-function-length: 1.2.2 | ||||
|     dev: true | ||||
| 
 | ||||
|   /callsites@3.1.0: | ||||
| @ -4818,13 +4831,13 @@ packages: | ||||
|       clone: 1.0.4 | ||||
|     dev: true | ||||
| 
 | ||||
|   /define-data-property@1.1.1: | ||||
|     resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} | ||||
|   /define-data-property@1.1.4: | ||||
|     resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.2 | ||||
|       es-define-property: 1.0.0 | ||||
|       es-errors: 1.3.0 | ||||
|       gopd: 1.0.1 | ||||
|       has-property-descriptors: 1.0.1 | ||||
|     dev: true | ||||
| 
 | ||||
|   /define-lazy-prop@2.0.0: | ||||
| @ -4836,8 +4849,8 @@ packages: | ||||
|     resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       define-data-property: 1.1.1 | ||||
|       has-property-descriptors: 1.0.1 | ||||
|       define-data-property: 1.1.4 | ||||
|       has-property-descriptors: 1.0.2 | ||||
|       object-keys: 1.1.1 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -5027,15 +5040,15 @@ packages: | ||||
|       array-buffer-byte-length: 1.0.0 | ||||
|       arraybuffer.prototype.slice: 1.0.2 | ||||
|       available-typed-arrays: 1.0.5 | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       es-set-tostringtag: 2.0.2 | ||||
|       es-to-primitive: 1.2.1 | ||||
|       function.prototype.name: 1.1.6 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       get-symbol-description: 1.0.0 | ||||
|       globalthis: 1.0.3 | ||||
|       gopd: 1.0.1 | ||||
|       has-property-descriptors: 1.0.1 | ||||
|       has-property-descriptors: 1.0.2 | ||||
|       has-proto: 1.0.1 | ||||
|       has-symbols: 1.0.3 | ||||
|       hasown: 2.0.0 | ||||
| @ -5065,11 +5078,23 @@ packages: | ||||
|       which-typed-array: 1.1.13 | ||||
|     dev: true | ||||
| 
 | ||||
|   /es-define-property@1.0.0: | ||||
|     resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.4 | ||||
|     dev: true | ||||
| 
 | ||||
|   /es-errors@1.3.0: | ||||
|     resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /es-set-tostringtag@2.0.2: | ||||
|     resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       has-tostringtag: 1.0.0 | ||||
|       hasown: 2.0.0 | ||||
|     dev: true | ||||
| @ -5750,7 +5775,7 @@ packages: | ||||
|     resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|       functions-have-names: 1.2.3 | ||||
| @ -5778,9 +5803,11 @@ packages: | ||||
|     resolution: {integrity: sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==} | ||||
|     dev: true | ||||
| 
 | ||||
|   /get-intrinsic@1.2.2: | ||||
|     resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} | ||||
|   /get-intrinsic@1.2.4: | ||||
|     resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       es-errors: 1.3.0 | ||||
|       function-bind: 1.1.2 | ||||
|       has-proto: 1.0.1 | ||||
|       has-symbols: 1.0.3 | ||||
| @ -5805,8 +5832,8 @@ packages: | ||||
|     resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       get-intrinsic: 1.2.4 | ||||
|     dev: true | ||||
| 
 | ||||
|   /get-tsconfig@4.7.2: | ||||
| @ -5901,7 +5928,7 @@ packages: | ||||
|   /gopd@1.0.1: | ||||
|     resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|     dev: true | ||||
| 
 | ||||
|   /graceful-fs@4.2.11: | ||||
| @ -5942,10 +5969,10 @@ packages: | ||||
|     engines: {node: '>=8'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /has-property-descriptors@1.0.1: | ||||
|     resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} | ||||
|   /has-property-descriptors@1.0.2: | ||||
|     resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.2 | ||||
|       es-define-property: 1.0.0 | ||||
|     dev: true | ||||
| 
 | ||||
|   /has-proto@1.0.1: | ||||
| @ -6167,9 +6194,9 @@ packages: | ||||
|     resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       hasown: 2.0.0 | ||||
|       side-channel: 1.0.4 | ||||
|       side-channel: 1.0.6 | ||||
|     dev: true | ||||
| 
 | ||||
|   /ip-address@7.1.0: | ||||
| @ -6202,8 +6229,8 @@ packages: | ||||
|   /is-array-buffer@3.0.2: | ||||
|     resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       is-typed-array: 1.1.12 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -6227,7 +6254,7 @@ packages: | ||||
|     resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       has-tostringtag: 1.0.0 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -6364,7 +6391,7 @@ packages: | ||||
|     resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       has-tostringtag: 1.0.0 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -6376,7 +6403,7 @@ packages: | ||||
|   /is-shared-array-buffer@1.0.2: | ||||
|     resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|     dev: true | ||||
| 
 | ||||
|   /is-stream@2.0.1: | ||||
| @ -6419,7 +6446,7 @@ packages: | ||||
|   /is-weakref@1.0.2: | ||||
|     resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|     dev: true | ||||
| 
 | ||||
|   /is-what@3.14.1: | ||||
| @ -7130,7 +7157,7 @@ packages: | ||||
|     resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       has-symbols: 1.0.3 | ||||
|       object-keys: 1.1.1 | ||||
| @ -7680,6 +7707,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'} | ||||
| @ -7782,7 +7815,7 @@ packages: | ||||
|     resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       set-function-name: 2.0.1 | ||||
|     dev: true | ||||
| @ -7933,8 +7966,8 @@ packages: | ||||
|     resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} | ||||
|     engines: {node: '>=0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       has-symbols: 1.0.3 | ||||
|       isarray: 2.0.5 | ||||
|     dev: true | ||||
| @ -7946,8 +7979,8 @@ packages: | ||||
|   /safe-regex-test@1.0.0: | ||||
|     resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       is-regex: 1.1.4 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -8037,23 +8070,25 @@ packages: | ||||
|     resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} | ||||
|     dev: false | ||||
| 
 | ||||
|   /set-function-length@1.1.1: | ||||
|     resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} | ||||
|   /set-function-length@1.2.2: | ||||
|     resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       define-data-property: 1.1.1 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       define-data-property: 1.1.4 | ||||
|       es-errors: 1.3.0 | ||||
|       function-bind: 1.1.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       gopd: 1.0.1 | ||||
|       has-property-descriptors: 1.0.1 | ||||
|       has-property-descriptors: 1.0.2 | ||||
|     dev: true | ||||
| 
 | ||||
|   /set-function-name@2.0.1: | ||||
|     resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       define-data-property: 1.1.1 | ||||
|       define-data-property: 1.1.4 | ||||
|       functions-have-names: 1.2.3 | ||||
|       has-property-descriptors: 1.0.1 | ||||
|       has-property-descriptors: 1.0.2 | ||||
|     dev: true | ||||
| 
 | ||||
|   /set-value@4.1.0: | ||||
| @ -8076,11 +8111,13 @@ packages: | ||||
|     engines: {node: '>=8'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /side-channel@1.0.4: | ||||
|     resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} | ||||
|   /side-channel@1.0.6: | ||||
|     resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       es-errors: 1.3.0 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       object-inspect: 1.13.1 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -8231,22 +8268,22 @@ packages: | ||||
|   /string.prototype.matchall@4.0.10: | ||||
|     resolution: {integrity: sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       has-symbols: 1.0.3 | ||||
|       internal-slot: 1.0.6 | ||||
|       regexp.prototype.flags: 1.5.1 | ||||
|       set-function-name: 2.0.1 | ||||
|       side-channel: 1.0.4 | ||||
|       side-channel: 1.0.6 | ||||
|     dev: true | ||||
| 
 | ||||
|   /string.prototype.trim@1.2.8: | ||||
|     resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|     dev: true | ||||
| @ -8254,7 +8291,7 @@ packages: | ||||
|   /string.prototype.trimend@1.0.7: | ||||
|     resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|     dev: true | ||||
| @ -8262,7 +8299,7 @@ packages: | ||||
|   /string.prototype.trimstart@1.0.7: | ||||
|     resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       define-properties: 1.2.1 | ||||
|       es-abstract: 1.22.3 | ||||
|     dev: true | ||||
| @ -8559,8 +8596,8 @@ packages: | ||||
|     resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       get-intrinsic: 1.2.2 | ||||
|       call-bind: 1.0.7 | ||||
|       get-intrinsic: 1.2.4 | ||||
|       is-typed-array: 1.1.12 | ||||
|     dev: true | ||||
| 
 | ||||
| @ -8568,7 +8605,7 @@ packages: | ||||
|     resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       for-each: 0.3.3 | ||||
|       has-proto: 1.0.1 | ||||
|       is-typed-array: 1.1.12 | ||||
| @ -8579,7 +8616,7 @@ packages: | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       available-typed-arrays: 1.0.5 | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       for-each: 0.3.3 | ||||
|       has-proto: 1.0.1 | ||||
|       is-typed-array: 1.1.12 | ||||
| @ -8588,7 +8625,7 @@ packages: | ||||
|   /typed-array-length@1.0.4: | ||||
|     resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       for-each: 0.3.3 | ||||
|       is-typed-array: 1.1.12 | ||||
|     dev: true | ||||
| @ -8624,7 +8661,7 @@ packages: | ||||
|   /unbox-primitive@1.0.2: | ||||
|     resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} | ||||
|     dependencies: | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       has-bigints: 1.0.2 | ||||
|       has-symbols: 1.0.3 | ||||
|       which-boxed-primitive: 1.0.2 | ||||
| @ -9158,8 +9195,8 @@ packages: | ||||
|       vue: 3.3.4 | ||||
|     dev: false | ||||
| 
 | ||||
|   /vue-demi@0.14.7(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==} | ||||
|   /vue-demi@0.14.8(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==} | ||||
|     engines: {node: '>=12'} | ||||
|     hasBin: true | ||||
|     requiresBuild: true | ||||
| @ -9343,7 +9380,7 @@ packages: | ||||
|     engines: {node: '>= 0.4'} | ||||
|     dependencies: | ||||
|       available-typed-arrays: 1.0.5 | ||||
|       call-bind: 1.0.5 | ||||
|       call-bind: 1.0.7 | ||||
|       for-each: 0.3.3 | ||||
|       gopd: 1.0.1 | ||||
|       has-tostringtag: 1.0.0 | ||||
| @ -9449,6 +9486,7 @@ packages: | ||||
| 
 | ||||
|   /workbox-google-analytics@7.0.0: | ||||
|     resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} | ||||
|     deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained | ||||
|     dependencies: | ||||
|       workbox-background-sync: 7.0.0 | ||||
|       workbox-core: 7.0.0 | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| import { extension as getExtensionFromMimeType, extension as getMimeTypeFromExtension } from 'mime-types'; | ||||
| import type { Ref } from 'vue'; | ||||
| import type { MaybeRef, Ref } from 'vue'; | ||||
| import _ from 'lodash'; | ||||
| import { get } from '@vueuse/core'; | ||||
| 
 | ||||
| export { | ||||
|   getMimeTypeFromBase64, | ||||
| @ -75,21 +76,11 @@ function downloadFromBase64({ sourceValue, filename, extension, fileMimeType }: | ||||
| } | ||||
| 
 | ||||
| function useDownloadFileFromBase64( | ||||
|   { source, filename, extension, fileMimeType }: | ||||
|   { source: Ref<string>; filename?: string; extension?: string; fileMimeType?: string }) { | ||||
|   return { | ||||
|     download() { | ||||
|       downloadFromBase64({ sourceValue: source.value, filename, extension, fileMimeType }); | ||||
|     }, | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| function useDownloadFileFromBase64Refs( | ||||
|   { source, filename, extension }: | ||||
|   { source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) { | ||||
|   { source: MaybeRef<string>; filename?: MaybeRef<string>; extension?: MaybeRef<string> }) { | ||||
|   return { | ||||
|     download() { | ||||
|       downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value }); | ||||
|       downloadFromBase64({ sourceValue: get(source), filename: get(filename), extension: get(extension) }); | ||||
|     }, | ||||
|   }; | ||||
| } | ||||
| @ -116,3 +107,13 @@ function previewImageFromBase64(base64String: string): HTMLImageElement { | ||||
| 
 | ||||
|   return img; | ||||
| } | ||||
| 
 | ||||
| function useDownloadFileFromBase64Refs( | ||||
|   { source, filename, extension }: | ||||
|   { source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) { | ||||
|   return { | ||||
|     download() { | ||||
|       downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value }); | ||||
|     }, | ||||
|   }; | ||||
| } | ||||
|  | ||||
| @ -80,12 +80,26 @@ import { tool as urlParser } from './url-parser'; | ||||
| 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 pdfEncrypt } from './pdf-encrypt'; | ||||
| import { tool as yamlViewer } from './yaml-viewer'; | ||||
| 
 | ||||
| export const toolsByCategory: ToolCategory[] = [ | ||||
|   { | ||||
|     name: 'Crypto', | ||||
|     components: [tokenGenerator, hashText, bcrypt, uuidGenerator, ulidGenerator, cypher, bip39, hmacGenerator, rsaKeyPairGenerator, passwordStrengthAnalyser, pdfSignatureChecker], | ||||
|     components: [ | ||||
|       tokenGenerator, | ||||
|       hashText, | ||||
|       bcrypt, | ||||
|       uuidGenerator, | ||||
|       ulidGenerator, | ||||
|       cypher, | ||||
|       bip39, | ||||
|       hmacGenerator, | ||||
|       rsaKeyPairGenerator, | ||||
|       passwordStrengthAnalyser, | ||||
|       pdfSignatureChecker, | ||||
|       pdfEncrypt, | ||||
|     ], | ||||
|   }, | ||||
|   { | ||||
|     name: 'Converter', | ||||
|  | ||||
							
								
								
									
										12
									
								
								src/tools/pdf-encrypt/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/tools/pdf-encrypt/index.ts
									
									
									
									
									
										Normal file
									
								
							| @ -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'), | ||||
| }); | ||||
							
								
								
									
										208
									
								
								src/tools/pdf-encrypt/pdf-encrypt.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								src/tools/pdf-encrypt/pdf-encrypt.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,208 @@ | ||||
| <script setup lang="ts"> | ||||
| import { Base64 } from 'js-base64'; | ||||
| import createQPDFModule from 'qpdf-wasm-esm-embedded'; | ||||
| import { useDownloadFileFromBase64Refs } from '@/composable/downloadBase64'; | ||||
| 
 | ||||
| const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle'); | ||||
| const file = ref<File | null>(null); | ||||
| 
 | ||||
| const restrictAccessibility = useStorage('pdf-encrypt:accessibility', false); | ||||
| const restrictAnnotate = useStorage('pdf-encrypt:annotate', false); | ||||
| const restrictAssemble = useStorage('pdf-encrypt:assemble', false); | ||||
| const restrictExtract = useStorage('pdf-encrypt:extract', false); | ||||
| const restrictForm = useStorage('pdf-encrypt:form', false); | ||||
| const restrictModifyOther = useStorage('pdf-encrypt:modoth', false); | ||||
| const clearTextMetadata = useStorage('pdf-encrypt:clearmeta', false); | ||||
| const restrictModify = useStorage('pdf-encrypt:mod', 'all'); | ||||
| const restrictPrint = useStorage('pdf-encrypt:print', 'full'); | ||||
| const userPassword = ref(''); | ||||
| const ownerPassword = ref(''); | ||||
| 
 | ||||
| const base64OutputPDF = ref(''); | ||||
| const logs = ref<string[]>([]); | ||||
| const fileName = ref(''); | ||||
| const fileExtension = ref('pdf'); | ||||
| const { download } = useDownloadFileFromBase64Refs( | ||||
|   { | ||||
|     source: base64OutputPDF, | ||||
|     filename: fileName, | ||||
|     extension: fileExtension, | ||||
|   }); | ||||
| 
 | ||||
| function onFileUploaded(uploadedFile: File) { | ||||
|   file.value = uploadedFile; | ||||
|   fileName.value = `encrypted_${file.value.name}`; | ||||
| } | ||||
| 
 | ||||
| async function onProcessClicked() { | ||||
|   if (!file.value) { | ||||
|     return; | ||||
|   } | ||||
|   const fileBuffer = await file.value.arrayBuffer(); | ||||
| 
 | ||||
|   status.value = 'processing'; | ||||
|   try { | ||||
|     const options = [ | ||||
|       '--verbose', | ||||
|       '--encrypt', | ||||
|     ]; | ||||
|     options.push(`${userPassword.value}`); | ||||
|     options.push(`${ownerPassword.value}`); | ||||
|     options.push('128'); | ||||
|     options.push('--use-aes=y'); | ||||
|     options.push(`--accessibility=${(restrictAccessibility.value ? 'n' : 'y')}`); | ||||
|     options.push(`--annotate=${(restrictAnnotate.value ? 'n' : 'y')}`); | ||||
|     options.push(`--assemble=${(restrictAssemble.value ? 'n' : 'y')}`); | ||||
|     options.push(`--extract=${(restrictExtract.value ? 'n' : 'y')}`); | ||||
|     options.push(`--form=${(restrictForm.value ? 'n' : 'y')}`); | ||||
|     options.push(`--modify-other=${(restrictModifyOther.value ? 'n' : 'y')}`); | ||||
|     options.push(`--modify=${(restrictModify.value)}`); | ||||
|     options.push(`--print=${(restrictPrint.value)}`); | ||||
|     if (clearTextMetadata.value) { | ||||
|       options.push('--cleartext-metadata'); | ||||
|     } | ||||
|     options.push('--'); | ||||
|     options.push('in.pdf'); | ||||
|     options.push('out.pdf'); | ||||
|     const outPdfBuffer = await callMainWithInOutPdf(fileBuffer, | ||||
|       options, 0); | ||||
|     base64OutputPDF.value = `data:application/pdf;base64,${Base64.fromUint8Array(outPdfBuffer)}`; | ||||
|     status.value = 'done'; | ||||
| 
 | ||||
|     download(); | ||||
|   } | ||||
|   catch (e) { | ||||
|     status.value = 'error'; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| async function callMainWithInOutPdf(data: ArrayBuffer, args: string[], expected_exitcode: number) { | ||||
|   logs.value = []; | ||||
|   const mod = await createQPDFModule({ | ||||
|     print(text: string) { | ||||
|       logs.value.push(text); | ||||
|     }, | ||||
|     printErr(text: string) { | ||||
|       logs.value.push(text); | ||||
|     }, | ||||
|   }); | ||||
|   mod.FS.writeFile('in.pdf', new Uint8Array(data)); | ||||
|   const ret = mod.callMain(args); | ||||
|   if (expected_exitcode !== ret) { | ||||
|     throw new Error('Process run failed'); | ||||
|   } | ||||
|   return mod.FS.readFile('out.pdf'); | ||||
| } | ||||
| 
 | ||||
| const printRestrictionOptions = [{ value: 'none', label: 'Disallow printing' }, | ||||
|   { value: 'low', label: 'Allow only low-resolution printing' }, | ||||
|   { value: 'full', label: 'Allow full printing' }, | ||||
| ]; | ||||
| const modificationRestrictionOptions = [ | ||||
|   { value: 'none', label: 'Allow no modifications' }, | ||||
|   { value: 'assembly', label: 'Allow document assembly only' }, | ||||
|   { value: 'form', label: 'Allow document assembly only + filling in form fields and signing' }, | ||||
|   { value: 'annotate', label: 'Allow document assembly only + filling in form fields and signing + commenting and modifying forms' }, | ||||
|   { value: 'all', label: 'Allow full document modification' }, | ||||
| ]; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <div> | ||||
|     <div style="flex: 0 0 100%"> | ||||
|       <div mx-auto max-w-600px> | ||||
|         <c-file-upload | ||||
|           title="Drag and drop a PDF file here, or click to select a file" | ||||
|           accept=".pdf" | ||||
|           @file-upload="onFileUploaded" | ||||
|         /> | ||||
|         <div mt-2 text-center> | ||||
|           <strong>Output file:</strong> {{ fileName }} | ||||
|         </div> | ||||
|       </div> | ||||
|     </div> | ||||
| 
 | ||||
|     <c-card title="Permissions" mb-3 mt-3> | ||||
|       <n-space> | ||||
|         <n-checkbox v-model:checked="restrictAccessibility"> | ||||
|           Restrict accessibility (usually ignored) | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="restrictAnnotate"> | ||||
|           Restrict commenting/filling form fields | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="restrictAssemble"> | ||||
|           Restrict document assembly | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="restrictExtract"> | ||||
|           Restrict text/graphic extraction | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="restrictForm"> | ||||
|           Restrict filling form fields | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="restrictModifyOther"> | ||||
|           Restrict other modifications | ||||
|         </n-checkbox> | ||||
|         <n-checkbox v-model:checked="clearTextMetadata"> | ||||
|           Prevent encryption of metadata | ||||
|         </n-checkbox> | ||||
|       </n-space> | ||||
|       <c-select | ||||
|         v-model:value="restrictModify" | ||||
|         :options="modificationRestrictionOptions" | ||||
|         label="Control modify access by level" | ||||
|         mt-3 | ||||
|       /> | ||||
|       <c-select | ||||
|         v-model:value="restrictPrint" | ||||
|         :options="printRestrictionOptions" | ||||
|         label="Control printing access" | ||||
|         mt-3 | ||||
|       /> | ||||
|     </c-card> | ||||
|     <n-form-item | ||||
|       label="Owner password:" | ||||
|       label-placement="left" | ||||
|       mb-1 | ||||
|     > | ||||
|       <n-input | ||||
|         :value="ownerPassword" | ||||
|         type="password" | ||||
|         placeholder="Owner password (optional)" | ||||
|       /> | ||||
|     </n-form-item> | ||||
| 
 | ||||
|     <n-form-item | ||||
|       label="User password:" | ||||
|       label-placement="left" | ||||
|       mb-1 | ||||
|     > | ||||
|       <n-input | ||||
|         :value="userPassword" | ||||
|         type="password" | ||||
|         placeholder="User password (optional)" | ||||
|       /> | ||||
|     </n-form-item> | ||||
| 
 | ||||
|     <div mt-3 flex justify-center> | ||||
|       <c-button :disabled="!file" @click="onProcessClicked()"> | ||||
|         Encrypt PDF | ||||
|       </c-button> | ||||
|     </div> | ||||
| 
 | ||||
|     <n-divider /> | ||||
| 
 | ||||
|     <div mt-3 flex justify-center> | ||||
|       <c-alert v-if="status === 'error'" type="error"> | ||||
|         An error occured processing {{ fileName }} | ||||
|       </c-alert> | ||||
|       <n-spin | ||||
|         v-if="status === 'processing'" | ||||
|         size="small" | ||||
|       /> | ||||
|     </div> | ||||
| 
 | ||||
|     <c-card title="Logs"> | ||||
|       <pre>{{ logs.join('\n') }}</pre> | ||||
|     </c-card> | ||||
|   </div> | ||||
| </template> | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user