Skip to content

Commit b1e5cc2

Browse files
committed
feat: add clipboard text validation for YouTube download
- Check for clipboard text before processing URL - Display warning toast if no text is found in clipboard - Bump package version to 0.1.6
1 parent 11dfc32 commit b1e5cc2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kunkun/kunkun-ext-youtube-downloader",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"license": "MIT",
55
"exports": "./mod.ts",
66
"imports": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.kunkun.sh",
33
"name": "kunkun-ext-youtube-dowloader",
4-
"version": "0.1.5",
4+
"version": "0.1.6",
55
"license": "MIT",
66
"type": "module",
77
"kunkun": {

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ class DownloadYouTubeExtension extends TemplateUiCommand {
178178
});
179179
return ui.goBack();
180180
}
181-
181+
const hasText = await clipboard.hasText();
182+
if (!hasText) {
183+
toast.warning("No text found in clipboard");
184+
return ui.goBack();
185+
}
182186
let url = await clipboard.readText();
183187
// url = "https://youtu.be/-b1FogYHTZc"; // for development only
184188
// check if url is a valid youtube url

0 commit comments

Comments
 (0)