File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
src/tools/torrent-to-magnet Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,12 @@ declare module '@vue/runtime-core' {
144
144
NLayoutSider : typeof import ( 'naive-ui' ) [ 'NLayoutSider' ]
145
145
NMenu : typeof import ( 'naive-ui' ) [ 'NMenu' ]
146
146
NP : typeof import ( 'naive-ui' ) [ 'NP' ]
147
+ NRadio : typeof import ( 'naive-ui' ) [ 'NRadio' ]
148
+ NRadioGroup : typeof import ( 'naive-ui' ) [ 'NRadioGroup' ]
147
149
NScrollbar : typeof import ( 'naive-ui' ) [ 'NScrollbar' ]
150
+ NSpace : typeof import ( 'naive-ui' ) [ 'NSpace' ]
148
151
NSpin : typeof import ( 'naive-ui' ) [ 'NSpin' ]
152
+ NStatistic : typeof import ( 'naive-ui' ) [ 'NStatistic' ]
149
153
NumeronymGenerator : typeof import ( './src/tools/numeronym-generator/numeronym-generator.vue' ) [ 'default' ]
150
154
OtpCodeGeneratorAndValidator : typeof import ( './src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue' ) [ 'default' ]
151
155
PasswordStrengthAnalyser : typeof import ( './src/tools/password-strength-analyser/password-strength-analyser.vue' ) [ 'default' ]
Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ import parseTorrent, { toMagnetURI } from 'parse-torrent';
4
4
import { withDefaultOnError } from ' @/utils/defaults' ;
5
5
import { useValidation } from ' @/composable/validation' ;
6
6
7
+ const inputType = ref <' file' | ' content' >(' file' );
7
8
const torrentContent = ref (' ' );
8
9
const fileInput = ref () as Ref <File | null >;
9
10
const torrentInfosRaw = computedAsync (async () => {
10
11
const file = fileInput .value ;
11
12
const content = torrentContent .value ;
12
13
try {
13
- if (file ) {
14
+ if (inputType . value === ' file ' && file ) {
14
15
return await parseTorrent (new Uint8Array (await file .arrayBuffer ()));
15
16
}
16
17
else {
@@ -53,14 +54,27 @@ const { attrs: validationAttrs } = useValidation({
53
54
54
55
<template >
55
56
<div >
57
+ <n-radio-group v-model:value =" inputType" name =" radiogroup" mb-2 flex justify-center >
58
+ <n-space >
59
+ <n-radio
60
+ value =" file"
61
+ label =" File"
62
+ />
63
+ <n-radio
64
+ value =" content"
65
+ label =" Content"
66
+ />
67
+ </n-space >
68
+ </n-radio-group >
69
+
56
70
<c-file-upload
71
+ v-if =" inputType === 'file'"
57
72
title =" Drag and drop torrent file here, or click to select a file"
58
73
@file-upload =" onUpload"
59
74
/>
60
75
61
- <n-p text-center >OR</n-p >
62
-
63
76
<c-input-text
77
+ v-if =" inputType === 'content'"
64
78
v-model:value =" torrentContent"
65
79
label =" Torrent/Magnet Content"
66
80
placeholder =" Paste your Torrent/Magnet content here"
You can’t perform that action at this time.
0 commit comments