···18 {
19 "name": "instance_url",
20 "title": "Instance URL",
21- "description": "The cobalt.tools instance to use. Please make sure that the instance you choose is trustworthy.",
22 "type": "textfield",
23 "default": "https://dl.woof.monster",
24- "placeholder": "https://cobalt.sudoman.ia",
25 "required": false
26 },
27 {
···49 {
50 "name": "default_folder",
51 "title": "Download media to",
52- "description": "The default folder to save media. This does not apply to media that can only be downloaded via the web browser.",
53 "type": "directory",
54 "required": true
0000000055 }
56 ],
57 "dependencies": {
···18 {
19 "name": "instance_url",
20 "title": "Instance URL",
21+ "description": "The cobalt.tools instance to use. Please make sure that the instance you choose is trustworthy, as malicious instances can be used to get info about your device.",
22 "type": "textfield",
23 "default": "https://dl.woof.monster",
24+ "placeholder": "https://dl.woof.monster",
25 "required": false
26 },
27 {
···49 {
50 "name": "default_folder",
51 "title": "Download media to",
52+ "description": "The default folder to save media.",
53 "type": "directory",
54 "required": true
55+ },
56+ {
57+ "name": "show_in_file_manager",
58+ "label": "Show media in file manager when download finishes",
59+ "description": "Shows where the media has been saved in the file manager",
60+ "type": "checkbox",
61+ "default": true,
62+ "required": false
63 }
64 ],
65 "dependencies": {
+33-12
src/download-media.tsx
···52 const media = await fetch(res.url);
53 await pipeline(Readable.fromWeb(media.body), fs.createWriteStream(`${values.destination}/${res.filename}`));
5455- switch (os.type()) {
56- case "Darwin":
57- await showHUD("Opened in Finder");
58- break;
59- case "Windows_NT":
60- await showHUD("Opened in File Explorer");
61- break;
000000000000000000000000062 }
63- await showInFinder(`${values.destination}/${res.filename}`);
64- await closeMainWindow({
65- clearRootSearch: true,
66- popToRootType: PopToRootType.Immediate,
67- });
68 break;
69 }
70 case "error":
···52 const media = await fetch(res.url);
53 await pipeline(Readable.fromWeb(media.body), fs.createWriteStream(`${values.destination}/${res.filename}`));
5455+ if (preferences.show_in_file_manager) {
56+ switch (os.type()) {
57+ case "Darwin":
58+ await showHUD("Opened in Finder");
59+ break;
60+ case "Windows_NT":
61+ await showHUD("Opened in File Explorer");
62+ break;
63+ }
64+ await showInFinder(`${values.destination}/${res.filename}`);
65+ await closeMainWindow({
66+ // showHUD can close the main window, making this redundant, but
67+ // we still needed to open the file manager, so we fully close
68+ // it here
69+ clearRootSearch: true,
70+ popToRootType: PopToRootType.Immediate,
71+ });
72+ } else {
73+ await closeMainWindow();
74+ showToast({
75+ // showHUD does not allow subtitles, so we close the main window
76+ // and show a "toast" instead.
77+ title: "Media successfully downloaded",
78+ message: res.filename,
79+ style: Toast.Style.Success,
80+ });
81+ await closeMainWindow({
82+ // we still needed to show the toast, now that we have, we can
83+ // fully close the main window
84+ clearRootSearch: true,
85+ popToRootType: PopToRootType.Immediate,
86+ });
87 }
88+000089 break;
90 }
91 case "error":