Compare commits

..
12 changed files with 854 additions and 84 deletions

No files matched your search

-21
View File
@@ -1,21 +0,0 @@
name: "Pull Requests Merge Conflicts Tagger"
on:
# So that PRs touching the same files as the push are updated
push:
# So that the `dirtyLabel` is removed if conflicts are resolve
# We recommend `pull_request_target` so that github secrets are available.
# In `pull_request` we wouldn't be able to change labels of fork PRs
pull_request_target:
types: [synchronize]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: check if prs are dirty
uses: eps1lon/actions-label-merge-conflict@v3
with:
dirtyLabel: "PR: needs rebase"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
# commentOnClean: "Conflicts have been resolved. A maintainer will review the pull request shortly."
+3 -3
View File
@@ -138,20 +138,19 @@ declare module '@vue/runtime-core' {
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NInput: typeof import('naive-ui')['NInput']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NLi: typeof import('naive-ui')['NLi']
NMenu: typeof import('naive-ui')['NMenu']
NP: typeof import('naive-ui')['NP']
NRadio: typeof import('naive-ui')['NRadio']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSlider: typeof import('naive-ui')['NSlider']
NSwitch: typeof import('naive-ui')['NSwitch']
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
PasteAsMarkdown: typeof import('./src/tools/paste-as-markdown/paste-as-markdown.vue')['default']
PdfSignatureChecker: typeof import('./src/tools/pdf-signature-checker/pdf-signature-checker.vue')['default']
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default']
@@ -182,6 +181,7 @@ declare module '@vue/runtime-core' {
TomlToYaml: typeof import('./src/tools/toml-to-yaml/toml-to-yaml.vue')['default']
'Tool.layout': typeof import('./src/layouts/tool.layout.vue')['default']
ToolCard: typeof import('./src/components/ToolCard.vue')['default']
TorrentToMagnet: typeof import('./src/tools/torrent-to-magnet/torrent-to-magnet.vue')['default']
UlidGenerator: typeof import('./src/tools/ulid-generator/ulid-generator.vue')['default']
UrlEncoder: typeof import('./src/tools/url-encoder/url-encoder.vue')['default']
UrlParser: typeof import('./src/tools/url-parser/url-parser.vue')['default']
+2 -1
View File
@@ -35,7 +35,6 @@
"release": "node ./scripts/release.mjs"
},
"dependencies": {
"@github/paste-markdown": "^1.5.3",
"@it-tools/bip39": "^0.0.4",
"@it-tools/oggen": "^1.3.0",
"@sindresorhus/slugify": "^2.2.1",
@@ -79,6 +78,7 @@
"netmask": "^2.0.2",
"node-forge": "^1.3.1",
"oui-data": "^1.0.10",
"parse-torrent": "^11.0.17",
"pdf-signature-reader": "^1.4.2",
"pinia": "^2.0.34",
"plausible-tracker": "^0.3.8",
@@ -135,6 +135,7 @@
"unplugin-icons": "^0.17.0",
"unplugin-vue-components": "^0.25.0",
"vite": "^4.4.9",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-pwa": "^0.16.0",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-svg-loader": "^4.0.0",
+714 -12
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -9,7 +9,7 @@ import { tool as textToUnicode } from './text-to-unicode';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as xmlToJson } from './xml-to-json';
import { tool as jsonToXml } from './json-to-xml';
import { tool as pasteAsMarkdown } from './paste-as-markdown';
import { tool as torrentToMagnet } from './torrent-to-magnet';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -134,6 +134,7 @@ export const toolsByCategory: ToolCategory[] = [
httpStatusCodes,
jsonDiff,
safelinkDecoder,
torrentToMagnet,
],
},
{
@@ -179,7 +180,6 @@ export const toolsByCategory: ToolCategory[] = [
textDiff,
numeronymGenerator,
asciiTextDrawer,
pasteAsMarkdown,
],
},
{
-12
View File
@@ -1,12 +0,0 @@
import { Markdown } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Paste as Markdown',
path: '/paste-as-markdown',
description: 'Paste cells/tables and links from clipboard content as Markdown',
keywords: ['paste', 'cell', 'table', 'links', 'md', 'markdown'],
component: () => import('./paste-as-markdown.vue'),
icon: Markdown,
createdAt: new Date('2024-07-14'),
});
@@ -1,31 +0,0 @@
<script setup lang="ts">
import { subscribe } from '@github/paste-markdown';
import CInputText from '@/ui/c-input-text/c-input-text.vue';
const inputElement = ref<typeof CInputText>();
const markdown = ref('');
// Subscribe the behavior to the textarea.
onMounted(() => {
subscribe(inputElement.value?.textareaRef as never);
});
</script>
<template>
<c-card title="Paste in Markdown" class="paste-zone">
<n-ul>
<n-li>Paste spreadsheet cells and HTML tables as a Markdown tables.</n-li>
<n-li>Paste URLs on selected text as Markdown links.</n-li>
<n-li>Paste text containing links as text containing Markdown links.</n-li>
<n-li>Paste image URLs as Markdown image links.</n-li>
</n-ul>
<CInputText
ref="inputElement"
v-model:value="markdown"
multiline
placeholder="Paste your content here..."
rows="10"
w-full
/>
</c-card>
</template>
+12
View File
@@ -0,0 +1,12 @@
import { Bookmarks } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Torrent to Magnet',
path: '/torrent-to-magnet',
description: 'Convert a torrent file to a Magnet url',
keywords: ['torrent', 'magnet', 'url', 'link'],
component: () => import('./torrent-to-magnet.vue'),
icon: Bookmarks,
createdAt: new Date('2024-04-20'),
});
+4
View File
@@ -0,0 +1,4 @@
declare module 'parse-torrent'{
export default function parseTorrent(content: string | ArrayBufferView): Promise<object>;
export function toMagnetURI(parsedTorrent: object): string;
}
@@ -0,0 +1,115 @@
<script setup lang="ts">
import type { Ref } from 'vue';
import parseTorrent, { toMagnetURI } from 'parse-torrent';
import { withDefaultOnError } from '@/utils/defaults';
import { useValidation } from '@/composable/validation';
const inputType = ref<'file' | 'content'>('file');
const torrentContent = ref('');
const fileInput = ref() as Ref<File | null>;
const torrentInfosRaw = computedAsync(async () => {
const file = fileInput.value;
const content = torrentContent.value;
try {
if (inputType.value === 'file' && file) {
return await parseTorrent(new Uint8Array(await file.arrayBuffer()));
}
else {
return await parseTorrent(content);
}
}
catch (e: any) {
return {
error: e.toString(),
};
}
});
const torrentInfos = computed(() => withDefaultOnError(() => {
return Object.entries(torrentInfosRaw.value).map(([k, v]) => {
return {
label: k?.toString() || '',
value: JSON.stringify(v),
};
});
}, []));
const magnetURI = computed(() => withDefaultOnError(() => toMagnetURI(torrentInfosRaw.value), []));
async function onUpload(file: File) {
if (file) {
fileInput.value = file;
}
}
watch(torrentContent, (_, newValue) => {
if (newValue !== '') {
fileInput.value = null;
}
});
const { attrs: validationAttrs } = useValidation({
source: torrentInfos,
rules: [{ message: 'Invalid torrent content', validator: torrent => torrent?.length > 0 }],
});
</script>
<template>
<div>
<n-radio-group v-model:value="inputType" name="radiogroup" mb-2 flex justify-center>
<n-space>
<n-radio
value="file"
label="File"
/>
<n-radio
value="content"
label="Content"
/>
</n-space>
</n-radio-group>
<c-file-upload
v-if="inputType === 'file'"
title="Drag and drop torrent file here, or click to select a file"
@file-upload="onUpload"
/>
<c-input-text
v-if="inputType === 'content'"
v-model:value="torrentContent"
label="Torrent/Magnet Content"
placeholder="Paste your Torrent/Magnet content here"
multiline
mb-2
/>
<n-divider />
<input-copyable
label="Magnet URI"
label-position="left"
label-width="100px"
label-align="right"
mb-2
:value="validationAttrs.validationStatus === 'error' ? '' : magnetURI"
placeholder="Please use a correct torrent"
/>
<input-copyable
v-for="{ label, value } of torrentInfos"
:key="label"
:label="label"
label-position="left"
label-width="100px"
label-align="right"
mb-2
:value="validationAttrs.validationStatus === 'error' ? '' : value"
placeholder="Please use a correct torrent"
/>
</div>
</template>
<style lang="less" scoped>
::v-deep(.n-upload-trigger) {
width: 100%;
}
</style>
-2
View File
@@ -137,8 +137,6 @@ onMounted(() => {
defineExpose({
inputWrapperRef,
textareaRef,
inputRef,
focus,
blur,
});
+2
View File
@@ -15,6 +15,7 @@ import { VitePWA } from 'vite-plugin-pwa';
import markdown from 'vite-plugin-vue-markdown';
import svgLoader from 'vite-svg-loader';
import { configDefaults } from 'vitest/config';
import { nodePolyfills } from 'vite-plugin-node-polyfills'
const baseUrl = process.env.BASE_URL ?? '/';
@@ -97,6 +98,7 @@ export default defineConfig({
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
}),
Unocss(),
nodePolyfills(),
],
base: baseUrl,
resolve: {