Feat/translate all content (#121)

* feat: add script to extract strings

* feat: extract many strings (html, attr, label)

* feat(extract string): extract html only for .vue and single file mode

* fix: __i18n_ally_root__

* feat: nestify en.yml + extract tab attributes

* feat: add script to extract strings

* feat: extract many strings (html, attr, label)

* feat(extract string): extract html only for .vue and single file mode

* fix: __i18n_ally_root__

* feat: nestify en.yml + extract tab attributes

* fix: lint

* feat: add vue-i18n-extract to check missing keys

* fix: unit tests

* fix: update vue i18n plugin
This commit is contained in:
sharevb authored and ShareVB committed 2025-07-20 21:01:01 +02:00
1 parent 0d4267e356
commit a8c6ebc81b
347 files changed
+10245 -4533

No files matched your search

-6
View File
@@ -316,21 +316,15 @@ declare module '@vue/runtime-core' {
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCode: typeof import('naive-ui')['NCode']
NColorPicker: typeof import('naive-ui')['NColorPicker']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NGi: typeof import('naive-ui')['NGi']
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
NginxMemo: typeof import('./src/tools/nginx-memo/nginx-memo.vue')['default']
'NginxMemo.content': typeof import('./src/tools/nginx-memo/nginx-memo.content.md')['default']
NGrid: typeof import('naive-ui')['NGrid']
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
+4973 -349
View File
File diff suppressed because it is too large. Load diff
+6 -3
View File
@@ -35,7 +35,9 @@
"script:create:tool": "node scripts/create-tool.mjs",
"script:create:ui": "hygen generator ui-component",
"release": "node ./scripts/release.mjs",
"script:extract:desc": "node ./scripts/extract-tools-desc.mjs"
"script:extract:desc": "node ./scripts/extract-tools-desc.mjs",
"script:extract:strings": "node ./scripts/extract-tools-strings.mjs",
"vue-i18n-extract": "vue-i18n-extract report --vueFiles 'src/**/*.?(ts|vue)' --languageFiles 'locales/*.yml'"
},
"dependencies": {
"@chenfengyuan/vue-barcode": "^2.0.2",
@@ -286,7 +288,7 @@
"vanilla-jsoneditor": "^0.23.8",
"vue": "^3.3.4",
"vue-color-wheel": "^0.1.1",
"vue-i18n": "^9.14.3",
"vue-i18n": "^11.1.9",
"vue-loading-overlay": "^6.0",
"vue-markdown-render": "^2.2.1",
"vue-mathjax-next": "^0.0.6",
@@ -312,7 +314,7 @@
"devDependencies": {
"@antfu/eslint-config": "^0.41.0",
"@iconify-json/mdi": "^1.1.50",
"@intlify/unplugin-vue-i18n": "^0.13.0",
"@intlify/unplugin-vue-i18n": "^6.0.8",
"@playwright/test": "^1.50.1",
"@rushstack/eslint-patch": "^1.2.0",
"@tsconfig/node18": "^18.2.0",
@@ -381,6 +383,7 @@
"vite-plugin-wasm": "^3.4.1",
"vite-svg-loader": "^4.0.0",
"vitest": "^0.34.6",
"vue-i18n-extract": "^2.0.7",
"workbox-window": "^7.3.0",
"zx": "^7.2.3"
},
+189 -83
View File
@@ -753,8 +753,8 @@ dependencies:
specifier: ^0.1.1
version: 0.1.1
vue-i18n:
specifier: ^9.14.3
version: 9.14.4(vue@3.3.4)
specifier: ^11.1.9
version: 11.1.9(vue@3.3.4)
vue-loading-overlay:
specifier: ^6.0
version: 6.0.6(vue@3.3.4)
@@ -827,8 +827,8 @@ devDependencies:
specifier: ^1.1.50
version: 1.2.3
'@intlify/unplugin-vue-i18n':
specifier: ^0.13.0
version: 0.13.0(rollup@2.79.2)(vue-i18n@9.14.4)
specifier: ^6.0.8
version: 6.0.8(@vue/compiler-dom@3.5.13)(eslint@8.47.0)(rollup@2.79.2)(typescript@5.2.2)(vue-i18n@11.1.9)(vue@3.3.4)
'@playwright/test':
specifier: ^1.50.1
version: 1.50.1
@@ -1033,6 +1033,9 @@ devDependencies:
vitest:
specifier: ^0.34.6
version: 0.34.6(jsdom@22.1.0)(less@4.2.2)
vue-i18n-extract:
specifier: ^2.0.7
version: 2.0.7
workbox-window:
specifier: ^7.3.0
version: 7.3.0
@@ -1290,10 +1293,10 @@ packages:
'@babel/helper-compilation-targets': 7.26.5
'@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.8)
'@babel/helpers': 7.26.7
'@babel/parser': 7.26.8
'@babel/parser': 7.27.2
'@babel/template': 7.26.8
'@babel/traverse': 7.26.8
'@babel/types': 7.26.8
'@babel/types': 7.27.1
'@types/gensync': 1.0.4
convert-source-map: 2.0.0
debug: 4.4.0
@@ -1390,7 +1393,7 @@ packages:
resolution: {integrity: sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.26.3
'@babel/types': 7.27.1
dev: true
/@babel/helper-annotate-as-pure@7.27.1:
@@ -1545,7 +1548,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/traverse': 7.26.7
'@babel/types': 7.26.3
'@babel/types': 7.27.1
transitivePeerDependencies:
- supports-color
dev: true
@@ -1572,7 +1575,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/traverse': 7.26.8
'@babel/types': 7.26.8
'@babel/types': 7.27.1
transitivePeerDependencies:
- supports-color
@@ -1653,7 +1656,7 @@ packages:
resolution: {integrity: sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.26.3
'@babel/types': 7.27.1
dev: true
/@babel/helper-optimise-call-expression@7.27.1:
@@ -1751,7 +1754,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/traverse': 7.26.7
'@babel/types': 7.26.3
'@babel/types': 7.27.1
transitivePeerDependencies:
- supports-color
dev: true
@@ -1791,7 +1794,6 @@ packages:
/@babel/helper-string-parser@7.27.1:
resolution: {integrity: sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-validator-identifier@7.22.5:
resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==}
@@ -1804,7 +1806,6 @@ packages:
/@babel/helper-validator-identifier@7.27.1:
resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-validator-option@7.22.5:
resolution: {integrity: sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==}
@@ -1923,7 +1924,6 @@ packages:
hasBin: true
dependencies:
'@babel/types': 7.27.1
dev: true
/@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.27.1(@babel/core@7.27.1):
resolution: {integrity: sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA==}
@@ -2960,7 +2960,6 @@ packages:
dependencies:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1
dev: true
/@braintree/sanitize-url@7.1.1:
resolution: {integrity: sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==}
@@ -3317,7 +3316,7 @@ packages:
/@codemod/parser@1.4.1:
resolution: {integrity: sha512-w9bvtcC1oJTuXAnp+ZOYLOWagtb8UBBZEKp9fYI0dA5KARiUJf00MmtDQyULaeZj/AQAGuOrm739DFDLeHv+0g==}
dependencies:
'@babel/parser': 7.26.8
'@babel/parser': 7.27.2
dev: false
/@codemod/utils@1.1.0:
@@ -3947,9 +3946,9 @@ packages:
dev: false
optional: true
/@intlify/bundle-utils@7.5.0(vue-i18n@9.14.4):
resolution: {integrity: sha512-6DymqusddBQ8kVtVBsVFFF7arNfIhuLacOmmsqayT2vl427j9m0VX12mMC+cgoVIodSpRfzYPaPTdPuJq7mK0Q==}
engines: {node: '>= 14.16'}
/@intlify/bundle-utils@10.0.1(vue-i18n@11.1.9):
resolution: {integrity: sha512-WkaXfSevtpgtUR4t8K2M6lbR7g03mtOxFeh+vXp5KExvPqS12ppaRj1QxzwRuRI5VUto54A22BjKoBMLyHILWQ==}
engines: {node: '>= 18'}
peerDependencies:
petite-vue-i18n: '*'
vue-i18n: '*'
@@ -3959,81 +3958,97 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 9.9.1
'@intlify/shared': 9.9.1
acorn: 8.14.0
'@intlify/message-compiler': 11.1.9
'@intlify/shared': 11.1.9
acorn: 8.14.1
escodegen: 2.1.0
estree-walker: 2.0.2
jsonc-eslint-parser: 2.3.0
magic-string: 0.30.17
mlly: 1.7.3
source-map-js: 1.2.1
vue-i18n: 9.14.4(vue@3.3.4)
vue-i18n: 11.1.9(vue@3.3.4)
yaml-eslint-parser: 1.2.2
dev: true
/@intlify/core-base@9.14.4:
resolution: {integrity: sha512-vtZCt7NqWhKEtHa3SD/322DlgP5uR9MqWxnE0y8Q0tjDs9H5Lxhss+b5wv8rmuXRoHKLESNgw9d+EN9ybBbj9g==}
/@intlify/core-base@11.1.9:
resolution: {integrity: sha512-Lrdi4wp3XnGhWmB/mMD/XtfGUw1Jt+PGpZI/M63X1ZqhTDjNHRVCs/i8vv8U1cwaj1A9fb0bkCQHLSL0SK+pIQ==}
engines: {node: '>= 16'}
dependencies:
'@intlify/message-compiler': 9.14.4
'@intlify/shared': 9.14.4
'@intlify/message-compiler': 11.1.9
'@intlify/shared': 11.1.9
/@intlify/message-compiler@9.14.4:
resolution: {integrity: sha512-vcyCLiVRN628U38c3PbahrhbbXrckrM9zpy0KZVlDk2Z0OnGwv8uQNNXP3twwGtfLsCf4gu3ci6FMIZnPaqZsw==}
/@intlify/message-compiler@11.1.9:
resolution: {integrity: sha512-84SNs3Ikjg0rD1bOuchzb3iK1vR2/8nxrkyccIl5DjFTeMzE/Fxv6X+A7RN5ZXjEWelc1p5D4kHA6HEOhlKL5Q==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 9.14.4
'@intlify/shared': 11.1.9
source-map-js: 1.2.1
/@intlify/message-compiler@9.9.1:
resolution: {integrity: sha512-zTvP6X6HeumHOXuAE1CMMsV6tTX+opKMOxO1OHTCg5N5Sm/F7d8o2jdT6W6L5oHUsJ/vvkGefHIs7Q3hfowmsA==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 9.9.1
source-map-js: 1.2.1
dev: true
/@intlify/shared@9.14.4:
resolution: {integrity: sha512-P9zv6i1WvMc9qDBWvIgKkymjY2ptIiQ065PjDv7z7fDqH3J/HBRBN5IoiR46r/ujRcU7hCuSIZWvCAFCyuOYZA==}
/@intlify/shared@11.1.9:
resolution: {integrity: sha512-H/83xgU1l8ox+qG305p6ucmoy93qyjIPnvxGWRA7YdOoHe1tIiW9IlEu4lTdsOR7cfP1ecrwyflQSqXdXBacXA==}
engines: {node: '>= 16'}
/@intlify/shared@9.9.1:
resolution: {integrity: sha512-b3Pta1nwkz5rGq434v0psHwEwHGy1pYCttfcM22IE//K9owbpkEvFptx9VcuRAxjQdrO2If249cmDDjBu5wMDA==}
engines: {node: '>= 16'}
dev: true
/@intlify/unplugin-vue-i18n@0.13.0(rollup@2.79.2)(vue-i18n@9.14.4):
resolution: {integrity: sha512-Mm9NhcvbsSZ5FXXnCpL/XFCk1hPp809hxErNmnwqGp21JjYOKGp3wpQSrpvGk33ZrHZbhPqAu70IEVEAxVZ5+A==}
engines: {node: '>= 14.16'}
/@intlify/unplugin-vue-i18n@6.0.8(@vue/compiler-dom@3.5.13)(eslint@8.47.0)(rollup@2.79.2)(typescript@5.2.2)(vue-i18n@11.1.9)(vue@3.3.4):
resolution: {integrity: sha512-Vvm3KhjE6TIBVUQAk37rBiaYy2M5OcWH0ZcI1XKEsOTeN1o0bErk+zeuXmcrcMc/73YggfI8RoxOUz9EB/69JQ==}
engines: {node: '>= 18'}
peerDependencies:
petite-vue-i18n: '*'
vue: ^3.2.25
vue-i18n: '*'
vue-i18n-bridge: '*'
peerDependenciesMeta:
petite-vue-i18n:
optional: true
vue-i18n:
optional: true
vue-i18n-bridge:
optional: true
dependencies:
'@intlify/bundle-utils': 7.5.0(vue-i18n@9.14.4)
'@intlify/shared': 9.9.1
'@eslint-community/eslint-utils': 4.4.0(eslint@8.47.0)
'@intlify/bundle-utils': 10.0.1(vue-i18n@11.1.9)
'@intlify/shared': 11.1.9
'@intlify/vue-i18n-extensions': 8.0.0(@intlify/shared@11.1.9)(@vue/compiler-dom@3.5.13)(vue-i18n@11.1.9)(vue@3.3.4)
'@rollup/pluginutils': 5.1.4(rollup@2.79.2)
'@vue/compiler-sfc': 3.5.13
'@typescript-eslint/scope-manager': 8.37.0
'@typescript-eslint/typescript-estree': 8.37.0(typescript@5.2.2)
debug: 4.4.0
fast-glob: 3.3.1
fast-glob: 3.3.3
js-yaml: 4.1.0
json5: 2.2.3
pathe: 1.1.2
picocolors: 1.1.1
source-map-js: 1.2.1
unplugin: 1.4.0
vue-i18n: 9.14.4(vue@3.3.4)
unplugin: 1.16.1
vue: 3.3.4
vue-i18n: 11.1.9(vue@3.3.4)
transitivePeerDependencies:
- '@vue/compiler-dom'
- eslint
- rollup
- supports-color
- typescript
dev: true
/@intlify/vue-i18n-extensions@8.0.0(@intlify/shared@11.1.9)(@vue/compiler-dom@3.5.13)(vue-i18n@11.1.9)(vue@3.3.4):
resolution: {integrity: sha512-w0+70CvTmuqbskWfzeYhn0IXxllr6mU+IeM2MU0M+j9OW64jkrvqY+pYFWrUnIIC9bEdij3NICruicwd5EgUuQ==}
engines: {node: '>= 18'}
peerDependencies:
'@intlify/shared': ^9.0.0 || ^10.0.0 || ^11.0.0
'@vue/compiler-dom': ^3.0.0
vue: ^3.0.0
vue-i18n: ^9.0.0 || ^10.0.0 || ^11.0.0
peerDependenciesMeta:
'@intlify/shared':
optional: true
'@vue/compiler-dom':
optional: true
vue:
optional: true
vue-i18n:
optional: true
dependencies:
'@babel/parser': 7.27.2
'@intlify/shared': 11.1.9
'@vue/compiler-dom': 3.5.13
vue: 3.3.4
vue-i18n: 11.1.9(vue@3.3.4)
dev: true
/@iplookup/country-extra@1.0.20250317:
@@ -5426,7 +5441,7 @@ packages:
dependencies:
detect-libc: 1.0.3
is-glob: 4.0.3
micromatch: 4.0.5
micromatch: 4.0.8
node-addon-api: 7.1.1
optionalDependencies:
'@parcel/watcher-android-arm64': 2.5.1
@@ -5676,7 +5691,7 @@ packages:
rollup:
optional: true
dependencies:
'@types/estree': 1.0.0
'@types/estree': 1.0.6
estree-walker: 2.0.2
picomatch: 4.0.2
rollup: 2.79.2
@@ -6463,7 +6478,6 @@ packages:
/@types/estree@1.0.6:
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
dev: false
/@types/figlet@1.7.0:
resolution: {integrity: sha512-KwrT7p/8Eo3Op/HBSIwGXOsTZKYiM9NpWRBJ5sVjWP/SmlS+oxxRvJht/FNAtliJvja44N3ul1yATgohnVBV0Q==}
@@ -6827,6 +6841,20 @@ packages:
- supports-color
dev: true
/@typescript-eslint/project-service@8.37.0(typescript@5.2.2):
resolution: {integrity: sha512-BIUXYsbkl5A1aJDdYJCBAo8rCEbAvdquQ8AnLb6z5Lp1u3x5PNgSSx9A/zqYc++Xnr/0DVpls8iQ2cJs/izTXA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <5.9.0'
dependencies:
'@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.2.2)
'@typescript-eslint/types': 8.37.0
debug: 4.4.0
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/scope-manager@5.60.0:
resolution: {integrity: sha512-hakuzcxPwXi2ihf9WQu1BbRj1e/Pd8ZZwVTG9kfbxAMZstKz8/9OoexIwnmLzShtsdap5U/CoQGRCWlSuPbYxQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -6851,6 +6879,23 @@ packages:
'@typescript-eslint/visitor-keys': 6.9.1
dev: true
/@typescript-eslint/scope-manager@8.37.0:
resolution: {integrity: sha512-0vGq0yiU1gbjKob2q691ybTg9JX6ShiVXAAfm2jGf3q0hdP6/BruaFjL/ManAR/lj05AvYCH+5bbVo0VtzmjOA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
dependencies:
'@typescript-eslint/types': 8.37.0
'@typescript-eslint/visitor-keys': 8.37.0
dev: true
/@typescript-eslint/tsconfig-utils@8.37.0(typescript@5.2.2):
resolution: {integrity: sha512-1/YHvAVTimMM9mmlPvTec9NP4bobA1RkDbMydxG8omqwJJLEW/Iy2C4adsAESIXU3WGLXFHSZUU+C9EoFWl4Zg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <5.9.0'
dependencies:
typescript: 5.2.2
dev: true
/@typescript-eslint/type-utils@6.4.1(eslint@8.47.0)(typescript@5.2.2):
resolution: {integrity: sha512-7ON8M8NXh73SGZ5XvIqWHjgX2f+vvaOarNliGhjrJnv1vdjG0LVIz+ToYfPirOoBi56jxAKLfsLm40+RvxVVXA==}
engines: {node: ^16.0.0 || >=18.0.0}
@@ -6886,6 +6931,11 @@ packages:
engines: {node: ^16.0.0 || >=18.0.0}
dev: true
/@typescript-eslint/types@8.37.0:
resolution: {integrity: sha512-ax0nv7PUF9NOVPs+lmQ7yIE7IQmAf8LGcXbMvHX5Gm+YJUYNAl340XkGnrimxZ0elXyoQJuN5sbg6C4evKA4SQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
dev: true
/@typescript-eslint/typescript-estree@5.60.0(typescript@5.2.2):
resolution: {integrity: sha512-R43thAuwarC99SnvrBmh26tc7F6sPa2B3evkXp/8q954kYL6Ro56AwASYWtEEi+4j09GbiNAHqYwNNZuNlARGQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -6949,6 +6999,27 @@ packages:
- supports-color
dev: true
/@typescript-eslint/typescript-estree@8.37.0(typescript@5.2.2):
resolution: {integrity: sha512-zuWDMDuzMRbQOM+bHyU4/slw27bAUEcKSKKs3hcv2aNnc/tvE/h7w60dwVw8vnal2Pub6RT1T7BI8tFZ1fE+yg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <5.9.0'
dependencies:
'@typescript-eslint/project-service': 8.37.0(typescript@5.2.2)
'@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.2.2)
'@typescript-eslint/types': 8.37.0
'@typescript-eslint/visitor-keys': 8.37.0
debug: 4.4.0
fast-glob: 3.3.3
is-glob: 4.0.3
minimatch: 9.0.5
semver: 7.7.1
ts-api-utils: 2.1.0(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/utils@5.60.0(eslint@8.47.0)(typescript@5.2.2):
resolution: {integrity: sha512-ba51uMqDtfLQ5+xHtwlO84vkdjrqNzOnqrnwbMHMRY8Tqeme8C2Q8Fc7LajfGR+e3/4LoYiWXUM6BpIIbHJ4hQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -7031,6 +7102,14 @@ packages:
eslint-visitor-keys: 3.4.3
dev: true
/@typescript-eslint/visitor-keys@8.37.0:
resolution: {integrity: sha512-YzfhzcTnZVPiLfP/oeKtDp2evwvHLMe0LOy7oe+hb9KKIumLNohYS9Hgp1ifwpu42YWxhZE8yieggz6JpqO/1w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
dependencies:
'@typescript-eslint/types': 8.37.0
eslint-visitor-keys: 4.2.1
dev: true
/@ungap/structured-clone@1.3.0:
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
dev: false
@@ -7469,8 +7548,9 @@ packages:
/@vue/compiler-core@3.5.13:
resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==}
requiresBuild: true
dependencies:
'@babel/parser': 7.26.3
'@babel/parser': 7.27.2
'@vue/shared': 3.5.13
entities: 4.5.0
estree-walker: 2.0.2
@@ -7526,20 +7606,6 @@ packages:
postcss: 8.4.49
source-map-js: 1.2.1
/@vue/compiler-sfc@3.5.13:
resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==}
dependencies:
'@babel/parser': 7.26.3
'@vue/compiler-core': 3.5.13
'@vue/compiler-dom': 3.5.13
'@vue/compiler-ssr': 3.5.13
'@vue/shared': 3.5.13
estree-walker: 2.0.2
magic-string: 0.30.17
postcss: 8.4.49
source-map-js: 1.2.1
dev: true
/@vue/compiler-ssr@3.2.47:
resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==}
dependencies:
@@ -7555,10 +7621,12 @@ packages:
/@vue/compiler-ssr@3.5.13:
resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
requiresBuild: true
dependencies:
'@vue/compiler-dom': 3.5.13
'@vue/shared': 3.5.13
dev: true
optional: true
/@vue/devtools-api@6.5.0:
resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==}
@@ -7648,6 +7716,7 @@ packages:
/@vue/shared@3.5.13:
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
requiresBuild: true
dev: true
/@vue/test-utils@2.3.2(vue@3.3.4):
@@ -8911,6 +8980,11 @@ packages:
/commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
/commander@6.2.1:
resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==}
engines: {node: '>= 6'}
dev: true
/commander@7.2.0:
resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
engines: {node: '>= 10'}
@@ -10089,6 +10163,14 @@ packages:
no-case: 2.3.2
dev: true
/dot-object@2.1.5:
resolution: {integrity: sha512-xHF8EP4XH/Ba9fvAF2LDd5O3IITVolerVV6xvkxoM8zlGEiCUrggpAnHyOoKJKCrhvPcGATFAUwIujj7bRG5UA==}
hasBin: true
dependencies:
commander: 6.2.1
glob: 7.2.3
dev: true
/dotignore@0.1.2:
resolution: {integrity: sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==}
hasBin: true
@@ -10829,6 +10911,11 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/eslint-visitor-keys@4.2.1:
resolution: {integrity: sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
dev: true
/eslint@8.47.0:
resolution: {integrity: sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -11742,7 +11829,7 @@ packages:
dependencies:
array-union: 2.1.0
dir-glob: 3.0.1
fast-glob: 3.3.1
fast-glob: 3.3.3
ignore: 5.2.4
merge2: 1.4.1
slash: 3.0.0
@@ -12765,7 +12852,6 @@ packages:
/is-valid-glob@1.0.0:
resolution: {integrity: sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA==}
engines: {node: '>=0.10.0'}
dev: false
/is-weakmap@2.0.2:
resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==}
@@ -14021,7 +14107,6 @@ packages:
engines: {node: '>=16 || 14 >=14.17'}
dependencies:
brace-expansion: 2.0.1
dev: false
/minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
@@ -17340,6 +17425,15 @@ packages:
typescript: 5.2.2
dev: true
/ts-api-utils@2.1.0(typescript@5.2.2):
resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==}
engines: {node: '>=18.12'}
peerDependencies:
typescript: '>=4.8.4'
dependencies:
typescript: 5.2.2
dev: true
/ts-custom-error@3.3.1:
resolution: {integrity: sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==}
engines: {node: '>=14.0.0'}
@@ -17961,6 +18055,7 @@ packages:
chokidar: 3.5.3
webpack-sources: 3.2.3
webpack-virtual-modules: 0.5.0
dev: false
/upath@1.2.0:
resolution: {integrity: sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==}
@@ -18533,14 +18628,25 @@ packages:
- supports-color
dev: true
/vue-i18n@9.14.4(vue@3.3.4):
resolution: {integrity: sha512-B934C8yUyWLT0EMud3DySrwSUJI7ZNiWYsEEz2gknTthqKiG4dzWE/WSa8AzCuSQzwBEv4HtG1jZDhgzPfWSKQ==}
/vue-i18n-extract@2.0.7:
resolution: {integrity: sha512-i1NW5R58S720iQ1BEk+6ILo3hT6UA8mtYNNolSH4rt9345qvXdvA6GHy2+jHozdDAKHwlu9VvS/+vIMKs1UYQw==}
hasBin: true
dependencies:
cac: 6.7.14
dot-object: 2.1.5
glob: 8.1.0
is-valid-glob: 1.0.0
js-yaml: 4.1.0
dev: true
/vue-i18n@11.1.9(vue@3.3.4):
resolution: {integrity: sha512-N9ZTsXdRmX38AwS9F6Rh93RtPkvZTkSy/zNv63FTIwZCUbLwwrpqlKz9YQuzFLdlvRdZTnWAUE5jMxr8exdl7g==}
engines: {node: '>= 16'}
peerDependencies:
vue: ^3.0.0
dependencies:
'@intlify/core-base': 9.14.4
'@intlify/shared': 9.14.4
'@intlify/core-base': 11.1.9
'@intlify/shared': 11.1.9
'@vue/devtools-api': 6.5.0
vue: 3.3.4
+113
View File
@@ -0,0 +1,113 @@
import fs from 'node:fs';
import path, { basename } from 'node:path';
import process from 'node:process';
import yaml from 'yaml';
const toolsDir = 'src/tools';
const localesFile = 'locales/en.yml';
// Load existing locales file or initialize an empty object
let localesData = {};
if (fs.existsSync(localesFile)) {
localesData = yaml.parse(fs.readFileSync(localesFile, 'utf-8')) || {};
}
// Function to process Vue components in a directory
function processVueComponents(toolDir, toolName) {
fs.readdirSync(toolDir)
.filter(file => file.endsWith('.vue'))
.forEach(file => processVueComponent(path.join(toolDir, file), toolName));
}
// Function to process a Vue component file
function processVueComponent(filePath, toolName) {
let content = fs.readFileSync(filePath, 'utf8');
const origContent = content;
// Update locales file with extracted name and description
if (!localesData.tools) {
localesData.tools = {};
}
if (!localesData.tools[toolName]) {
localesData.tools[toolName] = {};
}
// Regex to find label or placeholder attributes
let regex = /\b(label|text|message):\s*'((?:[^']|\\')+)'/g;
content = content.replace(regex, (match, attr, text) => {
if (!text?.trim()) {
return match;
}
const key = (attr + '-' + text.replace(/[\p{P}\p{S}\s]+/gu, '-').replace(/^-+|-+$/g, '').replace(/-+/g, '-')).toLowerCase();
if (!localesData.tools[toolName].texts) {
localesData.tools[toolName].texts = {};
}
localesData.tools[toolName].texts[key] = text;
return `${attr}: t('tools.${toolName}.texts.${key}')`;
});
if (filePath.endsWith('.vue')) {
// Regex to find label or placeholder attributes
regex = /(?<!:)((?:input-|output-)?(?:label|placeholder|title))="([^"]+)"/g;
content = content.replace(regex, (match, attr, text) => {
if (!text?.trim()) {
return match;
}
const key = (attr + '-' + text.replace(/[\p{P}\p{S}\s]+/gu, '-').replace(/^-+|-+$/g, '').replace(/-+/g, '-')).toLowerCase();
if (!localesData.tools[toolName].texts) {
localesData.tools[toolName].texts = {};
}
localesData.tools[toolName].texts[key] = text;
return `:${attr}="t('tools.${toolName}.texts.${key}')"`;
});
// Regex to find text inside HTML tags
const textInsideTagsRegex = /(?<!=)\>(?:\n\s*)?([^\<\>\n]+)(?:\n\s*)?\</g;
content = content.replace(textInsideTagsRegex, (match, text) => {
if (!text?.trim()) {
return match;
}
if (text.match(/[\}\{\|\[\<\>\]]/)) {
return match;
}
const key = ('tag-' + text.trim().replace(/[\p{P}\p{S}\s]+/gu, '-').replace(/^-+|-+$/g, '').replace(/-+/g, '-')).toLowerCase();
if (!localesData.tools[toolName].texts) {
localesData.tools[toolName].texts = {};
}
localesData.tools[toolName].texts[key] = text.trim();
return `>{{ t('tools.${toolName}.texts.${key}') }}<`;
});
}
if (origContent === content) {
console.log(`Nothing to extract in ${filePath}`);
return;
}
// Ensure the useI18n import exists
if (!content.includes("const { t } = useI18n();")) {
content = content.replace(/\<script setup( lang="ts")?\>/, "<script setup lang=\"ts\">\nimport { useI18n } from 'vue-i18n';\nconst { t } = useI18n();");
}
fs.writeFileSync(filePath, content, 'utf8');
console.log(`Processed: ${filePath}`);
}
if (process.argv[1]) {
processVueComponent(process.argv[2], process.argv[3] || basename(process.argv[2]));
} else {
fs.readdirSync(toolsDir)
.filter((toolName) => {
const toolPath = path.join(toolsDir, toolName);
return fs.statSync(toolPath).isDirectory();
})
.forEach((toolName) => {
const toolPath = path.join(toolsDir, toolName);
console.log(`Processing tool: ${toolName}`);
processVueComponents(toolPath, toolName);
});
}
// Write back the updated locales file
fs.writeFileSync(localesFile, yaml.stringify(localesData), 'utf-8');
console.log('Locales file updated!');
console.log('Transformation completed!');
+1 -1
View File
@@ -44,7 +44,7 @@ const toolFooter = computed<string>(() => {
packageName,
packageName.includes('://') ? packageName : `https://www.npmjs.com/package/${packageName}`),
);
return ((npmPackages.length > 0 ? `Made with ${npmPackages.join(', ')}\n` : '') + footer).trim();
return ((npmPackages.length > 0 ? t('tools.tool.layout.text.made-with-npmpackages-join-n', [npmPackages.join(', ')]) : '') + footer).trim();
});
const themeVars = useThemeVars();
</script>
+2 -2
View File
@@ -15,7 +15,7 @@ export const i18nPlugin: Plugin = {
},
};
export const translate = function (localeKey: string) {
export const translate = function (localeKey: string, list: unknown[] = []) {
const hasKey = i18n.global.te(localeKey, get(i18n.global.locale));
return hasKey ? i18n.global.t(localeKey) : localeKey;
return hasKey ? i18n.global.t(localeKey, list) : localeKey;
};
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import mappingData from './ad-mapping.json';
import { useFlexSearch } from '@/composable/flexSearch';
const { t } = useI18n();
const data = mappingData;
const search = ref('');
@@ -20,7 +23,7 @@ const { searchResult } = useFlexSearch({
<div flex items-center gap-3>
<c-input-text
v-model:value="search"
placeholder="Search Active Directory LDAP mapping"
:placeholder="t('tools.ad-ldap-searcher.texts.placeholder-search-active-directory-ldap-mapping')"
mx-auto max-w-600px
>
<template #prefix>
@@ -35,19 +38,19 @@ const { searchResult } = useFlexSearch({
mt-4 text-center text-20px font-bold
>
No results
{{ t('tools.ad-ldap-searcher.texts.tag-no-results') }}
</div>
<div v-else>
<div mt-4 text-20px font-bold>
Search result
{{ t('tools.ad-ldap-searcher.texts.tag-search-result') }}
</div>
<n-table>
<thead>
<th>TAB</th>
<th>Active Directory Field</th>
<th>LDAP Attribute</th>
<th>{{ t('tools.ad-ldap-searcher.texts.tag-tab') }}</th>
<th>{{ t('tools.ad-ldap-searcher.texts.tag-active-directory-field') }}</th>
<th>{{ t('tools.ad-ldap-searcher.texts.tag-ldap-attribute') }}</th>
</thead>
<tbody>
<tr v-for="(result, ix) in searchResult" :key="ix">
+41 -38
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useScriptTag } from '@vueuse/core';
import ageWasmUrl from '/age-wasm/age.wasm?url';
const { t } = useI18n();
declare global {
interface Window {
generateX25519Identity: () => {
@@ -164,42 +167,42 @@ function onDecryptFilesUploaded(uploadedFiles: File[]) {
<template>
<n-tabs type="card">
<!-- Generate Keys -->
<n-tab-pane name="keys" tab="Generate Keys">
<n-card title="Private Key" mb-1>
<textarea-copyable v-model:value="privKey" rows="3" multiline placeholder="Your private key will be generated here." />
<n-tab-pane name="keys" :tab="t('tools.age-crypto.text.generate-keys')">
<n-card :title="t('tools.age-crypto.texts.title-private-key')" mb-1>
<textarea-copyable v-model:value="privKey" rows="3" multiline :placeholder="t('tools.age-crypto.texts.placeholder-your-private-key-will-be-generated-here')" />
</n-card>
<n-card title="Public Key" mb-1>
<textarea-copyable v-model:value="pubKey" rows="3" multiline placeholder="Your public key will be generated here." />
<n-card :title="t('tools.age-crypto.texts.title-public-key')" mb-1>
<textarea-copyable v-model:value="pubKey" rows="3" multiline :placeholder="t('tools.age-crypto.texts.placeholder-your-public-key-will-be-generated-here')" />
</n-card>
<n-button type="primary" @click="generateKeys">
Generate Keys
{{ t('tools.age-crypto.texts.tag-generate-keys') }}
</n-button>
</n-tab-pane>
<!-- Encrypt Text -->
<n-tab-pane name="encrypt" tab="Encrypt">
<n-card title="Public Keys" mb-1>
<n-input v-model:value="recipients" type="textarea" placeholder="Recipient key or keys one per line" required />
<n-tab-pane name="encrypt" :tab="t('tools.age-crypto.text.encrypt')">
<n-card :title="t('tools.age-crypto.texts.title-public-keys')" mb-1>
<n-input v-model:value="recipients" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-recipient-key-or-keys-one-per-line')" required />
</n-card>
<n-card title="Message" mb-1>
<n-input v-model:value="message" type="textarea" placeholder="Message to encrypt" required />
<n-card :title="t('tools.age-crypto.texts.title-message')" mb-1>
<n-input v-model:value="message" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-message-to-encrypt')" required />
</n-card>
<n-card title="Output" mb-1>
<textarea-copyable v-model:value="encryptedOutput" rows="3" multiline placeholder="Encrypted output will be generated here." />
<n-card :title="t('tools.age-crypto.texts.title-output')" mb-1>
<textarea-copyable v-model:value="encryptedOutput" rows="3" multiline :placeholder="t('tools.age-crypto.texts.placeholder-encrypted-output-will-be-generated-here')" />
</n-card>
<n-button type="primary" @click="encrypt">
Encrypt
{{ t('tools.age-crypto.texts.tag-encrypt') }}
</n-button>
</n-tab-pane>
<!-- Encrypt Binary -->
<n-tab-pane name="encryptBinary" tab="Encrypt Binary">
<n-card title="Public Keys" mb-1>
<n-input v-model:value="recipientsBinary" type="textarea" placeholder="Recipient key or keys one per line" required />
<n-tab-pane name="encryptBinary" :tab="t('tools.age-crypto.text.encrypt-binary')">
<n-card :title="t('tools.age-crypto.texts.title-public-keys')" mb-1>
<n-input v-model:value="recipientsBinary" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-recipient-key-or-keys-one-per-line')" required />
</n-card>
<n-card title="Files" mb-1>
<n-card :title="t('tools.age-crypto.texts.title-files')" mb-1>
<c-file-upload
title="Drag and drop files here, or click to select some files"
:title="t('tools.age-crypto.texts.title-drag-and-drop-files-here-or-click-to-select-some-files')"
multiple
@files-upload="onEncryptFilesUploaded"
/>
@@ -209,38 +212,38 @@ function onDecryptFilesUploaded(uploadedFiles: File[]) {
</li>
</ul>
</n-card>
<n-card title="Output" mb-1>
<p>The encrypted files will be downloaded.</p>
<n-card :title="t('tools.age-crypto.texts.title-output')" mb-1>
<p>{{ t('tools.age-crypto.texts.tag-the-encrypted-files-will-be-downloaded') }}</p>
</n-card>
<n-button type="primary" @click="encryptBinary">
Encrypt Binary
{{ t('tools.age-crypto.texts.tag-encrypt-binary') }}
</n-button>
</n-tab-pane>
<!-- Decrypt Text -->
<n-tab-pane name="decrypt" tab="Decrypt">
<n-card title="Private Keys" mb-1>
<n-input v-model:value="identities" type="textarea" placeholder="Identity key or keys one per line" required />
<n-tab-pane name="decrypt" :tab="t('tools.age-crypto.text.decrypt')">
<n-card :title="t('tools.age-crypto.texts.title-private-keys')" mb-1>
<n-input v-model:value="identities" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-identity-key-or-keys-one-per-line')" required />
</n-card>
<n-card title="Encrypted Text" mb-1>
<n-input v-model:value="encryptedText" type="textarea" placeholder="Paste here encrypted text" required />
<n-card :title="t('tools.age-crypto.texts.title-encrypted-text')" mb-1>
<n-input v-model:value="encryptedText" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-paste-here-encrypted-text')" required />
</n-card>
<n-card title="Output" mb-1>
<textarea-copyable v-model:value="decryptedOutput" rows="3" multiline placeholder="Decrypted output will be generated here." />
<n-card :title="t('tools.age-crypto.texts.title-output')" mb-1>
<textarea-copyable v-model:value="decryptedOutput" rows="3" multiline :placeholder="t('tools.age-crypto.texts.placeholder-decrypted-output-will-be-generated-here')" />
</n-card>
<n-button type="primary" @click="decrypt">
Decrypt
{{ t('tools.age-crypto.texts.tag-decrypt') }}
</n-button>
</n-tab-pane>
<!-- Decrypt Binary -->
<n-tab-pane name="decryptBinary" tab="Decrypt Binary">
<n-card title="Private Keys" mb-1>
<n-input v-model:value="identitiesBinary" type="textarea" placeholder="Identity key or keys one per line" required />
<n-tab-pane name="decryptBinary" :tab="t('tools.age-crypto.text.decrypt-binary')">
<n-card :title="t('tools.age-crypto.texts.title-private-keys')" mb-1>
<n-input v-model:value="identitiesBinary" type="textarea" :placeholder="t('tools.age-crypto.texts.placeholder-identity-key-or-keys-one-per-line')" required />
</n-card>
<n-card title="Encrypted Files" mb-1>
<n-card :title="t('tools.age-crypto.texts.title-encrypted-files')" mb-1>
<c-file-upload
title="Drag and drop files here, or click to select some files"
:title="t('tools.age-crypto.texts.title-drag-and-drop-files-here-or-click-to-select-some-files')"
multiple
@files-upload="onDecryptFilesUploaded"
/>
@@ -250,11 +253,11 @@ function onDecryptFilesUploaded(uploadedFiles: File[]) {
</li>
</ul>
</n-card>
<n-card title="Output" mb-1>
<p>The decrypted files will be downloaded.</p>
<n-card :title="t('tools.age-crypto.texts.title-output')" mb-1>
<p>{{ t('tools.age-crypto.texts.tag-the-decrypted-files-will-be-downloaded') }}</p>
</n-card>
<n-button type="primary" @click="decryptBinary">
Decrypt Binary
{{ t('tools.age-crypto.texts.tag-decrypt-binary') }}
</n-button>
</n-tab-pane>
</n-tabs>
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import promptSplitter from 'chatgpt-prompt-splitter';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const prompt = ref('');
const splitLength = ref(1024);
@@ -23,7 +26,7 @@ const promptValidation = useValidation({
rules: [
{
validator: v => v !== '',
message: 'Prompt must not be empty',
message: t('tools.ai-prompt-splitter.texts.message-prompt-must-not-be-empty'),
},
],
});
@@ -31,22 +34,22 @@ const promptValidation = useValidation({
<template>
<div>
<c-card title="Prompt and options" mb-2>
<c-card :title="t('tools.ai-prompt-splitter.texts.title-prompt-and-options')" mb-2>
<c-input-text
v-model:value="prompt"
label="Full Prompt"
:label="t('tools.ai-prompt-splitter.texts.label-full-prompt')"
multiline
placeholder="Put your full prompt here..."
:placeholder="t('tools.ai-prompt-splitter.texts.placeholder-put-your-full-prompt-here')"
rows="10"
:validation="promptValidation"
mb-2
/>
<n-form-item label="Character length for each chunk">
<n-form-item :label="t('tools.ai-prompt-splitter.texts.label-character-length-for-each-chunk')">
<n-input-number v-model:value="splitLength" :min="1" />
</n-form-item>
</c-card>
<c-card title="Divided prompts">
<c-card :title="t('tools.ai-prompt-splitter.texts.title-divided-prompts')">
<div v-for="(splittedPrompt, index) in splittedPrompts" :key="index">
<TextareaCopyable :value="splittedPrompt" />
</div>
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { onMounted, ref } from 'vue';
import {
NButton, NCheckbox, NCheckboxGroup, NInput,
@@ -9,6 +10,8 @@ import styles from 'ansi-styles';
import type { CSPair } from 'ansi-styles';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const terminalContainer = ref<HTMLElement | null>(null);
const decoratedText = useQueryParamOrStorage({ name: 'text', storageName: 'ansi:t', defaultValue: 'Sample text' });
@@ -80,71 +83,71 @@ const escapeSequenceToTest = ref('');
<template>
<div>
<NSpace justify="center">
<n-form-item label="Mode:" label-placement="left">
<n-form-item :label="t('tools.ansi-escape-tester.texts.label-mode')" label-placement="left">
<n-radio-group v-model:value="colorMode">
<n-radio value="basic">
Basic
{{ t('tools.ansi-escape-tester.texts.tag-basic') }}
</n-radio>
<n-radio value="256">
256-color
{{ t('tools.ansi-escape-tester.texts.tag-256-color') }}
</n-radio>
<n-radio value="truecolor">
Truecolor
{{ t('tools.ansi-escape-tester.texts.tag-truecolor') }}
</n-radio>
</n-radio-group>
</n-form-item>
</NSpace>
<n-form-item label="Foreground:" label-placement="left" mb-1>
<n-form-item :label="t('tools.ansi-escape-tester.texts.label-foreground')" label-placement="left" mb-1>
<n-color-picker v-model:value="foregroundColor" :modes="['hex']" :show-alpha="false" :actions="['clear']" />
</n-form-item>
<n-form-item label="Background:" label-placement="left" mb-1>
<n-form-item :label="t('tools.ansi-escape-tester.texts.label-background')" label-placement="left" mb-1>
<n-color-picker v-model:value="backgroundColor" :modes="['hex']" :show-alpha="false" :actions="['clear']" />
</n-form-item>
<NSpace justify="center" mb-1>
<n-form-item label="Styles:" label-placement="left">
<n-form-item :label="t('tools.ansi-escape-tester.texts.label-styles')" label-placement="left">
<NCheckboxGroup v-model:value="fontStyles">
<NCheckbox value="bold">
Bold
{{ t('tools.ansi-escape-tester.texts.tag-bold') }}
</NCheckbox>
<NCheckbox value="italic">
Italic
{{ t('tools.ansi-escape-tester.texts.tag-italic') }}
</NCheckbox>
<NCheckbox value="underline">
Underline
{{ t('tools.ansi-escape-tester.texts.tag-underline') }}
</NCheckbox>
<NCheckbox value="overline">
Overline
{{ t('tools.ansi-escape-tester.texts.tag-overline') }}
</NCheckbox>
<NCheckbox value="inverse">
Inverse
{{ t('tools.ansi-escape-tester.texts.tag-inverse') }}
</NCheckbox>
<NCheckbox value="dim">
Dim
{{ t('tools.ansi-escape-tester.texts.tag-dim') }}
</NCheckbox>
<NCheckbox value="strikethrough">
Strikethrough
{{ t('tools.ansi-escape-tester.texts.tag-strikethrough') }}
</NCheckbox>
</NCheckboxGroup>
</n-form-item>
</NSpace>
<n-form-item label="Decorated text:" label-placement="left" mb-1>
<NInput v-model:value="decoratedText" placeholder="Enter text" />
<n-form-item :label="t('tools.ansi-escape-tester.texts.label-decorated-text')" label-placement="left" mb-1>
<NInput v-model:value="decoratedText" :placeholder="t('tools.ansi-escape-tester.texts.placeholder-enter-text')" />
</n-form-item>
<c-card title="Output ANSI Escape Sequence:">
<c-card :title="t('tools.ansi-escape-tester.texts.title-output-ansi-escape-sequence')">
<input-copyable v-model:value="outputEscapeSequence" readonly />
</c-card>
<c-card title="Terminal Preview:">
<n-form-item label-placement="left" label="Custom ANSI Sequence:">
<NInput v-model:value="escapeSequenceToTest" placeholder="Enter ANSI escape sequence" />
<c-card :title="t('tools.ansi-escape-tester.texts.title-terminal-preview')">
<n-form-item label-placement="left" :label="t('tools.ansi-escape-tester.texts.label-custom-ansi-sequence')">
<NInput v-model:value="escapeSequenceToTest" :placeholder="t('tools.ansi-escape-tester.texts.placeholder-enter-ansi-escape-sequence')" />
<NButton type="primary" ml-1 @click="term?.writeln(escapeSequenceToTest)">
Test
{{ t('tools.ansi-escape-tester.texts.tag-test') }}
</NButton>
<NButton type="primary" ml-1 @click="term?.clear()">
Clear
{{ t('tools.ansi-escape-tester.texts.tag-clear') }}
</NButton>
</n-form-item>
<div ref="terminalContainer" class="terminal" />
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Vault } from 'ansible-vault';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const decryptedInput = ref('');
const encryptPassword = ref('');
const encryptId = ref('');
@@ -34,11 +37,11 @@ const decryptedOutput = computedAsync(
</script>
<template>
<c-card title="Encrypt Ansible Vault Secret">
<c-card :title="t('tools.ansible-vault-crypt-decrypt.texts.title-encrypt-ansible-vault-secret')">
<c-input-text
v-model:value="decryptedInput"
placeholder="Put your string to encrypt..."
label="String to encrypt"
:placeholder="t('tools.ansible-vault-crypt-decrypt.texts.placeholder-put-your-string-to-encrypt')"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-string-to-encrypt')"
raw-text
mb-5
/>
@@ -46,15 +49,15 @@ const decryptedOutput = computedAsync(
<n-space>
<c-input-text
v-model:value="encryptPassword"
placeholder="Encryption password"
label="Encryption password"
:placeholder="t('tools.ansible-vault-crypt-decrypt.texts.placeholder-encryption-password')"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-encryption-password')"
raw-text
mb-5
/>
<c-input-text
v-model:value="encryptId"
placeholder="Encryption Id"
label="Encryption Id"
:placeholder="t('tools.ansible-vault-crypt-decrypt.texts.placeholder-encryption-id')"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-encryption-id')"
raw-text
mb-5
/>
@@ -63,7 +66,7 @@ const decryptedOutput = computedAsync(
<n-divider />
<TextareaCopyable
label="Encrypted string"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-encrypted-string')"
:value="cryptedOutput"
multiline
readonly
@@ -72,19 +75,19 @@ const decryptedOutput = computedAsync(
/>
</c-card>
<c-card title="Decrypt Ansible Vault Secret">
<c-card :title="t('tools.ansible-vault-crypt-decrypt.texts.title-decrypt-ansible-vault-secret')">
<c-input-text
v-model:value="cryptedInput"
placeholder="Put your encrypted string here..."
label="String to decrypt"
:placeholder="t('tools.ansible-vault-crypt-decrypt.texts.placeholder-put-your-encrypted-string-here')"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-string-to-decrypt')"
raw-text multiline mb-5
rows="5"
/>
<c-input-text
v-model:value="decryptPassword"
placeholder="Decryption password"
label="Decryption password"
:placeholder="t('tools.ansible-vault-crypt-decrypt.texts.placeholder-decryption-password')"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-decryption-password')"
raw-text
mb-5
/>
@@ -92,7 +95,7 @@ const decryptedOutput = computedAsync(
<n-divider />
<TextareaCopyable
label="Decrypted string"
:label="t('tools.ansible-vault-crypt-decrypt.texts.label-decrypted-string')"
:value="decryptedOutput"
multiline
readonly
+22 -19
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
interface KeyValuePair {
key: string
value?: string
@@ -72,50 +75,50 @@ function emptyKeyPair() {
<template>
<div>
<c-card title="API Calling">
<c-card :title="t('tools.api-tester.texts.title-api-calling')">
<c-input-text
v-model:value="baseUrl"
label="Base API Url"
placeholder="Base API Url"
:label="t('tools.api-tester.texts.label-base-api-url')"
:placeholder="t('tools.api-tester.texts.placeholder-base-api-url')"
mb-2
/>
<c-select
v-model:value="method"
label="HTTP Method:"
:label="t('tools.api-tester.texts.label-http-method')"
:options="['GET', 'POST', 'PUT', 'DELETE', 'PATCH']"
mb-2
/>
<c-card title="Headers" mb-2>
<c-card :title="t('tools.api-tester.texts.title-headers')" mb-2>
<n-dynamic-input v-model:value="headers" :on-create="emptyKeyPair">
<template #create-button-default>
Add a new HTTP Header
{{ t('tools.api-tester.texts.tag-add-a-new-http-header') }}
</template>
<template #default="{ value }">
<div v-if="value" w-100 flex justify-center gap-2>
<c-input-text v-model:value="value.key" placeholder="Header Name" type="text" />
<c-input-text v-model:value="value.value" placeholder="Value" type="text" />
<c-input-text v-model:value="value.key" :placeholder="t('tools.api-tester.texts.placeholder-header-name')" type="text" />
<c-input-text v-model:value="value.value" :placeholder="t('tools.api-tester.texts.placeholder-value')" type="text" />
</div>
</template>
</n-dynamic-input>
<c-select
v-model:value="contentType"
label="Content-Type:"
:label="t('tools.api-tester.texts.label-content-type')"
:options="['application/json', 'text/plain']"
mt-2
/>
</c-card>
<c-card title="Query Parameters" mb-2>
<c-card :title="t('tools.api-tester.texts.title-query-parameters')" mb-2>
<n-dynamic-input v-model:value="queryParams" :on-create="emptyKeyPair">
<template #create-button-default>
Add a new Query Parameter
{{ t('tools.api-tester.texts.tag-add-a-new-query-parameter') }}
</template>
<template #default="{ value }">
<div v-if="value" w-100 flex justify-center gap-2>
<c-input-text v-model:value="value.key" placeholder="Param Name" type="text" />
<c-input-text v-model:value="value.value" placeholder="Value" type="text" />
<c-input-text v-model:value="value.key" :placeholder="t('tools.api-tester.texts.placeholder-param-name')" type="text" />
<c-input-text v-model:value="value.value" :placeholder="t('tools.api-tester.texts.placeholder-value')" type="text" />
</div>
</template>
</n-dynamic-input>
@@ -123,20 +126,20 @@ function emptyKeyPair() {
<c-input-text
v-if="method !== 'GET' && method !== 'HEAD'"
v-model:value="body"
label="Body"
placeholder="HTTP Query body"
:label="t('tools.api-tester.texts.label-body')"
:placeholder="t('tools.api-tester.texts.placeholder-http-query-body')"
multiline
monospace
mb-2
/>
<n-checkbox v-model:checked="noCORS">
No CORS
{{ t('tools.api-tester.texts.tag-no-cors') }}
</n-checkbox>
<div mt-5 flex justify-center>
<c-button secondary @click="callAPI">
Call API
{{ t('tools.api-tester.texts.tag-call-api') }}
</c-button>
</div>
</c-card>
@@ -144,11 +147,11 @@ function emptyKeyPair() {
v-if="inprogress"
size="small"
/>
<c-alert v-if="!inprogress && apiCallResult && apiCallResult.code !== 200" type="error" mt-12 title="Error while calling API">
<c-alert v-if="!inprogress && apiCallResult && apiCallResult.code !== 200" type="error" mt-12 :title="t('tools.api-tester.texts.title-error-while-calling-api')">
<p><strong>Status code = {{ apiCallResult.code }}</strong></p>
<TextareaCopyable :value="apiCallResult.error" copy-placement="none" />
</c-alert>
<c-card v-if="!inprogress && apiCallResult && apiCallResult.code === 200" mt-12 title="API Call result">
<c-card v-if="!inprogress && apiCallResult && apiCallResult.code === 200" mt-12 :title="t('tools.api-tester.texts.title-api-call-result')">
<TextareaCopyable :value="apiCallResult.result" word-wrap />
</c-card>
</div>
@@ -75,12 +75,12 @@ const fonts = ['1Row', '3-D', '3D Diagonal', '3D-ASCII', '3x5', '4Max', '5 Line
:label="t('tools.ascii-text-drawer.font')"
:options="fonts"
searchable="true"
placeholder="Select font to use"
:placeholder="t('tools.ascii-text-drawer.texts.placeholder-select-font-to-use')"
/>
</n-gi>
<n-gi span="2">
<n-form-item :label="t('tools.ascii-text-drawer.width')" label-placement="top" label-width="100" :show-feedback="false">
<n-input-number v-model:value="width" min="0" max="10000" w-full placeholder="Width of the text" />
<n-input-number v-model:value="width" min="0" max="10000" w-full :placeholder="t('tools.ascii-text-drawer.texts.placeholder-width-of-the-text')" />
</n-form-item>
</n-gi>
</n-grid>
@@ -1,5 +1,6 @@
<!-- AspectRatioCalculator.vue -->
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { NButton, NInputNumber, NRadio, NRadioGroup, NSpace } from 'naive-ui';
import {
@@ -7,6 +8,8 @@ import {
calculateDimensions,
} from './aspect-ratio-calculator.service';
const { t } = useI18n();
const width = ref<number | null>(null);
const height = ref<number | null>(null);
const r1 = ref<number | null>(null);
@@ -72,47 +75,47 @@ function clearRatio() {
<NSpace vertical :size="24">
<NRadioGroup v-model:value="mode">
<NRadio value="ratio">
Calculate Aspect Ratio
{{ t('tools.aspect-ratio-calculator.texts.tag-calculate-aspect-ratio') }}
</NRadio>
<NRadio value="dimensions">
Calculate Dimensions
{{ t('tools.aspect-ratio-calculator.texts.tag-calculate-dimensions') }}
</NRadio>
</NRadioGroup>
<div class="input-group">
<div class="input-pair">
<label>Pixels width</label>
<NInputNumber v-model:value="width" placeholder="Pixels width" :min="1" />
<label>{{ t('tools.aspect-ratio-calculator.texts.tag-pixels-width') }}</label>
<NInputNumber v-model:value="width" :placeholder="t('tools.aspect-ratio-calculator.texts.placeholder-pixels-width')" :min="1" />
</div>
<div class="input-pair">
<label>Pixels height</label>
<NInputNumber v-model:value="height" placeholder="Pixels height" :min="1" />
<label>{{ t('tools.aspect-ratio-calculator.texts.tag-pixels-height') }}</label>
<NInputNumber v-model:value="height" :placeholder="t('tools.aspect-ratio-calculator.texts.placeholder-pixels-height')" :min="1" />
</div>
</div>
<div class="input-group">
<div class="input-pair">
<label>Ratio width</label>
<NInputNumber v-model:value="r1" placeholder="Ratio width" :min="1" />
<label>{{ t('tools.aspect-ratio-calculator.texts.tag-ratio-width') }}</label>
<NInputNumber v-model:value="r1" :placeholder="t('tools.aspect-ratio-calculator.texts.placeholder-ratio-width')" :min="1" />
</div>
<div class="separator">
:
{{ t('tools.aspect-ratio-calculator.texts.tag-') }}
</div>
<div class="input-pair">
<label>Ratio height</label>
<NInputNumber v-model:value="r2" placeholder="Ratio height" :min="1" />
<label>{{ t('tools.aspect-ratio-calculator.texts.tag-ratio-height') }}</label>
<NInputNumber v-model:value="r2" :placeholder="t('tools.aspect-ratio-calculator.texts.placeholder-ratio-height')" :min="1" />
</div>
</div>
<div class="button-container">
<NButton type="primary" @click="calculateResult">
Calculate
{{ t('tools.aspect-ratio-calculator.texts.tag-calculate') }}
</NButton>
<NButton v-if="mode === 'ratio'" @click="clearRatio">
Clear Ratio
{{ t('tools.aspect-ratio-calculator.texts.tag-clear-ratio') }}
</NButton>
<NButton @click="clearAll">
Clear All
{{ t('tools.aspect-ratio-calculator.texts.tag-clear-all') }}
</NButton>
</div>
@@ -1,10 +1,13 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import bwipjs, { type RenderOptions } from 'bwip-js/browser';
import { Base64 } from 'js-base64';
import formats from './barcode.formats.json';
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const foreground = useQueryParamOrStorage({ name: 'fg', storageName: 'barcode-gen:fg', defaultValue: '#000000' });
const background = useQueryParamOrStorage({ name: 'bg', storageName: 'barcode-gen:bg', defaultValue: '#FFFFFF' });
const scale = useQueryParamOrStorage({ name: 'scale', storageName: 'barcode-gen:scale', defaultValue: 2 });
@@ -67,17 +70,17 @@ const { download: downloadSVG } = useDownloadFileFromBase64({ source: barcodeSVG
label-position="left"
label-width="130px"
label-align="right"
label="Text:"
:label="t('tools.barcode-generator.texts.label-text')"
multiline
rows="1"
autosize
placeholder="Your barcode..."
:placeholder="t('tools.barcode-generator.texts.placeholder-your-barcode')"
mb-6
/>
<n-form label-width="130" label-placement="left">
<c-select
v-model:value="format"
label="Format:"
:label="t('tools.barcode-generator.texts.label-format')"
label-position="left"
label-width="130px"
label-align="right"
@@ -86,22 +89,22 @@ const { download: downloadSVG } = useDownloadFileFromBase64({ source: barcodeSVG
mb-4
/>
<n-form-item label="Foreground color:">
<n-form-item :label="t('tools.barcode-generator.texts.label-foreground-color')">
<n-color-picker v-model:value="foreground" :modes="['hex']" :show-alpha="false" />
</n-form-item>
<n-form-item label="Background color:">
<n-form-item :label="t('tools.barcode-generator.texts.label-background-color')">
<n-color-picker v-model:value="background" :modes="['hex']" :show-alpha="false" />
</n-form-item>
<n-form-item label="Scale:">
<n-form-item :label="t('tools.barcode-generator.texts.label-scale')">
<n-input-number v-model:value="scale" :min="0" />
</n-form-item>
<n-form-item label="Height (mm):">
<n-form-item :label="t('tools.barcode-generator.texts.label-height-mm')">
<n-input-number v-model:value="height" :min="0" />
</n-form-item>
<n-form-item label="Margin:">
<n-form-item :label="t('tools.barcode-generator.texts.label-margin')">
<n-input-number v-model:value="margin" :min="0" />
</n-form-item>
<n-form-item label="Display text:">
<n-form-item :label="t('tools.barcode-generator.texts.label-display-text')">
<n-checkbox v-model:checked="displayValue" />
</n-form-item>
</n-form>
@@ -114,10 +117,10 @@ const { download: downloadSVG } = useDownloadFileFromBase64({ source: barcodeSVG
<canvas ref="barcodeCanvas" />
<div flex justify-center>
<c-button mr-2 @click="downloadPNG">
Download PNG barcode
{{ t('tools.barcode-generator.texts.tag-download-png-barcode') }}
</c-button>
<c-button @click="downloadSVG">
Download SVG barcode
{{ t('tools.barcode-generator.texts.tag-download-svg-barcode') }}
</c-button>
</div>
</div>
+5 -2
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { BarcodeFormat, BrowserMultiFormatReader } from '@zxing/library';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const imageBase64 = ref('');
const barCode = computedAsync(async () => {
if (imageBase64.value === '') {
@@ -38,7 +41,7 @@ async function onUpload(file: File) {
<template>
<div>
<c-file-upload
title="Drag and drop a BarCode here, or click to select a file"
:title="t('tools.barcode-reader.texts.title-drag-and-drop-a-barcode-here-or-click-to-select-a-file')"
:paste-image="true"
mb-3
@file-upload="onUpload"
@@ -47,7 +50,7 @@ async function onUpload(file: File) {
<div v-if="barCode?.text">
<n-divider />
<h3>Decoded <span v-if="barCode?.format">({{ barCode?.format }})</span></h3>
<h3>{{ t('tools.barcode-reader.texts.tag-decoded') }}<span v-if="barCode?.format">({{ barCode?.format }})</span></h3>
<TextareaCopyable
:value="barCode?.text"
:word-wrap="true"
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useBase64 } from '@vueuse/core';
import type { Ref } from 'vue';
import { useCopy } from '@/composable/copy';
@@ -6,6 +7,8 @@ import { getExtensionFromMimeType, getMimeTypeFromBase64, previewImageFromBase64
import { useValidation } from '@/composable/validation';
import { isValidBase64 } from '@/utils/base64';
const { t } = useI18n();
const fileName = ref('file');
const fileExtension = ref('');
const base64Input = ref('');
@@ -19,7 +22,7 @@ const base64InputValidation = useValidation({
source: base64Input,
rules: [
{
message: 'Invalid base 64 string',
message: t('tools.base64-file-converter.texts.message-invalid-base-64-string'),
validator: value => isValidBase64(value.trim()),
},
],
@@ -69,7 +72,7 @@ function downloadFile() {
const fileInput = ref() as Ref<File>;
const { base64: fileBase64 } = useBase64(fileInput);
const { copy: copyFileBase64 } = useCopy({ source: fileBase64, text: 'Base64 string copied to the clipboard' });
const { copy: copyFileBase64 } = useCopy({ source: fileBase64, text: t('tools.base64-file-converter.texts.text-base64-string-copied-to-the-clipboard') });
async function onUpload(file: File) {
if (file) {
@@ -79,21 +82,21 @@ async function onUpload(file: File) {
</script>
<template>
<c-card title="Base64 to file">
<c-card :title="t('tools.base64-file-converter.texts.title-base64-to-file')">
<n-grid cols="3" x-gap="12">
<n-gi span="2">
<c-input-text
v-model:value="fileName"
label="File Name"
placeholder="Download filename"
:label="t('tools.base64-file-converter.texts.label-file-name')"
:placeholder="t('tools.base64-file-converter.texts.placeholder-download-filename')"
mb-2
/>
</n-gi>
<n-gi>
<c-input-text
v-model:value="fileExtension"
label="Extension"
placeholder="Extension"
:label="t('tools.base64-file-converter.texts.label-extension')"
:placeholder="t('tools.base64-file-converter.texts.placeholder-extension')"
mb-2
/>
</n-gi>
@@ -101,7 +104,7 @@ async function onUpload(file: File) {
<c-input-text
v-model:value="base64Input"
multiline
placeholder="Put your base64 file string here..."
:placeholder="t('tools.base64-file-converter.texts.placeholder-put-your-base64-file-string-here')"
rows="5"
:validation="base64InputValidation"
mb-2
@@ -113,21 +116,21 @@ async function onUpload(file: File) {
<div flex justify-center gap-3>
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="previewImage()">
Preview image
{{ t('tools.base64-file-converter.texts.tag-preview-image') }}
</c-button>
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="downloadFile()">
Download file
{{ t('tools.base64-file-converter.texts.tag-download-file') }}
</c-button>
</div>
</c-card>
<c-card title="File to base64">
<c-file-upload title="Drag and drop a file here, or click to select a file" @file-upload="onUpload" />
<c-input-text :value="fileBase64" multiline readonly placeholder="File in base64 will be here" rows="5" my-2 />
<c-card :title="t('tools.base64-file-converter.texts.title-file-to-base64')">
<c-file-upload :title="t('tools.base64-file-converter.texts.title-drag-and-drop-a-file-here-or-click-to-select-a-file')" @file-upload="onUpload" />
<c-input-text :value="fileBase64" multiline readonly :placeholder="t('tools.base64-file-converter.texts.placeholder-file-in-base64-will-be-here')" rows="5" my-2 />
<div flex justify-center>
<c-button @click="copyFileBase64()">
Copy
{{ t('tools.base64-file-converter.texts.tag-copy') }}
</c-button>
</div>
</c-card>
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Base64 } from 'js-base64';
import hexArray from 'hex-array';
import { useCopy } from '@/composable/copy';
import { isValidBase64 } from '@/utils/base64';
const { t } = useI18n();
const textInput = ref('');
const base64Output = computed(() => {
try {
@@ -13,7 +16,7 @@ const base64Output = computed(() => {
return e.toString();
}
});
const { copy: copyTextBase64 } = useCopy({ source: base64Output, text: 'Base64 Hex Array copied to the clipboard' });
const { copy: copyTextBase64 } = useCopy({ source: base64Output, text: t('tools.base64-hex-converter.texts.text-base64-hex-array-copied-to-the-clipboard') });
const uppercase = ref(false);
const grouping = ref(0);
@@ -33,70 +36,70 @@ const textOutput = computed(() => {
}
},
);
const { copy: copyText } = useCopy({ source: textOutput, text: 'Hex Array copied to the clipboard' });
const { copy: copyText } = useCopy({ source: textOutput, text: t('tools.base64-hex-converter.texts.text-hex-array-copied-to-the-clipboard') });
const b64ValidationRules = [
{
message: 'Invalid base64 string',
message: t('tools.base64-hex-converter.texts.message-invalid-base64-string'),
validator: (value: string) => isValidBase64(value.trim()),
},
];
</script>
<template>
<c-card title="Hex Array to Base64">
<c-card :title="t('tools.base64-hex-converter.texts.title-hex-array-to-base64')">
<c-input-text
v-model:value="textInput"
multiline
placeholder="Put your Hex Array here..."
:placeholder="t('tools.base64-hex-converter.texts.placeholder-put-your-hex-array-here')"
rows="5"
label="Hex Array to encode"
:label="t('tools.base64-hex-converter.texts.label-hex-array-to-encode')"
raw-text
mb-5
/>
<c-input-text
label="Base64 of Hex Array"
:label="t('tools.base64-hex-converter.texts.label-base64-of-hex-array')"
:value="base64Output"
multiline
readonly
placeholder="The Base64 encoding of your Hex Array will be here"
:placeholder="t('tools.base64-hex-converter.texts.placeholder-the-base64-encoding-of-your-hex-array-will-be-here')"
rows="5"
mb-5
/>
<div flex justify-center>
<c-button @click="copyTextBase64()">
Copy Base64
{{ t('tools.base64-hex-converter.texts.tag-copy-base64') }}
</c-button>
</div>
</c-card>
<c-card title="Base64 to Hex Array">
<c-card :title="t('tools.base64-hex-converter.texts.title-base64-to-hex-array')">
<n-space align="baseline" justify="center" mb-1>
<n-form-item label="Uppercase" label-placement="left">
<n-form-item :label="t('tools.base64-hex-converter.texts.label-uppercase')" label-placement="left">
<n-switch v-model:value="uppercase" />
</n-form-item>
<n-form-item label="Group by" label-placement="left">
<n-input-number v-model:value="grouping" :min="0" style="width: 6em" mr-1 /> digits (0 = no grouping)
<n-form-item :label="t('tools.base64-hex-converter.texts.label-group-by')" label-placement="left">
<n-input-number v-model:value="grouping" :min="0" style="width: 6em" mr-1 />{{ t('tools.base64-hex-converter.texts.tag-digits-0-no-grouping') }}
</n-form-item>
<n-form-item label="Split as rows by" label-placement="left">
<n-input-number v-model:value="rowlength" :min="0" style="width: 6em" mr-1 /> group of digits (0 = no rows)
<n-form-item :label="t('tools.base64-hex-converter.texts.label-split-as-rows-by')" label-placement="left">
<n-input-number v-model:value="rowlength" :min="0" style="width: 6em" mr-1 />{{ t('tools.base64-hex-converter.texts.tag-group-of-digits-0-no-rows') }}
</n-form-item>
</n-space>
<c-input-text
v-model:value="base64Input"
multiline
placeholder="Your Base64 Hex Array..."
:placeholder="t('tools.base64-hex-converter.texts.placeholder-your-base64-hex-array')"
rows="5"
:validation-rules="b64ValidationRules"
label="Base64 Hex Array to decode"
:label="t('tools.base64-hex-converter.texts.label-base64-hex-array-to-decode')"
mb-5
/>
<c-input-text
v-model:value="textOutput"
label="Decoded Hex Array"
placeholder="The decoded Hex Array will be here"
:label="t('tools.base64-hex-converter.texts.label-decoded-hex-array')"
:placeholder="t('tools.base64-hex-converter.texts.placeholder-the-decoded-hex-array-will-be-here')"
multiline
rows="5"
readonly
@@ -105,7 +108,7 @@ const b64ValidationRules = [
<div flex justify-center>
<c-button @click="copyText()">
Copy Decoded Hex Array
{{ t('tools.base64-hex-converter.texts.tag-copy-decoded-hex-array') }}
</c-button>
</div>
</c-card>
@@ -1,23 +1,26 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useCopy } from '@/composable/copy';
import { base64ToText, isValidBase64, textToBase64 } from '@/utils/base64';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const encodeUrlSafe = useStorage('base64-string-converter--encode-url-safe', false);
const decodeUrlSafe = useStorage('base64-string-converter--decode-url-safe', false);
const textInput = ref('');
const base64Output = computed(() => textToBase64(textInput.value, { makeUrlSafe: encodeUrlSafe.value }));
const { copy: copyTextBase64 } = useCopy({ source: base64Output, text: 'Base64 string copied to the clipboard' });
const { copy: copyTextBase64 } = useCopy({ source: base64Output, text: t('tools.base64-string-converter.texts.text-base64-string-copied-to-the-clipboard') });
const base64Input = ref('');
const textOutput = computed(() =>
withDefaultOnError(() => base64ToText(base64Input.value.trim(), { makeUrlSafe: decodeUrlSafe.value }), ''),
);
const { copy: copyText } = useCopy({ source: textOutput, text: 'String copied to the clipboard' });
const { copy: copyText } = useCopy({ source: textOutput, text: t('tools.base64-string-converter.texts.text-string-copied-to-the-clipboard') });
const b64ValidationRules = [
{
message: 'Invalid base64 string',
message: t('tools.base64-string-converter.texts.message-invalid-base64-string'),
validator: (value: string) => isValidBase64(value.trim(), { makeUrlSafe: decodeUrlSafe.value }),
},
];
@@ -25,56 +28,56 @@ const b64ValidationWatch = [decodeUrlSafe];
</script>
<template>
<c-card title="String to base64">
<n-form-item label="Encode URL safe" label-placement="left">
<c-card :title="t('tools.base64-string-converter.texts.title-string-to-base64')">
<n-form-item :label="t('tools.base64-string-converter.texts.label-encode-url-safe')" label-placement="left">
<n-switch v-model:value="encodeUrlSafe" />
</n-form-item>
<c-input-text
v-model:value="textInput"
multiline
placeholder="Put your string here..."
:placeholder="t('tools.base64-string-converter.texts.placeholder-put-your-string-here')"
rows="5"
label="String to encode"
:label="t('tools.base64-string-converter.texts.label-string-to-encode')"
raw-text
mb-5
/>
<c-input-text
label="Base64 of string"
:label="t('tools.base64-string-converter.texts.label-base64-of-string')"
:value="base64Output"
multiline
readonly
placeholder="The base64 encoding of your string will be here"
:placeholder="t('tools.base64-string-converter.texts.placeholder-the-base64-encoding-of-your-string-will-be-here')"
rows="5"
mb-5
/>
<div flex justify-center>
<c-button @click="copyTextBase64()">
Copy base64
{{ t('tools.base64-string-converter.texts.tag-copy-base64') }}
</c-button>
</div>
</c-card>
<c-card title="Base64 to string">
<n-form-item label="Decode URL safe" label-placement="left">
<c-card :title="t('tools.base64-string-converter.texts.title-base64-to-string')">
<n-form-item :label="t('tools.base64-string-converter.texts.label-decode-url-safe')" label-placement="left">
<n-switch v-model:value="decodeUrlSafe" />
</n-form-item>
<c-input-text
v-model:value="base64Input"
multiline
placeholder="Your base64 string..."
:placeholder="t('tools.base64-string-converter.texts.placeholder-your-base64-string')"
rows="5"
:validation-rules="b64ValidationRules"
:validation-watch="b64ValidationWatch"
label="Base64 string to decode"
:label="t('tools.base64-string-converter.texts.label-base64-string-to-decode')"
mb-5
/>
<c-input-text
v-model:value="textOutput"
label="Decoded string"
placeholder="The decoded string will be here"
:label="t('tools.base64-string-converter.texts.label-decoded-string')"
:placeholder="t('tools.base64-string-converter.texts.placeholder-the-decoded-string-will-be-here')"
multiline
rows="5"
readonly
@@ -83,7 +86,7 @@ const b64ValidationWatch = [decodeUrlSafe];
<div flex justify-center>
<c-button @click="copyText()">
Copy decoded string
{{ t('tools.base64-string-converter.texts.tag-copy-decoded-string') }}
</c-button>
</div>
</c-card>
@@ -31,7 +31,7 @@ const { copy } = useCopy({ source: header, text: t('tools.basic-auth-generator.c
/>
<c-card>
<n-statistic label="Authorization header:" class="header">
<n-statistic :label="t('tools.basic-auth-generator.texts.label-authorization-header')" class="header">
<n-scrollbar x-scrollable style="max-width: 550px; margin-bottom: -10px; padding-bottom: 10px" trigger="none">
{{ header }}
</n-scrollbar>
+16 -13
View File
@@ -1,14 +1,17 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { compareSync, hashSync } from 'bcryptjs';
import { useThemeVars } from 'naive-ui';
import { useCopy } from '@/composable/copy';
const { t } = useI18n();
const themeVars = useThemeVars();
const input = ref('');
const saltCount = ref(10);
const hashed = computed(() => hashSync(input.value, saltCount.value || 10));
const { copy } = useCopy({ source: hashed, text: 'Hashed string copied to the clipboard' });
const { copy } = useCopy({ source: hashed, text: t('tools.bcrypt.texts.text-hashed-string-copied-to-the-clipboard') });
const compareString = ref('');
const compareHash = ref('');
@@ -16,39 +19,39 @@ const compareMatch = computed(() => compareSync(compareString.value, compareHash
</script>
<template>
<c-card title="Hash">
<c-card :title="t('tools.bcrypt.texts.title-hash')">
<c-input-text
v-model:value="input"
placeholder="Your string to bcrypt..."
:placeholder="t('tools.bcrypt.texts.placeholder-your-string-to-bcrypt')"
raw-text
label="Your string: "
:label="t('tools.bcrypt.texts.label-your-string')"
label-position="left"
label-align="right"
label-width="120px"
mb-2
/>
<n-form-item label="Salt count: " label-placement="left" label-width="120">
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
<n-form-item :label="t('tools.bcrypt.texts.label-salt-count')" label-placement="left" label-width="120">
<n-input-number v-model:value="saltCount" :placeholder="t('tools.bcrypt.texts.placeholder-salt-rounds')" :max="100" :min="0" w-full />
</n-form-item>
<c-input-text :value="hashed" readonly text-center />
<div mt-5 flex justify-center>
<c-button @click="copy()">
Copy hash
{{ t('tools.bcrypt.texts.tag-copy-hash') }}
</c-button>
</div>
</c-card>
<c-card title="Compare string with hash">
<c-card :title="t('tools.bcrypt.texts.title-compare-string-with-hash')">
<n-form label-width="120">
<n-form-item label="Your string: " label-placement="left">
<c-input-text v-model:value="compareString" placeholder="Your string to compare..." raw-text />
<n-form-item :label="t('tools.bcrypt.texts.label-your-string')" label-placement="left">
<c-input-text v-model:value="compareString" :placeholder="t('tools.bcrypt.texts.placeholder-your-string-to-compare')" raw-text />
</n-form-item>
<n-form-item label="Your hash: " label-placement="left">
<c-input-text v-model:value="compareHash" placeholder="Your hash to compare..." raw-text />
<n-form-item :label="t('tools.bcrypt.texts.label-your-hash')" label-placement="left">
<c-input-text v-model:value="compareHash" :placeholder="t('tools.bcrypt.texts.placeholder-your-hash-to-compare')" raw-text />
</n-form-item>
<n-form-item label="Do they match ? " label-placement="left" :show-feedback="false">
<n-form-item :label="t('tools.bcrypt.texts.label-do-they-match')" label-placement="left" :show-feedback="false">
<div class="compare-result" :class="{ positive: compareMatch }">
{{ compareMatch ? 'Yes' : 'No' }}
</div>
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Plus, Trash } from '@vicons/tabler';
import { useStorage } from '@vueuse/core';
import _ from 'lodash';
@@ -7,6 +8,8 @@ import { arrayToMarkdownTable, computeAverage, computeVariance } from './benchma
import DynamicValues from './dynamic-values.vue';
import { useCopy } from '@/composable/copy';
const { t } = useI18n();
const suites = useStorage('benchmark-builder:suites', [
{ title: 'Suite 1', data: [5, 10] },
{ title: 'Suite 2', data: [8, 12] },
@@ -86,28 +89,26 @@ function copyAsBulletList() {
<c-input-text
v-model:value="suite.title"
label-position="left"
label="Suite name"
placeholder="Suite name..."
:label="t('tools.benchmark-builder.texts.label-suite-name')"
:placeholder="t('tools.benchmark-builder.texts.placeholder-suite-name')"
clearable
/>
<n-divider />
<n-form-item label="Suite values" :show-feedback="false">
<n-form-item :label="t('tools.benchmark-builder.texts.label-suite-values')" :show-feedback="false">
<DynamicValues v-model:values="suite.data" />
</n-form-item>
</c-card>
<div flex justify-center>
<c-button v-if="suites.length > 1" variant="text" @click="suites.splice(index, 1)">
<n-icon :component="Trash" depth="3" mr-2 size="18" />
Delete suite
<n-icon :component="Trash" depth="3" mr-2 size="18" />{{ t('tools.benchmark-builder.texts.tag-delete-suite') }}
</c-button>
<c-button
variant="text"
@click="suites.splice(index + 1, 0, { data: [0], title: `Suite ${suites.length + 1}` })"
>
<n-icon :component="Plus" depth="3" mr-2 size="18" />
Add suite
<n-icon :component="Plus" depth="3" mr-2 size="18" />{{ t('tools.benchmark-builder.texts.tag-add-suite') }}
</c-button>
</div>
</div>
@@ -117,7 +118,7 @@ function copyAsBulletList() {
<div style="flex: 0 0 100%">
<div style="max-width: 600px; margin: 0 auto">
<div mx-auto max-w-sm flex justify-center gap-3>
<c-input-text v-model:value="unit" placeholder="Unit (eg: ms)" label="Unit" label-position="left" mb-4 />
<c-input-text v-model:value="unit" :placeholder="t('tools.benchmark-builder.texts.placeholder-unit-eg-ms')" :label="t('tools.benchmark-builder.texts.label-unit')" label-position="left" mb-4 />
<c-button
@click="
@@ -127,7 +128,7 @@ function copyAsBulletList() {
]
"
>
Reset suites
{{ t('tools.benchmark-builder.texts.tag-reset-suites') }}
</c-button>
</div>
@@ -135,10 +136,10 @@ function copyAsBulletList() {
<div mt-5 flex justify-center gap-3>
<c-button @click="copyAsMarkdown()">
Copy as markdown table
{{ t('tools.benchmark-builder.texts.tag-copy-as-markdown-table') }}
</c-button>
<c-button @click="copyAsBulletList()">
Copy as bullet list
{{ t('tools.benchmark-builder.texts.tag-copy-as-bullet-list') }}
</c-button>
</div>
</div>
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Plus, Trash } from '@vicons/tabler';
import { useTemplateRefsList, useVModel } from '@vueuse/core';
import { NInputNumber } from 'naive-ui';
@@ -8,6 +9,8 @@ const props = defineProps<{ values: (number | null)[] }>();
const emit = defineEmits(['update:values']);
const { t } = useI18n();
const refs = useTemplateRefsList<typeof NInputNumber>();
const values = useVModel(props, 'values', emit);
@@ -35,7 +38,7 @@ function onInputEnter(index: number) {
:ref="refs.set"
v-model:value="values[index]"
:show-button="false"
placeholder="Set your measure..."
:placeholder="t('tools.benchmark-builder.texts.placeholder-set-your-measure')"
autofocus
@keydown.enter="onInputEnter(index)"
/>
@@ -47,8 +50,7 @@ function onInputEnter(index: number) {
</div>
<c-button @click="addValue">
<n-icon :component="Plus" depth="3" mr-2 size="18" />
Add a measure
<n-icon :component="Plus" depth="3" mr-2 size="18" />{{ t('tools.benchmark-builder.texts.tag-add-a-measure') }}
</c-button>
</div>
</template>
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { NCard, NForm, NFormItem, NInput } from 'naive-ui';
const { t } = useI18n();
const bimiData = ref({
domain: '',
logoUrl: '',
@@ -26,20 +29,20 @@ const bimiRecord = computed(() => {
</script>
<template>
<NCard title="BIMI DNS Record Generator">
<NCard :title="t('tools.bimi-dns-generator.texts.title-bimi-dns-record-generator')">
<NForm :model="bimiData" label-placement="left" label-width="150px">
<NFormItem label="Domain:">
<NInput v-model:value="bimiData.domain" placeholder="example.com" />
<NFormItem :label="t('tools.bimi-dns-generator.texts.label-domain')">
<NInput v-model:value="bimiData.domain" :placeholder="t('tools.bimi-dns-generator.texts.placeholder-example-com')" />
</NFormItem>
<NFormItem label="Logo URL:">
<NInput v-model:value="bimiData.logoUrl" placeholder="https://example.com/logo.svg" />
<NFormItem :label="t('tools.bimi-dns-generator.texts.label-logo-url')">
<NInput v-model:value="bimiData.logoUrl" :placeholder="t('tools.bimi-dns-generator.texts.placeholder-https-example-com-logo-svg')" />
</NFormItem>
<NFormItem label="VMC Certificate URL:">
<NInput v-model:value="bimiData.vmcUrl" placeholder="https://example.com/vmc.pem" />
<NFormItem :label="t('tools.bimi-dns-generator.texts.label-vmc-certificate-url')">
<NInput v-model:value="bimiData.vmcUrl" :placeholder="t('tools.bimi-dns-generator.texts.placeholder-https-example-com-vmc-pem')" />
</NFormItem>
</NForm>
<c-card title="Generated BIMI record">
<c-card :title="t('tools.bimi-dns-generator.texts.title-generated-bimi-record')">
<textarea-copyable :value="bimiRecord" />
</c-card>
</NCard>
+13 -10
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
chineseSimplifiedWordList,
chineseTraditionalWordList,
@@ -21,6 +22,8 @@ import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const languages = {
'English': englishWordList,
'Chinese simplified': chineseSimplifiedWordList,
@@ -53,11 +56,11 @@ const entropyValidation = useValidation({
rules: [
{
validator: value => value === '' || (value.length <= 32 && value.length >= 16 && value.length % 4 === 0),
message: 'Entropy length should be >= 16, <= 32 and be a multiple of 4',
message: t('tools.bip39-generator.texts.message-entropy-length-should-be-16-32-and-be-a-multiple-of-4'),
},
{
validator: value => /^[a-fA-F0-9]*$/.test(value),
message: 'Entropy should be an hexadecimal string',
message: t('tools.bip39-generator.texts.message-entropy-should-be-an-hexadecimal-string'),
},
],
});
@@ -67,7 +70,7 @@ const mnemonicValidation = useValidation({
rules: [
{
validator: value => isNotThrowing(() => mnemonicToEntropy(value, languages[language.value])),
message: 'Invalid mnemonic',
message: t('tools.bip39-generator.texts.message-invalid-mnemonic'),
},
],
});
@@ -76,8 +79,8 @@ function refreshEntropy() {
entropy.value = generateEntropy();
}
const { copy: copyEntropy } = useCopy({ source: entropy, text: 'Entropy copied to the clipboard' });
const { copy: copyPassphrase } = useCopy({ source: passphrase, text: 'Passphrase copied to the clipboard' });
const { copy: copyEntropy } = useCopy({ source: entropy, text: t('tools.bip39-generator.texts.text-entropy-copied-to-the-clipboard') });
const { copy: copyPassphrase } = useCopy({ source: passphrase, text: t('tools.bip39-generator.texts.text-passphrase-copied-to-the-clipboard') });
</script>
<template>
@@ -87,18 +90,18 @@ const { copy: copyPassphrase } = useCopy({ source: passphrase, text: 'Passphrase
<c-select
v-model:value="language"
searchable
label="Language:"
:label="t('tools.bip39-generator.texts.label-language')"
:options="Object.keys(languages)"
/>
</n-gi>
<n-gi span="2">
<n-form-item
label="Entropy (seed):"
:label="t('tools.bip39-generator.texts.label-entropy-seed')"
:feedback="entropyValidation.message"
:validation-status="entropyValidation.status"
>
<n-input-group>
<c-input-text v-model:value="entropy" placeholder="Your string..." />
<c-input-text v-model:value="entropy" :placeholder="t('tools.bip39-generator.texts.placeholder-your-string')" />
<c-button @click="refreshEntropy()">
<n-icon size="22">
@@ -115,12 +118,12 @@ const { copy: copyPassphrase } = useCopy({ source: passphrase, text: 'Passphrase
</n-gi>
</n-grid>
<n-form-item
label="Passphrase (mnemonic):"
:label="t('tools.bip39-generator.texts.label-passphrase-mnemonic')"
:feedback="mnemonicValidation.message"
:validation-status="mnemonicValidation.status"
>
<n-input-group>
<c-input-text v-model:value="passphrase" placeholder="Your mnemonic..." raw-text />
<c-input-text v-model:value="passphrase" :placeholder="t('tools.bip39-generator.texts.placeholder-your-mnemonic')" raw-text />
<c-button @click="copyPassphrase()">
<n-icon size="22" :component="Copy" />
+12 -9
View File
@@ -1,11 +1,14 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const units = ref('metric');
const weight = ref<number | null>(null);
const height = ref<number | null>(null);
const options = [
{ label: 'Metric (kg, m)', value: 'metric' },
{ label: 'US (lbs, in)', value: 'us' },
{ label: t('tools.bmi-calculator.texts.label-metric-kg-m'), value: 'metric' },
{ label: t('tools.bmi-calculator.texts.label-us-lbs-in'), value: 'us' },
];
const bmi = computed(() => {
@@ -48,19 +51,19 @@ const bmiCategory = computed(() => {
</script>
<template>
<c-card title="BMI Calculator" max-w-800px>
<c-select v-model:value="units" label="Select Units:" :options="options" mb-2 label-position="left" />
<c-card :title="t('tools.bmi-calculator.texts.title-bmi-calculator')" max-w-800px>
<c-select v-model:value="units" :label="t('tools.bmi-calculator.texts.label-select-units')" :options="options" mb-2 label-position="left" />
<n-space justify="space-evenly">
<n-form-item :label="`Weight (${(units === 'metric' ? 'kg' : 'lbs')}):`" label-placement="left" mb-2>
<n-input-number v-model:value="weight" placeholder="Enter weight" />
<n-input-number v-model:value="weight" :placeholder="t('tools.bmi-calculator.texts.placeholder-enter-weight')" />
</n-form-item>
<n-form-item :label="`Height (${(units === 'metric' ? 'm' : 'in')}):`" label-placement="left" mb-2>
<n-input-number v-model:value="height" placeholder="Enter height" />
<n-input-number v-model:value="height" :placeholder="t('tools.bmi-calculator.texts.placeholder-enter-height')" />
</n-form-item>
</n-space>
<c-card v-if="bmi" title="Result">
<input-copyable label="BMI:" label-position="left" label-width="100px" :value="bmi" mb-1 />
<input-copyable label="Category:" label-position="left" label-width="100px" :value="bmiCategory" />
<c-card v-if="bmi" :title="t('tools.bmi-calculator.texts.title-result')">
<input-copyable :label="t('tools.bmi-calculator.texts.label-bmi')" label-position="left" label-width="100px" :value="bmi" mb-1 />
<input-copyable :label="t('tools.bmi-calculator.texts.label-category')" label-position="left" label-width="100px" :value="bmiCategory" />
</c-card>
</c-card>
</template>
+26 -23
View File
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import EmailBounceParse from 'email-bounce-parser-browser';
const { t } = useI18n();
const emailContent = ref('');
const parsedBounce = computed(() => {
@@ -15,49 +18,49 @@ const parsedBounce = computed(() => {
<template>
<div>
<c-card title="Input" mb-2>
<c-card :title="t('tools.bounce-parser.texts.title-input')" mb-2>
<c-input-text
v-model:value="emailContent"
label="Bounce Email Textual Content"
:label="t('tools.bounce-parser.texts.label-bounce-email-textual-content')"
multiline
placeholder="Put your email text content here..."
:placeholder="t('tools.bounce-parser.texts.placeholder-put-your-email-text-content-here')"
rows="15"
mb-2
/>
</c-card>
<c-card v-if="parsedBounce && emailContent" title="Output" mb-2>
<c-card v-if="parsedBounce && emailContent" :title="t('tools.bounce-parser.texts.title-output')" mb-2>
<n-p v-if="parsedBounce.email?.email?.error" style="color: green" mb-2>
This mail is a bounce email
{{ t('tools.bounce-parser.texts.tag-this-mail-is-a-bounce-email') }}
</n-p>
<n-p v-if="!parsedBounce.email?.email?.error" style="color: red" mb-2>
This mail is NOT a bounce email
{{ t('tools.bounce-parser.texts.tag-this-mail-is-not-a-bounce-email') }}
</n-p>
<c-alert v-if="parsedBounce.parsingError" mb-2>
{{ parsedBounce.parsingError }}
</c-alert>
<input-copyable v-if="parsedBounce.email?.data?.recipient" label="Recipient" :value="parsedBounce.email?.data?.recipient" mb-2 />
<input-copyable v-if="parsedBounce.email?.data?.recipient" :label="t('tools.bounce-parser.texts.label-recipient')" :value="parsedBounce.email?.data?.recipient" mb-2 />
<div v-if="parsedBounce.email?.email?.error">
<c-card title="Error" mb-2>
<input-copyable v-if="parsedBounce.email?.data?.command" label="Command" :value="parsedBounce.email?.data?.command" />
<input-copyable v-if="parsedBounce.email?.data?.error?.code?.basic || parsedBounce.email?.data?.error?.code?.enhanced" label="Code" :value="`${parsedBounce.email?.data?.error?.code?.basic}/${parsedBounce.email?.data?.error?.code?.enhanced}`" />
<input-copyable v-if="parsedBounce.email?.data?.error?.label" label="Label" :value="parsedBounce.email?.data?.error?.label" />
<input-copyable v-if="parsedBounce.email?.data?.error?.type" label="Type" :value="parsedBounce.email?.data?.error?.type" />
<input-copyable v-if="parsedBounce.email?.data?.error?.temporary" label="Temporary" :value="parsedBounce.email?.data?.error?.temporary" />
<input-copyable v-if="parsedBounce.email?.data?.error?.permanent" label="Permanent" :value="parsedBounce.email?.data?.error?.permanent" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.type" label="Subtype" :value="parsedBounce.email?.data?.error?.data?.type" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.blocked" label="Blocked" :value="parsedBounce.email?.data?.error?.data?.blocked" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.spam" label="Spam" :value="parsedBounce.email?.data?.error?.data?.spam" />
<c-card :title="t('tools.bounce-parser.texts.title-error')" mb-2>
<input-copyable v-if="parsedBounce.email?.data?.command" :label="t('tools.bounce-parser.texts.label-command')" :value="parsedBounce.email?.data?.command" />
<input-copyable v-if="parsedBounce.email?.data?.error?.code?.basic || parsedBounce.email?.data?.error?.code?.enhanced" :label="t('tools.bounce-parser.texts.label-code')" :value="`${parsedBounce.email?.data?.error?.code?.basic}/${parsedBounce.email?.data?.error?.code?.enhanced}`" />
<input-copyable v-if="parsedBounce.email?.data?.error?.label" :label="t('tools.bounce-parser.texts.label-label')" :value="parsedBounce.email?.data?.error?.label" />
<input-copyable v-if="parsedBounce.email?.data?.error?.type" :label="t('tools.bounce-parser.texts.label-type')" :value="parsedBounce.email?.data?.error?.type" />
<input-copyable v-if="parsedBounce.email?.data?.error?.temporary" :label="t('tools.bounce-parser.texts.label-temporary')" :value="parsedBounce.email?.data?.error?.temporary" />
<input-copyable v-if="parsedBounce.email?.data?.error?.permanent" :label="t('tools.bounce-parser.texts.label-permanent')" :value="parsedBounce.email?.data?.error?.permanent" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.type" :label="t('tools.bounce-parser.texts.label-subtype')" :value="parsedBounce.email?.data?.error?.data?.type" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.blocked" :label="t('tools.bounce-parser.texts.label-blocked')" :value="parsedBounce.email?.data?.error?.data?.blocked" />
<input-copyable v-if="parsedBounce.email?.data?.error?.data?.spam" :label="t('tools.bounce-parser.texts.label-spam')" :value="parsedBounce.email?.data?.error?.data?.spam" />
</c-card>
<c-card v-if="parsedBounce.email?.data?.server?.hostname || parsedBounce.email?.data?.server?.ip" title="Server" mb-2>
<input-copyable v-if="parsedBounce.email?.data?.server?.hostname" label="Host" :value="parsedBounce.email?.data?.server?.hostname" />
<input-copyable v-if="parsedBounce.email?.data?.server?.ip" label="IP" :value="parsedBounce.email?.data?.server?.ip" />
<input-copyable v-if="parsedBounce.email?.data?.server?.port" label="Port" :value="parsedBounce.email?.data?.server?.port" />
<c-card v-if="parsedBounce.email?.data?.server?.hostname || parsedBounce.email?.data?.server?.ip" :title="t('tools.bounce-parser.texts.title-server')" mb-2>
<input-copyable v-if="parsedBounce.email?.data?.server?.hostname" :label="t('tools.bounce-parser.texts.label-host')" :value="parsedBounce.email?.data?.server?.hostname" />
<input-copyable v-if="parsedBounce.email?.data?.server?.ip" :label="t('tools.bounce-parser.texts.label-ip')" :value="parsedBounce.email?.data?.server?.ip" />
<input-copyable v-if="parsedBounce.email?.data?.server?.port" :label="t('tools.bounce-parser.texts.label-port')" :value="parsedBounce.email?.data?.server?.port" />
</c-card>
<c-card title="Details" mb-2>
<c-card :title="t('tools.bounce-parser.texts.title-details')" mb-2>
<textarea-copyable :value="JSON.stringify(parsedBounce.email?.data, null, 2)" />
</c-card>
<c-card title="Raw Error" mb-2>
<c-card :title="t('tools.bounce-parser.texts.title-raw-error')" mb-2>
<textarea-copyable :value="parsedBounce.email?.email?.error" word-wrap />
</c-card>
</div>
+17 -21
View File
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import _ from 'lodash';
import { useMediaRecorder } from './useMediaRecorder';
const { t } = useI18n();
interface Media { type: 'image' | 'video'; value: string; createdAt: Date }
const {
@@ -106,20 +109,18 @@ function downloadMedia({ type, value, createdAt }: Media) {
<template>
<div>
<c-card v-if="!isSupported">
Your browser does not support recording video from camera
{{ t('tools.camera-recorder.texts.tag-your-browser-does-not-support-recording-video-from-camera') }}
</c-card>
<c-card v-else-if="!permissionGranted" text-center>
You need to grant permission to use your camera and microphone
<c-alert v-if="permissionCannotBePrompted" mt-4 text-left>
{{ t('tools.camera-recorder.texts.tag-you-need-to-grant-permission-to-use-your-camera-and-microphone') }}<c-alert v-if="permissionCannotBePrompted" mt-4 text-left>
Your browser has blocked permission request or does not support it. You need to grant permission manually in
your browser settings (usually the lock icon in the address bar).
</c-alert>
<div v-else mt-4 flex justify-center>
<c-button @click="requestPermissions">
Grant permission
{{ t('tools.camera-recorder.texts.tag-grant-permission') }}
</c-button>
</div>
</c-card>
@@ -130,24 +131,24 @@ function downloadMedia({ type, value, createdAt }: Media) {
v-model:value="currentCamera"
label-position="left"
label-width="60px"
label="Video:"
:label="t('tools.camera-recorder.texts.label-video')"
:options="cameras.map(({ deviceId, label }) => ({ value: deviceId, label }))"
placeholder="Select camera"
:placeholder="t('tools.camera-recorder.texts.placeholder-select-camera')"
/>
<c-select
v-if="currentMicrophone && microphones.length > 0"
v-model:value="currentMicrophone"
label="Audio:"
:label="t('tools.camera-recorder.texts.label-audio')"
label-position="left"
label-width="60px"
:options="microphones.map(({ deviceId, label }) => ({ value: deviceId, label }))"
placeholder="Select microphone"
:placeholder="t('tools.camera-recorder.texts.placeholder-select-microphone')"
/>
</div>
<div v-if="!isMediaStreamAvailable" mt-3 flex justify-center>
<c-button type="primary" @click="start">
Start webcam
{{ t('tools.camera-recorder.texts.tag-start-webcam') }}
</c-button>
</div>
@@ -158,33 +159,28 @@ function downloadMedia({ type, value, createdAt }: Media) {
<div flex items-center justify-between gap-2>
<c-button :disabled="!isMediaStreamAvailable" @click="takeScreenshot">
<span mr-2> <icon-mdi-camera /></span>
Take screenshot
<span mr-2> <icon-mdi-camera /></span>{{ t('tools.camera-recorder.texts.tag-take-screenshot') }}
</c-button>
<div v-if="isRecordingSupported" flex justify-center gap-2>
<c-button v-if="recordingState === 'stopped'" @click="startRecording">
<span mr-2> <icon-mdi-video /></span>
Start recording
<span mr-2> <icon-mdi-video /></span>{{ t('tools.camera-recorder.texts.tag-start-recording') }}
</c-button>
<c-button v-if="recordingState === 'recording'" @click="pauseRecording">
<span mr-2> <icon-mdi-pause /></span>
Pause
<span mr-2> <icon-mdi-pause /></span>{{ t('tools.camera-recorder.texts.tag-pause') }}
</c-button>
<c-button v-if="recordingState === 'paused'" @click="resumeRecording">
<span mr-2> <icon-mdi-play /></span>
Resume
<span mr-2> <icon-mdi-play /></span>{{ t('tools.camera-recorder.texts.tag-resume') }}
</c-button>
<c-button v-if="recordingState !== 'stopped'" type="error" @click="stopRecording">
<span mr-2> <icon-mdi-record /></span>
Stop
<span mr-2> <icon-mdi-record /></span>{{ t('tools.camera-recorder.texts.tag-stop') }}
</c-button>
</div>
<div v-else italic op-60>
Video recording is not supported in your browser
{{ t('tools.camera-recorder.texts.tag-video-recording-is-not-supported-in-your-browser') }}
</div>
</div>
</div>
+11 -8
View File
@@ -1,10 +1,13 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import cards from '@younestouati/playing-cards-standard-deck';
import { exhaustiveUniqueRandom } from 'unique-random';
import { computedRefreshable } from '@/composable/computedRefreshable';
import { useCopy } from '@/composable/copy';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const cardKeys = [...Object.keys(cards).filter(k => k !== 'joker'), 'joker', 'joker'];
type CardNames = keyof typeof cards;
@@ -44,7 +47,7 @@ function translateName(cardId: string) {
const cardPickedString = computed(() => cardPicked.value.map(translateName).join(', '));
const { copy } = useCopy({ source: cardPickedString, text: 'Cards Picked copied to the clipboard' });
const { copy } = useCopy({ source: cardPickedString, text: t('tools.card-picker.texts.text-cards-picked-copied-to-the-clipboard') });
</script>
<template>
@@ -56,24 +59,24 @@ const { copy } = useCopy({ source: cardPickedString, text: 'Cards Picked copied
<textarea-copyable :value="cardPickedString" readonly mb-1 />
</div>
<div flex justify-center gap-3>
<n-form-item label="Number of cards:" label-placement="left">
<n-input-number v-model:value="numberOfCards" min="1" :max="maxCards" placeholder="Number of cards to pick" />
<n-form-item :label="t('tools.card-picker.texts.label-number-of-cards')" label-placement="left">
<n-input-number v-model:value="numberOfCards" min="1" :max="maxCards" :placeholder="t('tools.card-picker.texts.placeholder-number-of-cards-to-pick')" />
</n-form-item>
<n-form-item label="Number of packs:" label-placement="left">
<n-input-number v-model:value="numberOfPacks" min="1" placeholder="Number of card packs to pick in" />
<n-form-item :label="t('tools.card-picker.texts.label-number-of-packs')" label-placement="left">
<n-input-number v-model:value="numberOfPacks" min="1" :placeholder="t('tools.card-picker.texts.placeholder-number-of-card-packs-to-pick-in')" />
</n-form-item>
</div>
<div mb-4 flex justify-center>
<n-checkbox v-model:checked="useJokers">
Use Jokers
{{ t('tools.card-picker.texts.tag-use-jokers') }}
</n-checkbox>
</div>
<div flex justify-center gap-3>
<c-button @click="copy()">
Copy deck
{{ t('tools.card-picker.texts.tag-copy-deck') }}
</c-button>
<c-button @click="refreshCardPicked">
Refresh deck
{{ t('tools.card-picker.texts.tag-refresh-deck') }}
</c-button>
</div>
</c-card>
+22 -19
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
camelCase,
capitalCase,
@@ -16,12 +17,14 @@ import InputCopyable from '../../components/InputCopyable.vue';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const cleaningRegex = useQueryParamOrStorage({ name: 'clean', storageName: 'case-conv:cl', defaultValue: '[^\\w\\d\\s]' });
const cleaningRegexValidation = useValidation({
source: cleaningRegex,
rules: [
{
message: 'Invalid cleaning regex: {0}',
message: t('tools.case-converter.texts.message-invalid-cleaning-regex-0'),
validator: value => new RegExp(value),
getErrorMessage: (value) => {
const _ = new RegExp(value);
@@ -41,59 +44,59 @@ const inputCleaned = computed(() => {
const formats = computed(() => [
{
label: 'Lowercase:',
label: t('tools.case-converter.texts.label-lowercase'),
value: inputCleaned.value.toLocaleLowerCase(),
},
{
label: 'Uppercase:',
label: t('tools.case-converter.texts.label-uppercase'),
value: inputCleaned.value.toLocaleUpperCase(),
},
{
label: 'Camelcase:',
label: t('tools.case-converter.texts.label-camelcase'),
value: camelCase(inputCleaned.value),
},
{
label: 'Capitalcase:',
label: t('tools.case-converter.texts.label-capitalcase'),
value: capitalCase(inputCleaned.value),
},
{
label: 'Constantcase:',
label: t('tools.case-converter.texts.label-constantcase'),
value: constantCase(inputCleaned.value),
},
{
label: 'Dotcase:',
label: t('tools.case-converter.texts.label-dotcase'),
value: dotCase(inputCleaned.value),
},
{
label: 'Kebab/paramcase:',
label: t('tools.case-converter.texts.label-kebab-paramcase'),
value: kebabCase(inputCleaned.value),
},
{
label: 'Nocase:',
label: t('tools.case-converter.texts.label-nocase'),
value: noCase(inputCleaned.value),
},
{
label: 'Train/headercase:',
label: t('tools.case-converter.texts.label-train-headercase'),
value: trainCase(inputCleaned.value),
},
{
label: 'Pascalcase:',
label: t('tools.case-converter.texts.label-pascalcase'),
value: pascalCase(inputCleaned.value),
},
{
label: 'Pathcase:',
label: t('tools.case-converter.texts.label-pathcase'),
value: pathCase(inputCleaned.value),
},
{
label: 'Sentencecase:',
label: t('tools.case-converter.texts.label-sentencecase'),
value: sentenceCase(inputCleaned.value),
},
{
label: 'Snakecase:',
label: t('tools.case-converter.texts.label-snakecase'),
value: snakeCase(inputCleaned.value),
},
{
label: 'Mockingcase:',
label: t('tools.case-converter.texts.label-mockingcase'),
value: inputCleaned.value
.split('')
.map((char, index) => (index % 2 === 0 ? char.toUpperCase() : char.toLowerCase()))
@@ -112,8 +115,8 @@ const inputLabelAlignmentConfig = {
<c-card>
<c-input-text
v-model:value="input"
label="Your string:"
placeholder="Your string..."
:label="t('tools.case-converter.texts.label-your-string')"
:placeholder="t('tools.case-converter.texts.placeholder-your-string')"
raw-text
v-bind="inputLabelAlignmentConfig"
mb-1
@@ -121,8 +124,8 @@ const inputLabelAlignmentConfig = {
<c-input-text
v-model:value="cleaningRegex"
label="Cleaning regex:"
placeholder="Your cleaning regex..."
:label="t('tools.case-converter.texts.label-cleaning-regex')"
:placeholder="t('tools.case-converter.texts.placeholder-your-cleaning-regex')"
raw-text
v-bind="inputLabelAlignmentConfig"
mb-1
@@ -10,6 +10,8 @@ import type * as openpgp from 'openpgp';
import * as forge from 'node-forge';
import oids from './oids.json';
import { translate as t } from '@/plugins/i18n.plugin';
export interface LabelValue {
label: string
value: string
@@ -34,38 +36,38 @@ function buf2Hex(buffer: ArrayBuffer) { // buffer is an ArrayBuffer
export function getPublicKeyLabelValues(publicKey: Key) {
return [
{
label: 'Type:',
value: 'Public Key',
label: t('tools.certificate-key-parser.infos.text.type'),
value: t('tools.certificate-key-parser.infos.text.public-key'),
},
{
label: 'Key Type:',
label: t('tools.certificate-key-parser.texts.label-key-type'),
value: publicKey.type,
},
{
label: 'Size:',
label: t('tools.certificate-key-parser.texts.label-size'),
value: publicKey.size,
},
{
label: 'Comment:',
label: t('tools.certificate-key-parser.texts.label-comment'),
value: publicKey.comment,
multiline: true,
},
{
label: 'Curve:',
label: t('tools.certificate-key-parser.texts.label-curve'),
value: publicKey.curve ?? 'none',
},
{
label: 'Fingerprint (sha256):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-sha256'),
value: onErrorReturnErrorMessage(() => publicKey.fingerprint('sha256')),
multiline: true,
},
{
label: 'Fingerprint (sha512):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-sha512'),
value: onErrorReturnErrorMessage(() => publicKey.fingerprint('sha512')),
multiline: true,
},
{
label: 'Key (PEM):',
label: t('tools.certificate-key-parser.texts.label-key-pem'),
value: onErrorReturnErrorMessage(() => publicKey.toString('pem')),
multiline: true,
},
@@ -75,38 +77,38 @@ export function getPublicKeyLabelValues(publicKey: Key) {
export function getPrivateKeyLabelValues(privateKey: PrivateKey) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'Private Key',
},
{
label: 'Key Type:',
label: t('tools.certificate-key-parser.texts.label-key-type'),
value: privateKey.type,
},
{
label: 'Size:',
label: t('tools.certificate-key-parser.texts.label-size'),
value: privateKey.size,
},
{
label: 'Comment:',
label: t('tools.certificate-key-parser.texts.label-comment'),
value: privateKey.comment,
multiline: true,
},
{
label: 'Curve:',
label: t('tools.certificate-key-parser.texts.label-curve'),
value: privateKey.curve,
},
{
label: 'Fingerprint (sha256):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-sha256'),
value: onErrorReturnErrorMessage(() => privateKey.fingerprint('sha256')),
multiline: true,
},
{
label: 'Fingerprint (sha512):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-sha512'),
value: onErrorReturnErrorMessage(() => privateKey.fingerprint('sha512')),
multiline: true,
},
{
label: 'Key (PEM):',
label: t('tools.certificate-key-parser.texts.label-key-pem'),
value: onErrorReturnErrorMessage(() => privateKey.toString('pem')),
multiline: true,
},
@@ -116,64 +118,64 @@ export function getPrivateKeyLabelValues(privateKey: PrivateKey) {
export function getCertificateLabelValues(cert: Certificate, forgeCertificate: forge.pki.Certificate | null) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'Certificate',
},
{
label: 'Subjects:',
label: t('tools.certificate-key-parser.texts.label-subjects'),
value: cert.subjects?.map(s => s.toString()).join('\n'),
multiline: true,
},
{
label: 'Valid From:',
label: t('tools.certificate-key-parser.texts.label-valid-from'),
value: cert.validFrom.toISOString(),
},
{
label: 'Valid Until:',
label: t('tools.certificate-key-parser.texts.label-valid-until'),
value: cert.validUntil.toISOString(),
},
{
label: 'Issuer:',
label: t('tools.certificate-key-parser.texts.label-issuer'),
value: cert.issuer.toString(),
multiline: true,
},
{
label: 'Subject Key:',
label: t('tools.certificate-key-parser.texts.label-subject-key'),
value: onErrorReturnErrorMessage(() => cert.subjectKey?.toString('ssh')),
multiline: true,
},
{
label: 'Subject Key Type:',
label: t('tools.certificate-key-parser.texts.label-subject-key-type'),
value: cert.subjectKey?.type,
},
{
label: 'Subject Size:',
label: t('tools.certificate-key-parser.texts.label-subject-size'),
value: cert.subjectKey?.size,
},
{
label: 'Subject Comment:',
label: t('tools.certificate-key-parser.texts.label-subject-comment'),
value: cert.subjectKey?.comment,
multiline: true,
},
{
label: 'Subject Curve:',
label: t('tools.certificate-key-parser.texts.label-subject-curve'),
value: cert.subjectKey?.curve ?? 'none',
},
{
label: 'Issuer Key:',
label: t('tools.certificate-key-parser.texts.label-issuer-key'),
value: onErrorReturnErrorMessage(() => cert.issuerKey?.toString('ssh')),
multiline: true,
},
{
label: 'Serial:',
label: t('tools.certificate-key-parser.texts.label-serial'),
value: buf2Hex(cert.serial),
},
{
label: 'Purposes:',
label: t('tools.certificate-key-parser.texts.label-purposes'),
value: cert.purposes?.join(', '),
},
{
label: 'Extensions (parsed):',
label: t('tools.certificate-key-parser.texts.label-extensions-parsed'),
value: JSON.stringify(cert.getExtensions().map(ext => ({
oid: (<any>ext).oid,
name: (<any>ext).name || (<any>oids)[(<any>ext).oid],
@@ -183,7 +185,7 @@ export function getCertificateLabelValues(cert: Certificate, forgeCertificate: f
multiline: true,
},
{
label: 'Extensions (raw):',
label: t('tools.certificate-key-parser.texts.label-extensions-raw'),
value: JSON.stringify(forgeCertificate?.extensions.map(ext => ({
id: (<any>ext).id,
name: (<any>ext).id || (<any>oids)[(<any>ext).id],
@@ -207,7 +209,7 @@ export function getCertificateLabelValues(cert: Certificate, forgeCertificate: f
],
),
{
label: 'Certificate (pem):',
label: t('tools.certificate-key-parser.texts.label-certificate-pem'),
value: onErrorReturnErrorMessage(() => cert.toString('pem')),
multiline: true,
},
@@ -217,31 +219,31 @@ export function getCertificateLabelValues(cert: Certificate, forgeCertificate: f
export async function getPGPPublicKeyLabelValuesAsync(pgpPublicKey: openpgp.Key) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'PGP Public Key',
},
{
label: 'Creation Time:',
label: t('tools.certificate-key-parser.texts.label-creation-time'),
value: pgpPublicKey.getCreationTime().toString(),
},
{
label: 'Expiration Time:',
label: t('tools.certificate-key-parser.texts.label-expiration-time'),
value: (await pgpPublicKey.getExpirationTime())?.toString() || '',
},
{
label: 'Algorithm Info:',
label: t('tools.certificate-key-parser.texts.label-algorithm-info'),
value: JSON.stringify(pgpPublicKey.getAlgorithmInfo()),
},
{
label: 'Fingerprint:',
label: t('tools.certificate-key-parser.texts.label-fingerprint'),
value: pgpPublicKey.getFingerprint(),
},
{
label: 'User ID(s):',
label: t('tools.certificate-key-parser.texts.label-user-id-s'),
value: pgpPublicKey.getUserIDs().join(', '),
},
{
label: 'Key ID(s):',
label: t('tools.certificate-key-parser.texts.label-key-id-s'),
value: pgpPublicKey.getKeyIDs().map(k => k.toHex()).join(' ; '),
},
] as LabelValue[];
@@ -250,31 +252,31 @@ export async function getPGPPublicKeyLabelValuesAsync(pgpPublicKey: openpgp.Key)
export async function getPGPPrivateKeyLabelValuesAsync(pgpPrivateKey: openpgp.Key) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'PGP Private Key',
},
{
label: 'Creation Time:',
label: t('tools.certificate-key-parser.texts.label-creation-time'),
value: pgpPrivateKey.getCreationTime().toString(),
},
{
label: 'Expiration Time:',
label: t('tools.certificate-key-parser.texts.label-expiration-time'),
value: (await pgpPrivateKey.getExpirationTime())?.toString() || '',
},
{
label: 'Algorithm Info:',
label: t('tools.certificate-key-parser.texts.label-algorithm-info'),
value: JSON.stringify(pgpPrivateKey.getAlgorithmInfo()),
},
{
label: 'Fingerprint:',
label: t('tools.certificate-key-parser.texts.label-fingerprint'),
value: pgpPrivateKey.getFingerprint(),
},
{
label: 'User ID(s):',
label: t('tools.certificate-key-parser.texts.label-user-id-s'),
value: pgpPrivateKey.getUserIDs().join(', '),
},
{
label: 'Key ID(s):',
label: t('tools.certificate-key-parser.texts.label-key-id-s'),
value: pgpPrivateKey.getKeyIDs().map(k => k.toHex()).join(' ; '),
},
] as LabelValue[];
@@ -283,47 +285,47 @@ export async function getPGPPrivateKeyLabelValuesAsync(pgpPrivateKey: openpgp.Ke
export function getCSRLabelValues(csr: forge.pki.CertificateSigningRequest) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'Certificate Signing Request',
},
{
label: 'Subject:',
label: t('tools.certificate-key-parser.texts.label-subject'),
value: csr.subject?.attributes?.map(a => JSON.stringify(a, null, 2)).join('\n'),
multiline: true,
},
// {
// label: 'Request Info:',
// label: t('tools.certificate-key-parser.texts.label-request-info'),
// value: JSON.stringify(csr.certificationRequestInfo, null, 2),
// multiline: true,
// },
{
label: 'Signature:',
label: t('tools.certificate-key-parser.texts.label-signature'),
value: csr.signature?.toString('hex'),
},
{
label: 'Signature Oid:',
label: t('tools.certificate-key-parser.texts.label-signature-oid'),
value: csr.signatureOid?.toString(),
},
{
label: 'Signature parameters:',
label: t('tools.certificate-key-parser.texts.label-signature-parameters'),
value: JSON.stringify(csr.signatureParameters, null, 2),
},
{
label: 'Signing info:',
label: t('tools.certificate-key-parser.texts.label-signing-info'),
value: JSON.stringify(csr.siginfo, null, 2),
},
{
label: 'Extensions:',
label: t('tools.certificate-key-parser.texts.label-extensions'),
value: JSON.stringify(csr.attributes, null, 2),
multiline: true,
},
{
label: 'Public Key:',
label: t('tools.certificate-key-parser.texts.label-public-key'),
value: onErrorReturnErrorMessage(() => forge.pki.publicKeyToPem(csr.publicKey as never)),
multiline: true,
},
{
label: 'Public Key Fingerprint:',
label: t('tools.certificate-key-parser.texts.label-public-key-fingerprint'),
value: onErrorReturnErrorMessage(() => forge.pki.getPublicKeyFingerprint(csr.publicKey as never)?.toHex()),
multiline: true,
},
@@ -333,15 +335,15 @@ export function getCSRLabelValues(csr: forge.pki.CertificateSigningRequest) {
export function getFingerprintLabelValues(fingerprint: Fingerprint) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'Fingerprint',
},
{
label: 'Fingerprint (hex):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-hex'),
value: fingerprint.toString('hex'),
},
{
label: 'Fingerprint (base64):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-base64'),
value: fingerprint.toString('base64'),
},
] as LabelValue[];
@@ -350,15 +352,15 @@ export function getFingerprintLabelValues(fingerprint: Fingerprint) {
export function getSignatureLabelValues(signature: Signature) {
return [
{
label: 'Type:',
label: t('tools.certificate-key-parser.texts.label-type'),
value: 'Signature',
},
{
label: 'Fingerprint (asn1):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-asn1'),
value: signature.toString('asn1'),
},
{
label: 'Fingerprint (ssh):',
label: t('tools.certificate-key-parser.texts.label-fingerprint-ssh'),
value: signature.toString('ssh'),
},
] as LabelValue[];
@@ -19,6 +19,8 @@ import * as openpgp from 'openpgp';
import * as forge from 'node-forge';
import { type LabelValue, getCSRLabelValues, getCertificateLabelValues, getFingerprintLabelValues, getPGPPrivateKeyLabelValuesAsync, getPGPPublicKeyLabelValuesAsync, getPrivateKeyLabelValues, getPublicKeyLabelValues, getSignatureLabelValues } from './certificate-key-parser.infos';
import { translate as t } from '@/plugins/i18n.plugin';
export async function getKeysOrCertificatesInfosAsync(keyOrCertificateValue: string | Buffer, passphrase: string) {
const parts = keyOrCertificateValue.toString().trim().split(/(-----BEGIN [^-]+-----\n)/).filter(s => s !== '');
if (!parts.length) {
@@ -140,8 +142,8 @@ export async function getKeyOrCertificateInfosAsync(keyOrCertificateValue: strin
return {
values: [
{
label: 'Type:',
value: 'Unknown format or invalid passphrase',
label: t('tools.certificate-key-parser.service.text.type'),
value: t('tools.certificate-key-parser.service.text.unknown-format-or-invalid-passphrase'),
}],
};
}
@@ -149,7 +151,7 @@ export async function getKeyOrCertificateInfosAsync(keyOrCertificateValue: strin
return {
values: [
{
label: 'Error:',
label: t('tools.certificate-key-parser.service.text.error'),
value: e.toString(),
}] as LabelValue[],
};
@@ -1,10 +1,13 @@
<script setup lang="ts">
import { Buffer } from 'node:buffer';
import { useI18n } from 'vue-i18n';
import { getKeysOrCertificatesInfosAsync } from './certificate-key-parser.service';
import { type LabelValue } from './certificate-key-parser.infos';
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
const { t } = useI18n();
const inputKeyOrCertificate = ref('');
const passphrase = ref('');
const fileInput = ref() as Ref<Buffer>;
@@ -60,7 +63,7 @@ const parsedSections = computedAsync<LabelValue[][]>(async () => {
}
catch (e: any) {
return [
[{ label: 'Parsing Error', value: e.toString() }],
[{ label: t('tools.certificate-key-parser.texts.label-parsing-error'), value: e.toString() }],
];
}
});
@@ -73,26 +76,26 @@ const parsedSections = computedAsync<LabelValue[][]>(async () => {
<n-space>
<n-radio
value="file"
label="File"
:label="t('tools.certificate-key-parser.texts.label-file')"
/>
<n-radio
value="content"
label="Content"
:label="t('tools.certificate-key-parser.texts.label-content')"
/>
</n-space>
</n-radio-group>
<c-file-upload
v-if="inputType === 'file'"
title="Drag and drop a Certificate file here, or click to select a Certificate file"
:title="t('tools.certificate-key-parser.texts.title-drag-and-drop-a-certificate-file-here-or-click-to-select-a-certificate-file')"
@file-upload="onUpload"
/>
<c-input-text
v-if="inputType === 'content'"
v-model:value="inputKeyOrCertificate"
label="Paste your Public Key / Private Key / Signature / Fingerprint / Certificate:"
placeholder="Your Public Key / Private Key / Signature / Fingerprint / Certificate..."
:label="t('tools.certificate-key-parser.texts.label-paste-your-public-key-private-key-signature-fingerprint-certificate')"
:placeholder="t('tools.certificate-key-parser.texts.placeholder-your-public-key-private-key-signature-fingerprint-certificate')"
multiline
rows="8"
data-test-id="input"
@@ -101,8 +104,8 @@ const parsedSections = computedAsync<LabelValue[][]>(async () => {
<c-input-text
v-model:value="passphrase"
label="Passphrase (for encrypted keys):"
placeholder="Passphrase (for encrypted keys)..."
:label="t('tools.certificate-key-parser.texts.label-passphrase-for-encrypted-keys')"
:placeholder="t('tools.certificate-key-parser.texts.placeholder-passphrase-for-encrypted-keys')"
type="password"
data-test-id="pass"
/>
@@ -126,13 +129,13 @@ const parsedSections = computedAsync<LabelValue[][]>(async () => {
autosize mb-2
:multiline="multiline"
:value="value"
placeholder="Not Set"
:placeholder="t('tools.certificate-key-parser.texts.placeholder-not-set')"
/>
</c-card>
<div v-if="certificateX509DER !== ''" flex justify-center>
<c-button @click="downloadX509DERFile()">
Download X509 DER certificate
{{ t('tools.certificate-key-parser.texts.tag-download-x509-der-certificate') }}
</c-button>
</div>
</div>
@@ -1,6 +1,8 @@
import _ from 'lodash';
import type { GroupPermissions, Permissions, SpecialPermissions } from './chmod-calculator.types';
import { translate as t } from '@/plugins/i18n.plugin';
export { computeUmaskRepresentation, computeChmodOctalRepresentation, computeChmodSymbolicRepresentation, computePermissionsFromChmodOctalRepresentation, computePermissionsFromChmodSymbolicRepresentation };
function computeChmodOctalRepresentation({ permissions }: { permissions: Permissions }): string {
@@ -42,7 +44,7 @@ function computePermissionsFromChmodOctalRepresentation(octalPermissions: string
const specialPermissionValue = { setuid: 4, setgid: 2, stickybit: 1 };
if (!octalPermissions || !octalPermissions.match(/^[0-7]{3,4}$/)) {
throw new Error(`Invalid octal permissions (must be 3 or 4 octal digits): ${octalPermissions}`);
throw new Error(t('tools.chmod-calculator.service.text.invalid-octal-permissions-must-be-3-or-4-octal-digits-octalpermissions', [octalPermissions]));
}
const fullOctalPermissions = octalPermissions.length === 3 ? `0${octalPermissions}` : octalPermissions;
@@ -65,7 +67,7 @@ function computePermissionsFromChmodOctalRepresentation(octalPermissions: string
function computePermissionsFromChmodSymbolicRepresentation(symbolicPermissions: string): Permissions {
const formatRegex = /^[-dlbcsp]?([r-])([w-])([xs-])([r-])([w-])([xs-])([r-])([w-])([xt-])$/;
if (!symbolicPermissions || !symbolicPermissions.match(formatRegex)) {
throw new Error(`Invalid string permissions (must be in form 'rwxrwxrwx'): ${symbolicPermissions}`);
throw new Error(t('tools.chmod-calculator.service.text.invalid-string-permissions-must-be-in-form-rwxrwxrwx-symbolicpermissions', [symbolicPermissions]));
}
const [_, rOwner, wOwner, xOwner, rGroup, wGroup, xGroup, rAll, wAll, xAll] = formatRegex.exec(symbolicPermissions) || [];
+17 -14
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useThemeVars } from 'naive-ui';
import InputCopyable from '../../components/InputCopyable.vue';
@@ -7,6 +8,8 @@ import { computeChmodOctalRepresentation, computeChmodSymbolicRepresentation, co
import type { Group, Scope } from './chmod-calculator.types';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const themeVars = useThemeVars();
const scopes: { scope: Scope; title: string }[] = [
@@ -28,7 +31,7 @@ const octalPermissionsInputValidation = useValidation({
source: octalPermissionsInput,
rules: [
{
message: 'Invalid octal permission string',
message: t('tools.chmod-calculator.texts.message-invalid-octal-permission-string'),
validator: (value) => {
try {
computePermissionsFromChmodOctalRepresentation(value.trim());
@@ -56,7 +59,7 @@ const symbolicPermissionsInputValidation = useValidation({
source: symbolicPermissionsInput,
rules: [
{
message: 'Invalid symbolic permission string',
message: t('tools.chmod-calculator.texts.message-invalid-symbolic-permission-string'),
validator: (value) => {
try {
computePermissionsFromChmodSymbolicRepresentation(value.trim());
@@ -89,16 +92,16 @@ const umask = computed(() => computeUmaskRepresentation({ permissions: permissio
<n-space justify="center">
<c-input-text
v-model:value="octalPermissionsInput"
placeholder="Put your octal permissions here..."
label="Copy your octal permissions"
:placeholder="t('tools.chmod-calculator.texts.placeholder-put-your-octal-permissions-here')"
:label="t('tools.chmod-calculator.texts.label-copy-your-octal-permissions')"
:validation="octalPermissionsInputValidation"
mb-2
/>
<c-input-text
v-model:value="symbolicPermissionsInput"
placeholder="Put your symbolic permissions here..."
label="Copy your symbolic permissions"
:placeholder="t('tools.chmod-calculator.texts.placeholder-put-your-symbolic-permissions-here')"
:label="t('tools.chmod-calculator.texts.label-copy-your-symbolic-permissions')"
:validation="symbolicPermissionsInputValidation"
mb-2
/>
@@ -111,13 +114,13 @@ const umask = computed(() => computeUmaskRepresentation({ permissions: permissio
<tr>
<th class="text-center" scope="col" />
<th class="text-center" scope="col">
Owner (u)
{{ t('tools.chmod-calculator.texts.tag-owner-u') }}
</th>
<th class="text-center" scope="col">
Group (g)
{{ t('tools.chmod-calculator.texts.tag-group-g') }}
</th>
<th class="text-center" scope="col">
Public (o)
{{ t('tools.chmod-calculator.texts.tag-public-o') }}
</th>
</tr>
</thead>
@@ -133,7 +136,7 @@ const umask = computed(() => computeUmaskRepresentation({ permissions: permissio
</tr>
<tr>
<td class="line-header">
Flags
{{ t('tools.chmod-calculator.texts.tag-flags') }}
</td>
<td class="text-center">
<n-checkbox v-model:checked="permissions.flags.setuid" size="large" />
@@ -155,13 +158,13 @@ const umask = computed(() => computeUmaskRepresentation({ permissions: permissio
{{ symbolic }}
</div>
<c-card title="Chmod command" mb-1>
<c-card :title="t('tools.chmod-calculator.texts.title-chmod-command')" mb-1>
<InputCopyable label-position="left" :value="`chmod ${octal} path`" readonly />
</c-card>
<c-card title="Umask">
<InputCopyable label="Octal:" label-position="left" label-width="100px" :value="umask.octal" readonly />
<InputCopyable label="Symbolic:" label-position="left" label-width="100px" :value="umask.symbolic" readonly />
<c-card :title="t('tools.chmod-calculator.texts.title-umask')">
<InputCopyable :label="t('tools.chmod-calculator.texts.label-octal')" label-position="left" label-width="100px" :value="umask.octal" readonly />
<InputCopyable :label="t('tools.chmod-calculator.texts.label-symbolic')" label-position="left" label-width="100px" :value="umask.symbolic" readonly />
</c-card>
</div>
</template>
+11 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useStorage } from '@vueuse/core';
import { Check as CheckIcon, LetterX as CrossIcon } from '@vicons/tabler';
import { getMatch } from 'ip-matching';
@@ -7,6 +8,8 @@ import { withDefaultOnError } from '@/utils/defaults';
import { isNotThrowing } from '@/utils/boolean';
import SpanCopyable from '@/components/SpanCopyable.vue';
const { t } = useI18n();
const baseRange = useStorage('cidr-in-cidr:range', '192.168.0.1/24'); // NOSONAR
const ipOrRangeToTest = useStorage('cidr-in-cidr:ip', '192.168.0.1'); // NOSONAR
@@ -16,7 +19,7 @@ const matchResult = computed(() => withDefaultOnError(
const rangeValidationRules = [
{
message: 'We cannot parse this CIDR/IP Range/Mask/Wildcard, check the format',
message: t('tools.cidr-in-cidr.texts.message-we-cannot-parse-this-cidr-ip-range-mask-wildcard-check-the-format'),
validator: (value: string) => isNotThrowing(() => getMatch(value)) && getMatch(value),
},
];
@@ -26,16 +29,16 @@ const rangeValidationRules = [
<div>
<c-input-text
v-model:value="baseRange"
label="An IPv4/6 CIDR/Range/Mask/Wildcard (base network)"
placeholder="The ipv4/6 CIDR..."
:label="t('tools.cidr-in-cidr.texts.label-an-ipv4-6-cidr-range-mask-wildcard-base-network')"
:placeholder="t('tools.cidr-in-cidr.texts.placeholder-the-ipv4-6-cidr')"
:validation-rules="rangeValidationRules"
mb-4
/>
<c-input-text
v-model:value="ipOrRangeToTest"
label="An IPv4/6 CIDR/Range/Mask/Wildcard (to test for inclusion)"
placeholder="The An IPv4/6 CIDR/Range/Mask/Wildcard..."
:label="t('tools.cidr-in-cidr.texts.label-an-ipv4-6-cidr-range-mask-wildcard-to-test-for-inclusion')"
:placeholder="t('tools.cidr-in-cidr.texts.placeholder-the-an-ipv4-6-cidr-range-mask-wildcard')"
:validation-rules="rangeValidationRules"
mb-4
/>
@@ -46,20 +49,16 @@ const rangeValidationRules = [
<span v-if="matchResult.isIncluded">
<n-icon color="green">
<CheckIcon />
</n-icon>
Included
</span>
</n-icon>{{ t('tools.cidr-in-cidr.texts.tag-included') }}</span>
<span v-else>
<n-icon color="red">
<CrossIcon />
</n-icon>
Not included
</span>
</n-icon>{{ t('tools.cidr-in-cidr.texts.tag-not-included') }}</span>
</div>
<n-divider />
<c-card title="Subnets">
<c-card :title="t('tools.cidr-in-cidr.texts.title-subnets')">
<n-table>
<tbody>
<tr v-for="{ cidr, start, end } in matchResult.baseSubnets" :key="cidr">
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { APA, MLA } from 'citation-formatter';
const { t } = useI18n();
const citationData = ref({
authors: [''],
title: '',
@@ -38,37 +41,37 @@ const formattedCitation = computed(() => {
</script>
<template>
<n-card title="Citation Generator" style="max-width: 600px; margin: auto;">
<n-card :title="t('tools.citation-generator.texts.title-citation-generator')" style="max-width: 600px; margin: auto;">
<n-form label-placement="left" label-width="150px" :model="citationData">
<n-form-item label="Authors (in Last Name, First Name format):" label-placement="top">
<n-form-item :label="t('tools.citation-generator.texts.label-authors-in-last-name-first-name-format')" label-placement="top">
<n-dynamic-input
v-model:value="citationData.authors"
placeholder="Enter author name"
:placeholder="t('tools.citation-generator.texts.placeholder-enter-author-name')"
/>
</n-form-item>
<n-form-item label="Title:">
<n-input v-model:value="citationData.title" placeholder="e.g. Introduction to Vue 3" :status="citationData.title ? 'success' : 'error'" />
<n-form-item :label="t('tools.citation-generator.texts.label-title')">
<n-input v-model:value="citationData.title" :placeholder="t('tools.citation-generator.texts.placeholder-e-g-introduction-to-vue-3')" :status="citationData.title ? 'success' : 'error'" />
</n-form-item>
<n-form-item label="Publisher:">
<n-input v-model:value="citationData.publisher" placeholder="e.g. O'Reilly Media" :status="citationData.publisher ? 'success' : 'error'" />
<n-form-item :label="t('tools.citation-generator.texts.label-publisher')">
<n-input v-model:value="citationData.publisher" :placeholder="t('tools.citation-generator.texts.placeholder-e-g-o-reilly-media')" :status="citationData.publisher ? 'success' : 'error'" />
</n-form-item>
<n-form-item label="Publication Year:">
<n-form-item :label="t('tools.citation-generator.texts.label-publication-year')">
<n-input-number v-model:value="citationData.year" :min="0" :status="citationData.year ? 'success' : 'error'" />
</n-form-item>
<n-form-item label="URL (optional):">
<n-input v-model:value="citationData.url" placeholder="e.g. https://example.com" />
<n-form-item :label="t('tools.citation-generator.texts.label-url-optional')">
<n-input v-model:value="citationData.url" :placeholder="t('tools.citation-generator.texts.placeholder-e-g-https-example-com')" />
</n-form-item>
<n-form-item label="Citation Style">
<n-form-item :label="t('tools.citation-generator.texts.label-citation-style')">
<n-select
v-model:value="style"
:options="[
{ label: 'APA', value: 'apa' },
{ label: 'MLA', value: 'mla' },
{ label: t('tools.citation-generator.texts.label-apa'), value: 'apa' },
{ label: t('tools.citation-generator.texts.label-mla'), value: 'mla' },
]"
/>
</n-form-item>
@@ -76,7 +79,7 @@ const formattedCitation = computed(() => {
<n-divider />
<c-card title="Generated Citation">
<c-card :title="t('tools.citation-generator.texts.title-generated-citation')">
<textarea-copyable :value="formattedCitation" />
</c-card>
</n-card>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import * as service from './cli-command-editor.service';
const { t } = useI18n();
const inputCommand = ref('');
const options = computed(() => service.extractOptions(inputCommand.value));
const optionsObject = computed(() => service.buildOptionsObject(options.value));
@@ -17,9 +20,9 @@ const command = ref('');
label-position="left"
label-width="130px"
:label="$t('tools.cli-command-editor.command')"
:aria-label="$t('tools.cli-command-editor.command')"
:aria-:label="t('tools.cli-command-editor.texts.label-t-tools-cli-command-editor-command')"
:placeholder="$t('tools.cli-command-editor.placeholder')"
:aria-placeholder="$t('tools.cli-command-editor.placeholder')"
:aria-:placeholder="t('tools.cli-command-editor.texts.placeholder-t-tools-cli-command-editor-placeholder')"
raw-text
@update:value="() => { command = inputCommand }"
/>
@@ -30,9 +33,9 @@ const command = ref('');
label-width="130px"
label-align="left"
:label="service.sanitizeOption(option)"
:aria-label="service.sanitizeOption(option)"
:aria-:label="t('tools.cli-command-editor.texts.label-service-sanitizeoption-option')"
:placeholder="service.sanitizeOption(option)"
:aria-placeholder="service.sanitizeOption(option)"
:aria-:placeholder="t('tools.cli-command-editor.texts.placeholder-service-sanitizeoption-option')"
mt-6
@update:value="() => { command = service.buildEditedCommand(optionsInput, optionsObject, inputCommand) }"
/>
@@ -1,10 +1,13 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { bundledLanguagesInfo, createHighlighter } from 'shiki/bundle/full';
import { bundledThemesInfo } from 'shiki/themes';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { useCopy, useCopyClipboardItems } from '@/composable/copy';
const { t } = useI18n();
const code = ref(`// Using 'typeof' to infer types
const person = { name: "Alice", age: 30 };
type PersonType = typeof person; // { name: string; age: number }
@@ -85,7 +88,7 @@ const { copy: copyText } = useCopy({ source: code });
<div mb-3 flex items-baseline gap-1>
<c-select
v-model:value="currentLang"
label="Language"
:label="t('tools.code-highlighter.texts.label-language')"
label-position="left"
searchable
:options="langs"
@@ -93,7 +96,7 @@ const { copy: copyText } = useCopy({ source: code });
/>
<c-select
v-model:value="currentTheme"
label="Theme"
:label="t('tools.code-highlighter.texts.label-theme')"
label-position="left"
searchable
:options="themes"
@@ -103,22 +106,22 @@ const { copy: copyText } = useCopy({ source: code });
<c-input-text
v-model:value="code"
label="Code snippet to format:"
:label="t('tools.code-highlighter.texts.label-code-snippet-to-format')"
multiline
placeholder="Put your code snippet here"
:placeholder="t('tools.code-highlighter.texts.placeholder-put-your-code-snippet-here')"
rows="5"
mb-3
/>
<div flex justify-center gap-2>
<n-form-item label="Show line numbers" label-placement="left">
<n-form-item :label="t('tools.code-highlighter.texts.label-show-line-numbers')" label-placement="left">
<n-switch v-model:value="showLineNumbers" />
</n-form-item>
<c-button @click="copyHtml()">
Copy HTML Formatted
{{ t('tools.code-highlighter.texts.tag-copy-html-formatted') }}
</c-button>
<c-button @click="copyText()">
Copy Code Text
{{ t('tools.code-highlighter.texts.tag-copy-code-text') }}
</c-button>
</div>
+4 -1
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { computedRefreshable } from '@/composable/computedRefreshable';
import { randIntFromInterval } from '@/utils/random';
const { t } = useI18n();
const [coinFlip, refreshCoinFlip] = computedRefreshable(() => ({
coin: randIntFromInterval(0, 10) % 2 === 0 ? 'Heads' : 'Tails',
dt: Date.now(),
@@ -19,7 +22,7 @@ const [coinFlip, refreshCoinFlip] = computedRefreshable(() => ({
</Transition>
<div mt-4 flex justify-center>
<c-button @click="refreshCoinFlip">
Re flip
{{ t('tools.coin-flipper.texts.tag-re-flip') }}
</c-button>
</div>
</div>
@@ -1,16 +1,19 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { apcaContrastValue, hex, wcag, wcagContrastValue } from 'a11y-color-contrast';
import { useQueryParam } from '@/composable/queryParams';
const { t } = useI18n();
const forecolor = useQueryParam({ name: 'fg', defaultValue: '#000' });
const backcolor = useQueryParam({ name: 'bg', defaultValue: '#fff' });
const levels = [
{ score: 3, text: 'Very poor', bg: '#fbd0da', fg: '#5f071c', stars: 1 },
{ score: 4.5, text: 'Poor', bg: '#fbd0da', fg: '#5f071c', stars: 2 },
{ score: 7, text: 'Good', bg: '#fbf5d0', fg: '#5f5207', stars: 3 },
{ score: 12, text: 'Very good', bg: '#d2fbd0', fg: '#0d5f07', stars: 4 },
{ score: 9999, text: 'Super', bg: '#d2fbd0', fg: '#0d5f07', stars: 5 },
{ score: 3, text: t('tools.color-contrast-checker.texts.text-very-poor'), bg: '#fbd0da', fg: '#5f071c', stars: 1 },
{ score: 4.5, text: t('tools.color-contrast-checker.texts.text-poor'), bg: '#fbd0da', fg: '#5f071c', stars: 2 },
{ score: 7, text: t('tools.color-contrast-checker.texts.text-good'), bg: '#fbf5d0', fg: '#5f5207', stars: 3 },
{ score: 12, text: t('tools.color-contrast-checker.texts.text-very-good'), bg: '#d2fbd0', fg: '#0d5f07', stars: 4 },
{ score: 9999, text: t('tools.color-contrast-checker.texts.text-super'), bg: '#d2fbd0', fg: '#0d5f07', stars: 5 },
];
const smallLevels = [
{ score: 4.5, bg: '#fbd0da', fg: '#5f071c', stars: 1 },
@@ -53,7 +56,7 @@ const result = computed(() => {
<template>
<div max-w-600px>
<n-form-item
label="Forecolor:"
:label="t('tools.color-contrast-checker.texts.label-forecolor')"
label-placement="left"
mb-1
>
@@ -64,7 +67,7 @@ const result = computed(() => {
/>
</n-form-item>
<n-form-item
label="Backcolor:"
:label="t('tools.color-contrast-checker.texts.label-backcolor')"
label-placement="left"
mb-1
>
@@ -81,10 +84,10 @@ const result = computed(() => {
{{ result.error }}
</c-alert>
<c-card v-if="!result.error" title="WCAG 2.1">
<input-copyable readonly label="WCAG Constrast:" label-width="130px" label-position="left" :value="result.wcag21ConstrastValue" mb-3 />
<c-card v-if="!result.error" :title="t('tools.color-contrast-checker.texts.title-wcag-2-1')">
<input-copyable readonly :label="t('tools.color-contrast-checker.texts.label-wcag-constrast')" label-width="130px" label-position="left" :value="result.wcag21ConstrastValue" mb-3 />
<n-form-item v-if="result.level" label="Contrast quality:" label-width="130px" label-placement="left">
<n-form-item v-if="result.level" :label="t('tools.color-contrast-checker.texts.label-contrast-quality')" label-width="130px" label-placement="left">
<n-tag :max="5" :color="{ color: result.level.bg, textColor: result.level.fg, borderColor: result.level.fg }" mr-2>
<span>{{ result.wcag21ConstrastValue.toFixed(2) }} - {{ result.level.text }}</span>
</n-tag>
@@ -92,37 +95,37 @@ const result = computed(() => {
<n-rate :count="5" readonly :default-value="result.level.stars" :color="result.level.fg" />
</n-tag>
</n-form-item>
<n-form-item v-if="result.smallLevel" label="Small texts:" label-width="130px" label-placement="left">
<n-form-item v-if="result.smallLevel" :label="t('tools.color-contrast-checker.texts.label-small-texts')" label-width="130px" label-placement="left">
<n-tag :color="{ color: result.smallLevel.bg, textColor: result.smallLevel.fg, borderColor: result.smallLevel.fg }">
<n-rate :count="3" readonly :default-value="result.smallLevel.stars" :color="result.smallLevel.fg" />
</n-tag>
</n-form-item>
<n-form-item v-if="result.largeLevel" label="Large texts:" label-width="130px" label-placement="left">
<n-form-item v-if="result.largeLevel" :label="t('tools.color-contrast-checker.texts.label-large-texts')" label-width="130px" label-placement="left">
<n-tag :color="{ color: result.largeLevel.bg, textColor: result.largeLevel.fg, borderColor: result.largeLevel.fg }">
<n-rate :count="3" readonly :default-value="result.largeLevel.stars" :color="result.largeLevel.fg" />
</n-tag>
</n-form-item>
<c-card title="Normal text">
<n-form-item label="WCAG 2.1 AA:" label-width="130px" label-placement="left">
<c-card :title="t('tools.color-contrast-checker.texts.title-normal-text')">
<n-form-item :label="t('tools.color-contrast-checker.texts.label-wcag-2-1-aa')" label-width="130px" label-placement="left">
<n-tag :bordered="false" :type="result.aaNormal ? 'success' : 'error'">
{{ result.aaNormal ? 'Pass' : 'Fail' }}
</n-tag>
</n-form-item>
<n-form-item label="WCAG 2.1 AAA:" label-width="130px" label-placement="left">
<n-form-item :label="t('tools.color-contrast-checker.texts.label-wcag-2-1-aaa')" label-width="130px" label-placement="left">
<n-tag :bordered="false" :type="result.aaaNormal ? 'success' : 'error'">
{{ result.aaaNormal ? 'Pass' : 'Fail' }}
</n-tag>
</n-form-item>
</c-card>
<c-card title="Large text">
<n-p><i>Text that is 14pt (18.67px) and bold or any text bigger than 18pt (24px) is defined as large scale text.</i></n-p>
<n-form-item label="WCAG 2.1 AA:" label-width="130px" label-placement="left">
<c-card :title="t('tools.color-contrast-checker.texts.title-large-text')">
<n-p><i>{{ t('tools.color-contrast-checker.texts.tag-text-that-is-14pt-18-67px-and-bold-or-any-text-bigger-than-18pt-24px-is-defined-as-large-scale-text') }}</i></n-p>
<n-form-item :label="t('tools.color-contrast-checker.texts.label-wcag-2-1-aa')" label-width="130px" label-placement="left">
<n-tag :bordered="false" :type="result.aaLarge ? 'success' : 'error'">
{{ result.aaLarge ? 'Pass' : 'Fail' }}
</n-tag>
</n-form-item>
<n-form-item label="WCAG 2.1 AAA:" label-width="130px" label-placement="left">
<n-form-item :label="t('tools.color-contrast-checker.texts.label-wcag-2-1-aaa')" label-width="130px" label-placement="left">
<n-tag :bordered="false" :type="result.aaaLarge ? 'success' : 'error'">
{{ result.aaaLarge ? 'Pass' : 'Fail' }}
</n-tag>
@@ -130,8 +133,8 @@ const result = computed(() => {
</c-card>
</c-card>
<c-card v-if="!result.error" title="APCA">
<input-copyable readonly label="APCA Constrast:" label-width="130px" label-position="left" :value="result.apcaContrastValue" mb-2 />
<c-card v-if="!result.error" :title="t('tools.color-contrast-checker.texts.title-apca')">
<input-copyable readonly :label="t('tools.color-contrast-checker.texts.label-apca-constrast')" label-width="130px" label-position="left" :value="result.apcaContrastValue" mb-2 />
</c-card>
</div>
</template>
@@ -2,6 +2,8 @@ import { type Colord, colord } from 'colord';
import { withDefaultOnError } from '@/utils/defaults';
import { useValidation } from '@/composable/validation';
import { translate as t } from '@/plugins/i18n.plugin';
export { removeAlphaChannelWhenOpaque, buildColorFormat };
function removeAlphaChannelWhenOpaque(hexColor: string) {
@@ -13,7 +15,7 @@ function buildColorFormat({
parse = value => colord(value),
format,
placeholder,
invalidMessage = `Invalid ${label.toLowerCase()} format.`,
invalidMessage = t('tools.color-converter.models.text.invalid-label-tolowercase-format', [label.toLowerCase()]),
type = 'text',
}: {
label: string
+18 -15
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { Colord } from 'colord';
import { colord, extend } from 'colord';
import _ from 'lodash';
@@ -10,58 +11,60 @@ import xyzPlugin from 'colord/plugins/xyz';
import labPlugin from 'colord/plugins/lab';
import { buildColorFormat } from './color-converter.models';
const { t } = useI18n();
extend([cmykPlugin, hwbPlugin, namesPlugin, lchPlugin, xyzPlugin, labPlugin]);
const formats = {
picker: buildColorFormat({
label: 'color picker',
label: t('tools.color-converter.texts.label-color-picker'),
format: (v: Colord) => v.toHex(),
type: 'color-picker',
}),
hex: buildColorFormat({
label: 'hex',
label: t('tools.color-converter.texts.label-hex'),
format: (v: Colord) => v.toHex(),
placeholder: 'e.g. #ff0000',
}),
rgb: buildColorFormat({
label: 'rgb',
label: t('tools.color-converter.texts.label-rgb'),
format: (v: Colord) => v.toRgbString(),
placeholder: 'e.g. rgb(255, 0, 0)',
}),
hsl: buildColorFormat({
label: 'hsl',
label: t('tools.color-converter.texts.label-hsl'),
format: (v: Colord) => v.toHslString(),
placeholder: 'e.g. hsl(0, 100%, 50%)',
}),
hwb: buildColorFormat({
label: 'hwb',
label: t('tools.color-converter.texts.label-hwb'),
format: (v: Colord) => v.toHwbString(),
placeholder: 'e.g. hwb(0, 0%, 0%)',
}),
lch: buildColorFormat({
label: 'lch',
label: t('tools.color-converter.texts.label-lch'),
format: (v: Colord) => v.toLchString(),
placeholder: 'e.g. lch(53.24, 104.55, 40.85)',
}),
cmyk: buildColorFormat({
label: 'cmyk',
label: t('tools.color-converter.texts.label-cmyk'),
format: (v: Colord) => v.toCmykString(),
placeholder: 'e.g. cmyk(0, 100%, 100%, 0)',
}),
lab: buildColorFormat({
label: 'lab',
label: t('tools.color-converter.texts.label-lab'),
format: (v: Colord) => JSON.stringify(v.toLab()),
placeholder: 'e.g. { l: 14.89, a: 5.77, b: 14.41, alpha: 0.5 }',
parse: value => colord(JSON.parse(value)),
}),
xyz: buildColorFormat({
label: 'xyz',
label: t('tools.color-converter.texts.label-xyz'),
format: (v: Colord) => JSON.stringify(v.toXyz()),
placeholder: 'e.g. { x: 95.047, y: 100, z: 108.883, a: 1 }',
parse: value => colord(JSON.parse(value)),
}),
name: buildColorFormat({
label: 'name',
label: t('tools.color-converter.texts.label-name'),
format: (v: Colord) => v.toName({ closest: true }) ?? 'Unknown',
placeholder: 'e.g. red',
}),
@@ -124,23 +127,23 @@ function updateColorValue(value: Colord | undefined, omitLabel?: string) {
<template>
<div>
<c-card title="Transformations">
<n-form-item label="Saturation" label-placement="left">
<c-card :title="t('tools.color-converter.texts.title-transformations')">
<n-form-item :label="t('tools.color-converter.texts.label-saturation')" label-placement="left">
<n-slider v-model:value="saturation" :step="1" :min="-100" :max="100" mr-2 />
<n-input-number v-model:value="saturation" size="small" />
</n-form-item>
<n-form-item label="Brightness" label-placement="left">
<n-form-item :label="t('tools.color-converter.texts.label-brightness')" label-placement="left">
<n-slider v-model:value="brightness" :step="1" :min="-100" :max="100" mr-2 />
<n-input-number v-model:value="brightness" size="small" />
</n-form-item>
<n-space>
<n-form-item label="Grayscale" label-placement="left">
<n-form-item :label="t('tools.color-converter.texts.label-grayscale')" label-placement="left">
<n-checkbox v-model:checked="grayscale" mr-2 />
</n-form-item>
<n-form-item label="Invert" label-placement="left">
<n-form-item :label="t('tools.color-converter.texts.label-invert')" label-placement="left">
<n-checkbox v-model:checked="invert" mr-2 />
</n-form-item>
</n-space>
+15 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { colord, extend } from 'colord';
import a11yPlugin from 'colord/plugins/a11y';
@@ -7,6 +8,8 @@ import { useDebounce } from '@vueuse/core';
import type { Harmony, HarmonyType } from 'vue-color-wheel';
import { VueColorWheel } from 'vue-color-wheel';
const { t } = useI18n();
extend([a11yPlugin]);
const wheelColor = useDebounce(ref('#40ffff')); // { hue: 0, saturation: 0.68, value: 1 }
@@ -16,15 +19,15 @@ const isColorReadable = ref(false);
const isDarkTheme = useDark();
const harmonyTypes: { type: HarmonyType; label: string }[] = [
{ type: 'monochromatic', label: 'Monochromatic' },
{ type: 'complementary', label: 'Complementary' },
{ type: 'analogous', label: 'Analogous' },
{ type: 'triad', label: 'Triad' },
{ type: 'split', label: 'Split' },
{ type: 'compound', label: 'Compound' },
{ type: 'tetradic', label: 'Tetradic' },
{ type: 'square', label: 'Square' },
{ type: 'doubleSplit', label: 'Double Split' },
{ type: 'monochromatic', label: t('tools.color-wheel.texts.label-monochromatic') },
{ type: 'complementary', label: t('tools.color-wheel.texts.label-complementary') },
{ type: 'analogous', label: t('tools.color-wheel.texts.label-analogous') },
{ type: 'triad', label: t('tools.color-wheel.texts.label-triad') },
{ type: 'split', label: t('tools.color-wheel.texts.label-split') },
{ type: 'compound', label: t('tools.color-wheel.texts.label-compound') },
{ type: 'tetradic', label: t('tools.color-wheel.texts.label-tetradic') },
{ type: 'square', label: t('tools.color-wheel.texts.label-square') },
{ type: 'doubleSplit', label: t('tools.color-wheel.texts.label-double-split') },
];
const colorList = computed(() => {
@@ -85,14 +88,14 @@ watch(
<template>
<div>
<c-card title="Pick a color" mb-2>
<c-card :title="t('tools.color-wheel.texts.title-pick-a-color')" mb-2>
<n-color-picker :value="wheelColor" :show-alpha="false" />
<div
:style="{ backgroundColor: wheelColor }"
/>
</c-card>
<c-card title="Pick a palette type" mb-2>
<c-card :title="t('tools.color-wheel.texts.title-pick-a-palette-type')" mb-2>
<n-radio-group v-model:value="currentType" name="radiogroup">
<n-space>
<n-radio
@@ -104,7 +107,7 @@ watch(
</n-space>
</n-radio-group>
</c-card>
<c-card title="Wheel" mb-2 style="text-align: center">
<c-card :title="t('tools.color-wheel.texts.title-wheel')" mb-2 style="text-align: center">
<div style="display: inline-block">
<VueColorWheel
v-model:color="wheelColor"
+11 -7
View File
@@ -1,6 +1,10 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { useQueryParam } from '@/composable/queryParams';
const { t } = useI18n();
const cookieHeader = useQueryParam({ name: 'cookies', defaultValue: '' });
const parsedCookies = computed(() => {
@@ -12,17 +16,17 @@ const parsedCookies = computed(() => {
</script>
<template>
<n-card title="Cookie Parser">
<n-card :title="t('tools.cookies-parser.texts.title-cookie-parser')">
<n-space vertical>
<n-input v-model:value="cookieHeader" placeholder="Enter cookie header" type="text" />
<n-input v-model:value="cookieHeader" :placeholder="t('tools.cookies-parser.texts.placeholder-enter-cookie-header')" type="text" />
</n-space>
<n-p>
Tip: Navigate to a website to test, open F12 Console and run <n-tag :bordered="false">
<code>window.copy(document.cookie)</code>
</n-tag>. This will copy the cookie string to your clipboard. Note: This will only copy cookies available to javascript (HTTP only and secure cookies will be omitted).
{{ t('tools.cookies-parser.texts.tag-tip-navigate-to-a-website-to-test-open-f12-console-and-run') }}<n-tag :bordered="false">
<code>{{ t('tools.cookies-parser.texts.tag-window-copy-document-cookie') }}</code>
</n-tag>{{ t('tools.cookies-parser.texts.tag-this-will-copy-the-cookie-string-to-your-clipboard-note-this-will-only-copy-cookies-available-to-javascript-http-only-and-secure-cookies-will-be-omitted') }}
</n-p>
<n-table v-if="parsedCookies.length">
<thead><tr><th>Name</th><th>Value</th></tr></thead>
<thead><tr><th>{{ t('tools.cookies-parser.texts.tag-name') }}</th><th>{{ t('tools.cookies-parser.texts.tag-value') }}</th></tr></thead>
<tbody>
<tr v-for="cookie in parsedCookies" :key="cookie.name">
<td>
@@ -35,7 +39,7 @@ const parsedCookies = computed(() => {
</tbody>
</n-table>
<n-alert v-else type="warning">
No cookies found
{{ t('tools.cookies-parser.texts.tag-no-cookies-found') }}
</n-alert>
</n-card>
</template>
+15 -12
View File
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Countdown } from 'vue3-flip-countdown';
import moment from 'moment';
import { useQueryParam } from '@/composable/queryParams';
const { t } = useI18n();
interface CountDown {
d: number
h: number
@@ -96,26 +99,26 @@ const isEnded = computed(() => status.value === 'ended');
<template>
<div max-w-600px>
<c-card :disabled="status !== 'stopped'" title="Countdown time" mb-4>
<c-card :disabled="status !== 'stopped'" :title="t('tools.countdown.texts.title-countdown-time')" mb-4>
<div mb-4 flex justify-center gap-2>
<n-input-number v-model:value="days" :min="0">
<template #suffix>
days
{{ t('tools.countdown.texts.tag-days') }}
</template>
</n-input-number>
<n-input-number v-model:value="hours" :min="0">
<template #suffix>
hours
{{ t('tools.countdown.texts.tag-hours') }}
</template>
</n-input-number>
<n-input-number v-model:value="minutes" :min="0">
<template #suffix>
minutes
{{ t('tools.countdown.texts.tag-minutes') }}
</template>
</n-input-number>
<n-input-number v-model:value="seconds" :min="0">
<template #suffix>
seconds
{{ t('tools.countdown.texts.tag-seconds') }}
</template>
</n-input-number>
</div>
@@ -124,7 +127,7 @@ const isEnded = computed(() => status.value === 'ended');
<c-button
@click="start"
>
Start
{{ t('tools.countdown.texts.tag-start') }}
</c-button>
</div>
</c-card>
@@ -138,7 +141,7 @@ const isEnded = computed(() => status.value === 'ended');
:disabled="status === 'stopped'"
@click="toggleFullScreen"
>
Toggle Fullscreen
{{ t('tools.countdown.texts.tag-toggle-fullscreen') }}
</c-button>
</div>
</div>
@@ -147,16 +150,16 @@ const isEnded = computed(() => status.value === 'ended');
<n-modal v-model:show="isEnded" mask-closable="false">
<n-card
style="width: 600px"
title="Timer finished"
:title="t('tools.countdown.texts.title-timer-finished')"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<p>Timer ellapsed!</p>
<p>{{ t('tools.countdown.texts.tag-timer-ellapsed') }}</p>
<template #footer>
<n-button @click="stop()">
OK
{{ t('tools.countdown.texts.tag-ok') }}
</n-button>
</template>
</n-card>
@@ -167,7 +170,7 @@ const isEnded = computed(() => status.value === 'ended');
:disabled="status === 'stopped'"
@click="stop"
>
Stop
{{ t('tools.countdown.texts.tag-stop') }}
</c-button>
</div>
@@ -175,7 +178,7 @@ const isEnded = computed(() => status.value === 'ended');
Alarm at: {{ deadlineDate }}
</n-p>
<c-card v-if="history" title="History">
<c-card v-if="history" :title="t('tools.countdown.texts.title-history')">
<div flex justify-center gap-1>
<template v-for="(entry, index) in history" :key="index">
{{ index > 0 ? ' / ' : '' }}
+13 -10
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { lib } from 'crypto-js';
import { enc } from 'crypto-js';
@@ -8,6 +9,8 @@ import { convertHexToBin } from '../hash-text/hash-text.service';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
const text = ref('');
const file = ref<File | null>(null);
@@ -104,17 +107,17 @@ watch(text,
<div>
<c-card>
<c-file-upload
title="Drag and drop a file here, or click to select a file"
:title="t('tools.crc-calculator.texts.title-drag-and-drop-a-file-here-or-click-to-select-a-file')"
@file-upload="onUpload"
/>
<p>OR</p>
<p>{{ t('tools.crc-calculator.texts.tag-or') }}</p>
<c-input-text
v-model:value="text"
multiline raw-text
placeholder="Paste string to CRC..." rows="3"
autosize autofocus label="Your text to CRC:"
:placeholder="t('tools.crc-calculator.texts.placeholder-paste-string-to-crc')" rows="3"
autosize autofocus :label="t('tools.crc-calculator.texts.label-your-text-to-crc')"
/>
<n-divider />
@@ -122,22 +125,22 @@ watch(text,
<c-select
v-model:value="encoding"
mb-4
label="Digest encoding"
:label="t('tools.crc-calculator.texts.label-digest-encoding')"
:options="[
{
label: 'Binary (base 2)',
label: t('tools.crc-calculator.texts.label-binary-base-2'),
value: 'Bin',
},
{
label: 'Hexadecimal (base 16)',
label: t('tools.crc-calculator.texts.label-hexadecimal-base-16'),
value: 'Hex',
},
{
label: 'Base64 (base 64)',
label: t('tools.crc-calculator.texts.label-base64-base-64'),
value: 'Base64',
},
{
label: 'Base64url (base 64 with url safe chars)',
label: t('tools.crc-calculator.texts.label-base64url-base-64-with-url-safe-chars'),
value: 'Base64url',
},
]"
@@ -146,7 +149,7 @@ watch(text,
<div mt-3 flex justify-center>
<c-alert v-if="status === 'error'" type="error">
An error occured hashing file.
{{ t('tools.crc-calculator.texts.tag-an-error-occured-hashing-file') }}
</c-alert>
<n-spin
v-if="status === 'processing'"
+19 -16
View File
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { Countdown } from 'vue3-flip-countdown';
import { parseExpression } from 'cron-parser';
import moment from 'moment';
import { useQueryParam } from '@/composable/queryParams';
const { t } = useI18n();
const allDays = '0,1,2,3,4,5,6';
const alarmAt = useQueryParam({ name: 'at', defaultValue: '17:30:00' });
const alarmDays = useQueryParam({ name: 'days', defaultValue: allDays });
@@ -91,22 +94,22 @@ const isEnded = computed(() => status.value === 'ended');
<template>
<div max-w-600px>
<c-card :disabled="status !== 'stopped'" title="Alarm" mb-4>
<c-card :disabled="status !== 'stopped'" :title="t('tools.cron-alarm.texts.title-alarm')" mb-4>
<div mb-1 flex justify-center>
<n-form-item label="Alarm at:" label-placement="left">
<n-form-item :label="t('tools.cron-alarm.texts.label-alarm-at')" label-placement="left">
<n-time-picker v-model:formatted-value="alarmAt" />
</n-form-item>
</div>
<div flex justify-center>
<n-checkbox-group v-model:value="daysArray">
<n-space item-style="display: flex;">
<n-checkbox value="1" label="Monday" />
<n-checkbox value="2" label="Tuesday" />
<n-checkbox value="3" label="Wednesday" />
<n-checkbox value="4" label="Thursday" />
<n-checkbox value="5" label="Friday" />
<n-checkbox value="6" label="Saturday" />
<n-checkbox value="0" label="Sunday" />
<n-checkbox value="1" :label="t('tools.cron-alarm.texts.label-monday')" />
<n-checkbox value="2" :label="t('tools.cron-alarm.texts.label-tuesday')" />
<n-checkbox value="3" :label="t('tools.cron-alarm.texts.label-wednesday')" />
<n-checkbox value="4" :label="t('tools.cron-alarm.texts.label-thursday')" />
<n-checkbox value="5" :label="t('tools.cron-alarm.texts.label-friday')" />
<n-checkbox value="6" :label="t('tools.cron-alarm.texts.label-saturday')" />
<n-checkbox value="0" :label="t('tools.cron-alarm.texts.label-sunday')" />
</n-space>
</n-checkbox-group>
</div>
@@ -115,7 +118,7 @@ const isEnded = computed(() => status.value === 'ended');
<c-button
@click="start"
>
Start
{{ t('tools.cron-alarm.texts.tag-start') }}
</c-button>
</div>
</c-card>
@@ -128,7 +131,7 @@ const isEnded = computed(() => status.value === 'ended');
:disabled="status === 'stopped'"
@click="toggleFullScreen"
>
Toggle Fullscreen
{{ t('tools.cron-alarm.texts.tag-toggle-fullscreen') }}
</c-button>
</div>
</div>
@@ -139,7 +142,7 @@ const isEnded = computed(() => status.value === 'ended');
:disabled="status === 'stopped'"
@click="stop"
>
Stop
{{ t('tools.cron-alarm.texts.tag-stop') }}
</c-button>
</div>
@@ -150,22 +153,22 @@ const isEnded = computed(() => status.value === 'ended');
<n-modal v-model:show="isEnded" mask-closable="false">
<n-card
style="width: 600px"
title="Timer finished"
:title="t('tools.cron-alarm.texts.title-timer-finished')"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<p>Timer elapsed!</p>
<p>{{ t('tools.cron-alarm.texts.tag-timer-elapsed') }}</p>
<template #footer>
<n-button @click="stop()">
OK
{{ t('tools.cron-alarm.texts.tag-ok') }}
</n-button>
</template>
</n-card>
</n-modal>
<c-card v-if="history" title="History">
<c-card v-if="history" :title="t('tools.cron-alarm.texts.title-history')">
<div flex justify-center gap-1>
<template v-for="(entry, index) in history" :key="index">
{{ index > 0 ? ' / ' : '' }}
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import cronstrue from 'cronstrue';
import ctz from 'countries-and-timezones';
import getTimezoneOffset from 'get-timezone-offset';
@@ -6,6 +7,8 @@ import { type CronType, getLastExecutionTimes, isCronValid } from './crontab-gen
import { useStyleStore } from '@/stores/style.store';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const styleStore = useStyleStore();
const cron = ref('40 * * * *');
@@ -174,7 +177,7 @@ const cronString = computed(() => {
const cronValidationRules = [
{
validator: (value: string) => isCronValid(value, cronType.value),
message: 'This cron is invalid',
message: t('tools.crontab-generator.texts.message-this-cron-is-invalid'),
},
];
@@ -199,7 +202,7 @@ const executionTimesString = computed(() => {
<c-input-text
v-model:value="cron"
size="large"
placeholder="* * * * *"
:placeholder="t('tools.crontab-generator.texts.placeholder-')"
:validation-rules="cronValidationRules"
mb-3
/>
@@ -209,11 +212,11 @@ const executionTimesString = computed(() => {
<n-space>
<n-radio
value="standard"
label="Unix standard"
:label="t('tools.crontab-generator.texts.label-unix-standard')"
/>
<n-radio
value="aws"
label="AWS"
:label="t('tools.crontab-generator.texts.label-aws')"
/>
</n-space>
</n-radio-group>
@@ -230,22 +233,22 @@ const executionTimesString = computed(() => {
<div flex justify-center>
<n-form :show-feedback="false" label-width="170" label-placement="left">
<n-form-item label="Verbose">
<n-form-item :label="t('tools.crontab-generator.texts.label-verbose')">
<n-switch v-model:value="cronstrueConfig.verbose" />
</n-form-item>
<n-form-item label="Use 24 hour time format">
<n-form-item :label="t('tools.crontab-generator.texts.label-use-24-hour-time-format')">
<n-switch v-model:value="cronstrueConfig.use24HourTimeFormat" />
</n-form-item>
<n-form-item label="Days start at 0">
<n-form-item :label="t('tools.crontab-generator.texts.label-days-start-at-0')">
<n-switch v-model:value="cronstrueConfig.dayOfWeekStartIndexZero" />
</n-form-item>
<n-form-item label="Months start at 0">
<n-form-item :label="t('tools.crontab-generator.texts.label-months-start-at-0')">
<n-switch v-model:value="cronstrueConfig.monthStartIndexZero" />
</n-form-item>
<c-select
v-model:value="currentTimezone"
searchable
label="Timezone:"
:label="t('tools.crontab-generator.texts.label-timezone')"
:options="allTimezones"
/>
</n-form>
@@ -277,17 +280,16 @@ const executionTimesString = computed(() => {
<div v-if="styleStore.isSmallScreen">
<c-card v-for="{ symbol, meaning, example, equivalent } in getHelpers" :key="symbol" mb-3 important:border-none>
<div>
Symbol: <strong>{{ symbol }}</strong>
{{ t('tools.crontab-generator.texts.tag-symbol') }}<strong>{{ symbol }}</strong>
</div>
<div>
Meaning: <strong>{{ meaning }}</strong>
{{ t('tools.crontab-generator.texts.tag-meaning') }}<strong>{{ meaning }}</strong>
</div>
<div>
Example:
<strong><code>{{ example }}</code></strong>
{{ t('tools.crontab-generator.texts.tag-example') }}<strong><code>{{ example }}</code></strong>
</div>
<div>
Equivalent: <strong>{{ equivalent }}</strong>
{{ t('tools.crontab-generator.texts.tag-equivalent') }}<strong>{{ equivalent }}</strong>
</div>
</c-card>
</div>
+26 -23
View File
@@ -1,16 +1,19 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { generateCSR } from './csr-generator.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { withDefaultOnErrorAsync } from '@/utils/defaults';
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const commonName = ref('test.com');
const commonNameValidation = useValidation({
source: commonName,
rules: [
{
message: 'Common Name/Domain Name must not be empty',
message: t('tools.csr-generator.texts.message-common-name-domain-name-must-not-be-empty'),
validator: value => value?.trim() !== '',
},
],
@@ -52,98 +55,98 @@ const [certs, refreshCerts] = computedRefreshableAsync(
<div>
<div mb-2>
<n-form-item
label="Common Name/Domain Name:"
:label="t('tools.csr-generator.texts.label-common-name-domain-name')"
label-placement="top"
:feedback="commonNameValidation.message"
:validation-status="commonNameValidation.status"
>
<n-input
v-model:value="commonName"
placeholder="Common/Domain Name"
:placeholder="t('tools.csr-generator.texts.placeholder-common-domain-name')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Organization Name:"
:label="t('tools.csr-generator.texts.label-organization-name')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="organizationName"
placeholder="Organization Name"
:placeholder="t('tools.csr-generator.texts.placeholder-organization-name')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Organization Unit:"
:label="t('tools.csr-generator.texts.label-organization-unit')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="organizationalUnit"
placeholder="Organization Unit"
:placeholder="t('tools.csr-generator.texts.placeholder-organization-unit')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="State:"
:label="t('tools.csr-generator.texts.label-state')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="state"
placeholder="State"
:placeholder="t('tools.csr-generator.texts.placeholder-state')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="City:"
:label="t('tools.csr-generator.texts.label-city')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="city"
placeholder="City"
:placeholder="t('tools.csr-generator.texts.placeholder-city')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Country:"
:label="t('tools.csr-generator.texts.label-country')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="country"
placeholder="Country"
:placeholder="t('tools.csr-generator.texts.placeholder-country')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Contact Email:"
:label="t('tools.csr-generator.texts.label-contact-email')"
label-placement="left" label-width="100"
>
<n-input
v-model:value="contactEmail"
placeholder="Contact Email"
:placeholder="t('tools.csr-generator.texts.placeholder-contact-email')"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Subject Alternative Names:"
:label="t('tools.csr-generator.texts.label-subject-alternative-names')"
label-placement="top"
>
<n-input
v-model:value="subjectAlternativeNames"
placeholder="DNS Names, emails, IP, URI..."
:placeholder="t('tools.csr-generator.texts.placeholder-dns-names-emails-ip-uri')"
type="textarea"
/>
</n-form-item>
@@ -151,21 +154,21 @@ const [certs, refreshCerts] = computedRefreshableAsync(
<div>
<n-form-item
label="Private Key passphrase:"
:label="t('tools.csr-generator.texts.label-private-key-passphrase')"
label-placement="top"
>
<n-input
v-model:value="password"
type="password"
show-password-on="mousedown"
placeholder="Passphrase"
:placeholder="t('tools.csr-generator.texts.placeholder-passphrase')"
/>
</n-form-item>
</div>
<div flex justify-center>
<c-button @click="refreshCerts">
Refresh CSR
{{ t('tools.csr-generator.texts.tag-refresh-csr') }}
</c-button>
</div>
@@ -173,17 +176,17 @@ const [certs, refreshCerts] = computedRefreshableAsync(
<div v-if="commonNameValidation.isValid">
<div>
<h3>Certificate Signing Request</h3>
<h3>{{ t('tools.csr-generator.texts.tag-certificate-signing-request') }}</h3>
<TextareaCopyable :value="certs.csrPem" :download-file-name="`${organizationName}.csr`" />
</div>
<div>
<h3>Public key</h3>
<h3>{{ t('tools.csr-generator.texts.tag-public-key') }}</h3>
<TextareaCopyable :value="certs.publicKeyPem" word-wrap :download-file-name="`${organizationName}.pem`" />
</div>
<div>
<h3>Private key</h3>
<h3>{{ t('tools.csr-generator.texts.tag-private-key') }}</h3>
<TextareaCopyable :value="certs.privateKeyPem" :download-file-name="`${organizationName}.key`" />
</div>
</div>
+6 -3
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import beautify from 'js-beautify';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const inputCSS = ref('');
const outputCSS = computed(() => {
return beautify.css(inputCSS.value, {
@@ -17,15 +20,15 @@ const outputCSS = computed(() => {
<c-input-text
v-model:value="inputCSS"
multiline raw-text
placeholder="Your CSS content..."
:placeholder="t('tools.css-prettifier.texts.placeholder-your-css-content')"
rows="8"
autofocus
label="Your CSS to format (can paste from clipboard):"
:label="t('tools.css-prettifier.texts.label-your-css-to-format-can-paste-from-clipboard')"
/>
<n-divider />
<n-form-item label="Output prettified CSS:">
<n-form-item :label="t('tools.css-prettifier.texts.label-output-prettified-css')">
<TextareaCopyable
:value="outputCSS"
multiline
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import xPathToCss from 'xpath-to-css';
import cssToXpath from 'csstoxpath';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const cssInput = ref('');
const xpathOutput = computed(
() => {
@@ -30,46 +33,46 @@ const cssOutput = computed(
<template>
<div max-w-600>
<c-card title="CSS to XPath">
<c-card :title="t('tools.css-xpath-converter.texts.title-css-to-xpath')">
<c-input-text
v-model:value="cssInput"
placeholder="Put your CSS selector here..."
label="CSS selector to convert"
:placeholder="t('tools.css-xpath-converter.texts.placeholder-put-your-css-selector-here')"
:label="t('tools.css-xpath-converter.texts.label-css-selector-to-convert')"
raw-text
mb-5
/>
<router-link target="_blank" to="/css-selectors-memo" mb-1 mt-1>
See CSS Selectors Cheatsheet
{{ t('tools.css-xpath-converter.texts.tag-see-css-selectors-cheatsheet') }}
</router-link>
<n-divider />
<TextareaCopyable
label="XPath expression"
:label="t('tools.css-xpath-converter.texts.label-xpath-expression')"
:value="xpathOutput"
readonly
mb-5
/>
</c-card>
<c-card title="XPath to CSS" mt-5>
<c-card :title="t('tools.css-xpath-converter.texts.title-xpath-to-css')" mt-5>
<c-input-text
v-model:value="xpathInput"
placeholder="Put your XPath expression here..."
label="XPath expression to convert"
:placeholder="t('tools.css-xpath-converter.texts.placeholder-put-your-xpath-expression-here')"
:label="t('tools.css-xpath-converter.texts.label-xpath-expression-to-convert')"
raw-text
mb-5
/>
<router-link target="_blank" to="/xpath-memo" mb-1 mt-1>
See XPath Cheatsheet
{{ t('tools.css-xpath-converter.texts.tag-see-xpath-cheatsheet') }}
</router-link>
<n-divider />
<TextareaCopyable
label="CSS Selector"
:label="t('tools.css-xpath-converter.texts.label-css-selector')"
:value="cssOutput"
readonly
mb-5
+25 -21
View File
@@ -1,8 +1,12 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { convertCsvToArray } from '../csv-to-json/csv-to-json.service';
import { objectArrayToData } from '@/utils/objectarray.export';
import type { ExportFormat } from '@/utils/objectarray.export';
const { t } = useI18n();
const inputType = ref<'file' | 'content'>('file');
const csvContent = ref('');
const fileInput = ref() as Ref<File | null>;
@@ -15,14 +19,14 @@ const nestify = ref(false);
const typedValues = ref(false);
const formats = [
{ label: 'JSON', value: 'json' },
{ label: 'YAML', value: 'yaml' },
{ label: 'SQL INSERT', value: 'sql' },
{ label: 'CSV (comma)', value: 'csv' },
{ label: 'CSV (semicolon)', value: 'csv_semicolon' },
{ label: 'CSV (tab)', value: 'tsv' },
{ label: 'Markdown', value: 'markdown' },
{ label: 'XML', value: 'xml' },
{ label: t('tools.csv-to-data.texts.label-json'), value: 'json' },
{ label: t('tools.csv-to-data.texts.label-yaml'), value: 'yaml' },
{ label: t('tools.csv-to-data.texts.label-sql-insert'), value: 'sql' },
{ label: t('tools.csv-to-data.texts.label-csv-comma'), value: 'csv' },
{ label: t('tools.csv-to-data.texts.label-csv-semicolon'), value: 'csv_semicolon' },
{ label: t('tools.csv-to-data.texts.label-csv-tab'), value: 'tsv' },
{ label: t('tools.csv-to-data.texts.label-markdown'), value: 'markdown' },
{ label: t('tools.csv-to-data.texts.label-xml'), value: 'xml' },
];
async function handleFileUpload(file: File) {
@@ -65,17 +69,17 @@ async function convertFile() {
</script>
<template>
<NCard title="CSV Converter">
<NCard :title="t('tools.csv-to-data.texts.title-csv-converter')">
<c-card>
<n-radio-group v-model:value="inputType" name="radiogroup" mb-2 flex justify-center>
<n-space>
<n-radio
value="file"
label="File"
:label="t('tools.csv-to-data.texts.label-file')"
/>
<n-radio
value="content"
label="Content"
:label="t('tools.csv-to-data.texts.label-content')"
/>
</n-space>
</n-radio-group>
@@ -83,15 +87,15 @@ async function convertFile() {
<c-file-upload
v-if="inputType === 'file'"
accept=".csv,.tsv"
title="Drag and drop a CSV file here, or click to select a file"
:title="t('tools.csv-to-data.texts.title-drag-and-drop-a-csv-file-here-or-click-to-select-a-file')"
@file-upload="handleFileUpload"
/>
<c-input-text
v-if="inputType === 'content'"
v-model:value="csvContent"
label="Paste your CSV Content:"
placeholder="Your CSV..."
:label="t('tools.csv-to-data.texts.label-paste-your-csv-content')"
:placeholder="t('tools.csv-to-data.texts.placeholder-your-csv')"
multiline
rows="8"
data-test-id="input"
@@ -99,23 +103,23 @@ async function convertFile() {
</c-card>
<n-space justify="center">
<n-form-item label="Typed Values" label-placement="left">
<n-form-item :label="t('tools.csv-to-data.texts.label-typed-values')" label-placement="left">
<n-checkbox v-model:checked="typedValues" />
</n-form-item>
<n-form-item label="Nestify ('a.b.c' to nested objects)" label-placement="left">
<n-form-item :label="t('tools.csv-to-data.texts.label-nestify-a-b-c-to-nested-objects')" label-placement="left">
<n-checkbox v-model:checked="nestify" />
</n-form-item>
</n-space>
<NFormItem label="Select output format:" label-placement="left">
<NSelect v-model:value="selectedFormat" :options="formats" placeholder="Select format" />
<NFormItem :label="t('tools.csv-to-data.texts.label-select-output-format')" label-placement="left">
<NSelect v-model:value="selectedFormat" :options="formats" :placeholder="t('tools.csv-to-data.texts.placeholder-select-format')" />
</NFormItem>
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" label="Table Name:" label-placement="left" />
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" :label="t('tools.csv-to-data.texts.label-table-name')" label-placement="left" />
<div mt-3 flex justify-center>
<NButton :disabled="!((inputType === 'file' && fileInput) || csvContent)" @click="convertFile">
Convert
{{ t('tools.csv-to-data.texts.tag-convert') }}
</NButton>
</div>
@@ -123,7 +127,7 @@ async function convertFile() {
{{ error }}
</c-alert>
<c-card v-if="convertedData" title="Converted data">
<c-card v-if="convertedData" :title="t('tools.csv-to-data.texts.title-converted-data')">
<textarea-copyable :value="convertedData" :language="selectedFormat" />
</c-card>
</NCard>
+8 -5
View File
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { convertCsvToArray } from './csv-to-json.service';
import FormatTransformer from '@/components/FormatTransformer.vue';
import type { UseValidationRule } from '@/composable/validation';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const typedValues = ref(false);
function transformer(value: string) {
@@ -18,19 +21,19 @@ function transformer(value: string) {
const rules: UseValidationRule<string>[] = [
{
validator: (v: string) => v === '' || ((v.includes(',') || v.includes(';') || v.includes('\t') || v.includes('|')) && v.includes('\n')),
message: 'Provided CSV is not valid.',
message: t('tools.csv-to-json.texts.message-provided-csv-is-not-valid'),
},
];
</script>
<template>
<n-form-item label="Typed Values" label-placement="left">
<n-form-item :label="t('tools.csv-to-json.texts.label-typed-values')" label-placement="left">
<n-checkbox v-model:checked="typedValues" />
</n-form-item>
<FormatTransformer
input-label="Your raw CSV"
input-placeholder="Paste your raw CSV here..."
output-label="JSON version of your CSV"
:input-label="t('tools.csv-to-json.texts.input-label-your-raw-csv')"
:input-placeholder="t('tools.csv-to-json.texts.input-placeholder-paste-your-raw-csv-here')"
:output-label="t('tools.csv-to-json.texts.output-label-json-version-of-your-csv')"
:input-validation-rules="rules"
:transformer="transformer"
/>
+7 -4
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
type Warnings, toAnsible, toAnsibleWarn, toCFML, toCFMLWarn, toCSharp,
toCSharpWarn, toClojure, toClojureWarn, toDart, toDartWarn, toElixir, toElixirWarn, toGo,
@@ -16,6 +17,8 @@ import {
} from 'curlconverter';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const translate = {
'ansible': [toAnsible, toAnsibleWarn],
'cfml': [toCFML, toCFMLWarn],
@@ -110,23 +113,23 @@ const inlang = computed(() => {
<c-input-text
v-model:value="curl"
size="large"
placeholder="Your curl command"
:placeholder="t('tools.curl-converter.texts.placeholder-your-curl-command')"
mb-3
/>
<c-select
v-model:value="language"
searchable
label="Language:"
:label="t('tools.curl-converter.texts.label-language')"
:options="Object.keys(translate)"
/>
<n-divider />
<n-form-item label="Curl language equivalent:">
<n-form-item :label="t('tools.curl-converter.texts.label-curl-language-equivalent')">
<TextareaCopyable :value="inlang.translated as string" />
</n-form-item>
<n-form-item label="Warnings:">
<n-form-item :label="t('tools.curl-converter.texts.label-warnings')">
<TextareaCopyable style="color: red" :value="(inlang.warnings as Warnings || []).map(w => w[1]).join('\n')" />
</n-form-item>
</div>
+17 -14
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import JSON5 from 'json5';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const url = ref('');
const method = ref('POST'); // Default method set to POST for body support
const bodyType = ref('json'); // Default body type
@@ -69,7 +72,7 @@ const jsonBodyValidation = useValidation({
source: jsonData,
rules: [
{
message: 'Invalid JSON string',
message: t('tools.curl-generator.texts.message-invalid-json-string'),
validator: value => !value || JSON5.parse(value),
},
],
@@ -78,38 +81,38 @@ const jsonBodyValidation = useValidation({
<template>
<div>
<NFormItem label="Url:" label-placement="left">
<NInput v-model:value="url" placeholder="Enter URL" />
<NFormItem :label="t('tools.curl-generator.texts.label-url')" label-placement="left">
<NInput v-model:value="url" :placeholder="t('tools.curl-generator.texts.placeholder-enter-url')" />
</NFormItem>
<NFormItem label="Method:" label-placement="left">
<NFormItem :label="t('tools.curl-generator.texts.label-method')" label-placement="left">
<NSelect v-model:value="method" :options="methods.map(m => ({ label: m, value: m }))" />
</NFormItem>
<NRadioGroup v-model:value="bodyType" mb-2>
<NRadio value="json">
JSON Body
{{ t('tools.curl-generator.texts.tag-json-body') }}
</NRadio>
<NRadio value="form-data">
Multipart Form-Data
{{ t('tools.curl-generator.texts.tag-multipart-form-data') }}
</NRadio>
</NRadioGroup>
<c-card v-if="bodyType === 'json'" title="JSON Body:" mb-2>
<c-card v-if="bodyType === 'json'" :title="t('tools.curl-generator.texts.title-json-body')" mb-2>
<c-input-text
v-model:value="jsonData" multiline rows="6"
placeholder="Enter JSON body" :validation="jsonBodyValidation"
:placeholder="t('tools.curl-generator.texts.placeholder-enter-json-body')" :validation="jsonBodyValidation"
/>
</c-card>
<c-card v-else title="Form entries:" mb-2>
<NDynamicInput v-model:value="formData" preset="pair" key-placeholder="Key" value-placeholder="Value" />
<c-card v-else :title="t('tools.curl-generator.texts.title-form-entries')" mb-2>
<NDynamicInput v-model:value="formData" preset="pair" key-:placeholder="t('tools.curl-generator.texts.placeholder-key')" value-:placeholder="t('tools.curl-generator.texts.placeholder-value')" />
</c-card>
<c-card title="HTTP Headers:" mb-2>
<NDynamicInput v-model:value="headers" preset="pair" key-placeholder="Header" value-placeholder="Value" />
<c-card :title="t('tools.curl-generator.texts.title-http-headers')" mb-2>
<NDynamicInput v-model:value="headers" preset="pair" key-:placeholder="t('tools.curl-generator.texts.placeholder-header')" value-:placeholder="t('tools.curl-generator.texts.placeholder-value')" />
</c-card>
<c-card title="Options:" mb-2>
<c-card :title="t('tools.curl-generator.texts.title-options')" mb-2>
<template v-for="option in optionsList" :key="option.key">
<NCheckbox v-model:checked="selectedOptions[option.key]">
{{ `--${option.key}` }} <em>({{ option.description }})</em>
@@ -117,7 +120,7 @@ const jsonBodyValidation = useValidation({
</template>
</c-card>
<c-card title="Generated curl command">
<c-card :title="t('tools.curl-generator.texts.title-generated-curl-command')">
<textarea-copyable :value="curlCommand" />
</c-card>
</div>
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { code, countries, country } from 'currency-codes-ts';
import converter from 'currency-exchanger-js';
import moneysData from './moneys.json';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const allCurrencies = Object.entries(moneysData).map(([k, v]) => ({ value: k, label: v || k }));
const otherCurrencies = useQueryParamOrStorage<{ name: string }[]>({ name: 'to', storageName: 'currency-conv:others', defaultValue: [{ name: 'usd' }] });
const currentCurrency = useQueryParamOrStorage<string>({ name: 'from', storageName: 'currency-conv:cur', defaultValue: 'eur' });
@@ -34,27 +37,27 @@ const currencyToCountriesOutput = computed(() => code(currencyToCountriesInput.v
<template>
<div>
<c-card title="Currency Converter" mb-2>
<c-card :title="t('tools.currency-converter.texts.title-currency-converter')" mb-2>
<c-select
v-model:value="currentCurrency"
label="From"
:label="t('tools.currency-converter.texts.label-from')"
label-position="left"
searchable
:options="allCurrencies"
mb-2
/>
<n-form-item label="Amount:" label-placement="left" mb-2>
<n-form-item :label="t('tools.currency-converter.texts.label-amount')" label-placement="left" mb-2>
<n-input-number v-model:value="amount" :min="0" />
</n-form-item>
<n-form-item label="For Date:" label-placement="left" mb-2>
<n-form-item :label="t('tools.currency-converter.texts.label-for-date')" label-placement="left" mb-2>
<n-date-picker
v-model:value="currentDatetime"
type="date"
/>
</n-form-item>
<c-card title="Converted currencies">
<c-card :title="t('tools.currency-converter.texts.title-converted-currencies')">
<n-dynamic-input
v-model:value="otherCurrencies"
show-sort-button
@@ -65,7 +68,7 @@ const currencyToCountriesOutput = computed(() => code(currencyToCountriesInput.v
<n-select
v-model:value="value.name"
filterable
placeholder="Please select a currency"
:placeholder="t('tools.currency-converter.texts.placeholder-please-select-a-currency')"
:options="allCurrencies"
w-full
/>
@@ -76,10 +79,10 @@ const currencyToCountriesOutput = computed(() => code(currencyToCountriesInput.v
</c-card>
</c-card>
<c-card title="Country to Currencies" mb-2>
<c-card :title="t('tools.currency-converter.texts.title-country-to-currencies')" mb-2>
<c-select
v-model:value="countryToCurrenciesInput"
label="Country"
:label="t('tools.currency-converter.texts.label-country')"
label-position="left"
searchable
:options="allCountries"
@@ -94,10 +97,10 @@ const currencyToCountriesOutput = computed(() => code(currencyToCountriesInput.v
</ul>
</c-card>
<c-card title="Currencies to Countries" mb-2>
<c-card :title="t('tools.currency-converter.texts.title-currencies-to-countries')" mb-2>
<c-select
v-model:value="currencyToCountriesInput"
label="Currency"
:label="t('tools.currency-converter.texts.label-currency')"
label-position="left"
searchable
:options="allCurrencies"
+26 -23
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { type Faker, allFakers } from '@faker-js/faker';
import JSON5 from 'json5';
import { objectArrayToData } from '@/utils/objectarray.export';
@@ -6,6 +7,8 @@ import type { ExportFormat } from '@/utils/objectarray.export';
import type { UseValidationRule } from '@/composable/validation';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const jsonInput = useQueryParamOrStorage({
name: 'template',
storageName: 'faker:tmpl',
@@ -33,14 +36,14 @@ const selectedLocale = useQueryParamOrStorage({ name: 'locale', storageName: 'fa
const faker = computed(() => (allFakers as Record<string, Faker>)[selectedLocale.value]);
const formats = [
{ label: 'JSON', value: 'json' },
{ label: 'YAML', value: 'yaml' },
{ label: 'SQL INSERT', value: 'sql' },
{ label: 'CSV (comma)', value: 'csv' },
{ label: 'CSV (semicolon)', value: 'csv_semicolon' },
{ label: 'CSV (tab)', value: 'tsv' },
{ label: 'Markdown', value: 'markdown' },
{ label: 'XML', value: 'xml' },
{ label: t('tools.data-faker.texts.label-json'), value: 'json' },
{ label: t('tools.data-faker.texts.label-yaml'), value: 'yaml' },
{ label: t('tools.data-faker.texts.label-sql-insert'), value: 'sql' },
{ label: t('tools.data-faker.texts.label-csv-comma'), value: 'csv' },
{ label: t('tools.data-faker.texts.label-csv-semicolon'), value: 'csv_semicolon' },
{ label: t('tools.data-faker.texts.label-csv-tab'), value: 'tsv' },
{ label: t('tools.data-faker.texts.label-markdown'), value: 'markdown' },
{ label: t('tools.data-faker.texts.label-xml'), value: 'xml' },
];
// Extract all faker methods dynamically
@@ -106,50 +109,50 @@ function insertMethodIntoJson() {
const rules: UseValidationRule<string>[] = [
{
validator: (v: string) => v === '' || JSON5.parse(v),
message: 'Provided JSON is not valid.',
message: t('tools.data-faker.texts.message-provided-json-is-not-valid'),
},
];
</script>
<template>
<NCard title="Fake Data Generator">
<c-input-text v-model:value="jsonInput" label="JSON Template:" multiline mb-1 rows="10" placeholder="Enter JSON template..." :validation-rules="rules" />
<NCard :title="t('tools.data-faker.texts.title-fake-data-generator')">
<c-input-text v-model:value="jsonInput" :label="t('tools.data-faker.texts.label-json-template')" multiline mb-1 rows="10" :placeholder="t('tools.data-faker.texts.placeholder-enter-json-template')" :validation-rules="rules" />
<c-card title="Faker Method insertion" mb-1>
<c-card :title="t('tools.data-faker.texts.title-faker-method-insertion')" mb-1>
<n-space>
<c-select v-model:value="selectedMethod" style="width: 200px" :options="fakerMethods" searchable placeholder="Search Faker Method" />
<c-select v-model:value="selectedMethod" style="width: 200px" :options="fakerMethods" searchable :placeholder="t('tools.data-faker.texts.placeholder-search-faker-method')" />
<NButton @click="insertMethodIntoJson">
Insert Selected Method
{{ t('tools.data-faker.texts.tag-insert-selected-method') }}
</NButton>
</n-space>
</c-card>
<n-space mb-1>
<NFormItem label="Number of objects to generate:" label-placement="left">
<NInputNumber v-model:value="itemCount" :min="1" placeholder="Number of objects to generate" />
<NFormItem :label="t('tools.data-faker.texts.label-number-of-objects-to-generate')" label-placement="left">
<NInputNumber v-model:value="itemCount" :min="1" :placeholder="t('tools.data-faker.texts.placeholder-number-of-objects-to-generate')" />
</NFormItem>
<n-form-item label="Nestify (handle nested objects)" label-placement="left">
<n-form-item :label="t('tools.data-faker.texts.label-nestify-handle-nested-objects')" label-placement="left">
<n-checkbox v-model:checked="nestify" />
</n-form-item>
</n-space>
<c-select v-model:value="selectedLocale" label="Locale:" label-position="left" :options="allLocales" searchable mb-1 placeholder="Search locale version" />
<c-select v-model:value="selectedLocale" :label="t('tools.data-faker.texts.label-locale')" label-position="left" :options="allLocales" searchable mb-1 :placeholder="t('tools.data-faker.texts.placeholder-search-locale-version')" />
<NFormItem label="Select output format:" label-placement="left" mb-1>
<NSelect v-model:value="selectedFormat" :options="formats" placeholder="Select format" />
<NFormItem :label="t('tools.data-faker.texts.label-select-output-format')" label-placement="left" mb-1>
<NSelect v-model:value="selectedFormat" :options="formats" :placeholder="t('tools.data-faker.texts.placeholder-select-format')" />
</NFormItem>
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" label="Table Name:" label-placement="left" mb-1 />
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" :label="t('tools.data-faker.texts.label-table-name')" label-placement="left" mb-1 />
<NButton mb-2 mt-2 @click="handleGenerate">
Generate Fake Data
{{ t('tools.data-faker.texts.tag-generate-fake-data') }}
</NButton>
<c-alert v-if="error">
{{ error }}
</c-alert>
<c-card v-if="generatedData" title="Generated data">
<c-card v-if="generatedData" :title="t('tools.data-faker.texts.title-generated-data')">
<textarea-copyable :value="generatedData" :language="selectedFormat" />
</c-card>
</NCard>
@@ -1,38 +1,41 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import InputCopyable from '../../components/InputCopyable.vue';
import { type AllSupportedUnits, convertStorageAndRateUnitsDisplay } from './data-storage-unit-converter.service';
const { t } = useI18n();
const input = ref<{ size: string; unit: string }>({ size: '0', unit: 'KB' });
const output = ref<{ unit: string; precision: number; appendUnit: boolean }>({ unit: 'MB', precision: 3, appendUnit: false });
const allUnits = [
{ value: 'B', label: 'Bytes (B)' },
{ value: 'b', label: 'Bits (bit)' },
{ value: 'iB', label: 'Bibytes (iB)' },
{ value: 'KB', label: 'Kilobytes (KB)' },
{ value: 'Kb', label: 'Kilobits (Kbit)' },
{ value: 'KiB', label: 'Kibibytes (KiB)' },
{ value: 'MB', label: 'Megabytes (MB)' },
{ value: 'Mb', label: 'Megabits (Mbit)' },
{ value: 'MiB', label: 'Mebibytes (MiB)' },
{ value: 'GB', label: 'Gigabytes (GB)' },
{ value: 'Gb', label: 'Gigabits (Gbit)' },
{ value: 'GiB', label: 'Gibibytes (GiB)' },
{ value: 'TB', label: 'Terabytes (TB)' },
{ value: 'Tb', label: 'Terabits (Tbit)' },
{ value: 'TiB', label: 'Tebibytes (TiB)' },
{ value: 'PB', label: 'Petabytes (PB)' },
{ value: 'Pb', label: 'Petabits (Pbit)' },
{ value: 'PiB', label: 'Pebibytes (PiB)' },
{ value: 'EB', label: 'Exabytes (EB)' },
{ value: 'Eb', label: 'Exabits (Ebit)' },
{ value: 'EiB', label: 'Exbibytes (EiB)' },
{ value: 'ZB', label: 'Zettabytes (ZB)' },
{ value: 'Zb', label: 'Zettabits (Zbit)' },
{ value: 'ZiB', label: 'Zebibytes (ZiB)' },
{ value: 'YB', label: 'Yottabytes (YB)' },
{ value: 'Yb', label: 'Yottabits (Ybit)' },
{ value: 'YiB', label: 'Yobibytes (YiB)' },
{ value: 'B', label: t('tools.data-storage-unit-converter.texts.label-bytes-b') },
{ value: 'b', label: t('tools.data-storage-unit-converter.texts.label-bits-bit') },
{ value: 'iB', label: t('tools.data-storage-unit-converter.texts.label-bibytes-ib') },
{ value: 'KB', label: t('tools.data-storage-unit-converter.texts.label-kilobytes-kb') },
{ value: 'Kb', label: t('tools.data-storage-unit-converter.texts.label-kilobits-kbit') },
{ value: 'KiB', label: t('tools.data-storage-unit-converter.texts.label-kibibytes-kib') },
{ value: 'MB', label: t('tools.data-storage-unit-converter.texts.label-megabytes-mb') },
{ value: 'Mb', label: t('tools.data-storage-unit-converter.texts.label-megabits-mbit') },
{ value: 'MiB', label: t('tools.data-storage-unit-converter.texts.label-mebibytes-mib') },
{ value: 'GB', label: t('tools.data-storage-unit-converter.texts.label-gigabytes-gb') },
{ value: 'Gb', label: t('tools.data-storage-unit-converter.texts.label-gigabits-gbit') },
{ value: 'GiB', label: t('tools.data-storage-unit-converter.texts.label-gibibytes-gib') },
{ value: 'TB', label: t('tools.data-storage-unit-converter.texts.label-terabytes-tb') },
{ value: 'Tb', label: t('tools.data-storage-unit-converter.texts.label-terabits-tbit') },
{ value: 'TiB', label: t('tools.data-storage-unit-converter.texts.label-tebibytes-tib') },
{ value: 'PB', label: t('tools.data-storage-unit-converter.texts.label-petabytes-pb') },
{ value: 'Pb', label: t('tools.data-storage-unit-converter.texts.label-petabits-pbit') },
{ value: 'PiB', label: t('tools.data-storage-unit-converter.texts.label-pebibytes-pib') },
{ value: 'EB', label: t('tools.data-storage-unit-converter.texts.label-exabytes-eb') },
{ value: 'Eb', label: t('tools.data-storage-unit-converter.texts.label-exabits-ebit') },
{ value: 'EiB', label: t('tools.data-storage-unit-converter.texts.label-exbibytes-eib') },
{ value: 'ZB', label: t('tools.data-storage-unit-converter.texts.label-zettabytes-zb') },
{ value: 'Zb', label: t('tools.data-storage-unit-converter.texts.label-zettabits-zbit') },
{ value: 'ZiB', label: t('tools.data-storage-unit-converter.texts.label-zebibytes-zib') },
{ value: 'YB', label: t('tools.data-storage-unit-converter.texts.label-yottabytes-yb') },
{ value: 'Yb', label: t('tools.data-storage-unit-converter.texts.label-yottabits-ybit') },
{ value: 'YiB', label: t('tools.data-storage-unit-converter.texts.label-yobibytes-yib') },
];
const convertedValue = computed(() => {
@@ -54,49 +57,48 @@ const convertedValue = computed(() => {
<template>
<div>
<n-p text-center>
1MiB = 1024KiB ; 1MB = 1000kB ; 1GiB = 1024MiB ; 1GB = 1000MB ;
<n-a href="https://en.wikipedia.org/wiki/Byte" target="_blank" rel="noopener">
see here for details
{{ t('tools.data-storage-unit-converter.texts.tag-1mib-1024kib-1mb-1000kb-1gib-1024mib-1gb-1000mb') }}<n-a href="https://en.wikipedia.org/wiki/Byte" target="_blank" rel="noopener">
{{ t('tools.data-storage-unit-converter.texts.tag-see-here-for-details') }}
</n-a>
</n-p>
<c-card>
<n-form-item label="Input Size:" label-placement="left" mb-1>
<n-form-item :label="t('tools.data-storage-unit-converter.texts.label-input-size')" label-placement="left" mb-1>
<c-input-text
v-model:value="input.size"
placeholder="Put your number here (ex: 1024)"
:placeholder="t('tools.data-storage-unit-converter.texts.placeholder-put-your-number-here-ex-1024')"
mr-2
/>
<c-select
v-model:value="input.unit"
:options="allUnits"
placeholder="Select input unit"
:placeholder="t('tools.data-storage-unit-converter.texts.placeholder-select-input-unit')"
/>
</n-form-item>
<div flex items-baseline gap-2>
<c-select
v-model:value="output.unit"
label="Output:" label-position="left"
:label="t('tools.data-storage-unit-converter.texts.label-output')" label-position="left"
:options="allUnits"
placeholder="Select output unit"
:placeholder="t('tools.data-storage-unit-converter.texts.placeholder-select-output-unit')"
/>
<n-form-item label="Precision:" label-placement="left">
<n-input-number v-model:value="output.precision" style="width:100px" placeholder="Precision..." :max="10" :min="0" />
<n-form-item :label="t('tools.data-storage-unit-converter.texts.label-precision')" label-placement="left">
<n-input-number v-model:value="output.precision" style="width:100px" :placeholder="t('tools.data-storage-unit-converter.texts.placeholder-precision')" :max="10" :min="0" />
</n-form-item>
<n-checkbox v-model:checked="output.appendUnit">
Show unit?
{{ t('tools.data-storage-unit-converter.texts.tag-show-unit') }}
</n-checkbox>
</div>
<n-divider />
<InputCopyable
label="Output value"
:label="t('tools.data-storage-unit-converter.texts.label-output-value')"
:value="convertedValue"
placeholder="Output value will be here..."
:placeholder="t('tools.data-storage-unit-converter.texts.placeholder-output-value-will-be-here')"
/>
</c-card>
</div>
@@ -1,38 +1,41 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { formatDuration, intervalToDuration } from 'date-fns';
import { type AllSupportedUnits, displayStorageAndRateUnits } from '../data-storage-unit-converter/data-storage-unit-converter.service';
import { amountTransferable, transferSpeedRate, transferTimeSeconds } from './data-transfer-rate-converter.service';
const { t } = useI18n();
const allStorateUnits = [
{ value: 'B', label: 'Bytes (B)' },
{ value: 'iB', label: 'Bibytes (iB)' },
{ value: 'KB', label: 'Kilobytes (KB)' },
{ value: 'KiB', label: 'Kibibytes (KiB)' },
{ value: 'MB', label: 'Megabytes (MB)' },
{ value: 'MiB', label: 'Mebibytes (MiB)' },
{ value: 'GB', label: 'Gigabytes (GB)' },
{ value: 'GiB', label: 'Gibibytes (GiB)' },
{ value: 'TB', label: 'Terabytes (TB)' },
{ value: 'TiB', label: 'Tebibytes (TiB)' },
{ value: 'PB', label: 'Petabytes (PB)' },
{ value: 'PiB', label: 'Pebibytes (PiB)' },
{ value: 'EB', label: 'Exabytes (EB)' },
{ value: 'EiB', label: 'Exbibytes (EiB)' },
{ value: 'ZB', label: 'Zettabytes (ZB)' },
{ value: 'ZiB', label: 'Zebibytes (ZiB)' },
{ value: 'YB', label: 'Yottabytes (YB)' },
{ value: 'YiB', label: 'Yobibytes (YiB)' },
{ value: 'B', label: t('tools.data-transfer-rate-converter.texts.label-bytes-b') },
{ value: 'iB', label: t('tools.data-transfer-rate-converter.texts.label-bibytes-ib') },
{ value: 'KB', label: t('tools.data-transfer-rate-converter.texts.label-kilobytes-kb') },
{ value: 'KiB', label: t('tools.data-transfer-rate-converter.texts.label-kibibytes-kib') },
{ value: 'MB', label: t('tools.data-transfer-rate-converter.texts.label-megabytes-mb') },
{ value: 'MiB', label: t('tools.data-transfer-rate-converter.texts.label-mebibytes-mib') },
{ value: 'GB', label: t('tools.data-transfer-rate-converter.texts.label-gigabytes-gb') },
{ value: 'GiB', label: t('tools.data-transfer-rate-converter.texts.label-gibibytes-gib') },
{ value: 'TB', label: t('tools.data-transfer-rate-converter.texts.label-terabytes-tb') },
{ value: 'TiB', label: t('tools.data-transfer-rate-converter.texts.label-tebibytes-tib') },
{ value: 'PB', label: t('tools.data-transfer-rate-converter.texts.label-petabytes-pb') },
{ value: 'PiB', label: t('tools.data-transfer-rate-converter.texts.label-pebibytes-pib') },
{ value: 'EB', label: t('tools.data-transfer-rate-converter.texts.label-exabytes-eb') },
{ value: 'EiB', label: t('tools.data-transfer-rate-converter.texts.label-exbibytes-eib') },
{ value: 'ZB', label: t('tools.data-transfer-rate-converter.texts.label-zettabytes-zb') },
{ value: 'ZiB', label: t('tools.data-transfer-rate-converter.texts.label-zebibytes-zib') },
{ value: 'YB', label: t('tools.data-transfer-rate-converter.texts.label-yottabytes-yb') },
{ value: 'YiB', label: t('tools.data-transfer-rate-converter.texts.label-yobibytes-yib') },
];
const allBitsUnits = [
{ value: 'b', label: 'Bits (bit)' },
{ value: 'Kb', label: 'Kilobits (Kbit)' },
{ value: 'Mb', label: 'Megabits (Mbit)' },
{ value: 'Gb', label: 'Gigabits (Gbit)' },
{ value: 'Tb', label: 'Terabits (Tbit)' },
{ value: 'Pb', label: 'Petabits (Pbit)' },
{ value: 'Eb', label: 'Exabits (Ebit)' },
{ value: 'Zb', label: 'Zettabits (Zbit)' },
{ value: 'Yb', label: 'Yottabits (Ybit)' },
{ value: 'b', label: t('tools.data-transfer-rate-converter.texts.label-bits-bit') },
{ value: 'Kb', label: t('tools.data-transfer-rate-converter.texts.label-kilobits-kbit') },
{ value: 'Mb', label: t('tools.data-transfer-rate-converter.texts.label-megabits-mbit') },
{ value: 'Gb', label: t('tools.data-transfer-rate-converter.texts.label-gigabits-gbit') },
{ value: 'Tb', label: t('tools.data-transfer-rate-converter.texts.label-terabits-tbit') },
{ value: 'Pb', label: t('tools.data-transfer-rate-converter.texts.label-petabits-pbit') },
{ value: 'Eb', label: t('tools.data-transfer-rate-converter.texts.label-exabits-ebit') },
{ value: 'Zb', label: t('tools.data-transfer-rate-converter.texts.label-zettabits-zbit') },
{ value: 'Yb', label: t('tools.data-transfer-rate-converter.texts.label-yottabits-ybit') },
];
const allRateUnits = [...allBitsUnits, ...allStorateUnits];
@@ -143,31 +146,30 @@ const amountTransferableOutput = computed(() => {
<template>
<div>
<n-p text-center>
1MiB = 1024KiB ; 1MB = 1000kB ; 1GiB = 1024MiB ; 1GB = 1000MB ;
<n-a href="https://en.wikipedia.org/wiki/Byte" target="_blank" rel="noopener">
see here for details
{{ t('tools.data-transfer-rate-converter.texts.tag-1mib-1024kib-1mb-1000kb-1gib-1024mib-1gb-1000mb') }}<n-a href="https://en.wikipedia.org/wiki/Byte" target="_blank" rel="noopener">
{{ t('tools.data-transfer-rate-converter.texts.tag-see-here-for-details') }}
</n-a>
</n-p>
<c-card title="Transfer Time" mb-2>
<n-form-item label="Data Size:" label-placement="left">
<n-input v-model:value="transferTimeInput.dataSize" placeholder="Data Size..." :min="0" w-full />
<c-card :title="t('tools.data-transfer-rate-converter.texts.title-transfer-time')" mb-2>
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-data-size')" label-placement="left">
<n-input v-model:value="transferTimeInput.dataSize" :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-data-size')" :min="0" w-full />
<c-select
v-model:value="transferTimeInput.dataSizeUnit"
searchable
:options="allStorateUnits"
placeholder="Select a storage unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-storage-unit')"
ml-1
/>
</n-form-item>
<n-form-item label="Bit Rate:" label-placement="left">
<n-input v-model:value="transferTimeInput.bitRate" placeholder="Bit Rate..." :min="0" w-full />
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-bit-rate')" label-placement="left">
<n-input v-model:value="transferTimeInput.bitRate" :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-bit-rate')" :min="0" w-full />
<c-select
v-model:value="transferTimeInput.bitRateUnit"
searchable
:options="allRateUnits"
placeholder="Select a bit rate unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-bit-rate-unit')"
ml-1
/>
</n-form-item>
@@ -175,76 +177,76 @@ const amountTransferableOutput = computed(() => {
<n-divider />
<InputCopyable
label="Transfer time"
:label="t('tools.data-transfer-rate-converter.texts.label-transfer-time')"
:value="transferTimeOutput"
placeholder="Transfer time will be here..."
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-transfer-time-will-be-here')"
/>
</c-card>
<c-card title="Transfer Bit Rate/Speed" mb-2>
<n-form-item label="Data Size:" label-placement="left">
<n-input v-model:value="transferSpeedRateInput.dataSize" placeholder="Data Size..." :min="0" w-full />
<c-card :title="t('tools.data-transfer-rate-converter.texts.title-transfer-bit-rate-speed')" mb-2>
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-data-size')" label-placement="left">
<n-input v-model:value="transferSpeedRateInput.dataSize" :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-data-size')" :min="0" w-full />
<c-select
v-model:value="transferSpeedRateInput.dataSizeUnit"
:options="allStorateUnits"
placeholder="Select a storage unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-storage-unit')"
ml-1
/>
</n-form-item>
<n-form-item label="Duration (h/m/s):" label-placement="left">
<n-input-number v-model:value="transferSpeedRateInput.hours" mr-1 placeholder="Hours" :min="0" w-full />
<n-input-number v-model:value="transferSpeedRateInput.minutes" mr-1 placeholder="Minutes" :min="0" w-full />
<n-input-number v-model:value="transferSpeedRateInput.seconds" mr-1 placeholder="Seconds" :min="0" w-full />
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-duration-h-m-s')" label-placement="left">
<n-input-number v-model:value="transferSpeedRateInput.hours" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-hours')" :min="0" w-full />
<n-input-number v-model:value="transferSpeedRateInput.minutes" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-minutes')" :min="0" w-full />
<n-input-number v-model:value="transferSpeedRateInput.seconds" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-seconds')" :min="0" w-full />
</n-form-item>
<n-divider />
<div flex items-baseline gap-2>
<InputCopyable
label="Transfer Bit Rate/Speed:"
:label="t('tools.data-transfer-rate-converter.texts.label-transfer-bit-rate-speed')"
label-position="left"
:value="transferSpeedRateOutput"
placeholder="Bit Rate will be here..."
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-bit-rate-will-be-here')"
/>
<c-select
v-model:value="transferSpeedRateInput.bitRateUnit"
:options="allRateUnits"
placeholder="Select a bit rate unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-bit-rate-unit')"
ml-1
/>
</div>
</c-card>
<c-card title="Amount Transferable" mb-2>
<n-form-item label="Bit Rate:" label-placement="left">
<n-input v-model:value="amountTransferableInput.bitRate" placeholder="Bit Rate..." :min="0" w-full />
<c-card :title="t('tools.data-transfer-rate-converter.texts.title-amount-transferable')" mb-2>
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-bit-rate')" label-placement="left">
<n-input v-model:value="amountTransferableInput.bitRate" :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-bit-rate')" :min="0" w-full />
<c-select
v-model:value="amountTransferableInput.bitRateUnit"
:options="allRateUnits"
placeholder="Select a bit rate unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-bit-rate-unit')"
ml-1
/>
</n-form-item>
<n-form-item label="Duration (h/m/s):" label-placement="left">
<n-input-number v-model:value="amountTransferableInput.hours" mr-1 placeholder="Hours" :min="0" w-full />
<n-input-number v-model:value="amountTransferableInput.minutes" mr-1 placeholder="Minutes" :min="0" w-full />
<n-input-number v-model:value="amountTransferableInput.seconds" mr-1 placeholder="Seconds" :min="0" w-full />
<n-form-item :label="t('tools.data-transfer-rate-converter.texts.label-duration-h-m-s')" label-placement="left">
<n-input-number v-model:value="amountTransferableInput.hours" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-hours')" :min="0" w-full />
<n-input-number v-model:value="amountTransferableInput.minutes" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-minutes')" :min="0" w-full />
<n-input-number v-model:value="amountTransferableInput.seconds" mr-1 :placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-seconds')" :min="0" w-full />
</n-form-item>
<n-divider />
<div flex items-baseline gap-2>
<InputCopyable
label="Amount transferable:"
:label="t('tools.data-transfer-rate-converter.texts.label-amount-transferable')"
label-position="left"
:value="amountTransferableOutput"
placeholder="Amount transferable will be here..."
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-amount-transferable-will-be-here')"
/>
<c-select
v-model:value="amountTransferableInput.dataSizeUnit"
searchable
:options="allStorateUnits"
placeholder="Select a storage unit"
:placeholder="t('tools.data-transfer-rate-converter.texts.placeholder-select-a-storage-unit')"
ml-1
/>
</div>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { addToDate } from './date-duration-calculator.service';
const { t } = useI18n();
const now = Date.now();
const inputReferenceDate = ref(now);
@@ -11,8 +14,8 @@ const errorsDateAdder = computed(() => resultDateAdder.value.errors.join('\n'));
<template>
<div>
<c-card title="Date + Duration Calculator" mb-2>
<n-form-item label="Reference Date:" label-placement="left" mb-1>
<c-card :title="t('tools.date-duration-calculator.texts.title-date-duration-calculator')" mb-2>
<n-form-item :label="t('tools.date-duration-calculator.texts.label-reference-date')" label-placement="left" mb-1>
<n-date-picker v-model:value="inputReferenceDate" type="datetime" />
</n-form-item>
@@ -20,22 +23,22 @@ const errorsDateAdder = computed(() => resultDateAdder.value.errors.join('\n'));
v-model:value="inputDurations"
multiline
rows="5"
label="Duration(s)"
placeholder="Please enter duration, one per line with optional sign"
:label="t('tools.date-duration-calculator.texts.label-duration-s')"
:placeholder="t('tools.date-duration-calculator.texts.placeholder-please-enter-duration-one-per-line-with-optional-sign')"
mb-2
/>
<n-p>Supports: comment (# line), HH:MM:SS.FFF, 3d 1h 3s..., P4DT12H20M20.3S..</n-p>
<n-p>{{ t('tools.date-duration-calculator.texts.tag-supports-comment-line-hh-mm-ss-fff-3d-1h-3s-p4dt12h20m20-3s') }}</n-p>
<c-card v-if="errorsDateAdder" title="Lines errors">
<c-card v-if="errorsDateAdder" :title="t('tools.date-duration-calculator.texts.title-lines-errors')">
<textarea-copyable :value="errorsDateAdder" />
</c-card>
<n-divider />
<input-copyable v-if="resultDateAdder" label="Result Date:" label-position="left" label-width="150px" :value="resultDateAdder.date.toString()" mb-1 />
<input-copyable v-if="resultDateAdder" label="Result ISO Date:" label-position="left" label-width="150px" :value="resultDateAdder.date.toISOString()" mb-1 />
<input-copyable v-if="resultDateAdder" label="Duration (seconds):" label-position="left" label-width="150px" :value="resultDateAdder.durationSeconds" mb-1 />
<input-copyable v-if="resultDateAdder" label="Duration:" label-position="left" label-width="150px" :value="resultDateAdder.durationPretty" mb-1 />
<input-copyable v-if="resultDateAdder" :label="t('tools.date-duration-calculator.texts.label-result-date')" label-position="left" label-width="150px" :value="resultDateAdder.date.toString()" mb-1 />
<input-copyable v-if="resultDateAdder" :label="t('tools.date-duration-calculator.texts.label-result-iso-date')" label-position="left" label-width="150px" :value="resultDateAdder.date.toISOString()" mb-1 />
<input-copyable v-if="resultDateAdder" :label="t('tools.date-duration-calculator.texts.label-duration-seconds')" label-position="left" label-width="150px" :value="resultDateAdder.durationSeconds" mb-1 />
<input-copyable v-if="resultDateAdder" :label="t('tools.date-duration-calculator.texts.label-duration')" label-position="left" label-width="150px" :value="resultDateAdder.durationPretty" mb-1 />
</c-card>
</div>
</template>
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
formatISO,
formatISO9075,
@@ -40,6 +41,8 @@ import {
import { withDefaultOnError } from '@/utils/defaults';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const inputDate = ref('');
const toDate: ToDateMapper = date => new Date(date);
@@ -167,7 +170,7 @@ const validation = useValidation({
watch: [formatIndex],
rules: [
{
message: 'This date is invalid for this format',
message: t('tools.date-time-converter.texts.message-this-date-is-invalid-for-this-format'),
validator: value =>
withDefaultOnError(() => {
if (value === '') {
@@ -196,7 +199,7 @@ function formatDateUsingFormatter(formatter: (date: Date) => string, date?: Date
<c-input-text
v-model:value="inputDate"
autofocus
placeholder="Put your date string here..."
:placeholder="t('tools.date-time-converter.texts.placeholder-put-your-date-string-here')"
clearable
test-id="date-time-converter-input"
:validation="validation"
@@ -221,7 +224,7 @@ function formatDateUsingFormatter(formatter: (date: Date) => string, date?: Date
label-position="left"
label-align="right"
:value="formatDateUsingFormatter(fromDate, normalizedDate)"
placeholder="Invalid date..."
:placeholder="t('tools.date-time-converter.texts.placeholder-invalid-date')"
:test-id="name"
readonly
mt-2
@@ -1,5 +1,7 @@
import type { DateTime } from 'luxon';
import { translate as t } from '@/plugins/i18n.plugin';
export type DayOfWeek =
| 'monday'
| 'tuesday'
@@ -76,7 +78,7 @@ export class BusinessTime {
isBusinessDay(datetime: DateTime) {
const date = datetime.setZone(this.businessTimezone);
if (!date.isValid) {
throw new Error('Invalid date');
throw new Error(t('tools.business-time-calculator.text.invalid-date'));
}
const dayMonth = date.toFormat('dd/MM') as Holiday;
@@ -144,7 +146,7 @@ export class BusinessTime {
unit: 'hours' | 'minutes' | 'seconds'
}) {
if (start > end) {
throw new Error('start date is greater than end date');
throw new Error(t('tools.business-time-calculator.text.start-date-is-greater-than-end-date'));
}
const interval = {
+51 -48
View File
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import ctz from 'countries-and-timezones';
import { type Weekdays, allWeekDays, diffDateTimes, getSupportedCountries, getSupportedRegions, getSupportedStates } from './days-calculator.service';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const now = Date.now();
const inputDateRange = ref<[number, number]>([now, now + 86400]);
@@ -57,8 +60,8 @@ const inputProps = {
<template>
<div>
<c-card title="Dates Interval" mb-2>
<n-form-item label="Date Range:" label-placement="left" label-width="100px" label-align="left" mb-1>
<c-card :title="t('tools.days-calculator.texts.title-dates-interval')" mb-2>
<n-form-item :label="t('tools.days-calculator.texts.label-date-range')" label-placement="left" label-width="100px" label-align="left" mb-1>
<n-date-picker v-model:value="inputDateRange" type="datetimerange" />
</n-form-item>
@@ -67,7 +70,7 @@ const inputProps = {
label-position="left"
label-width="100px"
searchable
label="Country:"
:label="t('tools.days-calculator.texts.label-country')"
:options="allCountries"
mb-1
/>
@@ -77,9 +80,9 @@ const inputProps = {
label-position="left"
label-width="100px"
searchable
label="State:"
:label="t('tools.days-calculator.texts.label-state')"
:options="possibleStates"
placeholder="Select a specific state or let empty for general info"
:placeholder="t('tools.days-calculator.texts.placeholder-select-a-specific-state-or-let-empty-for-general-info')"
mb-1
/>
<c-select
@@ -88,7 +91,7 @@ const inputProps = {
label-position="left"
label-width="100px"
searchable
label="Region:"
:label="t('tools.days-calculator.texts.label-region')"
:options="possibleRegions"
mb-1
/>
@@ -97,39 +100,39 @@ const inputProps = {
label-position="left"
label-width="100px"
searchable
label="Timezone:"
:label="t('tools.days-calculator.texts.label-timezone')"
:options="allTimezones"
mb-2
/>
<div mb-2 flex items-baseline gap-2>
<n-form-item label="Business Start Hour:" label-placement="left" flex-1>
<n-form-item :label="t('tools.days-calculator.texts.label-business-start-hour')" label-placement="left" flex-1>
<n-input-number v-model:value="businessStartHour" :min="0" :max="24" />
</n-form-item>
<n-form-item label="Business End Hour:" label-placement="left" flex-1>
<n-form-item :label="t('tools.days-calculator.texts.label-business-end-hour')" label-placement="left" flex-1>
<n-input-number v-model:value="businessEndHour" :min="0" :max="24" />
</n-form-item>
</div>
<div mb-2 flex items-baseline justify-center gap-2>
<n-checkbox v-model:checked="includeHolidays">
Include Holidays
{{ t('tools.days-calculator.texts.tag-include-holidays') }}
</n-checkbox>
<n-checkbox v-model:checked="includeEndDate">
Include End Date
{{ t('tools.days-calculator.texts.tag-include-end-date') }}
</n-checkbox>
</div>
<c-card title="Weekdays">
<c-card :title="t('tools.days-calculator.texts.title-weekdays')">
<n-checkbox-group v-model:value="includeWeekDays">
<n-space justify="center">
<n-checkbox value="monday" label="Monday" />
<n-checkbox value="tuesday" label="Tuesday" />
<n-checkbox value="wednesday" label="Wednesday" />
<n-checkbox value="thursday" label="Thursday" />
<n-checkbox value="friday" label="Friday" />
<n-checkbox value="saturday" label="Saturday" />
<n-checkbox value="sunday" label="Sunday" />
<n-checkbox value="monday" :label="t('tools.days-calculator.texts.label-monday')" />
<n-checkbox value="tuesday" :label="t('tools.days-calculator.texts.label-tuesday')" />
<n-checkbox value="wednesday" :label="t('tools.days-calculator.texts.label-wednesday')" />
<n-checkbox value="thursday" :label="t('tools.days-calculator.texts.label-thursday')" />
<n-checkbox value="friday" :label="t('tools.days-calculator.texts.label-friday')" />
<n-checkbox value="saturday" :label="t('tools.days-calculator.texts.label-saturday')" />
<n-checkbox value="sunday" :label="t('tools.days-calculator.texts.label-sunday')" />
</n-space>
</n-checkbox-group>
</c-card>
@@ -140,40 +143,40 @@ const inputProps = {
{{ error }}
</c-alert>
<c-card v-if="resultDaysDiff" title="Result">
<input-copyable v-bind="inputProps" label="Start Date" :value="resultDaysDiff.startDate" />
<input-copyable v-bind="inputProps" label="Start Date (ISO)" :value="resultDaysDiff.startDate.toISOString()" />
<input-copyable v-bind="inputProps" label="End Date" :value="resultDaysDiff.endDate" />
<input-copyable v-bind="inputProps" label="End Date (ISO)" :value="resultDaysDiff.endDate.toISOString()" />
<c-card v-if="resultDaysDiff" :title="t('tools.days-calculator.texts.title-result')">
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-start-date')" :value="resultDaysDiff.startDate" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-start-date-iso')" :value="resultDaysDiff.startDate.toISOString()" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-end-date')" :value="resultDaysDiff.endDate" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-end-date-iso')" :value="resultDaysDiff.endDate.toISOString()" />
<n-divider />
<input-copyable v-bind="inputProps" label="Total Difference Seconds" :value="resultDaysDiff.totalDifference.seconds" />
<input-copyable v-bind="inputProps" label="Total Difference Minutes" :value="resultDaysDiff.totalDifference.minutes" />
<input-copyable v-bind="inputProps" label="Total Difference Hours" :value="resultDaysDiff.totalDifference.hours" />
<input-copyable v-bind="inputProps" label="Total Difference Days" :value="resultDaysDiff.totalDifference.days" />
<input-copyable v-bind="inputProps" label="Total Difference Weeks" :value="resultDaysDiff.totalDifference.weeks" />
<input-copyable v-bind="inputProps" label="Total Difference Months" :value="resultDaysDiff.totalDifference.months" />
<input-copyable v-bind="inputProps" label="Total Difference Years" :value="resultDaysDiff.totalDifference.years" />
<input-copyable v-bind="inputProps" label="Total Difference" :value="resultDaysDiff.totalDifferenceFormatted" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-seconds')" :value="resultDaysDiff.totalDifference.seconds" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-minutes')" :value="resultDaysDiff.totalDifference.minutes" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-hours')" :value="resultDaysDiff.totalDifference.hours" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-days')" :value="resultDaysDiff.totalDifference.days" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-weeks')" :value="resultDaysDiff.totalDifference.weeks" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-months')" :value="resultDaysDiff.totalDifference.months" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference-years')" :value="resultDaysDiff.totalDifference.years" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-total-difference')" :value="resultDaysDiff.totalDifferenceFormatted" />
<n-divider />
<input-copyable v-bind="inputProps" label="Difference Seconds" :value="resultDaysDiff.differenceSeconds" />
<input-copyable v-bind="inputProps" label="Difference " :value="resultDaysDiff.differenceFormatted" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-difference-seconds')" :value="resultDaysDiff.differenceSeconds" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-difference')" :value="resultDaysDiff.differenceFormatted" />
<n-divider />
<input-copyable v-bind="inputProps" label="Business Seconds" :value="resultDaysDiff.businessSeconds" />
<input-copyable v-bind="inputProps" label="Business Time" :value="resultDaysDiff.businessSecondsFormatted" />
<input-copyable v-bind="inputProps" label="Business Hours" :value="resultDaysDiff.businessHours" />
<input-copyable v-bind="inputProps" label="Business Days" :value="resultDaysDiff.businessDays" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-business-seconds')" :value="resultDaysDiff.businessSeconds" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-business-time')" :value="resultDaysDiff.businessSecondsFormatted" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-business-hours')" :value="resultDaysDiff.businessHours" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-business-days')" :value="resultDaysDiff.businessDays" />
<n-divider />
<input-copyable v-bind="inputProps" placeholder="None" label="Mondays" :value="resultDaysDiff.mondays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Tuesdays" :value="resultDaysDiff.tuesdays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Wednesdays" :value="resultDaysDiff.wednesdays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Thursdays" :value="resultDaysDiff.thursdays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Fridays" :value="resultDaysDiff.fridays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Saturdays" :value="resultDaysDiff.saturdays" />
<input-copyable v-bind="inputProps" placeholder="None" label="Sundays" :value="resultDaysDiff.sundays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-mondays')" :value="resultDaysDiff.mondays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-tuesdays')" :value="resultDaysDiff.tuesdays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-wednesdays')" :value="resultDaysDiff.wednesdays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-thursdays')" :value="resultDaysDiff.thursdays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-fridays')" :value="resultDaysDiff.fridays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-saturdays')" :value="resultDaysDiff.saturdays" />
<input-copyable v-bind="inputProps" :placeholder="t('tools.days-calculator.texts.placeholder-none')" :label="t('tools.days-calculator.texts.label-sundays')" :value="resultDaysDiff.sundays" />
<n-divider />
<input-copyable v-bind="inputProps" label="Weekend Days" :value="resultDaysDiff.weekendDays" />
<input-copyable v-bind="inputProps" label="Full Weekends" :value="resultDaysDiff.weekends" />
<c-card v-if="resultDaysDiff.holidays?.length" title="Holidays in period">
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-weekend-days')" :value="resultDaysDiff.weekendDays" />
<input-copyable v-bind="inputProps" :label="t('tools.days-calculator.texts.label-full-weekends')" :value="resultDaysDiff.weekends" />
<c-card v-if="resultDaysDiff.holidays?.length" :title="t('tools.days-calculator.texts.title-holidays-in-period')">
<ul>
<li v-for="(holiday, index) in resultDaysDiff.holidays" :key="index">
{{ holiday.date }}: {{ holiday.name }} ({{ holiday.type }})
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useWindowSize } from '@vueuse/core';
const { t } = useI18n();
const { width, height } = useWindowSize();
const sections = [
@@ -8,27 +11,27 @@ const sections = [
name: 'Screen',
information: [
{
label: 'Screen size',
label: t('tools.device-information.texts.label-screen-size'),
value: computed(() => `${window.screen.availWidth} x ${window.screen.availHeight}`),
},
{
label: 'Orientation',
label: t('tools.device-information.texts.label-orientation'),
value: computed(() => window.screen.orientation.type),
},
{
label: 'Orientation angle',
label: t('tools.device-information.texts.label-orientation-angle'),
value: computed(() => `${window.screen.orientation.angle}°`),
},
{
label: 'Color depth',
label: t('tools.device-information.texts.label-color-depth'),
value: computed(() => `${window.screen.colorDepth} bits`),
},
{
label: 'Pixel ratio',
label: t('tools.device-information.texts.label-pixel-ratio'),
value: computed(() => `${window.devicePixelRatio} dppx`),
},
{
label: 'Window size',
label: t('tools.device-information.texts.label-window-size'),
value: computed(() => `${width.value} x ${height.value}`),
},
],
@@ -37,19 +40,19 @@ const sections = [
name: 'Device',
information: [
{
label: 'Browser vendor',
label: t('tools.device-information.texts.label-browser-vendor'),
value: computed(() => navigator.vendor),
},
{
label: 'Languages',
label: t('tools.device-information.texts.label-languages'),
value: computed(() => navigator.languages.join(', ')),
},
{
label: 'Platform',
label: t('tools.device-information.texts.label-platform'),
value: computed(() => navigator.platform),
},
{
label: 'User agent',
label: t('tools.device-information.texts.label-user-agent'),
value: computed(() => navigator.userAgent),
},
],
@@ -58,11 +61,11 @@ const sections = [
name: 'Time zone',
information: [
{
label: 'Time zone name',
label: t('tools.device-information.texts.label-time-zone-name'),
value: computed(() => Intl.DateTimeFormat().resolvedOptions().timeZone),
},
{
label: 'UTC offset',
label: t('tools.device-information.texts.label-utc-offset'),
value: computed(() => `${new Date().getTimezoneOffset()} minutes`),
},
],
@@ -83,7 +86,7 @@ const sections = [
{{ value }}
</n-ellipsis>
<div v-else class="undefined-value">
unknown
{{ t('tools.device-information.texts.tag-unknown') }}
</div>
</div>
</n-gi>
+16 -13
View File
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { DiceRoll } from '@dice-roller/rpg-dice-roller';
import { computedRefreshable } from '@/composable/computedRefreshable';
import { useCopy } from '@/composable/copy';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const dicesNotations = useQueryParamOrStorage({ name: 'dices', storageName: 'dice-roll:dices', defaultValue: '3d6' });
const [diceRollResult, refreshDiceRollResult] = computedRefreshable(() => {
try {
@@ -22,20 +25,20 @@ const [diceRollResult, refreshDiceRollResult] = computedRefreshable(() => {
const diceRollString = computed(() => diceRollResult.value.roll?.output || '');
const { copy } = useCopy({ source: diceRollString, text: 'Dice Roll copied to the clipboard' });
const { copy } = useCopy({ source: diceRollString, text: t('tools.dice-roller.texts.text-dice-roll-copied-to-the-clipboard') });
</script>
<template>
<c-card>
<c-input-text
v-model:value="dicesNotations"
label="Dice Roll Notations:" label-position="left"
placeholder="Dice configuration"
:label="t('tools.dice-roller.texts.label-dice-roll-notations')" label-position="left"
:placeholder="t('tools.dice-roller.texts.placeholder-dice-configuration')"
mb-2
/>
<n-p mb-2>
For more information about Dice Notation, see <n-a href="https://dice-roller.github.io/documentation/guide/notation/" target="_blank">
here
{{ t('tools.dice-roller.texts.tag-for-more-information-about-dice-notation-see') }}<n-a href="https://dice-roller.github.io/documentation/guide/notation/" target="_blank">
{{ t('tools.dice-roller.texts.tag-here') }}
</n-a>
</n-p>
@@ -43,24 +46,24 @@ const { copy } = useCopy({ source: diceRollString, text: 'Dice Roll copied to th
{{ diceRollResult.error }}
</c-alert>
<c-card v-if="!diceRollResult.error" title="Roll Result" mb-2>
<c-card v-if="!diceRollResult.error" :title="t('tools.dice-roller.texts.title-roll-result')" mb-2>
<input-copyable :value="diceRollResult.roll?.output" readonly mb-1 />
<input-copyable :value="diceRollResult.roll?.total" label="Total" readonly placeholder="Dice Roll total:" label-position="left" mb-1 />
<input-copyable :value="diceRollResult.roll?.total" :label="t('tools.dice-roller.texts.label-total')" readonly :placeholder="t('tools.dice-roller.texts.placeholder-dice-roll-total')" label-position="left" mb-1 />
</c-card>
<div mb-2 flex justify-center gap-3>
<c-button @click="copy()">
Copy roll result
{{ t('tools.dice-roller.texts.tag-copy-roll-result') }}
</c-button>
<c-button @click="refreshDiceRollResult">
Refresh roll
{{ t('tools.dice-roller.texts.tag-refresh-roll') }}
</c-button>
</div>
<c-card v-if="!diceRollResult.error" title="Dice Notation Stats" mb-2>
<input-copyable :value="diceRollResult.roll?.minTotal" readonly label="Min Total:" label-position="left" mb-1 />
<input-copyable :value="diceRollResult.roll?.maxTotal" readonly label="Max Total:" label-position="left" mb-1 />
<input-copyable :value="diceRollResult.roll?.averageTotal" readonly label="Avg Total:" label-position="left" mb-1 />
<c-card v-if="!diceRollResult.error" :title="t('tools.dice-roller.texts.title-dice-notation-stats')" mb-2>
<input-copyable :value="diceRollResult.roll?.minTotal" readonly :label="t('tools.dice-roller.texts.label-min-total')" label-position="left" mb-1 />
<input-copyable :value="diceRollResult.roll?.maxTotal" readonly :label="t('tools.dice-roller.texts.label-max-total')" label-position="left" mb-1 />
<input-copyable :value="diceRollResult.roll?.averageTotal" readonly :label="t('tools.dice-roller.texts.label-avg-total')" label-position="left" mb-1 />
</c-card>
</c-card>
</template>
+8 -4
View File
@@ -1,7 +1,11 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { countBy, orderBy } from 'lodash';
const { t } = useI18n();
const inputText = ref('');
const sortedWordCounts = computed(() => {
// Remove punctuation, extract words, count occurrences
@@ -15,13 +19,13 @@ const sortedWordCounts = computed(() => {
<template>
<div>
<c-input-text v-model:value="inputText" multiline rows="10" label="Text:" placeholder="Enter text..." mb-1 />
<c-card title="Distinct words">
<c-input-text v-model:value="inputText" multiline rows="10" :label="t('tools.distinct-words.texts.label-text')" :placeholder="t('tools.distinct-words.texts.placeholder-enter-text')" mb-1 />
<c-card :title="t('tools.distinct-words.texts.title-distinct-words')">
<n-table>
<thead>
<tr>
<th>Word</th>
<th>Count</th>
<th>{{ t('tools.distinct-words.texts.tag-word') }}</th>
<th>{{ t('tools.distinct-words.texts.tag-count') }}</th>
</tr>
</thead>
<tbody>
@@ -1,18 +1,21 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { NForm, NFormItem, NInput, NSelect } from 'naive-ui';
import { generateKeyPair } from '../rsa-key-pair-generator/rsa-key-pair-generator.service';
import { withDefaultOnErrorAsync } from '@/utils/defaults';
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
const { t } = useI18n();
const domain = ref('');
const selector = ref('default');
const keySize = ref('2048');
const password = ref('');
const keySizes = [
{ label: '1024-bit (Less secure, but faster)', value: '1024' },
{ label: '2048-bit (Recommended for security)', value: '2048' },
{ label: '4096-bit (Stronger security, but slower)', value: '4096' },
{ label: t('tools.dkim-dns-generator.texts.label-1024-bit-less-secure-but-faster'), value: '1024' },
{ label: t('tools.dkim-dns-generator.texts.label-2048-bit-recommended-for-security'), value: '2048' },
{ label: t('tools.dkim-dns-generator.texts.label-4096-bit-stronger-security-but-slower'), value: '4096' },
];
const emptyCerts = { publicKey: '', privateKey: '' };
@@ -44,42 +47,42 @@ const dKIMRecord = computed(() => {
<template>
<NForm label-placement="top">
<NFormItem label="Domain Name:">
<NInput v-model:value="domain" placeholder="Enter domain (e.g., example.com)" />
<NFormItem :label="t('tools.dkim-dns-generator.texts.label-domain-name')">
<NInput v-model:value="domain" :placeholder="t('tools.dkim-dns-generator.texts.placeholder-enter-domain-e-g-example-com')" />
</NFormItem>
<NFormItem label="Selector (Unique name used to distinguish DKIM records for the same domain):">
<NInput v-model:value="selector" placeholder="Enter selector (e.g., default)" />
<NFormItem :label="t('tools.dkim-dns-generator.texts.label-selector-unique-name-used-to-distinguish-dkim-records-for-the-same-domain')">
<NInput v-model:value="selector" :placeholder="t('tools.dkim-dns-generator.texts.placeholder-enter-selector-e-g-default')" />
</NFormItem>
<NFormItem label="Key Size (of the RSA key used for signing emails):">
<NSelect v-model:value="keySize" :options="keySizes" placeholder="Select key size" />
<NFormItem :label="t('tools.dkim-dns-generator.texts.label-key-size-of-the-rsa-key-used-for-signing-emails')">
<NSelect v-model:value="keySize" :options="keySizes" :placeholder="t('tools.dkim-dns-generator.texts.placeholder-select-key-size')" />
</NFormItem>
<NFormItem label="Passphrase (of private key):">
<NFormItem :label="t('tools.dkim-dns-generator.texts.label-passphrase-of-private-key')">
<NInput
v-model:value="password"
type="password"
show-password-on="mousedown"
placeholder="Passphrase"
:placeholder="t('tools.dkim-dns-generator.texts.placeholder-passphrase')"
/>
</NFormItem>
<div mb-2 flex justify-center>
<n-button @click="refreshCerts()">
Refresh Certificate
{{ t('tools.dkim-dns-generator.texts.tag-refresh-certificate') }}
</n-button>
</div>
<c-card title="Generate DKIM Record" mb-1>
<c-card :title="t('tools.dkim-dns-generator.texts.title-generate-dkim-record')" mb-1>
<textarea-copyable :value="dKIMRecord" />
</c-card>
<c-card v-if="dKIMRecord" title="RSA Public Key" mb-1>
<c-card v-if="dKIMRecord" :title="t('tools.dkim-dns-generator.texts.title-rsa-public-key')" mb-1>
<textarea-copyable :value="certs.publicKey" />
</c-card>
<c-card v-if="dKIMRecord" title="PEM RSA Private key">
<c-card v-if="dKIMRecord" :title="t('tools.dkim-dns-generator.texts.title-pem-rsa-private-key')">
<textarea-copyable :value="certs.privateKey" />
</c-card>
</NForm>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
const { t } = useI18n();
const domain = ref('');
const policy = ref('none');
const subPolicy = ref('none');
@@ -36,60 +39,60 @@ const dmarcRecord = computed(() => {
});
const policies = [
{ label: 'None', value: 'none' },
{ label: 'Quarantine', value: 'quarantine' },
{ label: 'Reject', value: 'reject' },
{ label: t('tools.dmarc-dns-generator.texts.label-none'), value: 'none' },
{ label: t('tools.dmarc-dns-generator.texts.label-quarantine'), value: 'quarantine' },
{ label: t('tools.dmarc-dns-generator.texts.label-reject'), value: 'reject' },
];
const alignments = [
{ label: 'Relaxed (r)', value: 'r' },
{ label: 'Strict (s)', value: 's' },
{ label: t('tools.dmarc-dns-generator.texts.label-relaxed-r'), value: 'r' },
{ label: t('tools.dmarc-dns-generator.texts.label-strict-s'), value: 's' },
];
</script>
<template>
<n-card title="DMARC Record Generator" max-w-600px>
<n-form-item label="Domain:" label-placement="left">
<n-input v-model:value="domain" placeholder="example.com" />
<n-card :title="t('tools.dmarc-dns-generator.texts.title-dmarc-record-generator')" max-w-600px>
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-domain')" label-placement="left">
<n-input v-model:value="domain" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-example-com')" />
</n-form-item>
<n-form-item label="Policy:" label-placement="left">
<n-select v-model:value="policy" :options="policies" placeholder="Select policy" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-policy')" label-placement="left">
<n-select v-model:value="policy" :options="policies" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-select-policy')" />
</n-form-item>
<n-form-item label="Subdomain Policy:" label-placement="left">
<n-select v-model:value="subPolicy" :options="policies" placeholder="Select policy" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-subdomain-policy')" label-placement="left">
<n-select v-model:value="subPolicy" :options="policies" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-select-policy')" />
</n-form-item>
<n-form-item label="Percentage (of emails subject to DMARC policy enforcement (0-100%)):" label-placement="top">
<n-input-number v-model:value="percentage" :min="0" :max="100" placeholder="Enter percentage" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-percentage-of-emails-subject-to-dmarc-policy-enforcement-0-100')" label-placement="top">
<n-input-number v-model:value="percentage" :min="0" :max="100" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-enter-percentage')" />
</n-form-item>
<n-form-item label="Aggregate Email (where aggregate DMARC reports should be sent):" label-placement="top">
<n-input v-model:value="rua" placeholder="admin@example.com" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-aggregate-email-where-aggregate-dmarc-reports-should-be-sent')" label-placement="top">
<n-input v-model:value="rua" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-admin-example-com')" />
</n-form-item>
<n-form-item label="Forensic Email (where forensic DMARC failure reports should be sent):" label-placement="top">
<n-input v-model:value="ruf" placeholder="admin@example.com" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-forensic-email-where-forensic-dmarc-failure-reports-should-be-sent')" label-placement="top">
<n-input v-model:value="ruf" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-admin-example-com')" />
</n-form-item>
<n-form-item label="Alignment (SPF):" label-placement="left">
<n-select v-model:value="aspf" :options="alignments" placeholder="Select alignment" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-alignment-spf')" label-placement="left">
<n-select v-model:value="aspf" :options="alignments" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-select-alignment')" />
</n-form-item>
<n-form-item label="Alignment (DKIM):" label-placement="left">
<n-select v-model:value="adkim" :options="alignments" placeholder="Select alignment" />
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-alignment-dkim')" label-placement="left">
<n-select v-model:value="adkim" :options="alignments" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-select-alignment')" />
</n-form-item>
<n-form-item label="Reporting Interval (for sending DMARC aggregate reports):" label-placement="top">
<n-input-number v-model:value="ri" :min="3600" placeholder="Enter interval">
<n-form-item :label="t('tools.dmarc-dns-generator.texts.label-reporting-interval-for-sending-dmarc-aggregate-reports')" label-placement="top">
<n-input-number v-model:value="ri" :min="3600" :placeholder="t('tools.dmarc-dns-generator.texts.placeholder-enter-interval')">
<template #suffix>
seconds
{{ t('tools.dmarc-dns-generator.texts.tag-seconds') }}
</template>
</n-input-number>
</n-form-item>
<n-card v-if="dmarcRecord" title="Generated DMARC Record">
<n-card v-if="dmarcRecord" :title="t('tools.dmarc-dns-generator.texts.title-generated-dmarc-record')">
<textarea-copyable :value="dmarcRecord" />
</n-card>
</n-card>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { parseDmarcReportFromEmail, parseDmarcReportsFromXml } from 'dmarc-report-parser';
const { t } = useI18n();
const inputType = ref<'file' | 'content'>('file');
const emailContent = ref('');
const fileInput = ref() as Ref<File | null>;
@@ -68,32 +71,32 @@ function policyResultClass(policyResult: string) {
<template>
<div>
<c-card title="Input" mb-2>
<c-card :title="t('tools.dmarc-report-analyzer.texts.title-input')" mb-2>
<n-radio-group v-model:value="inputType" name="radiogroup" mb-2 flex justify-center>
<n-space>
<n-radio
value="file"
label="DMARC XML File"
:label="t('tools.dmarc-report-analyzer.texts.label-dmarc-xml-file')"
/>
<n-radio
value="content"
label="EML Content"
:label="t('tools.dmarc-report-analyzer.texts.label-eml-content')"
/>
</n-space>
</n-radio-group>
<c-file-upload
v-if="inputType === 'file'"
title="Drag and drop DMARC XML Report file here, or click to select a file"
:title="t('tools.dmarc-report-analyzer.texts.title-drag-and-drop-dmarc-xml-report-file-here-or-click-to-select-a-file')"
@file-upload="onUpload"
/>
<c-input-text
v-if="inputType === 'content'"
v-model:value="emailContent"
label="Raw Email Content"
:label="t('tools.dmarc-report-analyzer.texts.label-raw-email-content')"
multiline
placeholder="Put your eml/email content here..."
:placeholder="t('tools.dmarc-report-analyzer.texts.placeholder-put-your-eml-email-content-here')"
rows="15"
mb-2
/>
@@ -103,34 +106,34 @@ function policyResultClass(policyResult: string) {
{{ error }}
</c-alert>
<c-card v-if="!error && parsedReport" title="Output">
<input-copyable v-if="fileInput?.name" label="File Name" :value="fileInput?.name" />
<c-card v-if="!error && parsedReport" :title="t('tools.dmarc-report-analyzer.texts.title-output')">
<input-copyable v-if="fileInput?.name" :label="t('tools.dmarc-report-analyzer.texts.label-file-name')" :value="fileInput?.name" />
<c-card
v-for="(report, reportIndex) in parsedReport.reports || []"
:key="reportIndex" :title="`${report.reportMetadata?.orgName} (${report.reportMetadata?.reportId})`"
>
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="OrgName:" :value="report.reportMetadata?.orgName" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="Email:" :value="report.reportMetadata?.email" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="extraContactInfo:" :value="report.reportMetadata?.extraContactInfo" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="reportId:" :value="report.reportMetadata?.reportId" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="Date Begin:" :value="toDate(report.reportMetadata?.dateRange?.begin)" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="Date End:" :value="toDate(report.reportMetadata?.dateRange?.end)" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 label="Domain:" :value="report.policyPublished?.domain" />
<c-card title="Policy Published:" mb-2>
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-orgname')" :value="report.reportMetadata?.orgName" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-email')" :value="report.reportMetadata?.email" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-extracontactinfo')" :value="report.reportMetadata?.extraContactInfo" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-reportid')" :value="report.reportMetadata?.reportId" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-date-begin')" :value="toDate(report.reportMetadata?.dateRange?.begin)" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-date-end')" :value="toDate(report.reportMetadata?.dateRange?.end)" />
<input-copyable v-bind="inputLabelAlignmentConfig" mb-1 :label="t('tools.dmarc-report-analyzer.texts.label-domain')" :value="report.policyPublished?.domain" />
<c-card :title="t('tools.dmarc-report-analyzer.texts.title-policy-published')" mb-2>
<textarea-copyable :value="JSON.stringify(report.policyPublished, null, 2)" />
</c-card>
<c-card title="Failures" mt-2>
<c-card :title="t('tools.dmarc-report-analyzer.texts.title-failures')" mt-2>
<n-table>
<thead>
<tr>
<th>Source IP</th>
<th>Email Volume</th>
<th>DMARC Policy</th>
<th>DKIM Policy</th>
<th>SPF Policy</th>
<th>Identifiers</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-source-ip') }}</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-email-volume') }}</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-dmarc-policy') }}</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-dkim-policy') }}</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-spf-policy') }}</th>
<th>{{ t('tools.dmarc-report-analyzer.texts.tag-identifiers') }}</th>
</tr>
</thead>
<tbody>
+8 -5
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { combineTXT, query, wellknown } from 'dns-query';
import types from './dns.records.types.json';
const { t } = useI18n();
const type = ref('A');
const name = ref('google.com');
const answers = ref<string[]>([]);
@@ -31,15 +34,15 @@ async function queryDNS() {
<div>
<c-input-text
v-model:value="name"
label="Name"
:label="t('tools.dns-queries.texts.label-name')"
label-position="left"
placeholder="Name to query"
:placeholder="t('tools.dns-queries.texts.placeholder-name-to-query')"
mb-2
/>
<c-select
v-model:value="type"
searchable
label="DNS record type:"
:label="t('tools.dns-queries.texts.label-dns-record-type')"
label-position="left"
:options="Object.values(types).map(kv => ({ value: kv.value, label: `${kv.value}: ${kv.label}` }))"
mb-2
@@ -49,13 +52,13 @@ async function queryDNS() {
<c-button
@click="queryDNS"
>
Send DNS query
{{ t('tools.dns-queries.texts.tag-send-dns-query') }}
</c-button>
</div>
<n-divider />
<c-card title="Query results">
<c-card :title="t('tools.dns-queries.texts.title-query-results')">
<textarea-copyable
v-for="(answer, index) in answers"
:key="index"
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import Composeverter from 'composeverter';
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
import { textToBase64 } from '@/utils/base64';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const dockerCompose = ref(
`nginx:
ports:
@@ -22,11 +25,11 @@ const expandPorts = ref(
);
const conversion = useStorage('docker-compose-converter:conversion', 'latest');
const conversionOptions = [
{ value: 'v1ToV2x', label: 'V1 to V2 2.x' },
{ value: 'v1ToV3x', label: 'V1 to V2 3.x' },
{ value: 'v2xToV3x', label: 'V2 - 2.x to 3.x' },
{ value: 'v3xToV2x', label: 'V2 - 3.x to 2.x' },
{ value: 'latest', label: 'To CommonSpec' },
{ value: 'v1ToV2x', label: t('tools.docker-compose-converter.texts.label-v1-to-v2-2-x') },
{ value: 'v1ToV3x', label: t('tools.docker-compose-converter.texts.label-v1-to-v2-3-x') },
{ value: 'v2xToV3x', label: t('tools.docker-compose-converter.texts.label-v2-2-x-to-3-x') },
{ value: 'v3xToV2x', label: t('tools.docker-compose-converter.texts.label-v2-3-x-to-2-x') },
{ value: 'latest', label: t('tools.docker-compose-converter.texts.label-to-commonspec') },
];
const conversionResult = computed(() => {
@@ -79,7 +82,7 @@ const MONACO_EDITOR_OPTIONS = {
<template>
<div>
<c-label label="Paste your existing Docker Compose:">
<c-label :label="t('tools.docker-compose-converter.texts.label-paste-your-existing-docker-compose')">
<div relative w-full>
<c-monaco-editor
v-model:value="dockerCompose"
@@ -92,7 +95,7 @@ const MONACO_EDITOR_OPTIONS = {
</c-label>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-compose-converter.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
@@ -108,13 +111,13 @@ const MONACO_EDITOR_OPTIONS = {
<c-select
v-model:value="conversion"
label-position="top"
label="Docker Compose conversion:"
:label="t('tools.docker-compose-converter.texts.label-docker-compose-conversion')"
:options="conversionOptions"
placeholder="Select Docker Compose conversion"
:placeholder="t('tools.docker-compose-converter.texts.placeholder-select-docker-compose-conversion')"
/>
</n-gi>
<n-gi span="2">
<n-form-item label="Indent size:" label-placement="top" label-width="100" :show-feedback="false">
<n-form-item :label="t('tools.docker-compose-converter.texts.label-indent-size')" label-placement="top" label-width="100" :show-feedback="false">
<n-input-number v-model:value="indentSize" min="0" max="10" w-100px />
</n-form-item>
</n-gi>
@@ -124,10 +127,10 @@ const MONACO_EDITOR_OPTIONS = {
<div class="mb-6 flex flex-row items-center gap-2">
<n-checkbox v-model:checked="expandPorts">
Expand Ports
{{ t('tools.docker-compose-converter.texts.tag-expand-ports') }}
</n-checkbox>
<n-checkbox v-model:checked="expandVolumes">
Expand Volumes
{{ t('tools.docker-compose-converter.texts.tag-expand-volumes') }}
</n-checkbox>
</div>
@@ -137,7 +140,7 @@ const MONACO_EDITOR_OPTIONS = {
<div mt-5 flex justify-center>
<c-button :disabled="dockerCompose === ''" secondary @click="download">
Download converted docker-compose.yml
{{ t('tools.docker-compose-converter.texts.tag-download-converted-docker-compose-yml') }}
</c-button>
</div>
</div>
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import decomposerize from 'decomposerize';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const detachOption = ref<boolean>(false);
const removeOption = ref<boolean>(false);
const longArgsOption = ref<boolean>(false);
@@ -49,7 +52,7 @@ const MONACO_EDITOR_OPTIONS = {
<template>
<div>
<c-label label="Paste your Docker Compose file content:">
<c-label :label="t('tools.docker-compose-to-docker-run-converter.texts.label-paste-your-docker-compose-file-content')">
<div relative w-full>
<c-monaco-editor
v-model:value="dockerCompose"
@@ -62,7 +65,7 @@ const MONACO_EDITOR_OPTIONS = {
</c-label>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-compose-to-docker-run-converter.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
@@ -75,16 +78,16 @@ const MONACO_EDITOR_OPTIONS = {
<div class="mb-6 flex flex-row items-center gap-2">
<n-checkbox v-model:checked="detachOption">
Detach (-d)
{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-detach-d') }}
</n-checkbox>
<n-checkbox v-model:checked="removeOption">
Remove (--rm)
{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-remove-rm') }}
</n-checkbox>
<n-checkbox v-model:checked="longArgsOption">
Long Arguments
{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-long-arguments') }}
</n-checkbox>
<n-checkbox v-model:checked="equalAsSepOption">
--<i>arg</i>=<i>value</i> ?
{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-') }}<i>{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-arg') }}</i>{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-') }}<i>{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-value') }}</i>{{ t('tools.docker-compose-to-docker-run-converter.texts.tag-') }}
</n-checkbox>
</div>
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { convert as docker2kube } from 'docker2kube';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const dockerCompose = ref(
`version: '3.3'
services:
@@ -35,7 +38,7 @@ const MONACO_EDITOR_OPTIONS = {
<template>
<div>
<c-label label="Paste your Docker Compose file content:">
<c-label :label="t('tools.docker-compose-to-kubernetes.texts.label-paste-your-docker-compose-file-content')">
<div relative w-full>
<c-monaco-editor
v-model:value="dockerCompose"
@@ -48,7 +51,7 @@ const MONACO_EDITOR_OPTIONS = {
</c-label>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-compose-to-kubernetes.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
validateDockerComposeToCommonSpec,
} from 'composeverter';
const { t } = useI18n();
const dockerCompose = ref(
`version: '3.3'
services:
@@ -38,7 +41,7 @@ const MONACO_EDITOR_OPTIONS = {
<template>
<div>
<c-label label="Paste your Docker Compose file content:">
<c-label :label="t('tools.docker-compose-validator.texts.label-paste-your-docker-compose-file-content')">
<div relative w-full>
<c-monaco-editor
v-model:value="dockerCompose"
@@ -51,19 +54,19 @@ const MONACO_EDITOR_OPTIONS = {
</c-label>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-compose-validator.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message.message }} (<n-a v-if="message.helpLink" target="_blank" rel="noreferer noopener">
See Docker Compose help
</n-a>)
{{ t('tools.docker-compose-validator.texts.tag-see-docker-compose-help') }}
</n-a>{{ t('tools.docker-compose-validator.texts.tag-') }}
</li>
</ul>
</n-alert>
</div>
<div v-else>
<n-alert type="success" mt-5>
Validation successful!
{{ t('tools.docker-compose-validator.texts.tag-validation-successful') }}
</n-alert>
</div>
</div>
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import composerize from 'composerize';
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
import { textToBase64 } from '@/utils/base64';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const dockerRuns = ref(
'docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx',
);
@@ -14,9 +17,9 @@ const existingDockerComposeFile = ref(
);
const format = useStorage('docker-run-to-compose:format', 'latest');
const formatOptions = [
{ value: 'v2x', label: 'V2 - 2.x' },
{ value: 'v3x', label: 'V2 - 3.x' },
{ value: 'latest', label: 'CommonSpec' },
{ value: 'v2x', label: t('tools.docker-run-to-docker-compose-converter.texts.label-v2-2-x') },
{ value: 'v3x', label: t('tools.docker-run-to-docker-compose-converter.texts.label-v2-3-x') },
{ value: 'latest', label: t('tools.docker-run-to-docker-compose-converter.texts.label-commonspec') },
];
const conversionResult = computed(() => {
@@ -45,18 +48,18 @@ const MONACO_EDITOR_OPTIONS = {
<div>
<c-input-text
v-model:value="dockerRuns"
label="Your docker run command(s):"
:label="t('tools.docker-run-to-docker-compose-converter.texts.label-your-docker-run-command-s')"
style="font-family: monospace"
multiline
raw-text
monospace
placeholder="Your docker run command(s) to convert..."
:placeholder="t('tools.docker-run-to-docker-compose-converter.texts.placeholder-your-docker-run-command-s-to-convert')"
rows="4"
/>
<n-divider />
<c-label label="Eventually, paste your existing Docker Compose:">
<c-label :label="t('tools.docker-run-to-docker-compose-converter.texts.label-eventually-paste-your-existing-docker-compose')">
<div relative w-full>
<c-monaco-editor
v-model:value="existingDockerComposeFile"
@@ -75,13 +78,13 @@ const MONACO_EDITOR_OPTIONS = {
<c-select
v-model:value="format"
label-position="top"
label="Docker Compose format:"
:label="t('tools.docker-run-to-docker-compose-converter.texts.label-docker-compose-format')"
:options="formatOptions"
placeholder="Select Docker Compose format"
:placeholder="t('tools.docker-run-to-docker-compose-converter.texts.placeholder-select-docker-compose-format')"
/>
</n-gi>
<n-gi span="2">
<n-form-item label="Indent size:" label-placement="top" label-width="100" :show-feedback="false">
<n-form-item :label="t('tools.docker-run-to-docker-compose-converter.texts.label-indent-size')" label-placement="top" label-width="100" :show-feedback="false">
<n-input-number v-model:value="indentSize" min="0" max="10" w-100px />
</n-form-item>
</n-gi>
@@ -93,12 +96,12 @@ const MONACO_EDITOR_OPTIONS = {
<div mt-5 flex justify-center>
<c-button :disabled="dockerCompose === ''" secondary @click="download">
Download docker-compose.yml
{{ t('tools.docker-run-to-docker-compose-converter.texts.tag-download-docker-compose-yml') }}
</c-button>
</div>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-run-to-docker-compose-converter.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { convert as docker2kube } from 'docker2kube';
import composerize from 'composerize';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const dockerRuns = ref(
'docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always nginx',
);
@@ -24,12 +27,12 @@ const errors = computed(() => conversionResult.value.errors);
<div>
<c-input-text
v-model:value="dockerRuns"
label="Your docker run command(s):"
:label="t('tools.docker-run-to-kubernetes.texts.label-your-docker-run-command-s')"
style="font-family: monospace"
multiline
raw-text
monospace
placeholder="Your docker run command(s) to convert..."
:placeholder="t('tools.docker-run-to-kubernetes.texts.placeholder-your-docker-run-command-s-to-convert')"
rows="4"
/>
@@ -38,7 +41,7 @@ const errors = computed(() => conversionResult.value.errors);
<TextareaCopyable :value="kuebYaml" language="yaml" />
<div v-if="errors.length > 0">
<n-alert title="The following errors occured" type="error" mt-5>
<n-alert :title="t('tools.docker-run-to-kubernetes.texts.title-the-following-errors-occured')" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
@@ -1,15 +1,18 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import _ from 'lodash';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { useValidation } from '@/composable/validation';
const { t } = useI18n();
const input = ref('');
const cleaningRegex = useQueryParamOrStorage({ name: 'clean', storageName: 'dedup:clean', defaultValue: '' });
const regexValidation = useValidation({
source: cleaningRegex,
rules: [
{
message: 'Invalid regex: {0}',
message: t('tools.duplicate-line-finder.texts.message-invalid-regex-0'),
validator: value => new RegExp(value),
getErrorMessage: (value) => {
const _ = new RegExp(value);
@@ -30,18 +33,18 @@ const duplicatedLines = computed(() => {
<div>
<c-input-text
v-model:value="input"
placeholder="Your string to list duplicated lines..."
:placeholder="t('tools.duplicate-line-finder.texts.placeholder-your-string-to-list-duplicated-lines')"
raw-text
multiline
rows="10"
label="Your text: "
:label="t('tools.duplicate-line-finder.texts.label-your-text')"
mb-2
/>
<c-input-text
v-model:value="cleaningRegex"
placeholder="Your cleaning regex..."
:placeholder="t('tools.duplicate-line-finder.texts.placeholder-your-cleaning-regex')"
raw-text
label="Cleaning regex: "
:label="t('tools.duplicate-line-finder.texts.label-cleaning-regex')"
label-position="left"
label-align="right"
label-width="120px"
@@ -49,7 +52,7 @@ const duplicatedLines = computed(() => {
mb-2
/>
<n-form-item label="Duplicated lines:">
<n-form-item :label="t('tools.duplicate-line-finder.texts.label-duplicated-lines')">
<textarea-copyable :value="duplicatedLines" />
</n-form-item>
</div>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { computeDuration } from './duration-calculator.service';
const { t } = useI18n();
const inputDurations = ref('');
const result = computed(() => computeDuration(inputDurations.value));
const errors = computed(() => result.value.errors.join('\n'));
@@ -12,31 +15,31 @@ const errors = computed(() => result.value.errors.join('\n'));
v-model:value="inputDurations"
multiline
rows="5"
label="Duration(s)"
placeholder="Please enter duration, one per line with optional sign"
:label="t('tools.duration-calculator.texts.label-duration-s')"
:placeholder="t('tools.duration-calculator.texts.placeholder-please-enter-duration-one-per-line-with-optional-sign')"
mb-2
/>
<n-p>Supports: comment (# line), HH:MM:SS.FFF, 3d 1h 3s..., P4DT12H20M20.3S..</n-p>
<n-p>{{ t('tools.duration-calculator.texts.tag-supports-comment-line-hh-mm-ss-fff-3d-1h-3s-p4dt12h20m20-3s') }}</n-p>
<n-divider />
<c-card title="Total">
<input-copyable label="Prettified" :value="result.total.prettified" />
<input-copyable label="Prettified (full)" :value="result.total.prettifiedVerbose" />
<input-copyable label="Prettified (colon)" :value="result.total.prettifiedColonNotation" />
<input-copyable label="Prettified (days)" :value="result.total.prettifiedDaysColon" />
<input-copyable label="Prettified (hours)" :value="result.total.prettifiedHoursColon" />
<input-copyable label="Prettified (ISO8601)" :value="result.total.iso8601Duration" />
<input-copyable label="Milliseconds" :value="result.total.milliseconds" />
<input-copyable label="Seconds" :value="result.total.seconds" />
<input-copyable label="Minutes" :value="result.total.minutes" />
<input-copyable label="Hours" :value="result.total.hours" />
<input-copyable label="Days" :value="result.total.days" />
<input-copyable label="Weeks" :value="result.total.weeks" />
<input-copyable label="Years" :value="result.total.years" />
<c-card :title="t('tools.duration-calculator.texts.title-total')">
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified')" :value="result.total.prettified" />
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified-full')" :value="result.total.prettifiedVerbose" />
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified-colon')" :value="result.total.prettifiedColonNotation" />
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified-days')" :value="result.total.prettifiedDaysColon" />
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified-hours')" :value="result.total.prettifiedHoursColon" />
<input-copyable :label="t('tools.duration-calculator.texts.label-prettified-iso8601')" :value="result.total.iso8601Duration" />
<input-copyable :label="t('tools.duration-calculator.texts.label-milliseconds')" :value="result.total.milliseconds" />
<input-copyable :label="t('tools.duration-calculator.texts.label-seconds')" :value="result.total.seconds" />
<input-copyable :label="t('tools.duration-calculator.texts.label-minutes')" :value="result.total.minutes" />
<input-copyable :label="t('tools.duration-calculator.texts.label-hours')" :value="result.total.hours" />
<input-copyable :label="t('tools.duration-calculator.texts.label-days')" :value="result.total.days" />
<input-copyable :label="t('tools.duration-calculator.texts.label-weeks')" :value="result.total.weeks" />
<input-copyable :label="t('tools.duration-calculator.texts.label-years')" :value="result.total.years" />
</c-card>
<c-card title="Lines errors" mb-2>
<c-card :title="t('tools.duration-calculator.texts.title-lines-errors')" mb-2>
<textarea-copyable :value="errors" />
</c-card>
</div>
@@ -1,27 +1,30 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type sshpk from 'sshpk';
import { generateKeyPair } from './ecdsa-key-pair-generator.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { withDefaultOnErrorAsync } from '@/utils/defaults';
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
const { t } = useI18n();
const password = ref('');
const comment = ref('');
const emptyCerts = { publicKey: '', privateKey: '' };
const curve = useStorage('ecdsa-key-pair-generator:curve', 'nistp256');
const curveOptions = [
{ value: 'nistp256', label: 'nistp256' },
{ value: 'nistp384', label: 'nistp384' },
{ value: 'nistp521', label: 'nistp521' },
{ value: 'nistp256', label: t('tools.ecdsa-key-pair-generator.texts.label-nistp256') },
{ value: 'nistp384', label: t('tools.ecdsa-key-pair-generator.texts.label-nistp384') },
{ value: 'nistp521', label: t('tools.ecdsa-key-pair-generator.texts.label-nistp521') },
];
const format = useStorage('ecdsa-key-pair-generator:format', 'ssh');
const formatOptions = [
{ value: 'pem', label: 'PEM' },
{ value: 'pkcs8', label: 'PKCS#8' },
{ value: 'ssh', label: 'OpenSSH Standard' },
{ value: 'openssh', label: 'OpenSSH New' },
{ value: 'putty', label: 'PuTTY' },
{ value: 'pem', label: t('tools.ecdsa-key-pair-generator.texts.label-pem') },
{ value: 'pkcs8', label: t('tools.ecdsa-key-pair-generator.texts.label-pkcs-8') },
{ value: 'ssh', label: t('tools.ecdsa-key-pair-generator.texts.label-openssh-standard') },
{ value: 'openssh', label: t('tools.ecdsa-key-pair-generator.texts.label-openssh-new') },
{ value: 'putty', label: t('tools.ecdsa-key-pair-generator.texts.label-putty') },
];
const supportsPassphrase = computed(() => format.value === 'ssh');
@@ -44,56 +47,56 @@ const [certs, refreshCerts] = computedRefreshableAsync(
<c-select
v-model:value="format"
label-position="left"
label="Format:"
:label="t('tools.ecdsa-key-pair-generator.texts.label-format')"
:options="formatOptions"
placeholder="Select a key format"
:placeholder="t('tools.ecdsa-key-pair-generator.texts.placeholder-select-a-key-format')"
/>
<c-select
v-model:value="curve"
label-position="left"
label="Curve:"
:label="t('tools.ecdsa-key-pair-generator.texts.label-curve')"
:options="curveOptions"
placeholder="Select a curve type"
:placeholder="t('tools.ecdsa-key-pair-generator.texts.placeholder-select-a-curve-type')"
/>
</n-space>
<div v-if="supportsPassphrase" mb-1 mt-3>
<n-form-item label="Passphrase :" label-placement="left">
<n-form-item :label="t('tools.ecdsa-key-pair-generator.texts.label-passphrase')" label-placement="left">
<n-input
v-model:value="password"
type="password"
show-password-on="mousedown"
placeholder="Passphrase"
:placeholder="t('tools.ecdsa-key-pair-generator.texts.placeholder-passphrase')"
/>
</n-form-item>
</div>
<div mb-2>
<n-form-item label="Comment :" label-placement="left">
<n-form-item :label="t('tools.ecdsa-key-pair-generator.texts.label-comment')" label-placement="left">
<n-input
v-model:value="comment"
type="text"
placeholder="Comment"
:placeholder="t('tools.ecdsa-key-pair-generator.texts.placeholder-comment')"
/>
</n-form-item>
</div>
<n-space justify="center" mb-1>
<c-button @click="refreshCerts">
Refresh key-pair
{{ t('tools.ecdsa-key-pair-generator.texts.tag-refresh-key-pair') }}
</c-button>
</n-space>
<n-divider />
<div>
<h3>Public key</h3>
<h3>{{ t('tools.ecdsa-key-pair-generator.texts.tag-public-key') }}</h3>
<TextareaCopyable :value="certs.publicKey" :word-wrap="true" />
</div>
<div>
<h3>Private key</h3>
<h3>{{ t('tools.ecdsa-key-pair-generator.texts.tag-private-key') }}</h3>
<TextareaCopyable :value="certs.privateKey" />
</div>
</div>
@@ -1,21 +1,24 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type sshpk from 'sshpk';
import { generateKeyPair } from './ed25519-key-pair-generator.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { withDefaultOnErrorAsync } from '@/utils/defaults';
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
const { t } = useI18n();
const password = ref('');
const comment = ref('');
const emptyCerts = { publicKey: '', privateKey: '' };
const format = useStorage('ed25519-key-pair-generator:format', 'ssh');
const formatOptions = [
{ value: 'pem', label: 'PEM' },
{ value: 'pkcs8', label: 'PKCS#8' },
{ value: 'ssh', label: 'OpenSSH Standard' },
{ value: 'openssh', label: 'OpenSSH New' },
{ value: 'putty', label: 'PuTTY' },
{ value: 'pem', label: t('tools.ed25519-key-pair-generator.texts.label-pem') },
{ value: 'pkcs8', label: t('tools.ed25519-key-pair-generator.texts.label-pkcs-8') },
{ value: 'ssh', label: t('tools.ed25519-key-pair-generator.texts.label-openssh-standard') },
{ value: 'openssh', label: t('tools.ed25519-key-pair-generator.texts.label-openssh-new') },
{ value: 'putty', label: t('tools.ed25519-key-pair-generator.texts.label-putty') },
];
const supportsPassphrase = computed(() => format.value === 'ssh');
@@ -38,42 +41,42 @@ const [certs, refreshCerts] = computedRefreshableAsync(
<c-select
v-model:value="format"
label-position="left"
label="Format:"
:label="t('tools.ed25519-key-pair-generator.texts.label-format')"
:options="formatOptions"
placeholder="Select a key format"
:placeholder="t('tools.ed25519-key-pair-generator.texts.placeholder-select-a-key-format')"
/>
<n-form-item v-if="supportsPassphrase" label="Passphrase :" label-placement="left">
<n-form-item v-if="supportsPassphrase" :label="t('tools.ed25519-key-pair-generator.texts.label-passphrase')" label-placement="left">
<n-input
v-model:value="password"
type="password"
show-password-on="mousedown"
placeholder="Passphrase"
:placeholder="t('tools.ed25519-key-pair-generator.texts.placeholder-passphrase')"
/>
</n-form-item>
</n-space>
<n-space mb-2>
<n-form-item label="Comment :" label-placement="left">
<n-form-item :label="t('tools.ed25519-key-pair-generator.texts.label-comment')" label-placement="left">
<n-input
v-model:value="comment"
type="text"
placeholder="Comment"
:placeholder="t('tools.ed25519-key-pair-generator.texts.placeholder-comment')"
/>
</n-form-item>
<c-button @click="refreshCerts">
Refresh key-pair
{{ t('tools.ed25519-key-pair-generator.texts.tag-refresh-key-pair') }}
</c-button>
</n-space>
<div>
<h3>Public key</h3>
<h3>{{ t('tools.ed25519-key-pair-generator.texts.tag-public-key') }}</h3>
<TextareaCopyable :value="certs.publicKey" :word-wrap="true" />
</div>
<div>
<h3>Private key</h3>
<h3>{{ t('tools.ed25519-key-pair-generator.texts.tag-private-key') }}</h3>
<TextareaCopyable :value="certs.privateKey" />
</div>
</div>
+34 -31
View File
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import PostalMime from 'postal-mime';
const { t } = useI18n();
const inputType = ref<'file' | 'content'>('file');
const emailContent = ref('');
const fileInput = ref() as Ref<File | null>;
@@ -47,32 +50,32 @@ function onUpload(file: File) {
<template>
<div>
<c-card title="Input" mb-2>
<c-card :title="t('tools.email-parser.texts.title-input')" mb-2>
<n-radio-group v-model:value="inputType" name="radiogroup" mb-2 flex justify-center>
<n-space>
<n-radio
value="file"
label="File"
:label="t('tools.email-parser.texts.label-file')"
/>
<n-radio
value="content"
label="Content"
:label="t('tools.email-parser.texts.label-content')"
/>
</n-space>
</n-radio-group>
<c-file-upload
v-if="inputType === 'file'"
title="Drag and drop EML file here, or click to select a file"
:title="t('tools.email-parser.texts.title-drag-and-drop-eml-file-here-or-click-to-select-a-file')"
@file-upload="onUpload"
/>
<c-input-text
v-if="inputType === 'content'"
v-model:value="emailContent"
label="Email Content"
:label="t('tools.email-parser.texts.label-email-content')"
multiline
placeholder="Put your eml/email content here..."
:placeholder="t('tools.email-parser.texts.placeholder-put-your-eml-email-content-here')"
rows="15"
mb-2
/>
@@ -82,34 +85,34 @@ function onUpload(file: File) {
{{ error }}
</c-alert>
<c-card v-if="!error && parsedEmail" title="Output">
<input-copyable v-if="fileInput?.name" label="File Name" :value="fileInput?.name" />
<input-copyable v-if="parsedEmail.date" label="Date" :value="parsedEmail.date" />
<input-copyable v-if="parsedEmail.from?.name" label="From (name)" :value="parsedEmail.from?.name" />
<input-copyable v-if="parsedEmail.from" label="From (address)" :value="parsedEmail.from?.address || parsedEmail.from" />
<input-copyable v-if="parsedEmail.to" label="To" :value="JSON.stringify(parsedEmail.to)" />
<input-copyable v-if="parsedEmail.cc" label="Cc" :value="JSON.stringify(parsedEmail.cc)" />
<input-copyable v-if="parsedEmail.bcc" label="Bcc" :value="JSON.stringify(parsedEmail.bcc)" />
<input-copyable v-if="parsedEmail.replyTo" label="Reply-To" :value="JSON.stringify(parsedEmail.replyTo)" />
<input-copyable v-if="parsedEmail.subject" label="Subject" :value="parsedEmail.subject" />
<c-card v-if="parsedEmail.text" title="Plain Content" mb-2>
<c-card v-if="!error && parsedEmail" :title="t('tools.email-parser.texts.title-output')">
<input-copyable v-if="fileInput?.name" :label="t('tools.email-parser.texts.label-file-name')" :value="fileInput?.name" />
<input-copyable v-if="parsedEmail.date" :label="t('tools.email-parser.texts.label-date')" :value="parsedEmail.date" />
<input-copyable v-if="parsedEmail.from?.name" :label="t('tools.email-parser.texts.label-from-name')" :value="parsedEmail.from?.name" />
<input-copyable v-if="parsedEmail.from" :label="t('tools.email-parser.texts.label-from-address')" :value="parsedEmail.from?.address || parsedEmail.from" />
<input-copyable v-if="parsedEmail.to" :label="t('tools.email-parser.texts.label-to')" :value="JSON.stringify(parsedEmail.to)" />
<input-copyable v-if="parsedEmail.cc" :label="t('tools.email-parser.texts.label-cc')" :value="JSON.stringify(parsedEmail.cc)" />
<input-copyable v-if="parsedEmail.bcc" :label="t('tools.email-parser.texts.label-bcc')" :value="JSON.stringify(parsedEmail.bcc)" />
<input-copyable v-if="parsedEmail.replyTo" :label="t('tools.email-parser.texts.label-reply-to')" :value="JSON.stringify(parsedEmail.replyTo)" />
<input-copyable v-if="parsedEmail.subject" :label="t('tools.email-parser.texts.label-subject')" :value="parsedEmail.subject" />
<c-card v-if="parsedEmail.text" :title="t('tools.email-parser.texts.title-plain-content')" mb-2>
<details>
<summary>See content</summary>
<summary>{{ t('tools.email-parser.texts.tag-see-content') }}</summary>
<textarea-copyable :value="parsedEmail.text" word-wrap />
</details>
</c-card>
<c-card v-if="parsedEmail.html" title="Html Content" mb-2>
<c-card v-if="parsedEmail.html" :title="t('tools.email-parser.texts.title-html-content')" mb-2>
<details>
<summary>See content</summary>
<summary>{{ t('tools.email-parser.texts.tag-see-content') }}</summary>
<textarea-copyable :value="parsedEmail.html" word-wrap />
</details>
</c-card>
<c-card v-if="parsedEmail?.attachments?.length" title="Attachments" mb-2>
<c-card v-if="parsedEmail?.attachments?.length" :title="t('tools.email-parser.texts.title-attachments')" mb-2>
<n-table>
<thead>
<tr>
<th scope="col">
Attachment
{{ t('tools.email-parser.texts.tag-attachment') }}
</th><th scope="col" />
</tr>
</thead>
@@ -123,7 +126,7 @@ function onUpload(file: File) {
</td>
<td>
<c-button @click="downloadFile(h.content, h.filename || h.contentId || 'noname', h.mimeType)">
Download
{{ t('tools.email-parser.texts.tag-download') }}
</c-button>
</td>
</tr>
@@ -131,15 +134,15 @@ function onUpload(file: File) {
</n-table>
</c-card>
<input-copyable v-if="parsedEmail.messageId" label="Message Id" :value="parsedEmail.messageId" />
<input-copyable v-if="parsedEmail.inReplyTo" label="In Reply To" :value="parsedEmail.inReplyTo" />
<input-copyable v-if="parsedEmail.references" label="References" :value="parsedEmail.references" />
<input-copyable v-if="parsedEmail.deliveredTo" label="Delivered To" :value="parsedEmail.deliveredTo" />
<input-copyable v-if="parsedEmail.returnPath" label="Return Path" :value="parsedEmail.returnPath" />
<input-copyable v-if="parsedEmail.sender?.name" label="Sender (name)" :value="parsedEmail.sender?.name" />
<input-copyable v-if="parsedEmail.sender" label="Sender (address)" :value="parsedEmail.sender?.address || parsedEmail.sender" />
<input-copyable v-if="parsedEmail.messageId" :label="t('tools.email-parser.texts.label-message-id')" :value="parsedEmail.messageId" />
<input-copyable v-if="parsedEmail.inReplyTo" :label="t('tools.email-parser.texts.label-in-reply-to')" :value="parsedEmail.inReplyTo" />
<input-copyable v-if="parsedEmail.references" :label="t('tools.email-parser.texts.label-references')" :value="parsedEmail.references" />
<input-copyable v-if="parsedEmail.deliveredTo" :label="t('tools.email-parser.texts.label-delivered-to')" :value="parsedEmail.deliveredTo" />
<input-copyable v-if="parsedEmail.returnPath" :label="t('tools.email-parser.texts.label-return-path')" :value="parsedEmail.returnPath" />
<input-copyable v-if="parsedEmail.sender?.name" :label="t('tools.email-parser.texts.label-sender-name')" :value="parsedEmail.sender?.name" />
<input-copyable v-if="parsedEmail.sender" :label="t('tools.email-parser.texts.label-sender-address')" :value="parsedEmail.sender?.address || parsedEmail.sender" />
<c-card title="All Headers" mt-2>
<c-card :title="t('tools.email-parser.texts.title-all-headers')" mt-2>
<input-copyable
v-for="(h, index) in parsedEmail.headers || []"
:key="index"
+14 -10
View File
@@ -1,9 +1,13 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { EmojiInfo } from './emoji.types';
import { getAllCodePoints, isEmojiSupported } from './emoji-utils';
import { useCopy } from '@/composable/copy';
const props = defineProps<{ emojiInfo: EmojiInfo }>();
const { t } = useI18n();
const { emojiInfo } = toRefs(props);
const { copy } = useCopy();
@@ -26,25 +30,25 @@ const isKeywordsTruncated = computed(() => {
// Copy functions with better notifications
async function copyEmoji() {
await copy(emojiInfo.value.emoji, {
notificationMessage: `Emoji ${emojiInfo.value.emoji} copied to clipboard`,
notificationMessage: t('tools.emoji-card.text.emoji-emojiinfo-value-emoji-copied-to-clipboard', [emojiInfo.value.emoji]),
});
}
async function copyCodePoints() {
await copy(completeCodePoints.value, {
notificationMessage: `Code points '${completeCodePoints.value}' copied to clipboard`,
notificationMessage: t('tools.emoji-card.text.code-points-completecodepoints-value-copied-to-clipboard', [completeCodePoints.value]),
});
}
async function copyUnicode() {
await copy(emojiInfo.value.unicode, {
notificationMessage: `Unicode '${emojiInfo.value.unicode}' copied to clipboard`,
notificationMessage: t('tools.emoji-card.text.unicode-emojiinfo-value-unicode-copied-to-clipboard', [emojiInfo.value.unicode]),
});
}
async function copyName() {
await copy(emojiInfo.value.title, {
notificationMessage: `Name '${emojiInfo.value.title}' copied to clipboard`,
notificationMessage: t('tools.emoji-card.text.name-emojiinfo-value-title-copied-to-clipboard', [emojiInfo.value.title]),
});
}
</script>
@@ -70,7 +74,7 @@ async function copyName() {
'emoji-fallback': !emojiSupported,
'emoji-supported': emojiSupported,
}"
:title="`Click to copy ${emojiInfo.emoji}`"
:title="$t('tools.emoji-card.text.click-to-copy-emojiinfo-emoji', [emojiInfo.emoji])"
@click="copyEmoji"
>
{{ emojiInfo.emoji }}
@@ -85,7 +89,7 @@ async function copyName() {
font-bold
transition
hover:text-primary
:title="`Click to copy name: ${emojiInfo.title}`"
:title="$t('tools.emoji-card.text.click-to-copy-name-emojiinfo-title', [emojiInfo.title])"
@click="copyName"
>
{{ emojiInfo.title }}
@@ -117,7 +121,7 @@ async function copyName() {
hover:text-primary
hover:op-100
dark:hover:bg-gray-800
:title="`Click to copy: ${completeCodePoints}`"
:title="$t('tools.emoji-card.text.click-to-copy-completecodepoints', [completeCodePoints])"
@click="copyCodePoints"
>
{{ completeCodePoints }}
@@ -135,7 +139,7 @@ async function copyName() {
hover:text-primary
hover:op-100
dark:hover:bg-gray-800
:title="`Click to copy: ${emojiInfo.unicode}`"
:title="$t('tools.emoji-card.text.click-to-copy-emojiinfo-unicode', [emojiInfo.unicode])"
@click="copyUnicode"
>
{{ emojiInfo.unicode }}
@@ -144,8 +148,8 @@ async function copyName() {
</div>
<!-- Support indicator -->
<div v-if="!emojiSupported" text-xs op-50 title="This emoji might not display correctly on your system">
⚠️
<div v-if="!emojiSupported" text-xs op-50 :title="t('tools.emoji-picker.texts.title-this-emoji-might-not-display-correctly-on-your-system')">
{{ t('tools.emoji-picker.texts.tag-️') }}
</div>
</c-card>
</template>
+10 -7
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import emojiUnicodeData from 'unicode-emoji-json';
import emojiKeywords from 'emojilib';
import _ from 'lodash';
@@ -7,6 +8,8 @@ import { escapeUnicodeComplete, getAllCodePoints } from './emoji-utils';
import useDebouncedRef from '@/composable/debouncedref';
import { useFlexSearch } from '@/composable/flexSearch';
const { t } = useI18n();
// Enhanced emoji processing functions
const escapeUnicode = ({ emoji }: { emoji: string }) => escapeUnicodeComplete(emoji);
@@ -172,14 +175,14 @@ onUnmounted(() => {
<div mx-auto mb-4 max-w-600px flex justify-center gap-3>
<c-input-text
v-model:value="rawSearchQuery"
placeholder="Search emojis (e.g. 'smile') or paste an emoji (e.g. '😄')"
:placeholder="t('tools.emoji-picker.texts.placeholder-search-emojis-e-g-smile-or-paste-an-emoji-e-g')"
class="flex-1"
>
<template #prefix>
<icon-mdi-search mr-6px color-black op-70 dark:color-white />
</template>
</c-input-text>
<n-form-item label="Max results:" label-placement="left">
<n-form-item :label="t('tools.emoji-picker.texts.label-max-results')" label-placement="left">
<n-input-number v-model:value="limit" :min="10" :max="500" :step="10" style="width: 100px" />
</n-form-item>
</div>
@@ -187,16 +190,16 @@ onUnmounted(() => {
<!-- Search Results -->
<div v-if="searchQuery.trim().length > 0">
<div v-if="displayedSearchResults.length === 0" mt-4 text-center text-20px font-bold op-70>
<div>No results found</div>
<div>{{ t('tools.emoji-picker.texts.tag-no-results-found') }}</div>
<div mt-2 text-14px font-normal>
Try searching for something else like "smile", "flag", or "😄"
{{ t('tools.emoji-picker.texts.tag-try-searching-for-something-else-like-smile-flag-or') }}
</div>
</div>
<div v-else>
<div mb-3 mt-4 flex items-center gap-2 text-20px font-bold>
<span>Search Results</span>
<span text-14px font-normal op-70>({{ displayedSearchResults.length }} found)</span>
<span>{{ t('tools.emoji-picker.texts.tag-search-results') }}</span>
<span text-14px font-normal op-70>{{ $t('tools.emoji-picker.text.displayedsearchresults-length-found', [displayedSearchResults.length]) }}</span>
</div>
<emoji-grid :emoji-infos="displayedSearchResults" />
@@ -217,7 +220,7 @@ onUnmounted(() => {
<!-- Loading indicator when more groups are coming -->
<div v-if="visibleGroupsCount < emojisGroups.length" mt-6 text-center>
<div text-14px op-70>
Loading more groups... ({{ visibleGroupsCount }}/{{ emojisGroups.length }})
<span>{{ $t('tools.emoji-picker.text.loading-more-groups') }}</span> ({{ visibleGroupsCount }}/{{ emojisGroups.length }})
</div>
</div>
</div>
+22 -22
View File
@@ -29,25 +29,25 @@ const [decryptOutput, decryptError] = computedCatch(() => algos[decryptAlgo.valu
<div flex gap-3>
<c-input-text
v-model:value="cypherInput"
label="Your text:"
placeholder="The string to cypher"
:label="t('tools.encryption.texts.label-your-text')"
:placeholder="t('tools.encryption.texts.placeholder-the-string-to-cypher')"
rows="4"
multiline raw-text monospace autosize flex-1
/>
<div flex flex-1 flex-col gap-2>
<c-input-text v-model:value="cypherSecret" label="Your secret key:" clearable raw-text />
<c-input-text v-model:value="cypherSecret" :label="t('tools.encryption.texts.label-your-secret-key')" clearable raw-text />
<c-select
v-model:value="cypherSecretEncoding" label="Key encoding"
v-model:value="cypherSecretEncoding" :label="t('tools.encryption.texts.label-key-encoding')"
flex-1
placeholder="Select the key encoding..."
:placeholder="t('tools.encryption.texts.placeholder-select-the-key-encoding')"
:options="[
{
label: 'Plain Text',
label: t('tools.encryption.texts.label-plain-text'),
value: 'Text',
},
{
label: 'Hexadecimal Text',
label: t('tools.encryption.texts.label-hexadecimal-text'),
value: 'Hex',
},
]"
@@ -55,19 +55,19 @@ const [decryptOutput, decryptError] = computedCatch(() => algos[decryptAlgo.valu
<c-select
v-model:value="cypherAlgo"
label="Encryption algorithm:"
:label="t('tools.encryption.texts.label-encryption-algorithm')"
:options="Object.keys(algos).map((label) => ({ label, value: label }))"
/>
</div>
</div>
<c-alert v-if="cypherError" type="error" mt-12 title="Error while cyphering">
<c-alert v-if="cypherError" type="error" mt-12 :title="t('tools.encryption.texts.title-error-while-cyphering')">
{{ cypherError }}
</c-alert>
<c-input-text
label="Your text encrypted:"
:label="t('tools.encryption.texts.label-your-text-encrypted')"
:value="cypherOutput"
rows="3"
placeholder="Your string hash"
:placeholder="t('tools.encryption.texts.placeholder-your-string-hash')"
multiline monospace readonly autosize mt-5
/>
</c-card>
@@ -75,25 +75,25 @@ const [decryptOutput, decryptError] = computedCatch(() => algos[decryptAlgo.valu
<div flex gap-3>
<c-input-text
v-model:value="decryptInput"
label="Your encrypted text:"
placeholder="The string to cypher"
:label="t('tools.encryption.texts.label-your-encrypted-text')"
:placeholder="t('tools.encryption.texts.placeholder-the-string-to-cypher')"
rows="4"
multiline raw-text monospace autosize flex-1
/>
<div flex flex-1 flex-col gap-2>
<c-input-text v-model:value="decryptSecret" label="Your secret key:" clearable raw-text />
<c-input-text v-model:value="decryptSecret" :label="t('tools.encryption.texts.label-your-secret-key')" clearable raw-text />
<c-select
v-model:value="decryptSecretEncoding" label="Key encoding"
v-model:value="decryptSecretEncoding" :label="t('tools.encryption.texts.label-key-encoding')"
flex-1
placeholder="Select the key encoding..."
:placeholder="t('tools.encryption.texts.placeholder-select-the-key-encoding')"
:options="[
{
label: 'Plain Text',
label: t('tools.encryption.texts.label-plain-text'),
value: 'Text',
},
{
label: 'Hexadecimal Text',
label: t('tools.encryption.texts.label-hexadecimal-text'),
value: 'Hex',
},
]"
@@ -101,19 +101,19 @@ const [decryptOutput, decryptError] = computedCatch(() => algos[decryptAlgo.valu
<c-select
v-model:value="decryptAlgo"
label="Encryption algorithm:"
:label="t('tools.encryption.texts.label-encryption-algorithm')"
:options="Object.keys(algos).map((label) => ({ label, value: label }))"
/>
</div>
</div>
<c-alert v-if="decryptError" type="error" mt-12 title="Error while decrypting">
<c-alert v-if="decryptError" type="error" mt-12 :title="t('tools.encryption.texts.title-error-while-decrypting')">
{{ decryptError }}
</c-alert>
<c-input-text
v-else
label="Your decrypted text:"
:label="t('tools.encryption.texts.label-your-decrypted-text')"
:value="decryptOutput"
placeholder="Your string hash"
:placeholder="t('tools.encryption.texts.placeholder-your-string-hash')"
rows="3"
multiline monospace readonly autosize mt-5
/>
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { computeCost } from './energy-computer.service';
const { t } = useI18n();
const wattage = ref(100);
const durationHours = ref(2);
const kWhCost = ref(0.1);
@@ -9,18 +12,18 @@ const totalCost = computed(() => computeCost(wattage.value, durationHours.value,
<template>
<div>
<n-form-item label="Device Wattage" mb-1>
<n-form-item :label="t('tools.energy-computer.texts.label-device-wattage')" mb-1>
<n-input-number v-model:value="wattage" :min="0" />
</n-form-item>
<n-form-item label="Usage Duration (hours)" mb-1>
<n-form-item :label="t('tools.energy-computer.texts.label-usage-duration-hours')" mb-1>
<n-input-number v-model:value="durationHours" :min="0" />
</n-form-item>
<n-form-item label="kWh Cost" mb-1>
<n-form-item :label="t('tools.energy-computer.texts.label-kwh-cost')" mb-1>
<n-input-number v-model:value="kWhCost" :min="0" />
</n-form-item>
<n-divider />
<input-copyable label="Total Cost" :value="totalCost" />
<input-copyable :label="t('tools.energy-computer.texts.label-total-cost')" :value="totalCost" />
</div>
</template>
+15 -11
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
// Duplicate issue with sub directory
import { addMilliseconds, formatRelative } from 'date-fns';
@@ -7,6 +9,8 @@ import { enGB } from 'date-fns/locale';
import { formatMsDuration } from './eta-calculator.service';
const { t } = useI18n();
const unitCount = ref(3 * 62);
const unitPerTimeSpan = ref(3);
const timeSpan = ref(5);
@@ -31,29 +35,29 @@ const endAt = computed(() =>
</div>
<n-divider />
<div flex gap-2>
<n-form-item label="Amount of element to consume" flex-1>
<n-form-item :label="t('tools.eta-calculator.texts.label-amount-of-element-to-consume')" flex-1>
<n-input-number v-model:value="unitCount" :min="1" />
</n-form-item>
<n-form-item label="The consumption started at" flex-1>
<n-form-item :label="t('tools.eta-calculator.texts.label-the-consumption-started-at')" flex-1>
<n-date-picker v-model:value="startedAt" type="datetime" />
</n-form-item>
</div>
<p>Amount of unit consumed by time span</p>
<p>{{ t('tools.eta-calculator.texts.tag-amount-of-unit-consumed-by-time-span') }}</p>
<div flex flex-col items-baseline gap-y-2 md:flex-row>
<n-input-number v-model:value="unitPerTimeSpan" :min="1" />
<div flex items-baseline gap-2>
<span ml-2>in</span>
<span ml-2>{{ t('tools.eta-calculator.texts.tag-in') }}</span>
<n-input-number v-model:value="timeSpan" min-w-130px :min="1" />
<c-select
v-model:value="timeSpanUnitMultiplier"
min-w-130px
:options="[
{ label: 'milliseconds', value: 1 },
{ label: 'seconds', value: 1000 },
{ label: 'minutes', value: 1000 * 60 },
{ label: 'hours', value: 1000 * 60 * 60 },
{ label: 'days', value: 1000 * 60 * 60 * 24 },
{ label: t('tools.eta-calculator.texts.label-milliseconds'), value: 1 },
{ label: t('tools.eta-calculator.texts.label-seconds'), value: 1000 },
{ label: t('tools.eta-calculator.texts.label-minutes'), value: 1000 * 60 },
{ label: t('tools.eta-calculator.texts.label-hours'), value: 1000 * 60 * 60 },
{ label: t('tools.eta-calculator.texts.label-days'), value: 1000 * 60 * 60 * 24 },
]"
/>
</div>
@@ -61,12 +65,12 @@ const endAt = computed(() =>
<n-divider />
<c-card mb-2>
<n-statistic label="Total duration">
<n-statistic :label="t('tools.eta-calculator.texts.label-total-duration')">
{{ formatMsDuration(durationMs) }}
</n-statistic>
</c-card>
<c-card>
<n-statistic label="It will end ">
<n-statistic :label="t('tools.eta-calculator.texts.label-it-will-end')">
{{ endAt }}
</n-statistic>
</c-card>
+22 -18
View File
@@ -1,8 +1,12 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import * as XLSX from 'xlsx';
import { objectArrayToData } from '@/utils/objectarray.export';
import type { ExportFormat } from '@/utils/objectarray.export';
const { t } = useI18n();
const workbook = ref<XLSX.WorkBook | null>(null);
const convertedData = ref<string>('');
const selectedFormat = ref<string>('json');
@@ -12,14 +16,14 @@ const sheetName = ref('');
const error = ref('');
const formats = [
{ label: 'JSON', value: 'json' },
{ label: 'YAML', value: 'yaml' },
{ label: 'SQL INSERT', value: 'sql' },
{ label: 'CSV (comma)', value: 'csv' },
{ label: 'CSV (semicolon)', value: 'csv_semicolon' },
{ label: 'CSV (tab)', value: 'tsv' },
{ label: 'Markdown', value: 'markdown' },
{ label: 'XML', value: 'xml' },
{ label: t('tools.excel-to-data.texts.label-json'), value: 'json' },
{ label: t('tools.excel-to-data.texts.label-yaml'), value: 'yaml' },
{ label: t('tools.excel-to-data.texts.label-sql-insert'), value: 'sql' },
{ label: t('tools.excel-to-data.texts.label-csv-comma'), value: 'csv' },
{ label: t('tools.excel-to-data.texts.label-csv-semicolon'), value: 'csv_semicolon' },
{ label: t('tools.excel-to-data.texts.label-csv-tab'), value: 'tsv' },
{ label: t('tools.excel-to-data.texts.label-markdown'), value: 'markdown' },
{ label: t('tools.excel-to-data.texts.label-xml'), value: 'xml' },
];
async function handleFileUpload(file: File) {
@@ -52,31 +56,31 @@ function convertFile() {
</script>
<template>
<NCard title="XLSX Converter">
<NCard :title="t('tools.excel-to-data.texts.title-xlsx-converter')">
<c-file-upload
title="Drag and drop a XLSX here, or click to select a file"
:title="t('tools.excel-to-data.texts.title-drag-and-drop-a-xlsx-here-or-click-to-select-a-file')"
accept=".xlsx"
mb-3
@file-upload="handleFileUpload"
/>
<NFormItem v-if="workbook" label="Select Sheet to use:" label-placement="left">
<NSelect v-model:value="sheetName" :options="workbook.SheetNames?.map((s) => ({ label: s, value: s }))" placeholder="Select sheet" />
<NFormItem v-if="workbook" :label="t('tools.excel-to-data.texts.label-select-sheet-to-use')" label-placement="left">
<NSelect v-model:value="sheetName" :options="workbook.SheetNames?.map((s) => ({ label: s, value: s }))" :placeholder="t('tools.excel-to-data.texts.placeholder-select-sheet')" />
</NFormItem>
<NFormItem label="Select output format:" label-placement="left">
<NSelect v-model:value="selectedFormat" :options="formats" placeholder="Select format" />
<NFormItem :label="t('tools.excel-to-data.texts.label-select-output-format')" label-placement="left">
<NSelect v-model:value="selectedFormat" :options="formats" :placeholder="t('tools.excel-to-data.texts.placeholder-select-format')" />
</NFormItem>
<n-form-item label="Nestify ('a.b.c' to nested objects)" label-placement="left">
<n-form-item :label="t('tools.excel-to-data.texts.label-nestify-a-b-c-to-nested-objects')" label-placement="left">
<n-checkbox v-model:checked="nestify" />
</n-form-item>
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" label="Table Name:" label-placement="left" />
<c-input-text v-if="selectedFormat === 'sql'" v-model:value="tableName" :label="t('tools.excel-to-data.texts.label-table-name')" label-placement="left" />
<div mt-3 flex justify-center>
<NButton :disabled="!workbook" @click="convertFile">
Convert
{{ t('tools.excel-to-data.texts.tag-convert') }}
</NButton>
</div>
@@ -84,7 +88,7 @@ function convertFile() {
{{ error }}
</c-alert>
<c-card v-if="convertedData" title="Converted data">
<c-card v-if="convertedData" :title="t('tools.excel-to-data.texts.title-converted-data')">
<textarea-copyable :value="convertedData" :language="selectedFormat" />
</c-card>
</NCard>
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { getTextFromHtml, validateHtml } from './extract-text-from-html.service';
import { withDefaultOnError } from '@/utils/defaults';
import type { UseValidationRule } from '@/composable/validation';
const { t } = useI18n();
function transformer(value: string) {
return withDefaultOnError(() => {
if (value === '') {
@@ -15,16 +18,16 @@ function transformer(value: string) {
const rules: UseValidationRule<string>[] = [
{
validator: (value: string) => value === '' || validateHtml(value),
message: 'Provided HTML is not valid.',
message: t('tools.extract-text-from-html.texts.message-provided-html-is-not-valid'),
},
];
</script>
<template>
<format-transformer
input-label="Your raw HTML"
input-placeholder="Paste your raw HTML here..."
output-label="Text from your HTML"
:input-label="t('tools.extract-text-from-html.texts.input-label-your-raw-html')"
:input-placeholder="t('tools.extract-text-from-html.texts.input-placeholder-paste-your-raw-html-here')"
:output-label="t('tools.extract-text-from-html.texts.output-label-text-from-your-html')"
:input-validation-rules="rules"
:transformer="transformer"
/>
+10 -6
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
createAdler32, // (): Promise<IHasher>
createBLAKE2b, // (bits?: number, key?: IDataType): Promise<IHasher> // default is 512 bits
@@ -31,6 +33,8 @@ import { convertHexToBin } from '../hash-text/hash-text.service';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
const file = ref<File | null>(null);
@@ -168,7 +172,7 @@ const hashWasmValues = computed(() => withDefaultOnError(() => {
<div>
<c-card>
<c-file-upload
title="Drag and drop a file here, or click to select a file"
:title="t('tools.file-hasher.texts.title-drag-and-drop-a-file-here-or-click-to-select-a-file')"
@file-upload="onUpload"
/>
@@ -177,22 +181,22 @@ const hashWasmValues = computed(() => withDefaultOnError(() => {
<c-select
v-model:value="encoding"
mb-4
label="Digest encoding"
:label="t('tools.file-hasher.texts.label-digest-encoding')"
:options="[
{
label: 'Binary (base 2)',
label: t('tools.file-hasher.texts.label-binary-base-2'),
value: 'Bin',
},
{
label: 'Hexadecimal (base 16)',
label: t('tools.file-hasher.texts.label-hexadecimal-base-16'),
value: 'Hex',
},
{
label: 'Base64 (base 64)',
label: t('tools.file-hasher.texts.label-base64-base-64'),
value: 'Base64',
},
{
label: 'Base64url (base 64 with url safe chars)',
label: t('tools.file-hasher.texts.label-base64url-base-64-with-url-safe-chars'),
value: 'Base64url',
},
]"
+8 -5
View File
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { FileTypeResult } from 'file-type';
import { fileTypeFromBuffer } from 'file-type';
import InputCopyable from '../../components/InputCopyable.vue';
const { t } = useI18n();
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
const file = ref<File | null>(null);
const type = ref<FileTypeResult | undefined>(undefined);
@@ -27,17 +30,17 @@ async function onFileUploaded(uploadedFile: File) {
<div style="flex: 0 0 100%" mb-3>
<div mx-auto max-w-600px>
<c-file-upload
title="Drag and drop a file here, or click to select a file"
:title="t('tools.file-type.texts.title-drag-and-drop-a-file-here-or-click-to-select-a-file')"
@file-upload="onFileUploaded"
/>
</div>
</div>
<div mt-3 flex justify-center>
<c-card v-if="status === 'done'" title="Information">
<c-card v-if="status === 'done'" :title="t('tools.file-type.texts.title-information')">
<InputCopyable
:value="file?.name || ''"
label="File name:"
:label="t('tools.file-type.texts.label-file-name')"
label-position="left"
label-width="100px"
label-align="right"
@@ -47,7 +50,7 @@ async function onFileUploaded(uploadedFile: File) {
<InputCopyable
:value="type?.ext || '<unknown>'"
label="Extension:"
:label="t('tools.file-type.texts.label-extension')"
label-position="left"
label-width="100px"
label-align="right"
@@ -56,7 +59,7 @@ async function onFileUploaded(uploadedFile: File) {
/>
<InputCopyable
:value="type?.mime || '<unknown>'"
label="MIME Type:"
:label="t('tools.file-type.texts.label-mime-type')"
label-position="left"
label-width="100px"
label-align="right"
@@ -1,4 +1,8 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const zone = ref<string>('public');
const action = ref<string>('add');
const ruleType = ref<string>('service');
@@ -6,15 +10,15 @@ const value = ref<string>('http');
const permanent = ref<boolean>(true);
const ruleTypes = [
{ label: 'Service', value: 'service' },
{ label: 'Port', value: 'port' },
{ label: 'Protocol', value: 'protocol' },
{ label: 'Rich Rule', value: 'rich-rule' },
{ label: t('tools.firewalld-generator.texts.label-service'), value: 'service' },
{ label: t('tools.firewalld-generator.texts.label-port'), value: 'port' },
{ label: t('tools.firewalld-generator.texts.label-protocol'), value: 'protocol' },
{ label: t('tools.firewalld-generator.texts.label-rich-rule'), value: 'rich-rule' },
];
const actions = [
{ label: 'Add', value: 'add' },
{ label: 'Remove', value: 'remove' },
{ label: t('tools.firewalld-generator.texts.label-add'), value: 'add' },
{ label: t('tools.firewalld-generator.texts.label-remove'), value: 'remove' },
];
const command = computed(() => {
@@ -30,28 +34,28 @@ const command = computed(() => {
<template>
<div>
<NForm label-width="120px" label-placement="left">
<NFormItem label="Zone:">
<NSelect v-model:value="zone" :options="[{ label: 'Public', value: 'public' }, { label: 'Home', value: 'home' }, { label: 'Work', value: 'work' }]" />
<NFormItem :label="t('tools.firewalld-generator.texts.label-zone')">
<NSelect v-model:value="zone" :options="[{ label: t('tools.firewalld-generator.texts.label-public'), value: 'public' }, { label: t('tools.firewalld-generator.texts.label-home'), value: 'home' }, { label: t('tools.firewalld-generator.texts.label-work'), value: 'work' }]" />
</NFormItem>
<NFormItem label="Action:">
<NFormItem :label="t('tools.firewalld-generator.texts.label-action')">
<NSelect v-model:value="action" :options="actions" />
</NFormItem>
<NFormItem label="Rule Type:">
<NFormItem :label="t('tools.firewalld-generator.texts.label-rule-type')">
<NSelect v-model:value="ruleType" :options="ruleTypes" />
</NFormItem>
<NFormItem label="Value:">
<NInput v-model:value="value" placeholder="Enter the service/port/protocol" />
<NFormItem :label="t('tools.firewalld-generator.texts.label-value')">
<NInput v-model:value="value" :placeholder="t('tools.firewalld-generator.texts.placeholder-enter-the-service-port-protocol')" />
</NFormItem>
<NFormItem label="Permanent">
<NSelect v-model:value="permanent" :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }]" />
<NFormItem :label="t('tools.firewalld-generator.texts.label-permanent')">
<NSelect v-model:value="permanent" :options="[{ label: t('tools.firewalld-generator.texts.label-yes'), value: true }, { label: t('tools.firewalld-generator.texts.label-no'), value: false }]" />
</NFormItem>
</NForm>
<c-card title="Generated fw command:" mt-2>
<c-card :title="t('tools.firewalld-generator.texts.title-generated-fw-command')" mt-2>
<textarea-copyable :value="command" />
</c-card>
</div>
@@ -1,3 +1,5 @@
import { translate as t } from '@/plugins/i18n.plugin';
export function convertDecimalToBinary({ value, bitCount }: { value: string; bitCount: number }) {
let number = Number.parseFloat(value.replace(/\s/g, ''));
if (value.match(/^-?inf(inity)?$/i)) {
@@ -16,16 +18,16 @@ export function convertDecimalToBinary({ value, bitCount }: { value: string; bit
return [...uint].slice(0, 2).reverse().map(p => p.toString(2).padStart(32, '0')).join('');
}
default:
throw new Error('Unsupported bit count. Only 32 and 64 are allowed.');
throw new Error(t('tools.floating-point-number-converter.model.text.unsupported-bit-count-only-32-and-64-are-allowed'));
}
}
export function convertBinaryToDecimal({ value, decimalPrecision, removeZeroPadding }: { value: string; decimalPrecision: string; removeZeroPadding: boolean }) {
if (value.match(/[^01]/)) {
throw new Error('Not a binary number.');
throw new Error(t('tools.floating-point-number-converter.model.text.not-a-binary-number'));
}
if (decimalPrecision.match(/[^\d]/)) {
throw new Error('Decimal Precision must be a positive whole number.');
throw new Error(t('tools.floating-point-number-converter.model.text.decimal-precision-must-be-a-positive-whole-number'));
}
let result: number;
@@ -41,7 +43,7 @@ export function convertBinaryToDecimal({ value, decimalPrecision, removeZeroPadd
break;
}
default:
throw new Error('Invalid length. Supply a binary string with length 32 or 64.');
throw new Error(t('tools.floating-point-number-converter.model.text.invalid-length-supply-a-binary-string-with-length-32-or-64'));
}
const zeroNegative = result === 0 && 2 / result === Number.NEGATIVE_INFINITY;
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import InputCopyable from '../../components/InputCopyable.vue';
import { convertBase } from '../integer-base-converter/integer-base-converter.model';
import { calcErrorDueToConversion, convertBinaryToDecimal, convertDecimalToBinary } from './floating-point-number-converter.model';
import { getErrorMessageIfThrows } from '@/utils/error';
const { t } = useI18n();
const bitCount = ref(32);
const decimalInput = ref('42.42');
const binaryOutput = ref();
@@ -30,11 +33,11 @@ const binaryToDecimalError = computed(() =>
</script>
<template>
<c-card title="Decimal to Binary" style="min-width: 650px">
<c-card :title="t('tools.floating-point-number-converter.texts.title-decimal-to-binary')" style="min-width: 650px">
<c-input-text
v-model:value="decimalInput"
label="Decimal Number"
placeholder="Put your decimal number here (ex: 42.42)"
:label="t('tools.floating-point-number-converter.texts.label-decimal-number')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-put-your-decimal-number-here-ex-42-42')"
label-position="left"
label-width="210px"
label-align="right"
@@ -44,17 +47,17 @@ const binaryToDecimalError = computed(() =>
<c-select
v-model:value="bitCount"
mb-4
label="Bit Count"
:label="t('tools.floating-point-number-converter.texts.label-bit-count')"
label-position="left"
label-width="210px"
label-align="right"
:options="[
{
label: '32-Bit (Single precision)',
label: t('tools.floating-point-number-converter.texts.label-32-bit-single-precision'),
value: 32,
},
{
label: '64-Bit (Double precision)',
label: t('tools.floating-point-number-converter.texts.label-64-bit-double-precision'),
value: 64,
},
]"
@@ -63,8 +66,8 @@ const binaryToDecimalError = computed(() =>
<n-divider />
<InputCopyable
label="Binary Number"
placeholder="Binary Number"
:label="t('tools.floating-point-number-converter.texts.label-binary-number')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-binary-number')"
:value="binaryOutput = convertDecimalToBinary({ value: decimalInput, bitCount })"
readonly
label-position="left"
@@ -74,8 +77,8 @@ const binaryToDecimalError = computed(() =>
/>
<InputCopyable
label="Hexadecimal Representation"
placeholder="Hexadecimal Representation"
:label="t('tools.floating-point-number-converter.texts.label-hexadecimal-representation')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-hexadecimal-representation')"
:value="convertBase({ value: binaryOutput, fromBase: 2, toBase: 16 })"
readonly
label-position="left"
@@ -85,8 +88,8 @@ const binaryToDecimalError = computed(() =>
/>
<InputCopyable
label="Actually stored value"
placeholder="Actually stored value"
:label="t('tools.floating-point-number-converter.texts.label-actually-stored-value')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-actually-stored-value')"
:value="actualValue = errorlessBinaryToDecimalConversion({ value: binaryOutput, decimalPrecision: '32', removeZeroPadding: true })"
readonly
label-position="left"
@@ -96,8 +99,8 @@ const binaryToDecimalError = computed(() =>
/>
<InputCopyable
label="Error due to conversion"
placeholder="Error due to conversion"
:label="t('tools.floating-point-number-converter.texts.label-error-due-to-conversion')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-error-due-to-conversion')"
:value="calcErrorDueToConversion({ decimalInput, actualValue })"
readonly
label-position="left"
@@ -107,11 +110,11 @@ const binaryToDecimalError = computed(() =>
/>
</c-card>
<c-card title="Binary to Decimal" style="min-width: 650px">
<c-card :title="t('tools.floating-point-number-converter.texts.title-binary-to-decimal')" style="min-width: 650px">
<c-input-text
v-model:value="binaryInput"
label="Binary Number"
placeholder="Put your binary number here (ex: 01000010001010011010111000010100)"
:label="t('tools.floating-point-number-converter.texts.label-binary-number')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-put-your-binary-number-here-ex-01000010001010011010111000010100')"
label-position="left"
label-width="140px"
label-align="right"
@@ -120,8 +123,8 @@ const binaryToDecimalError = computed(() =>
<c-input-text
v-model:value="decimalPrecision"
label="Decimal Precision"
placeholder="Choose the decimal precision (digits after the decimal point)."
:label="t('tools.floating-point-number-converter.texts.label-decimal-precision')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-choose-the-decimal-precision-digits-after-the-decimal-point')"
label-position="left"
label-width="140px"
label-align="right"
@@ -129,7 +132,7 @@ const binaryToDecimalError = computed(() =>
/>
<n-form-item
label="Show Trailing Zeros"
:label="t('tools.floating-point-number-converter.texts.label-show-trailing-zeros')"
label-placement="left"
label-width="140px"
label-align="right"
@@ -146,8 +149,8 @@ const binaryToDecimalError = computed(() =>
<n-divider />
<InputCopyable
label="Decimal Number"
placeholder="Decimal Number"
:label="t('tools.floating-point-number-converter.texts.label-decimal-number')"
:placeholder="t('tools.floating-point-number-converter.texts.placeholder-decimal-number')"
:value="errorlessBinaryToDecimalConversion({ value: binaryInput, decimalPrecision, removeZeroPadding: !showTrailingZeros })"
readonly
label-position="left"
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import convertTreeToStructure from './lib/convert-tree-to-structure';
import { generateTree } from './lib/generate-tree';
import { parseInput } from './lib/parse-input';
import { withDefaultOnError } from '@/utils/defaults';
const { t } = useI18n();
const inputStructureTemplate = `my-app
src
index.html
@@ -40,12 +43,12 @@ const MONACO_EDITOR_OPTIONS = {
<template>
<div class="min-h-0 flex flex-row gap-8" style="margin: 0 auto; max-width: 2200px; flex: 1 !important;">
<div class="min-w-0 flex-1">
<c-card title="Indented Structure → Folder Tree">
<c-card :title="t('tools.folder-structure-diagram.texts.title-indented-structure-folder-tree')">
<c-monaco-editor
v-model:value="inputStructure"
theme="vs-dark"
height="400px"
placeholder="Paste your indented structure here..."
:placeholder="t('tools.folder-structure-diagram.texts.placeholder-paste-your-indented-structure-here')"
:options="MONACO_EDITOR_OPTIONS"
/>
</c-card>
@@ -55,12 +58,12 @@ const MONACO_EDITOR_OPTIONS = {
<TextareaCopyable :value="outputTree" :scrollable="true" />
</div>
<div class="min-w-0 flex-1">
<c-card title="Folder Tree → Indented Structure">
<c-card :title="t('tools.folder-structure-diagram.texts.title-folder-tree-indented-structure')">
<c-monaco-editor
v-model:value="inputTree"
theme="vs-dark"
height="400px"
placeholder="Paste your folder tree here..."
:placeholder="t('tools.folder-structure-diagram.texts.placeholder-paste-your-folder-tree-here')"
:options="MONACO_EDITOR_OPTIONS"
/>
</c-card>
+15 -12
View File
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
// Centralized wheel configuration - edit these values to change wheel size
const WHEEL_CONFIG = {
size: 550, // Overall wheel size
@@ -283,7 +286,7 @@ function getTextPosition(index: number) {
<div class="fortune-wheel-container">
<!-- Controls -->
<div class="wheel-controls">
<n-form-item label="Spin Duration (seconds):" label-placement="left" my--5>
<n-form-item :label="t('tools.fortune-wheel.texts.label-spin-duration-seconds')" label-placement="left" my--5>
<n-input-number v-model:value="spinDuration" :min="0" :max="10" />
</n-form-item>
@@ -291,18 +294,18 @@ function getTextPosition(index: number) {
<!-- Add new option -->
<div class="add-option-section">
<h3>Add New Option</h3>
<h3>{{ t('tools.fortune-wheel.texts.tag-add-new-option') }}</h3>
<div class="add-option-form">
<c-input-text
v-model:value="newOptionText"
placeholder="Enter wheel option"
:placeholder="t('tools.fortune-wheel.texts.placeholder-enter-wheel-option')"
@keyup.enter="addOption"
/>
<c-button :disabled="!newOptionText.trim()" @click="addOption">
Add Option
{{ t('tools.fortune-wheel.texts.tag-add-option') }}
</c-button>
<c-button class="clear-all-button" @click="removeAllOptions">
Clear All Options
{{ t('tools.fortune-wheel.texts.tag-clear-all-options') }}
</c-button>
</div>
</div>
@@ -311,7 +314,7 @@ function getTextPosition(index: number) {
<div class="options-section">
<h3>Wheel Options ({{ wheelOptions.length }})</h3>
<div v-if="wheelOptions.length === 0" class="empty-state">
No options added yet. Add some options to start spinning!
{{ t('tools.fortune-wheel.texts.tag-no-options-added-yet-add-some-options-to-start-spinning') }}
</div>
<div v-else class="options-list">
<div
@@ -326,25 +329,25 @@ function getTextPosition(index: number) {
<c-button
size="small"
:disabled="index === 0"
title="Move up"
:title="t('tools.fortune-wheel.texts.title-move-up')"
@click="moveOption(index, index - 1)"
>
↑
{{ t('tools.fortune-wheel.texts.tag-') }}
</c-button>
<c-button
size="small"
:disabled="index === wheelOptions.length - 1"
title="Move down"
:title="t('tools.fortune-wheel.texts.title-move-down')"
@click="moveOption(index, index + 1)"
>
↓
{{ t('tools.fortune-wheel.texts.tag-') }}
</c-button>
<c-button
size="small"
title="Remove"
:title="t('tools.fortune-wheel.texts.title-remove')"
@click="removeOption(option.id)"
>
✕
{{ t('tools.fortune-wheel.texts.tag-') }}
</c-button>
</div>
</div>
+19 -16
View File
@@ -1,6 +1,9 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { NForm, NFormItem, NInput, NSelect } from 'naive-ui';
const { t } = useI18n();
const device = ref('');
const mountPoint = ref('');
const fsType = ref('auto');
@@ -88,41 +91,41 @@ const fstabLine = computed(
<template>
<NForm>
<NFormItem label="Device:" label-placement="left" label-width="140px">
<NInput v-model:value="device" placeholder="/dev/sda1 or UUID=... or server:/path" />
<NFormItem :label="t('tools.fstab-generator.texts.label-device')" label-placement="left" label-width="140px">
<NInput v-model:value="device" :placeholder="t('tools.fstab-generator.texts.placeholder-dev-sda1-or-uuid-or-server-path')" />
</NFormItem>
<NFormItem label="Mount Point:" label-placement="left" label-width="140px">
<NInput v-model:value="mountPoint" placeholder="/mnt/data or /home" />
<NFormItem :label="t('tools.fstab-generator.texts.label-mount-point')" label-placement="left" label-width="140px">
<NInput v-model:value="mountPoint" :placeholder="t('tools.fstab-generator.texts.placeholder-mnt-data-or-home')" />
</NFormItem>
<NFormItem label="Filesystem Type:" label-placement="left" label-width="140px">
<NFormItem :label="t('tools.fstab-generator.texts.label-filesystem-type')" label-placement="left" label-width="140px">
<NSelect v-model:value="fsType" :options="fileSystems.map(fs => ({ label: fs, value: fs }))" />
</NFormItem>
<NFormItem label="Filesystem options:">
<NFormItem :label="t('tools.fstab-generator.texts.label-filesystem-options')">
<NSelect
v-model:value="options" placeholder="By default: Standard mount options (rw, suid, dev, exec, auto, nouser, async)"
v-model:value="options" :placeholder="t('tools.fstab-generator.texts.placeholder-by-default-standard-mount-options-rw-suid-dev-exec-auto-nouser-async')"
multiple
:options="filesystemOptions.map(o => ({ value: o.value, label: `${o.description} (${o.value})` }))"
/>
</NFormItem>
<NFormItem label="Dump (Determines whether the 'dump' utility should back up this filesystem):">
<NSelect v-model:value="dump" :options="[{ label: 'Do not include in backups', value: '0' }, { label: 'Include in backups', value: '1' }]" />
<NFormItem :label="t('tools.fstab-generator.texts.label-dump-determines-whether-the-dump-utility-should-back-up-this-filesystem')">
<NSelect v-model:value="dump" :options="[{ label: t('tools.fstab-generator.texts.label-do-not-include-in-backups'), value: '0' }, { label: t('tools.fstab-generator.texts.label-include-in-backups'), value: '1' }]" />
</NFormItem>
<NFormItem label="Pass (Controls the order for filesystem checks at boot):">
<NFormItem :label="t('tools.fstab-generator.texts.label-pass-controls-the-order-for-filesystem-checks-at-boot')">
<NSelect
v-model:value="pass"
:options="[{ label: 'No check', value: '0' }, { label: 'Root filesystem first', value: '1' }, { label: 'Other filesystems after root', value: '2' }]"
:options="[{ label: t('tools.fstab-generator.texts.label-no-check'), value: '0' }, { label: t('tools.fstab-generator.texts.label-root-filesystem-first'), value: '1' }, { label: t('tools.fstab-generator.texts.label-other-filesystems-after-root'), value: '2' }]"
/>
</NFormItem>
<c-input-text
v-model:value="username"
placeholder="Username"
label="Username:"
:placeholder="t('tools.fstab-generator.texts.placeholder-username')"
:label="t('tools.fstab-generator.texts.label-username')"
label-position="left"
label-width="140px"
label-align="right"
@@ -133,8 +136,8 @@ const fstabLine = computed(
<c-input-text
v-model:value="password"
placeholder="Password"
label="Password:"
:placeholder="t('tools.fstab-generator.texts.placeholder-password')"
:label="t('tools.fstab-generator.texts.label-password')"
label-position="left"
label-width="140px"
label-align="right"
@@ -142,7 +145,7 @@ const fstabLine = computed(
flex-1
/>
<c-card title="Generated /etc/fstab line" mt-5>
<c-card :title="t('tools.fstab-generator.texts.title-generated-etc-fstab-line')" mt-5>
<textarea-copyable :value="fstabLine" />
</c-card>
</NForm>
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import haversine from 'haversine';
import SpanCopyable from '@/components/SpanCopyable.vue';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const latitude1 = useQueryParamOrStorage({ name: 'lat1', storageName: 'geo-dist:lat1', defaultValue: 0 });
const longitude1 = useQueryParamOrStorage({ name: 'lng1', storageName: 'geo-dist:lng1', defaultValue: 0 });
@@ -22,56 +25,56 @@ const distanceNMI = computed(() => haversine(start.value, end.value, { unit: 'nm
<template>
<div>
<c-card title="Distance computer" mb-2>
<n-form-item label="Geolocation 1 (latitude, longitude):">
<c-card :title="t('tools.geo-distance-calculator.texts.title-distance-computer')" mb-2>
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-geolocation-1-latitude-longitude')">
<n-space justify="space-between">
<n-input-number v-model:value="latitude1" :min="-90" :max="90" placeholder="Latitude..." />
<n-input-number v-model:value="longitude1" :min="-180" :max="180" placeholder="Longitude..." />
<n-input-number v-model:value="latitude1" :min="-90" :max="90" :placeholder="t('tools.geo-distance-calculator.texts.placeholder-latitude')" />
<n-input-number v-model:value="longitude1" :min="-180" :max="180" :placeholder="t('tools.geo-distance-calculator.texts.placeholder-longitude')" />
</n-space>
</n-form-item>
<n-form-item label="Geolocation 2 (latitude, longitude):" gap-2>
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-geolocation-2-latitude-longitude')" gap-2>
<n-space justify="space-between">
<n-input-number v-model:value="latitude2" :min="-90" :max="90" placeholder="Latitude..." />
<n-input-number v-model:value="longitude2" :min="-180" :max="180" placeholder="Longitude..." />
<n-input-number v-model:value="latitude2" :min="-90" :max="90" :placeholder="t('tools.geo-distance-calculator.texts.placeholder-latitude')" />
<n-input-number v-model:value="longitude2" :min="-180" :max="180" :placeholder="t('tools.geo-distance-calculator.texts.placeholder-longitude')" />
</n-space>
</n-form-item>
<n-divider />
<n-form-item label="Distance (km):" label-width="120px" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-distance-km')" label-width="120px" label-placement="left">
<SpanCopyable :value="distanceKM.toString()" />
</n-form-item>
<n-form-item label="Distance (mile):" label-width="120px" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-distance-mile')" label-width="120px" label-placement="left">
<SpanCopyable :value="distanceMile.toString()" />
</n-form-item>
<n-form-item label="Distance (meter):" label-width="120px" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-distance-meter')" label-width="120px" label-placement="left">
<SpanCopyable :value="distanceMeter.toString()" />
</n-form-item>
<n-form-item label="Distance (nmi):" label-width="120px" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-distance-nmi')" label-width="120px" label-placement="left">
<SpanCopyable :value="distanceNMI.toString()" />
</n-form-item>
</c-card>
<c-card title="Your position">
<c-card :title="t('tools.geo-distance-calculator.texts.title-your-position')">
<n-space justify="center">
<n-form-item label="Latitude:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-latitude')" label-placement="left">
<SpanCopyable :value="userCoords?.latitude?.toString() || 'Unknown'" />
</n-form-item>
<n-form-item label="Longitude:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-longitude')" label-placement="left">
<SpanCopyable :value="userCoords?.longitude?.toString() || 'Unknown'" />
</n-form-item>
</n-space>
<n-space justify="center">
<n-form-item label="Altitude:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-altitude')" label-placement="left">
<SpanCopyable :value="userCoords?.altitude?.toString() || 'Unknown'" />
</n-form-item>
<n-form-item label="Heading:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-heading')" label-placement="left">
<SpanCopyable :value="userCoords?.heading?.toString() || 'Unknown'" />
</n-form-item>
<n-form-item label="Speed:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-speed')" label-placement="left">
<SpanCopyable :value="userCoords?.speed?.toString() || 'Unknown'" />
</n-form-item>
<n-form-item label="Accuracy:" label-placement="left">
<n-form-item :label="t('tools.geo-distance-calculator.texts.label-accuracy')" label-placement="left">
<SpanCopyable :value="userCoords?.accuracy?.toString() || 'Unknown'" />
</n-form-item>
</n-space>
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { GPTTokens } from 'gpt-tokens';
import JSON5 from 'json5';
import type { supportModelType } from 'gpt-tokens';
@@ -6,6 +7,8 @@ import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { useValidation } from '@/composable/validation';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const { t } = useI18n();
const models = GPTTokens.supportModels;
const model = useQueryParamOrStorage({ name: 'model', storageName: 'gpt-counter:model', defaultValue: 'gpt-3.5-turbo-1106' });
@@ -20,7 +23,7 @@ const messagesValidation = useValidation({
source: messagesJsonArray,
rules: [
{
message: 'Invalid "messages" array',
message: t('tools.gpt-token-estimator.texts.message-invalid-messages-array'),
validator: value => value && JSON5.parse(value.trim()),
},
],
@@ -29,7 +32,7 @@ const toolsValidation = useValidation({
source: toolsJsonArray,
rules: [
{
message: 'Invalid "tools" array',
message: t('tools.gpt-token-estimator.texts.message-invalid-tools-array'),
validator: value => value && JSON5.parse(value.trim()),
},
],
@@ -93,56 +96,56 @@ const outputTokenCosts = computed(() => {
<c-select
v-model:value="model"
label-position="left"
label="Model:"
:label="t('tools.gpt-token-estimator.texts.label-model')"
:options="models"
placeholder="Select GPT model"
:placeholder="t('tools.gpt-token-estimator.texts.placeholder-select-gpt-model')"
mb-2
/>
<div flex justify-center>
<n-form-item label="Advanded JSON Mode" label-placement="left">
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-advanded-json-mode')" label-placement="left">
<n-checkbox v-model:checked="isAdvancedMode" mr-2 />
</n-form-item>
</div>
<c-card v-if="isAdvancedMode" title="Prompts">
<c-card v-if="isAdvancedMode" :title="t('tools.gpt-token-estimator.texts.title-prompts')">
<c-input-text
v-model:value="messagesJsonArray"
multiline raw-text
placeholder="Your 'messages' JSON array..."
:placeholder="t('tools.gpt-token-estimator.texts.placeholder-your-messages-json-array')"
rows="5"
autofocus
label="Your 'messages' JSON array:"
:label="t('tools.gpt-token-estimator.texts.label-your-messages-json-array')"
:validation="messagesValidation"
/>
<c-input-text
v-model:value="toolsJsonArray"
multiline raw-text
placeholder="Your 'tools' JSON array..."
:placeholder="t('tools.gpt-token-estimator.texts.placeholder-your-tools-json-array')"
rows="5"
autofocus
label="Your 'tools' JSON array:"
:label="t('tools.gpt-token-estimator.texts.label-your-tools-json-array')"
:validation="toolsValidation"
/>
</c-card>
<c-card v-else title="Input JSON(s)">
<c-card v-else :title="t('tools.gpt-token-estimator.texts.title-input-json-s')">
<c-input-text
v-model:value="systemPrompt"
multiline raw-text
placeholder="Your System Prompt content..."
:placeholder="t('tools.gpt-token-estimator.texts.placeholder-your-system-prompt-content')"
rows="2"
autofocus
label="Your System Prompt content:"
:label="t('tools.gpt-token-estimator.texts.label-your-system-prompt-content')"
/>
<c-input-text
v-model:value="userPrompt"
multiline raw-text
placeholder="Your User Prompt content..."
:placeholder="t('tools.gpt-token-estimator.texts.placeholder-your-user-prompt-content')"
rows="6"
autofocus
label="Your User Prompt content:"
:label="t('tools.gpt-token-estimator.texts.label-your-user-prompt-content')"
/>
</c-card>
@@ -153,16 +156,16 @@ const outputTokenCosts = computed(() => {
</c-alert>
<div v-if="!outputTokenCosts.error">
<n-form-item label="Used Tokens:">
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-used-tokens')">
<TextareaCopyable :value="outputTokenCosts.usedTokens" />
</n-form-item>
<n-form-item label="Prompt Tokens:">
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-prompt-tokens')">
<TextareaCopyable :value="outputTokenCosts.promptUsedTokens" />
</n-form-item>
<n-form-item label="Completion Tokens:">
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-completion-tokens')">
<TextareaCopyable :value="outputTokenCosts.completionUsedTokens" />
</n-form-item>
<n-form-item label="Used USD:">
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-used-usd')">
<TextareaCopyable :value="outputTokenCosts.usedUSD" />
</n-form-item>
</div>
Loaded 100 of 347 files, more files were not shown because too many files have changed in this diff. Show more