Skip to content

Commit

Permalink
feat: ✨ use the silent parameter for immediate download
Browse files Browse the repository at this point in the history
  • Loading branch information
caorushizi committed Jan 1, 2025
1 parent 9169caf commit ee3b8a4
Show file tree
Hide file tree
Showing 7 changed files with 461 additions and 308 deletions.
3 changes: 3 additions & 0 deletions .cspell/custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ Qrcode
redownload
Redownload
reduxjs
remusao
rmvb
shadcn
Sider
smaz
stylelint
svgr
svgz
tailwindcss
TDAPP
tiptap
tldts
tseslint
typeorm
vaul
Expand Down
13 changes: 12 additions & 1 deletion packages/main/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
"homepage": "https://downloader.caorushizi.cn/",
"license": "MIT",
"dependencies": {
"@ghostery/adblocker": "^2.3.1",
"@ghostery/adblocker-content": "^2.3.1",
"@ghostery/adblocker-electron": "^2.3.1",
"node-pty": "^1.0.0"
"@ghostery/adblocker-electron-preload": "^2.3.1",
"@ghostery/adblocker-extended-selectors": "^2.3.1",
"@remusao/guess-url-type": "^1.3.0",
"@remusao/small": "^1.3.0",
"@remusao/smaz": "^1.10.0",
"@remusao/smaz-compress": "^1.10.0",
"@remusao/smaz-decompress": "^1.10.0",
"@remusao/trie": "^1.5.0",
"node-pty": "^1.0.0",
"tldts-experimental": "^6.1.70"
},
"devDependencies": {
"electron": "30.0.8"
Expand Down
1 change: 1 addition & 0 deletions packages/main/scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const external = [
"aws-sdk",
"mock-aws-s3",
"@ghostery/adblocker-electron",
"tldts-experimental",
"node-pty",
];

Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"ahooks": "^3.8.0",
"antd": "^5.18.0",
"antd": "^5.22.7",
"antd-style": "^3.6.2",
"axios": "^1.7.2",
"class-variance-authority": "^0.7.0",
Expand Down
24 changes: 17 additions & 7 deletions packages/renderer/src/pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,23 @@ const HomePage: FC<Props> = ({ filter = DownloadFilter.list }) => {
// new
if (search.has("n")) {
const type = search.get("type");
const item: DownloadFormType = {
batch: false,
type: isDownloadType(type) ? type : DownloadType.m3u8,
url: search.get("url") || "",
name: search.get("name") || randomName(),
};
newFormRef.current?.openModal(item);
const silent = !!search.get("silent");
if (silent) {
const item: Omit<DownloadItem, "id"> = {
type: isDownloadType(type) ? type : DownloadType.m3u8,
url: search.get("url") || "",
name: search.get("name") || randomName(),
};
downloadNow(item);
} else {
const item: DownloadFormType = {
batch: false,
type: isDownloadType(type) ? type : DownloadType.m3u8,
url: search.get("url") || "",
name: search.get("name") || randomName(),
};
newFormRef.current?.openModal(item);
}
}
}, [location.search]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@/store";
import { generateUrl, randomName } from "@/utils";
import { useMemoizedFn } from "ahooks";
import { Empty, Space, Spin, message } from "antd";
import { Empty, Space, Spin, message, Splitter } from "antd";
import React, { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
Expand Down Expand Up @@ -172,7 +172,7 @@ export function BrowserView() {
}

return (
<div className="flex h-full min-w-60 max-w-60 flex-col gap-3 overflow-y-auto bg-white p-3 dark:bg-[#1F2024]">
<div className="flex h-full flex-col gap-3 overflow-y-auto bg-white p-3 dark:bg-[#1F2024]">
{store.sources.map((item, index) => {
return (
<div
Expand Down Expand Up @@ -218,10 +218,14 @@ export function BrowserView() {

return (
<div className="flex flex-1 flex-col overflow-hidden">
<div className="flex h-full flex-1 gap-2">
{renderContent()}
{renderSidePanel()}
</div>
<Splitter className="flex h-full flex-1 gap-2">
<Splitter.Panel>{renderContent()}</Splitter.Panel>
{store.sources.length && (
<Splitter.Panel defaultSize={240} min="20%" max="70%">
{renderSidePanel()}
</Splitter.Panel>
)}
</Splitter>
<DownloadForm
id="browser"
isEdit
Expand Down
Loading

0 comments on commit ee3b8a4

Please sign in to comment.