Compare commits

...

388 Commits

Author SHA1 Message Date
士子☀️ 635377d227 Merge pull request #153 from caorushizi/feat/webcontentsView
Feat/webcontents view
2024-05-22 21:11:38 +08:00
caorushizi dc86ab8f4c feat: release 2.2.0 2024-05-22 21:09:25 +08:00
caorushizi 36b63ad916 fix: 🐛 bilibili 2024-05-22 20:56:18 +08:00
士子☀️ e1b378811d Merge pull request #152 from caorushizi/feat/webcontentsView
fix: 🐛  .env
2024-05-22 19:30:00 +08:00
caorushizi 37fb9bba75 fix: 🐛 .env 2024-05-22 19:28:19 +08:00
士子☀️ 848253c678 Merge pull request #151 from caorushizi/feat/webcontentsView
Feat/webcontents view
2024-05-22 18:19:33 +08:00
caorushizi b64e779ed1 feat: release 2.2.0-beta.4 2024-05-22 18:18:07 +08:00
caorushizi 046a62cde3 fix: 🐛 load url 2024-05-22 18:16:38 +08:00
caorushizi 1a9e6efb90 feat: use webcontents view and capture page 2024-05-22 15:15:39 +08:00
士子☀️ fd422c15ba Merge pull request #150 from caorushizi/fix/addForm
fix: 🐛  fix run release scripts
2024-05-22 04:04:18 +08:00
caorushizi c338f76f8d fix: 🐛 fix run release scripts 2024-05-22 04:03:32 +08:00
士子☀️ 4285b3f4f7 Merge pull request #149 from caorushizi/fix/addForm
feat:   支持直播视频下载
2024-05-22 03:51:41 +08:00
caorushizi d0109869a6 feat: 支持直播视频下载 2024-05-22 03:50:38 +08:00
士子☀️ d29ad44c54 Merge pull request #148 from caorushizi/fix/addForm
fix: 🐛  float button position
2024-05-22 01:02:50 +08:00
caorushizi be61b07fea fix: 🐛 float button position 2024-05-22 01:01:38 +08:00
士子☀️ e5e171fb6f Merge pull request #147 from caorushizi/fix/addForm
fix: 🐛  release 2.2.0-beta.3
2024-05-22 00:33:59 +08:00
caorushizi 805d97c3ca fix: 🐛 release 2.2.0-beta.3 2024-05-22 00:32:35 +08:00
士子☀️ 040222f259 Merge pull request #146 from caorushizi/fix/addForm
fix: 🐛  fix browser window event
2024-05-21 22:52:39 +08:00
caorushizi 09ed55eba4 fix: 🐛 fix browser window event 2024-05-21 22:51:40 +08:00
士子☀️ a6d4f8cf98 Merge pull request #145 from caorushizi/fix/addForm
fix: 🐛  release 2.2.0-beta.2
2024-05-21 02:38:48 +08:00
caorushizi d19b2394e8 fix: 🐛 release 2.2.0-beta.2 2024-05-21 02:37:40 +08:00
士子☀️ 036a99d84d Merge pull request #143 from caorushizi/fix/video
Fix/video
2024-05-14 12:22:24 +08:00
caorushizi b022335af7 feat: release 2.2.0-beta.1 2024-05-14 12:21:21 +08:00
caorushizi a66c20c9d5 feat: 修复页面中下载嗅探问题 2024-05-14 12:19:47 +08:00
caorushizi f9fc135647 fix: 🐛 修复 dom-ready 执行的顺序 2024-05-13 09:49:34 +08:00
士子☀️ fbbee9c114 Merge pull request #142 from caorushizi/fix/docs
Fix/docs
2024-05-13 09:42:35 +08:00
caorushizi a65fbcbaf8 fix: 🐛 修复插件展现运行的时机 2024-05-13 09:41:06 +08:00
士子☀️ 39b68b71d4 refactor: 📦️ modify mediago protocol, upgrade adblocker 2024-05-13 01:51:13 +08:00
士子☀️ 4d12a0a937 Merge pull request #140 from caorushizi/fix/docs
ci: 🎡  github actions
2024-05-02 19:01:16 +08:00
士子☀️ 960973302e ci: 🎡 github actions 2024-05-02 18:58:01 +08:00
士子☀️ 1a68b00bdd Merge pull request #139 from caorushizi/fix/docs
ci: 🎡  modify github actions
2024-05-02 18:32:22 +08:00
士子☀️ dba73fc473 ci: 🎡 modify github actions 2024-05-02 18:30:24 +08:00
士子☀️ 211f7314ce Merge pull request #138 from caorushizi/fix/docs
docs: 📝  remove reaction
2024-05-02 18:18:19 +08:00
士子☀️ 64d719a63a docs: 📝 remove reaction 2024-05-02 18:17:19 +08:00
士子☀️ 0304e6b569 Merge pull request #135 from caorushizi/feat/mediago
Feat/mediago
2024-04-05 23:46:23 +08:00
士子☀️ 190447a0bd feat: release v2.2.0-beta.0 2024-04-05 23:44:13 +08:00
士子☀️ 497d1265f0 chore: 🔨 add lint-staged 2024-04-05 23:42:35 +08:00
士子☀️ 6d459e0692 feat: rename mediago 2024-04-05 23:09:30 +08:00
士子☀️ 45cde40cea chore: 🔨 fix pre-commit 2024-04-05 22:36:13 +08:00
士子☀️ e9deb4c7f7 chore: 🔨 use tsx instead of ts-node 2024-04-05 22:02:59 +08:00
caorushizi 1abfc763dc docs: 📝 update waline client 2024-03-26 14:31:00 +08:00
caorushizi b84ddcc88d docs: 📝 update vitepress 2024-03-26 13:02:22 +08:00
士子☀️ 33f7951901 refactor: 📦️ remove submodule 2024-03-20 23:23:09 +08:00
士子☀️ d3354f9109 Merge pull request #125 from caorushizi/feat/player
refactor: 📦️  remove tsno
2024-03-20 19:32:06 +08:00
caorushizi d252816cc3 refactor: 📦️ remove tsno 2024-03-20 19:29:27 +08:00
士子☀️ 6e31904e95 Merge pull request #124 from caorushizi/feat/player
refactor: 📦️  remove video player
2024-03-20 16:59:12 +08:00
caorushizi 2825d1f4c7 refactor: 📦️ remove video player 2024-03-20 16:50:58 +08:00
士子☀️ fcb10c6137 Merge pull request #118 from caorushizi/feat/player
fix: 🐛  catch video
2024-03-17 18:04:27 +08:00
士子☀️ f564739578 fix: 🐛 catch video 2024-03-17 18:03:24 +08:00
士子☀️ 40faf4b383 Merge pull request #117 from caorushizi/feat/player
fix: 🐛  fix mobile video size
2024-03-17 17:46:01 +08:00
士子☀️ affff353bd fix: 🐛 fix mobile video size 2024-03-17 17:45:04 +08:00
士子☀️ f410fabff7 Merge pull request #116 from caorushizi/feat/player
fix: 🐛  fix video container
2024-03-17 17:22:13 +08:00
士子☀️ 7d4b201b6e fix: 🐛 fix video container 2024-03-17 17:21:10 +08:00
士子☀️ a9ac0aa16b Merge pull request #115 from caorushizi/2.1.0-beta.1
feat:   v2.1.0-beta.1
2024-03-17 16:09:16 +08:00
士子☀️ 5419970080 feat: v2.1.0-beta.1 2024-03-17 16:08:34 +08:00
士子☀️ 506a573180 Merge pull request #114 from caorushizi/feat/dialog
fix: 🐛 按照获取时间正序排列
2024-03-17 02:03:43 +08:00
士子☀️ 17b2450b43 feat: use download dialog 2024-03-17 02:01:32 +08:00
士子☀️ 2942e65a54 fix: 🐛 按照获取时间正序排列 2024-03-17 00:17:47 +08:00
士子☀️ 913a7bd9e5 Merge pull request #113 from caorushizi/feat/dialog
feat:   show download dialog
2024-03-17 00:12:31 +08:00
士子☀️ c5f2edd9de feat: show download dialog 2024-03-17 00:09:34 +08:00
士子☀️ 24d511e6b6 Merge pull request #112 from caorushizi/feat/plugins
feat:  bilibili plguins
2024-03-10 19:23:15 +08:00
士子☀️ 47f3336f9a feat: 2.1.0-beta.0 2024-03-10 19:22:30 +08:00
士子☀️ e0e6e5dbed feat: bilibili plguins 2024-03-10 19:19:27 +08:00
士子☀️ aa7f3e7bf7 Merge pull request #111 from caorushizi/feat/terminal
feat:  use terminal
2024-03-10 16:43:04 +08:00
caorushizi 065a6c45f7 feat: terminal 2024-03-10 16:40:25 +08:00
士子☀️ b13174dda1 feat: use terminal 2024-03-10 16:19:16 +08:00
士子☀️ 9e6a931a41 Merge pull request #109 from caorushizi/feat/terminal
feat:  terminal
2024-03-09 08:57:23 +08:00
士子☀️ cdabdfd2f8 feat: layout style 2024-03-09 01:06:49 +08:00
士子☀️ b4cdbd7547 feat: show terminal 2024-03-09 00:05:15 +08:00
caorushizi 75fe603919 feat: terminal 2024-03-08 21:35:05 +08:00
士子☀️ 16ef9ae642 Merge pull request #104 from caorushizi/feat/actions
feat:   add vscode debug config
2024-02-27 23:13:35 +08:00
士子☀️ 7db3162748 feat: add vscode debug config 2024-02-27 23:11:37 +08:00
士子☀️ 3f0e6d9856 Merge pull request #102 from caorushizi/feat/actions
feat:   update actions version
2024-02-27 01:04:51 +08:00
士子☀️ d87fc4a400 feat: update actions version 2024-02-27 01:03:26 +08:00
士子☀️ ec6241b79e Merge pull request #101 from caorushizi/fix/node-pty
fix: 🐛  cannot find module 'node-pty'
2024-02-27 00:50:42 +08:00
士子☀️ 9b37398e9f fix: 🐛 cannot find module 'node-pty' 2024-02-27 00:49:05 +08:00
士子☀️ 3fca8694ee fix: 🐛 filename 2024-02-25 23:39:24 +08:00
士子☀️ 78efffa29b Merge pull request #95 from caorushizi/dev/terminal
Dev/terminal
2024-02-25 22:40:02 +08:00
士子☀️ 737ecbdadd fix: 🐛 build player 2024-02-25 22:37:34 +08:00
士子☀️ fa6ce22ea7 Merge pull request #94 from caorushizi/dev/terminal
Dev/terminal
2024-02-25 22:22:36 +08:00
士子☀️ 315c55c844 feat: terminal 2024-02-25 18:28:37 +08:00
士子☀️ d9ba60e1a5 feat: terminal 2024-02-25 17:31:58 +08:00
士子☀️ 7503322d01 feat: terminal 2024-02-25 13:36:14 +08:00
士子☀️ 2e5f2dc687 Merge pull request #91 from caorushizi/dev/plugins
style: 💄 eslint
2024-02-24 23:28:27 +08:00
士子☀️ e4afd27908 fix: 🐛 add tsconfig 2024-02-24 23:19:09 +08:00
士子☀️ 6fe5d5523e feat: remove player page. use node-pty 2024-02-24 22:50:03 +08:00
士子☀️ 7335946ec2 refactor: 📦️ refactoring the project directory structure 2024-02-23 19:32:06 +08:00
士子☀️ eb4576de9b feat: 使用 node 伪终端 2024-02-21 22:17:02 +08:00
士子☀️ 1e41a9ee99 feat: node 伪终端获取详细日志 2024-02-21 21:44:12 +08:00
士子☀️ dd5226ab47 refactor: 📦️ downloader 2024-02-12 09:56:07 +08:00
士子☀️ 989e5535eb feat: new player 2024-02-12 01:55:11 +08:00
士子☀️ 65efeed692 style: 💄 eslint 2024-02-11 23:18:45 +08:00
士子☀️ fcddb2d382 Merge pull request #88 from caorushizi/dev/plugins
fix: 🐛  types
2024-02-11 18:13:57 +08:00
士子☀️ bbc892ec81 fix: 🐛 types 2024-02-11 18:08:51 +08:00
士子☀️ ca1c2821a7 Merge pull request #87 from caorushizi/dev/plugins
fix: 🐛  types
2024-02-11 18:02:50 +08:00
士子☀️ c8d4f763fd fix: 🐛 types 2024-02-11 18:00:08 +08:00
士子☀️ a3d587af44 Merge pull request #85 from caorushizi/dev/plugins
feat:  new plugin
2024-02-11 17:00:28 +08:00
士子☀️ ce2146cc89 feat: add plugin 2024-02-11 16:59:02 +08:00
士子☀️ 8455f17517 style: 💄 somthing 2024-02-11 10:45:32 +08:00
士子☀️ c075bdd4f9 feat: new plugin 2024-02-09 22:18:35 +08:00
士子☀️ 65d88d0896 Merge pull request #82 from caorushizi/dev/i18n
feat: display language
2024-02-09 17:01:55 +08:00
士子☀️ 1c62640301 style: 💄 add lint-staged 2024-02-09 17:00:48 +08:00
士子☀️ dd6684c550 feat: build plugin
build plugin with lit.
2024-02-09 15:54:22 +08:00
士子☀️ 2e1a753583 test 2024-02-09 15:41:34 +08:00
士子☀️ cbf6e4ecfb test 2024-02-09 15:26:20 +08:00
士子☀️ 5af471fe1a plugin 2024-02-09 13:23:52 +08:00
士子☀️ 0deb205faa plugin 2024-02-09 00:11:40 +08:00
士子☀️ 73eaf0ecaa plugin 2024-02-09 00:10:32 +08:00
士子☀️ 4791defbdd sniffing helper 2024-02-08 18:23:49 +08:00
士子☀️ 926249184b i18n 2024-02-08 15:12:08 +08:00
士子☀️ 659b2755ef feat: display language 2024-02-04 20:15:43 +08:00
士子☀️ e9d36edaa4 v2.0.3-beta.3 2024-01-22 23:01:56 +08:00
士子☀️ fdcdbf27eb dev tools 2024-01-22 22:25:29 +08:00
士子☀️ 2f5cc2eb80 Merge branch 'master' of https://github.com/caorushizi/m3u8-downloader 2024-01-21 19:11:42 +08:00
士子☀️ c087fa4956 webview 2024-01-21 19:10:11 +08:00
士子☀️ ed33ec6532 actions 2024-01-21 17:54:37 +08:00
士子☀️ 2d96c2730c .npmrc 2024-01-21 17:41:59 +08:00
士子☀️ 5bcec10be3 docs 2024-01-21 17:18:02 +08:00
士子☀️ 207bd15b14 .npmrc 2024-01-21 17:07:41 +08:00
士子☀️ 00f0bfc84b os version 2024-01-21 17:06:59 +08:00
士子☀️ 7bc3f83c88 update electron. 2024-01-21 16:56:59 +08:00
士子☀️ 1af2803c22 eslint 2024-01-21 01:20:02 +08:00
士子☀️ fd6a81abfd package version 2024-01-21 00:01:09 +08:00
士子☀️ a383093914 Merge pull request #71 from caorushizi/dependabot/npm_and_yarn/typescript-eslint/parser-6.19.0
build(deps-dev): bump @typescript-eslint/parser from 5.60.0 to 6.19.0
2024-01-20 23:29:33 +08:00
士子☀️ 13656429af Merge pull request #70 from caorushizi/dependabot/npm_and_yarn/better-sqlite3-9.3.0
build(deps): bump better-sqlite3 from 8.7.0 to 9.3.0
2024-01-20 23:29:11 +08:00
dependabot[bot] bc34881b38 build(deps-dev): bump @typescript-eslint/parser from 5.60.0 to 6.19.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.60.0 to 6.19.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.19.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-20 15:11:08 +00:00
dependabot[bot] e3b11cb087 build(deps): bump better-sqlite3 from 8.7.0 to 9.3.0
Bumps [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) from 8.7.0 to 9.3.0.
- [Release notes](https://github.com/WiseLibs/better-sqlite3/releases)
- [Commits](https://github.com/WiseLibs/better-sqlite3/compare/v8.7.0...v9.3.0)

---
updated-dependencies:
- dependency-name: better-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-20 15:11:00 +00:00
士子☀️ 8df78ca377 Merge pull request #61 from caorushizi/dependabot/npm_and_yarn/typescript-5.3.3
build(deps-dev): bump typescript from 5.1.6 to 5.3.3
2024-01-20 23:08:49 +08:00
士子☀️ f12919c6bc Update README.md 2024-01-16 23:02:29 +08:00
士子☀️ 00df324ae7 Merge pull request #66 from caorushizi/readme
readme
2024-01-15 22:25:23 +08:00
士子☀️ f14f9ffc1b readme 2024-01-15 22:23:40 +08:00
dependabot[bot] a388b725bc build(deps-dev): bump typescript from 5.1.6 to 5.3.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.1.6 to 5.3.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.3.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-14 07:37:58 +00:00
caorushizi e64eaeefef macos 2024-01-14 15:35:15 +08:00
士子☀️ 6830d69b62 build script. 2024-01-14 12:09:08 +08:00
士子☀️ 8f609a8e93 checkout 2024-01-14 10:42:54 +08:00
士子☀️ 99c23f47c5 setup go 2024-01-14 10:36:14 +08:00
士子☀️ 95f9e20f39 go build 2024-01-14 01:34:08 +08:00
士子☀️ df1e664bc9 Merge pull request #60 from caorushizi/dev0114
add plugin
2024-01-14 01:25:05 +08:00
士子☀️ fec30a6453 add plugin 2024-01-14 01:24:24 +08:00
士子☀️ a048211486 add plugin 2024-01-14 01:14:02 +08:00
士子☀️ 465e9b2988 add plugin 2024-01-13 23:19:19 +08:00
士子☀️ af1ff19cb2 add web plugin 2024-01-13 20:28:58 +08:00
士子☀️ eae470f2ec video server 2024-01-13 12:24:52 +08:00
士子☀️ 1933799e32 feat: video list. 2024-01-13 01:03:46 +08:00
士子☀️ c7977bf7b4 Merge pull request #55 from caorushizi/dependabot/npm_and_yarn/electron-25.8.4
build(deps-dev): bump electron from 25.2.0 to 25.8.4
2023-12-29 16:40:43 +08:00
士子☀️ ce8407ce46 Merge pull request #58 from caorushizi/dependabot/npm_and_yarn/axios-1.6.0
build(deps): bump axios from 1.4.0 to 1.6.0
2023-12-29 16:40:01 +08:00
dependabot[bot] 5d313df190 build(deps): bump axios from 1.4.0 to 1.6.0
Bumps [axios](https://github.com/axios/axios) from 1.4.0 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.4.0...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-11 13:41:05 +00:00
dependabot[bot] c560a09904 build(deps-dev): bump electron from 25.2.0 to 25.8.4
Bumps [electron](https://github.com/electron/electron) from 25.2.0 to 25.8.4.
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v25.2.0...v25.8.4)

---
updated-dependencies:
- dependency-name: electron
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-05 17:37:26 +00:00
士子☀️ df66a92989 Merge pull request #46 from caorushizi/feat/v2.1.0
m3u8
2023-08-22 14:49:01 +08:00
士子☀️ 52c9611e49 m3u8 2023-08-07 23:54:19 +08:00
士子☀️ 4018112a1d 优化二进制调用逻辑 2023-08-02 21:26:46 +08:00
士子☀️ 633a257e65 优化表单 2023-08-01 23:49:22 +08:00
caorushizi 0666d41226 工程优化 2023-07-29 14:14:37 +08:00
士子☀️ c2cfe55e24 Merge pull request #43 from caorushizi/dev/2.1.0 2023-07-29 13:43:37 +08:00
士子☀️ cb7fbddd7a 工程优化 2023-07-29 13:41:16 +08:00
士子☀️ 135d9fed1b 工程优化 2023-07-29 10:39:27 +08:00
士子☀️ 267aedc594 工程优化 2023-07-29 09:24:11 +08:00
士子☀️ 325d0da930 工程优化 2023-07-29 00:28:01 +08:00
士子☀️ 615bc74d15 Merge pull request #42 from caorushizi/dev/2.1.0 2023-07-27 17:59:32 +08:00
士子☀️ 1ca6935d36 download form. 2023-07-24 23:49:10 +08:00
士子☀️ 3bfb7139d3 download form. 2023-07-22 12:56:56 +08:00
士子☀️ 14d44765e5 form name 2023-07-22 00:03:58 +08:00
士子☀️ 807dd2d920 request 2023-07-21 23:39:02 +08:00
士子☀️ c9a0a7f7c2 request 2023-07-21 23:31:07 +08:00
士子☀️ a3eea6d501 v2.1.0 2023-07-20 23:25:33 +08:00
士子☀️ 4ce7dcac1b Merge pull request #38 from caorushizi/dev 2023-07-18 23:51:35 +08:00
士子☀️ 096762f24c some thing 2023-07-18 23:49:03 +08:00
士子☀️ baf358d223 something 2023-07-18 23:44:22 +08:00
士子☀️ e72973346b add: get web request. 2023-07-12 00:30:15 +08:00
士子☀️ 41258ecee8 add: get web request response. 2023-07-11 22:48:14 +08:00
士子☀️ b6a5be152a Merge pull request #37 from caorushizi/dev0709 2023-07-09 15:39:55 +08:00
士子☀️ d5d45c4935 fix: download use proxy. 2023-07-09 15:38:48 +08:00
士子☀️ 81eb4ecf09 Merge pull request #36 from caorushizi/dev0709 2023-07-09 15:09:23 +08:00
士子☀️ 5a4cc8c449 bin dir 2023-07-09 15:07:57 +08:00
士子☀️ e7ab664310 release: v2.0.2 2023-07-09 14:54:21 +08:00
士子☀️ 3cb2fa27b9 release: v2.0.2 2023-07-09 14:18:41 +08:00
士子☀️ e29e41aa4c release: v2.0.2 2023-07-09 14:01:15 +08:00
士子☀️ cc62613640 Merge pull request #35 from caorushizi/release/v2.0.2 2023-07-09 13:53:19 +08:00
士子☀️ 2720bcc685 release: v2.0.2 2023-07-09 13:52:40 +08:00
士子☀️ c8ac4182fc Merge pull request #34 from caorushizi/release/v2.0.2 2023-07-09 13:25:36 +08:00
士子☀️ 55b70d3e6d release: v2.0.2 2023-07-09 13:24:06 +08:00
士子☀️ a19765b0d3 fix: browser loading status. 2023-07-08 23:05:13 +08:00
士子☀️ 5c7b65385a remove postinstall 2023-07-08 16:34:34 +08:00
caorushizi b6b84269a3 fix: mac app. 2023-07-08 15:55:12 +08:00
士子☀️ e44cb249d0 Merge pull request #30 from caorushizi/feat/v2.0.2 2023-07-08 12:11:51 +08:00
士子☀️ 8bea071865 release size. 2023-07-08 12:00:50 +08:00
caorushizi a782652fca fix: tray icon. 2023-07-06 22:49:11 +08:00
caorushizi 3a02803d3c fix: mac download. 2023-07-06 22:16:28 +08:00
士子☀️ 263a08ab4c Merge pull request #29 from caorushizi/feat/v2.0.2 2023-07-06 00:32:55 +08:00
士子☀️ ecdbd985ce feat: tray context menu. 2023-07-06 00:32:05 +08:00
士子☀️ dd403564cc docs: addition function. 2023-07-06 00:15:57 +08:00
士子☀️ 69d741b39a Merge pull request #28 from caorushizi/dev 2023-07-05 23:53:59 +08:00
士子☀️ 4c9c2e2d68 add: tray icon. 2023-07-05 23:52:38 +08:00
士子☀️ 8660701340 download list. 2023-07-05 22:48:41 +08:00
士子☀️ 341c5570af support live mode. 2023-07-05 01:13:29 +08:00
士子☀️ ee12753818 Update README.md 2023-07-04 12:56:52 +08:00
士子☀️ 055638278c feat: something 2023-07-04 07:52:43 +08:00
士子☀️ bf06ff6482 docs: dark mode. 2023-07-02 15:32:34 +08:00
士子☀️ 459a5bc5b7 docs: comments dark theme. 2023-07-02 14:08:04 +08:00
士子☀️ a93f18037c release: v2.0.1 2023-07-02 13:50:22 +08:00
士子☀️ 67b5218002 release: v2.0.1 2023-07-02 13:38:46 +08:00
士子☀️ d3c745dda4 docs: update. 2023-07-02 13:19:31 +08:00
士子☀️ e694818f8f docs: support dark mode. 2023-07-02 13:10:30 +08:00
士子☀️ 729d7645e1 docs 2023-07-02 12:30:58 +08:00
士子☀️ 795e21df9c docs: content done. 2023-07-02 01:22:14 +08:00
士子☀️ bdc15e6c50 feat: max runner. 2023-07-01 23:02:42 +08:00
士子☀️ c3398ec572 baidu 2023-07-01 22:08:48 +08:00
士子☀️ 6b38b348fc actions 2023-07-01 21:37:43 +08:00
士子☀️ d650529842 actions 2023-07-01 21:32:21 +08:00
士子☀️ 2094408f52 actions 2023-07-01 21:28:26 +08:00
士子☀️ 89cb8b3a3a actions 2023-07-01 21:24:36 +08:00
士子☀️ 7a2d546972 actions. 2023-07-01 21:21:57 +08:00
士子☀️ 69e801ba2b Merge pull request #25 from caorushizi/dev
Dev
2023-07-01 21:16:54 +08:00
士子☀️ 14edc27ed1 add: docs and deploy. 2023-07-01 21:14:45 +08:00
士子☀️ 6f7fa7f067 add: docs 2023-07-01 20:15:40 +08:00
caorushizi a5a1c02e10 update: mac downloader 2023-07-01 19:01:51 +08:00
士子☀️ ce08cbce4b feat: some feature. 2023-07-01 18:12:35 +08:00
士子☀️ e03a5d38bb video header & web extension 2023-07-01 14:40:49 +08:00
士子☀️ 720db5a476 video headers & params format 2023-07-01 01:27:04 +08:00
士子☀️ e97783b08e Merge branch 'dev' of https://github.com/caorushizi/m3u8-downloader into dev 2023-06-30 00:45:34 +08:00
士子☀️ 12566f8668 add webview preload script. 2023-06-30 00:44:47 +08:00
caorushizi d686819417 npmrc 2023-06-29 19:26:47 +08:00
士子☀️ ea7b4a77af feat: prettier & web extension. 2023-06-28 23:53:46 +08:00
士子☀️ 6427a06879 test: do somthing. 2023-06-27 23:54:43 +08:00
士子☀️ f2f7a50e95 refactor: window service 2023-06-27 22:22:42 +08:00
caorushizi fbc57ebfca fix: webContents is null. 2023-06-27 11:46:55 +08:00
士子☀️ 26a5681dab feat: web extension. 2023-06-26 23:34:54 +08:00
士子☀️ 4640ff51e8 feat: add web extension. 2023-06-26 00:59:36 +08:00
士子☀️ b3b58680e0 release: v2.0.0 2023-06-24 15:29:27 +08:00
士子☀️ d1b75df87d Merge pull request #22 from caorushizi/development
fix: mac active.
2023-06-23 22:10:35 +08:00
caorushizi 4b4e1b9f54 fix: mac active. 2023-06-23 22:05:47 +08:00
士子☀️ 8ebb550270 Merge pull request #21 from caorushizi/development
release: v2.0.0-beta.7
2023-06-23 21:52:50 +08:00
士子☀️ 6b93954246 release: v2.0.0-beta.7 2023-06-23 21:48:46 +08:00
士子☀️ 550d7ebd4b release: v2.0.0-beta.7 2023-06-23 21:18:29 +08:00
caorushizi 3f331e5d3d feat: package.json 2023-06-23 21:12:54 +08:00
士子☀️ 020f921af8 release v2.0.0-beta.6 2023-06-23 10:44:58 +08:00
士子☀️ efa72ce12b release: v2.0.0-beta.6 2023-06-23 09:39:41 +08:00
士子☀️ 38ead633a5 release: v2.0.0-beta.6 2023-06-23 09:29:50 +08:00
士子☀️ 3eb1d0ae99 fix: get video source & dark mode 2023-06-22 21:39:43 +08:00
士子☀️ 7bed4ed335 update dependencies version. 2023-06-22 16:23:48 +08:00
士子☀️ b357d41f23 add: dark mode. 2023-06-22 15:58:48 +08:00
士子☀️ 3834603b0a update dependencies version. 2023-06-22 12:40:33 +08:00
士子☀️ f38ba108a3 add adblocker 2023-06-22 11:33:37 +08:00
士子☀️ 7ceda3d73f readme 2023-06-21 23:53:03 +08:00
士子☀️ aee57b6f98 feat: set dev tool load. 2023-06-20 23:28:47 +08:00
士子☀️ f9d49bd55f feat: restore browser state. 2023-06-20 22:49:07 +08:00
士子☀️ 3bb082473a Merge branch 'master' of https://github.com/caorushizi/m3u8-downloader 2023-06-20 22:01:23 +08:00
士子☀️ 31b6726fe5 fix: direct download. 2023-06-20 22:01:05 +08:00
士子☀️ 348b41b0dd Update README.md 2023-06-19 23:11:36 +08:00
士子☀️ d4bbfa0516 release: beta5 2023-06-18 18:38:38 +08:00
士子☀️ b2af9b3d25 release: 2.0.0-beta.5 2023-06-18 18:25:26 +08:00
caorushizi ded93a4f0b test 2023-06-18 18:04:59 +08:00
caorushizi d43f57565b feat: add video player. 2023-06-18 17:59:39 +08:00
caorushizi 34cf661fb2 feat: add video player 2023-06-18 17:05:05 +08:00
士子☀️ 91cfb883b6 feat: add video player. 2023-06-18 15:06:15 +08:00
士子☀️ 1cb7deb376 player 2023-06-17 21:24:54 +08:00
caorushizi 70933c63bb pack 2023-06-17 19:29:25 +08:00
caorushizi 5723b9edd0 player 2023-06-17 14:15:50 +08:00
士子☀️ 65f37a9c66 main 2023-06-17 13:08:45 +08:00
士子☀️ 57516793ab main 2023-06-17 02:42:41 +08:00
士子☀️ afecc5ac12 rename url 2023-06-17 01:16:53 +08:00
士子☀️ 3331564155 Merge pull request #20 from caorushizi/dev-server
feat: add video server
2023-06-17 00:13:54 +08:00
士子☀️ 19ce7b9906 add 2023-06-17 00:12:54 +08:00
士子☀️ 40f39340f0 add mobile. 2023-06-16 23:20:20 +08:00
士子☀️ f085bcacf7 add mobile 2023-06-11 02:29:53 +08:00
士子☀️ dbd4e73b6e feat: add mobile player. 2023-06-10 17:23:31 +08:00
士子☀️ b35e6b3315 feat: add video player. 2023-06-10 16:56:02 +08:00
士子☀️ 3c603a67dd feat: add video player 2023-06-10 11:33:35 +08:00
士子☀️ 8ff5abf5d8 feat: add video server 2023-06-08 01:22:59 +08:00
士子☀️ 0fdbd39393 fix: windows address url. 2023-06-07 01:02:22 +08:00
caorushizi df93770128 test 2023-06-04 00:40:39 +08:00
caorushizi b61a935068 test 2023-06-03 23:07:42 +08:00
士子☀️ 95e96b1057 优化素材提取页交互,优化打点逻辑,优化页面切换时的问题 2023-05-28 19:18:36 +08:00
士子☀️ 3dd325a280 Update README.md 2023-05-06 09:54:08 +08:00
士子☀️ bbe922df74 Update README.md 2023-05-06 09:53:03 +08:00
caorushizi e31eddfd2e 2.0.0-beta.4 2023-05-05 11:25:10 +08:00
caorushizi bbb9f5798b fix: peocess.env 2023-05-05 10:20:10 +08:00
caorushizi b634cf056d fix: env file. 2023-05-05 09:45:38 +08:00
士子☀️ 2ede22b50a github action pnpm version 2023-05-05 01:15:29 +08:00
士子☀️ a4efd83f7a build and release 2023-05-05 01:10:57 +08:00
caorushizi c3ebced763 macos pack 2023-05-04 23:32:03 +08:00
caorushizi 6cb6621df1 platform: add macos 2023-05-04 23:16:13 +08:00
士子☀️ 4e5febba8b something 2023-04-22 19:47:10 +08:00
士子☀️ 1fb787d4ea 手动添加链接;某些视频网站跳转 about:blank ;修改下载名称 2023-04-22 17:29:26 +08:00
士子☀️ f24ddaa55e add favorite 2023-04-22 14:33:57 +08:00
士子☀️ 66542a0003 talking data version 2023-04-17 23:04:17 +08:00
士子☀️ f8a8e1d3e6 不展示menu 2023-04-15 22:22:34 +08:00
士子☀️ c1873b8c6d 在新页面中打开浏览器 2023-04-15 21:30:15 +08:00
士子☀️ 07dceb2704 在新页面中打开浏览器 2023-04-15 21:05:07 +08:00
士子☀️ ceec042ffd 在新页面中打开浏览器 2023-04-15 16:45:39 +08:00
士子☀️ 2a47f255ee 升级antd,下载完成后删除原始文件 2023-04-14 00:04:44 +08:00
士子☀️ 1f899e6c6d env 2023-04-02 15:07:56 +08:00
士子☀️ f0686bb18c release 2023-04-01 20:44:51 +08:00
士子☀️ b321dc06e9 app version 2023-04-01 19:11:55 +08:00
士子☀️ 5f7c6e846b updater 2023-04-01 11:03:19 +08:00
士子☀️ 2d71475a48 Merge branch 'master' of https://github.com/caorushizi/m3u8-downloader 2023-04-01 10:55:55 +08:00
士子☀️ cfdeb4a1a8 updater 2023-04-01 10:55:36 +08:00
士子☀️ 5d3abdefdc Create .github/dependabot.yml 2023-04-01 10:16:21 +08:00
士子☀️ abcff22f3e 转换为音频 2023-03-31 23:27:45 +08:00
士子☀️ 7d4ca4d758 ipcrenderer 事件监听 2023-03-31 21:01:07 +08:00
caorushizi 9b44b2f31f 2.0 优化功能 2023-03-31 20:27:28 +08:00
士子☀️ 55bd8da894 feature: 完善首页、视频获取逻辑 2023-03-31 00:37:18 +08:00
士子☀️ e8c7abaa2f 修复事件监听&完善下载页面交互 2023-03-30 01:05:02 +08:00
士子☀️ 1702b9beac update 2023-03-28 23:49:41 +08:00
士子☀️ de25052980 暂停下载逻辑 2023-03-27 23:47:10 +08:00
士子☀️ 03700ed4bb readme 2023-03-26 20:48:18 +08:00
士子☀️ e0147a4a6e readme 2023-03-26 20:41:55 +08:00
士子☀️ 281fd07e23 Merge pull request #15 from caorushizi/dev
Dev
2023-03-26 20:34:14 +08:00
士子☀️ 1d7a0e62e5 download. 2023-03-26 20:29:20 +08:00
士子☀️ e4dcdb9422 download. 2023-03-26 19:22:29 +08:00
士子☀️ f035bb09b4 download. 2023-03-26 17:59:54 +08:00
士子☀️ 869c6497e9 download. 2023-03-26 15:54:43 +08:00
士子☀️ 151ed1ce0d download list progress. 2023-03-26 01:12:49 +08:00
士子☀️ bab349da9b download list. 2023-03-25 20:17:02 +08:00
士子☀️ ac8f9d2955 home page. 2023-03-25 16:00:06 +08:00
士子☀️ 0f2670069f readme. 2023-03-25 12:15:38 +08:00
士子☀️ 0af3d32337 download list. 2023-03-25 12:13:30 +08:00
士子☀️ f5a22f8393 config page. 2023-03-25 11:39:40 +08:00
士子☀️ 769a82e7ed setting form. 2023-03-25 00:08:23 +08:00
caorushizi 3985af0042 something 2023-03-24 20:09:18 +08:00
士子☀️ dca0e0a84b add electron extensions. 2023-03-24 00:29:27 +08:00
士子☀️ 233296ba3e receive 2023-03-23 00:22:37 +08:00
士子☀️ 2bc4fe0592 readme 2023-03-22 00:13:24 +08:00
士子☀️ c22245e296 source extract. 2023-03-22 00:11:15 +08:00
士子☀️ 29de2fc81c source extract. 2023-03-20 01:09:08 +08:00
士子☀️ bd27aefe8a source extract. 2023-03-20 00:50:08 +08:00
士子☀️ 722cabba57 source extract. 2023-03-19 19:23:35 +08:00
士子☀️ 3468c8d5e6 new branch. 2023-03-19 12:16:37 +08:00
caorushizi b3cc83f8cd new ui 2023-01-14 12:34:26 +08:00
caorushizi f6a1ca03ac new ui 2023-01-13 11:48:44 +08:00
士子☀️ 516ac72c3e feature: 修改页面提示逻辑 2022-12-28 00:07:53 +08:00
士子☀️ c068bde0a8 feature: 新增插件 2022-12-26 23:38:04 +08:00
士子☀️ ca3ed53a59 feature: 样式交互优化 2022-12-25 23:59:01 +08:00
士子☀️ 04c05ee15e feture: 优化样式交互 2022-12-25 20:48:31 +08:00
士子☀️ 60d27be739 style: eslint 修正 2022-12-25 15:11:06 +08:00
士子☀️ 259fe5f447 style: eslint 修正 2022-12-25 14:30:24 +08:00
士子☀️ 8d9b7fc9dc style: eslint 修正 2022-12-25 13:22:18 +08:00
士子☀️ d5d282147d style: eslint 修正 2022-12-24 17:51:28 +08:00
士子☀️ 08f7f66154 revert: 删除mediago-node 2022-12-23 22:15:26 +08:00
士子☀️ f702f847e6 style: 修正代码提交规范 2022-12-23 22:11:12 +08:00
士子☀️ b9b87cf354 master 2022-12-22 23:14:59 +08:00
士子☀️ a81b9a37ab master 2022-12-22 16:09:58 +08:00
士子☀️ 64174ef374 master 2022-12-18 23:20:34 +08:00
士子☀️ a8b3a9ee1a master 2022-12-17 00:30:53 +08:00
diaozhenyuan 7be1a7907d master 2022-12-16 21:14:14 +08:00
diaozhenyuan 05d207f34d master 2022-12-16 18:49:58 +08:00
diaozhenyuan 26be46b038 master 2022-12-16 18:02:24 +08:00
士子☀️ 47826f1f72 master 2022-12-15 23:27:59 +08:00
士子☀️ f7428f811a master 2022-12-12 22:55:24 +08:00
士子☀️ 3aa8577a38 master 2022-12-11 19:10:44 +08:00
士子☀️ 8b7965dbcb master 2022-12-11 02:54:46 +08:00
士子☀️ 006cb4b13c master 2022-12-10 19:14:22 +08:00
士子☀️ ecb8d6b387 master 2022-12-10 18:52:10 +08:00
士子☀️ b57b05fe1d master 2022-12-10 18:23:47 +08:00
士子☀️ 1e9969857d Merge pull request #13 from caorushizi/dev
Dev
2022-12-10 18:01:03 +08:00
士子☀️ af89dd2694 dev 2022-12-06 23:04:38 +08:00
士子☀️ e418e05ab1 dev 2022-11-29 23:34:31 +08:00
士子☀️ a8d8a7aca7 dev 2022-11-29 23:31:30 +08:00
士子☀️ 4c7226cda1 dev 2022-11-26 00:15:27 +08:00
士子☀️ 91b5ee4423 dev 2022-11-26 00:15:05 +08:00
士子☀️ f8d7148b9e Dev 2022-11-08 00:07:41 +08:00
士子☀️ 0f0687b5c9 dev 2022-11-06 23:36:28 +08:00
士子☀️ 1384cd4c6e dev 2022-11-06 12:41:35 +08:00
士子☀️ 4c5c78d0e4 dev 2022-11-06 12:15:07 +08:00
士子☀️ 551abb4496 dev 2022-10-30 21:49:32 +08:00
士子☀️ 8af8824c3e dev 2022-10-30 20:20:32 +08:00
士子☀️ c01c085ac1 dev 2022-10-30 01:46:39 +08:00
士子☀️ 8668acdd6d dev 2022-10-27 00:13:10 +08:00
士子☀️ 03567ed36d 重构 2022-10-24 00:10:10 +08:00
caorushizi dcfea2cfb3 整理项目文件 2022-05-01 01:01:05 +08:00
caorushizi 3c4e6c8240 整理项目文件 2022-04-30 23:23:38 +08:00
caorushizi 9e93426c38 2 2022-04-20 23:53:45 +08:00
caorushizi 5c698e2e9b 1 2022-04-19 23:34:58 +08:00
caorushizi b174e14fbd process 2022-04-19 23:27:09 +08:00
caorushizi 19e84cd415 downloader 2022-04-19 01:13:12 +08:00
caorushizi 73a9b3fd72 downloader 2022-04-19 01:12:33 +08:00
caorushizi 64a938879d downloader 2022-04-17 23:15:38 +08:00
caorushizi 66b9a9677b 重构文件目录 2022-04-17 01:55:37 +08:00
士子☀️ 39616244d9 mono repo. 2022-04-11 23:14:48 +08:00
士子☀️ 990846515f Update README.md 2022-02-06 21:32:25 +08:00
caorushizi 94777aead3 update readme.md 2022-02-05 16:59:13 +08:00
caorushizi 5275d3bfd3 删除视频数据打点 2022-02-05 16:43:06 +08:00
士子☀️ 73ae0ad083 Update README.md 2022-01-27 11:38:36 +08:00
caorushizi 5ed6e84a14 Merge branch 'master' of https://github.com/caorushizi/m3u8-downloader 2022-01-27 00:22:22 +08:00
caorushizi ed45cd8d73 README.md 2022-01-27 00:21:36 +08:00
士子☀️ f393b99cb5 Update README.md 2022-01-27 00:07:56 +08:00
caorushizi 6638600ffa 修复开发环境中没有注入环境变量导致无法运行 2022-01-26 23:53:54 +08:00
士子☀️ 4d5cae3b0c Update build.js 2022-01-26 13:38:31 +08:00
250 changed files with 21048 additions and 4437 deletions
+39
View File
@@ -0,0 +1,39 @@
behaviour
commitlint
conventionalcommits
optimizelegibility
pinia
tiptap
vuedraggable
vuejs
TDAPP
reduxjs
bilibili
localforage
ahooks
antd
languagedetector
redownload
Redownload
watting
Watting
cancle
Sider
inversify
datetime
typeorm
bili
mediago
nocheck
metas
DDTHH
Conpty
execa
bodys
cliqz
adblocker
acodec
KHTML
svgz
stylelint
consola
+15
View File
@@ -0,0 +1,15 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true
[*.md]
max_line_length = 0
trim_trailing_whitespace = false
+4
View File
@@ -0,0 +1,4 @@
APP_NAME=mediago
APP_ID=mediago.ziying.site
APP_COPYRIGHT=caorushizi
APP_VERSION=2.2.0
+6 -1
View File
@@ -1 +1,6 @@
NODE_ENV=development
APP_TD_APPID=
APP_CLARITY_APPID=
GH_TOKEN=
LOAD_DEVTOOLS=
DEBUG_PLUGINS=true
+5 -1
View File
@@ -1 +1,5 @@
NODE_ENV=production
APP_TD_APPID=
APP_CLARITY_APPID=
GH_TOKEN=
DEBUG_PLUGINS=false
-1
View File
@@ -1 +0,0 @@
NODE_ENV=staging
+1 -6
View File
@@ -1,6 +1 @@
.eslintrc.js
esbuild.config.js
babel.config.js
webpack.config.js
script/
vite.config.ts
+20
View File
@@ -0,0 +1,20 @@
/* eslint-env node */
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {},
};
-19
View File
@@ -1,19 +0,0 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "react"],
extends: [
"plugin:@typescript-eslint/recommended",
"react-app",
"plugin:prettier/recommended",
],
rules: {
"@typescript-eslint/ban-ts-comment": "warn",
"prettier/prettier": "error",
},
};
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+62
View File
@@ -0,0 +1,62 @@
# build.yml
# Workflow's name
name: Build Downloader App.
# Workflow's trigger
on:
push:
branches:
- master
# Workflow's jobs
jobs:
# job's id
release:
# job's name
name: build and release electron app
# the type of machine to run the job on
runs-on: ${{ matrix.os }}
# create a build matrix for jobs
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-12]
# create steps
steps:
# step1: check out repository
- name: Check out git repository
uses: actions/checkout@v4
# step2: install node env
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# step4: install python env
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
# step5: install pnpm env
- uses: pnpm/action-setup@v3
with:
version: latest
run_install: true
- name: Build & release app
run: pnpm run release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
APP_TD_APPID: ${{ secrets.APP_TD_APPID }}
APP_CLARITY_APPID: ${{ secrets.APP_CLARITY_APPID}}
- uses: actions/upload-artifact@v4
with:
name: mediago-${{ matrix.os }}
path: packages/main/release/mediago-setup-*
+52
View File
@@ -0,0 +1,52 @@
name: Deploy Downloader Docs.
on:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
env:
BUCKET: downloader-docs
ENDPOINT: oss-cn-beijing.aliyuncs.com
ACCESS_KEY: LTAI5tLckcUrBtj7bCiUYwWz
ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: latest
run_install: true
- name: Build with Vitepress
run: pnpm run docs:build
- name: Install Alibaba Cloud OSSUTIL
run: wget http://gosspublic.alicdn.com/ossutil/1.6.10/ossutil64 && chmod +x ossutil64
- name: Configure Alibaba Cloud OSSUTIL
run: ./ossutil64 config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig
- name: Upload the web folder to the chosen OSS bucket
run: ./ossutil64 --config-file .ossutilconfig cp ${{ github.workspace }}/docs/.vitepress/dist oss://${BUCKET} -r -f
+3 -10
View File
@@ -1,13 +1,6 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
.idea
.bin
.vscode
yarn.lock
yarn-error.log
build
devtools/*
.parcel-cache
.vitepress
*.tsno.mjs
+13
View File
@@ -0,0 +1,13 @@
{
"extends": [
"development"
],
"hints": {
"axe/text-alternatives": [
"default",
{
"image-alt": "off"
}
]
}
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1}
npm run commitlint ${1}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
npx tsx ./scripts/pre-commit.ts
+3
View File
@@ -0,0 +1,3 @@
registry=https://registry.npmmirror.com
electron_mirror=https://npmmirror.com/mirrors/electron/
package-manager=pnpm
+3
View File
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
+1
View File
@@ -0,0 +1 @@
{}
+23
View File
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run-script", "dev"],
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Attach to Electron",
"type": "node",
"request": "attach",
"address": "localhost",
"restart": true,
"timeout": 10000,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 士子☀️
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+81 -20
View File
@@ -1,32 +1,93 @@
# media-downloader
m3u8 视频在线提取工具 流媒体下载 m3u8下载 桌面客户端 windows mac
<img src="https://socialify.git.ci/caorushizi/mediago/image?font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Auto" alt="MediaDownloader"/>
# 功能简介
<div align="center">
<h1>MediaGo</h1>
<a href="https://downloader.caorushizi.cn/guides.html?form=github">快速开始</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://downloader.caorushizi.cn?form=github">官网</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://downloader.caorushizi.cn/documents.html?form=github">文档</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://github.com/caorushizi/mediago/discussions">Discussions</a>
<br>
<br>
可以直接在线获取 m3u8 链接地址,无需使用使用网络抓包,无需安装浏览器插件,可以直接带出请求标头……
<img alt="GitHub Downloads (all assets, all releases)" src="https://img.shields.io/github/downloads/caorushizi/mediago/total">
<img alt="GitHub Downloads (all assets, latest release)" src="https://img.shields.io/github/downloads/caorushizi/mediago/latest/total">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/caorushizi/mediago">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/caorushizi/mediago">
# 下载链接
<hr />
</div>
- [v1.0.3 windows](http://static.ziying.site/media-downloader-1.0.3%20Setup.exe)
- [v1.0.2 windows](http://static.ziying.site/media-downloader-1.0.2%20Setup.exe)
- [v1.0.1 windows](http://static.ziying.site/media-downloader-1.0.1%20Setup.exe)
- [v1.0.0 windows](http://static.ziying.site/media-downloader-1.0.0%20Setup.exe)
## Intro
# 更新日志 2021.04.18
1. 新增视频批量下载功能;
2. 添加收藏功能;
3. 更新了界面样式;
本项目支持 m3u8 视频在线提取工具 流媒体下载 m3u8 下载。
# 软件截图
- **✅&nbsp; 无需抓包**: 使用软件自带浏览器可以轻松嗅探网页中的视频资源,通过嗅探到的资源列表选择自己想要下载的资源,简单快速。
- **📱&nbsp; 移动播放**: 可以轻松无缝的在PC和移动设备之前切换,下载完成后即可使用手机观看视频。
- **⚡️&nbsp; 批量下载**: 支持同时下载多个视频和直播资源,高速带宽不闲置。
![首页](http://static.ziying.site/2021-04-29-home.png)
## Quickstart
![浏览器页面](http://static.ziying.site/downloader-browser.png)
运行代码需要 node 、 pnpm 和 go,node、go 需要在官网下载安装,pnpm 可以通过`npm i -g pnpm`安装。
![收藏页面](http://static.ziying.site/2021-04-29-fav.png)
## 运行代码
![设置页面](http://static.ziying.site/2021-04-29-setting.png)
```shell
# 代码下载
git clone https://github.com/caorushizi/mediago.git
# 使用 Vite & esBuild 构建
# 安装依赖
pnpm i
![vite esbuild](http://static.ziying.site/vite+esbuild.png)
# 开发环境
pnpm dev
# 打包运行
pnpm release
```
## Releases
**v2.0.22023.7.9 发布)**
- [windows mediago v2.0.2](https://github.com/caorushizi/mediago/releases/download/v2.0.2/media-downloader-setup-2.0.2.exe)
- [macos mediago v2.0.2](https://github.com/caorushizi/mediago/releases/download/v2.0.2/media-downloader-setup-2.0.2.dmg)
**更新日志**
- 暗黑模式
- 更多下载配置
- 支持请求标头自动带入
- 支持开启广告过滤
- 支持开启沉浸式嗅探
- 支持切换手机和 PC 模式
- 支持修改同时下载数量
- 修复了一些 bug
**v1.1.52022.2.5 发布)**
- [windows mediago v1.1.5](https://github.com/caorushizi/mediago/releases/download/1.1.5/media-downloader-setup-1.1.4.exe)
**更新日志**
## 软件截图
![首页](https://static.ziying.site/v2.0.3-beta-home.png)
![设置页面](https://static.ziying.site/v2.0.3-beta-settings.png)
![资源提取](https://static.ziying.site/v2.0.3-beta-extract.png)
## 技术栈
- vite <https://cn.vitejs.dev>
- antd <https://ant.design>
- electron <https://www.electronjs.org>
## 鸣谢
N_m3u8DL-CLI 来自于 <https://github.com/nilaoda/N_m3u8DL-CLI>
mediago 来自于 <https://github.com/caorushizi/mediago>
+100
View File
@@ -0,0 +1,100 @@
export default {
extends: ["@commitlint/config-conventional"], // extends can be nested
parserPreset: "conventional-changelog-conventionalcommits",
prompt: {
settings: {},
messages: {
skip: ":skip",
max: "upper %d chars",
min: "%d chars at least",
emptyWarning: "can not be empty",
upperLimitWarning: "over limit",
lowerLimitWarning: "below limit",
},
types: [
{ value: "feat", name: "feat: ✨ A new feature", emoji: "✨ " },
{ value: "fix", name: "fix: 🐛 A bug fix", emoji: "🐛 " },
{
value: "docs",
name: "docs: 📝 Documentation only changes",
emoji: "📝 ",
},
{
value: "style",
name: "style: 💄 Changes that do not affect the meaning of the code",
emoji: "💄 ",
},
{
value: "refactor",
name: "refactor: 📦️ A code change that neither fixes a bug nor adds a feature",
emoji: "📦️ ",
},
{
value: "perf",
name: "perf: 🚀 A code change that improves performance",
emoji: "🚀 ",
},
{
value: "test",
name: "test: 🚨 Adding missing tests or correcting existing tests",
emoji: "🚨 ",
},
{
value: "build",
name: "build: 🛠 Changes that affect the build system or external dependencies",
emoji: "🛠 ",
},
{
value: "ci",
name: "ci: 🎡 Changes to our CI configuration files and scripts",
emoji: "🎡 ",
},
{
value: "chore",
name: "chore: 🔨 Other changes that don't modify src or test files",
emoji: "🔨 ",
},
{
value: "revert",
name: "revert: ⏪️ Reverts a previous commit",
emoji: ":rewind:",
},
],
useEmoji: true,
confirmColorize: true,
emojiAlign: "center",
questions: {
scope: {
description:
"What is the scope of this change (e.g. component or file name)",
},
subject: {
description:
"Write a short, imperative tense description of the change",
},
body: {
description: "Provide a longer description of the change",
},
isBreaking: {
description: "Are there any breaking changes?",
},
breakingBody: {
description:
"A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
},
breaking: {
description: "Describe the breaking changes",
},
isIssueAffected: {
description: "Does this change affect any open issues?",
},
issuesBody: {
description:
"If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
};
+23
View File
@@ -0,0 +1,23 @@
{
"import": [
"@cspell/dict-lorem-ipsum/cspell-ext.json"
],
"caseSensitive": false,
"dictionaries": [
"custom-words"
],
"dictionaryDefinitions": [
{
"name": "custom-words",
"path": "./.cspell/custom-words.txt",
"addWords": true
}
],
"ignorePaths": [
"**/node_modules/**",
"**/dist/**",
"**/lib/**",
"**/docs/**",
"**/stats.html"
]
}
+2
View File
@@ -0,0 +1,2 @@
.vitepress/dist
.vitepress/cache
+62
View File
@@ -0,0 +1,62 @@
import { HeadConfig, defineConfig } from "vitepress";
const isDev = process.env.NODE_ENV === "development";
const head: HeadConfig[] = [
["link", { rel: "shortcut icon", href: "/favicon.svg" }],
];
if (!isDev) {
head.push([
"script",
{},
`var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?eefcbd14f0323044aa0ca678cd278381";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();`,
]);
}
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "MediaGo",
description: "简单易用,快速下载",
lastUpdated: true,
head,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "Home", link: "/" },
{ text: "教程", link: "/guides" },
],
sidebar: [
{
text: "开始",
items: [
{ text: "快速开始", link: "/guides" },
{ text: "使用说明", link: "/documents" },
],
},
{
text: "其他",
items: [
{ text: "旧版本", link: "/history" },
{ text: "意见收集", link: "/proposal" },
{ text: "支持列表", link: "/list" },
],
},
],
socialLinks: [
{ icon: "github", link: "https://github.com/caorushizi/m3u8-downloader" },
],
footer: {
message: '<a href="https://beian.miit.gov.cn">豫ICP备20012967号-2</a>',
copyright: "Copyright © 2021-present caorushizi",
},
},
});
@@ -0,0 +1,49 @@
<script setup lang="ts">
import { onMounted, watch, ref, watchEffect } from "vue";
import { init, WalineInstance } from "@waline/client";
import "@waline/client/waline.css";
import { useData, useRoute } from "vitepress";
const route = useRoute();
const { isDark } = useData();
const commentsRef = ref<WalineInstance | null>(null);
watchEffect(() => {
commentsRef.value?.update({
dark: isDark.value,
});
});
watch(
() => route.path,
() => {
commentsRef.value?.destroy();
initWaline();
}
);
function initWaline() {
commentsRef.value = init({
el: "#waline",
serverURL: "https://comments.ziying.site",
dark: isDark.value,
lang: "zh-CN",
pageview: true,
});
}
onMounted(() => {
initWaline();
});
</script>
<template>
<div id="waline">hello world</div>
</template>
<style scoped>
#waline {
margin-top: 20px;
}
</style>
+13
View File
@@ -0,0 +1,13 @@
import { h } from "vue";
import Theme from "vitepress/theme";
import "./style/var.css";
import Comments from "./components/Comments.vue";
export default {
...Theme,
Layout() {
return h(Theme.Layout, null, {
"doc-after": () => h(Comments),
});
},
};
+32
View File
@@ -0,0 +1,32 @@
:root {
/* 标题 */
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: linear-gradient(
135deg,
#5e9ef3 10%,
#2a82f6 100%
);
/* 图标背景 */
--vp-home-hero-image-background-image: linear-gradient(
135deg,
#5e9ef3 10%,
#2a82f6 100%
);
--vp-home-hero-image-filter: blur(150px);
/* brand按钮 */
--vp-button-brand-border: #5e9ef3;
--vp-button-brand-text: #f2f7fd;
--vp-button-brand-bg: #2a82f6;
--vp-button-brand-active-border: #5e9ef3;
--vp-button-brand-active-text: #fff;
--vp-button-brand-active-bg: #409eff;
--vp-button-brand-hover-border: #5e9ef3;
--vp-button-brand-hover-text: #fff;
--vp-button-brand-hover-bg: #2a82f6;
--vp-c-brand: #2a82f6;
}
+83
View File
@@ -0,0 +1,83 @@
---
layout: doc
outline: deep
---
# 使用说明
这个页面主要讲解的是设置页面的参数的含义
![step 1](./images/documents-step1.png)
## 基础设置
::: tip
下载器全局设置
:::
1. 选择文件夹: 视频下载的路径
2. 下载器主题: 支持浅色和深色模式
3. 在新窗口中打开浏览器: 开启了之后浏览器页面会独立出一个窗口。
![step 1](./images/documents-step2.png)
4. 下载完成提示: 开启之后下载完成会出现系统提示
## 浏览器设置
::: tip
浏览器窗口相关的设置
:::
1. 代理设置: 填写自己的代理地址
2. 代理开关: 打开开关后浏览器默认会走填写的代理地址,如果代理地址这个开关是打不开的
3. 开启广告过滤: 打开开关后会过滤页面中的广告
4. 以手机模式进入: 打开后会将浏览器伪装成手机浏览器,请求移动端的站点(左侧是开启手机模式的截图)
![step 2](./images/documents-step3.png)
5. 使用浏览器插件
- 打开状态: 从浏览器中嗅探到的资源不会自动添加到下载列表,需要手动点击页面下方的下载的链接来添加视频到下载列表 **(后面会有很强大的功能哦)**
![step 3](./images/documents-step4.png)
- 关闭状态: 浏览器中嗅探到的资源会自动添加到下载列表
## 下载设置
::: tip
和下载相关的设置
:::
1. 下载完成删除分片: 开启后下载完成后会将分片文件删除
2. 最大同时下载数量: 最多同时可以下载多少视频文件,目前最大是 10,最小是 1
3. 更多操作
- 配置文件目录: 软件数据库路径、日志等等路径
- 可执行文件目录: 下载器二进制文件的路径
- 本地存储路径: 下载视频的本地路径
4. 当前版本: 当前软件版本信息
## 其他问题
**Q: 关于直播视频的下载**
A: 软件支持直播下载,软件目前没有好的办法区分直播流,所以将所有的下载控制台开启。用户自行分辨下载数据源
**Q: 关于 MacOS 版本**
A: 目前 MacOS 版本属于非稳定版本,2023 年 5 月发布。需要在 Mac 的安全设置中打开来自身份不明开发者的 Mac App
![QA1](./images/documents-qa1.png)
**Q: 关于旧版本**
A: 1.1.5 版本确实发布了很长时间,经过大量用户的验证,比较稳定。所以想要使用旧版软件的话请访问[此链接](/history.html)
**Q: 关于 Win7 用户**
A: v2.0.0 之后的版本已经放弃不支持 Win7 如果需要在 win7 上面使用同样需要下载 1.1.5 版本
+96
View File
@@ -0,0 +1,96 @@
---
layout: doc
outline: deep
---
# 快速开始
这篇文章是软件的简单说明,可以快速上手使用本本软件。
::: tip
我建了一个 QQ 群,方便大家一起沟通交流: 574209001
:::
## 下载安装
**v2.0.12023.7.1 发布)**
- [windows mediago v2.0.1](https://github.com/caorushizi/mediago/releases/download/v2.0.1/media-downloader-setup-2.0.1.exe)
- [macos mediago v2.0.1](https://github.com/caorushizi/mediago/releases/download/v2.0.1/media-downloader-setup-2.0.1.dmg)
**更新日志**
- 暗黑模式
- 更多下载配置
- 支持请求标头自动带入
- 支持开启广告过滤
- 支持开启沉浸式嗅探
- 支持切换手机和 PC 模式
- 支持修改同时下载数量
- 修复了一些 bug
**v1.1.52022.2.5 发布)**
- [windows mediago v1.1.5](https://github.com/caorushizi/mediago/releases/download/1.1.5/media-downloader-setup-1.1.4.exe)
**更新日志**
- 支持视频下载
## 操作说明
### 视频自动嗅探
1. 选择【资源提取】
![step 1](./images/guides-step1.png)
2. 进入视频的网址
![step 2](./images/guides-step2.png)
3. 开始下载,即可下载视频
![step 3](./images/guides-step3.png)
### 手动下载
1. 点击页面右上角的【新建下载】
![step 1](./images/guides-step4.png)
2. 在新建下载弹窗中填入【视频名称】和【m3u8 地址】即可
![step 2](./images/guides-step5.png)
3. 在列表中点击下载,即可下载视频
![step 3](./images/guides-step3.png)
## 附加功能
1. 下载完成后可以在下载列表中点击转换音频按钮将视频转换为音频
![step 1](./images/addition-step1.png)
2. 下载完成后播放视频
- PC 播放
![step 2](./images/addition-step2.png)
- 移动端播放
![step 3](./images/addition-step3.png)
3. 批量下载
![step 3](./images/addition-step4.png)
## 开始你的视频下载吧
是不是很简单,快去下载你的视频吧
::: warning
本软件仅可用于学习交流
:::
+21
View File
@@ -0,0 +1,21 @@
---
layout: doc
outline: deep
---
# 旧版本
::: info
这里是旧版本的永久链接,如果有需求的话,可以在这里下载
**这个链接的软件不会自动升级, 可放心使用**
:::
**v1.1.52022.2.5 发布)**
- [windows mediago v1.1.5](https://github.com/caorushizi/mediago/releases/download/1.1.5/media-downloader-setup-1.1.4.exe)
- ~~macos mediago v1.1.5 无~~
**更新日志**
- 支持视频下载
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+30
View File
@@ -0,0 +1,30 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home
hero:
name: "在线视频下载"
text: "简单易用,快速下载"
tagline: 简单易学,无需抓包,不需要安装插件
image:
src: /home.png
alt: home
actions:
- theme: brand
text: 快速开始
link: /guides
- theme: alt
text: 使用说明
link: /documents
features:
- icon: ⏩
title: 无需抓包
details: 使用软件自带浏览器可以轻松嗅探网页中的视频资源,通过嗅探到的资源列表选择自己想要下载的资源,简单快速。
- icon: 📱
title: 移动播放
details: 可以轻松无缝的在PC和移动设备之前切换,下载完成后即可使用手机观看视频。
- icon: ⚡️
title: 支持批量下载
details: 支持同时下载多个视频和直播资源,高速带宽不闲置。
---
+22
View File
@@ -0,0 +1,22 @@
---
layout: doc
outline: deep
---
# 支持列表
::: tip
大家有什么网站想要支持的在这里提
:::
**模板**
---
- 网站首页: xxx
- 视频(直播)列表页: xxx
- 视频(直播)页: xxx
---
支持完成后我会在评论区回复
+16
View File
@@ -0,0 +1,16 @@
---
layout: doc
outline: deep
---
# 意见收集
::: info
这里手机大家使用软件的问题,或者意见建议
:::
如果软件报错,需要描述清楚在什么网站下载什么视频的时候报错
如果是建议请描述清楚你的需求
如果是意见请尽量提出来,我会尽量满足大家的需求
+40
View File
@@ -0,0 +1,40 @@
<svg t="1686326276609" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="6962" xmlns:xlink="http://www.w3.org/1999/xlink"
width="200" height="200">
<path
d="M110.933333 42.666667h716.8A68.266667 68.266667 0 0 1 896 110.933333v802.133334a68.266667 68.266667 0 0 1-68.266667 68.266666H110.933333A68.266667 68.266667 0 0 1 42.666667 913.066667V110.933333A68.266667 68.266667 0 0 1 110.933333 42.666667z"
fill="#111314" fill-opacity=".72" p-id="6963"></path>
<path
d="M853.333333 42.666667h85.333334a68.266667 68.266667 0 0 1 68.266666 68.266666v802.133334A68.266667 68.266667 0 0 1 938.666667 981.333333h-85.333334a68.266667 68.266667 0 0 0 68.266667-68.266666V110.933333A68.266667 68.266667 0 0 0 853.333333 42.666667z"
fill="#CACBCC" p-id="6964"></path>
<path
d="M162.133333 128h614.4a34.133333 34.133333 0 0 1 34.133334 34.133333v699.733334a34.133333 34.133333 0 0 1-34.133334 34.133333H162.133333a34.133333 34.133333 0 0 1-34.133333-34.133333V162.133333a34.133333 34.133333 0 0 1 34.133333-34.133333z"
fill="#FFFFFF" p-id="6965"></path>
<path
d="M187.733333 170.666667h563.2c9.386667 0 17.066667 7.68 17.066667 17.066666v221.866667a17.066667 17.066667 0 0 1-17.066667 17.066667H187.733333a17.066667 17.066667 0 0 1-17.066666-17.066667V187.733333c0-9.386667 7.68-17.066667 17.066666-17.066666z"
fill="#EDEEF0" p-id="6966"></path>
<path
d="M256 298.666667m17.066667 0l136.533333 0q17.066667 0 17.066667 17.066666l0 136.533334q0 17.066667-17.066667 17.066666l-136.533333 0q-17.066667 0-17.066667-17.066666l0-136.533334q0-17.066667 17.066667-17.066666Z"
fill="#FFC13C" p-id="6967"></path>
<path
d="M341.333333 392.533333a34.133333 34.133333 0 1 1 0-68.266666 34.133333 34.133333 0 0 1 0 68.266666z m65.109334 56.192H276.224C276.224 426.666667 276.224 401.066667 341.333333 401.066667s65.109333 25.6 65.109334 47.658666z"
fill="#FFFFFF" p-id="6968"></path>
<path
d="M469.333333 341.333333m17.066667 0l136.533333 0q17.066667 0 17.066667 17.066667l0 8.533333q0 17.066667-17.066667 17.066667l-136.533333 0q-17.066667 0-17.066667-17.066667l0-8.533333q0-17.066667 17.066667-17.066667Z"
fill="#5BADFF" p-id="6969"></path>
<path
d="M512 554.666667m17.066667 0l179.2 0q17.066667 0 17.066666 17.066666l0 51.2q0 17.066667-17.066666 17.066667l-179.2 0q-17.066667 0-17.066667-17.066667l0-51.2q0-17.066667 17.066667-17.066666Z"
fill="#EDEEF0" p-id="6970"></path>
<path
d="M512 682.666667m17.066667 0l179.2 0q17.066667 0 17.066666 17.066666l0 51.2q0 17.066667-17.066666 17.066667l-179.2 0q-17.066667 0-17.066667-17.066667l0-51.2q0-17.066667 17.066667-17.066666Z"
fill="#EDEEF0" p-id="6971"></path>
<path
d="M213.333333 554.666667m17.066667 0l221.866667 0q17.066667 0 17.066666 17.066666l0 8.533334q0 17.066667-17.066666 17.066666l-221.866667 0q-17.066667 0-17.066667-17.066666l0-8.533334q0-17.066667 17.066667-17.066666Z"
fill="#EDEEF0" p-id="6972"></path>
<path
d="M213.333333 640m17.066667 0l221.866667 0q17.066667 0 17.066666 17.066667l0 8.533333q0 17.066667-17.066666 17.066667l-221.866667 0q-17.066667 0-17.066667-17.066667l0-8.533333q0-17.066667 17.066667-17.066667Z"
fill="#EDEEF0" p-id="6973"></path>
<path
d="M213.333333 725.333333m17.066667 0l221.866667 0q17.066667 0 17.066666 17.066667l0 8.533333q0 17.066667-17.066666 17.066667l-221.866667 0q-17.066667 0-17.066667-17.066667l0-8.533333q0-17.066667 17.066667-17.066667Z"
fill="#EDEEF0" p-id="6974"></path>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

-14
View File
@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="referrer" content="never">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>在线视频下载</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/renderer/main.tsx"></script>
</body>
</html>
+50 -134
View File
@@ -1,144 +1,60 @@
{
"name": "media-downloader",
"version": "1.1.3",
"description": "在线视频下载",
"author": "caorushizi",
"main": "dist/main/index.js",
"license": "MIT",
"homepage": "./",
"name": "mediago",
"version": "0.1.0",
"description": "mediago",
"private": true,
"type": "module",
"scripts": {
"dist": "cross-env NODE_ENV=production node script/build.js",
"watch": "cross-env NODE_ENV=development node script/watch.js",
"electron": "cross-env NODE_ENV=production electron .",
"pack": "electron-builder --dir",
"build": "electron-builder",
"publish": "npm run dist && npm run build",
"build-debug": "npm run dist && npm run pack && ./build/win-unpacked/在线视频下载.exe"
"dev": "tsx scripts/dev.ts && pnpm --parallel -F \"./packages/*\" run dev",
"build": "tsx scripts/build.ts",
"build:plugin": "pnpm -F plugin run build",
"build:main": "pnpm -F main run build",
"build:renderer": "pnpm -F renderer run build",
"prerelease": "pnpm run build && pnpm -F mediago run pack",
"release": "pnpm run build && pnpm -F main run release",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs",
"types": "pnpm -F main run types",
"types:watch": "pnpm -F main run types:watch",
"prepare": "husky",
"commit": "git-cz",
"commitlint": "commitlint --edit",
"spellcheck": "cspell \"packages/**/src/**/*.{ts,tsx}\"",
"lint-staged": "pnpm --recursive -F \"./packages/*\" run lint-staged"
},
"dependencies": {
"@ant-design/icons": "^4.6.2",
"@ant-design/pro-form": "^1.49.6",
"@ant-design/pro-table": "^2.59.2",
"@chakra-ui/react": "^1.7.2",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@sentry/electron": "^2.5.4",
"@sentry/react": "^6.16.1",
"@sentry/tracing": "^6.16.1",
"antd": "^4.17.2",
"classnames": "^2.3.1",
"connected-react-router": "^6.9.1",
"electron-devtools-installer": "^3.2.0",
"electron-log": "^4.3.2",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^7.0.2",
"framer-motion": "^4",
"glob": "^7.1.6",
"localforage": "^1.9.0",
"m3u8-parser": "^4.7.0",
"moment": "^2.29.1",
"nanoid": "^3.1.30",
"prop-types": "^15.7.2",
"qs": "^6.10.1",
"re-resizable": "^6.9.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-file-drop": "^3.1.2",
"react-redux": "^7.2.4",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.6",
"redux": "^4.1.1",
"redux-devtools-extension": "^2.13.9",
"redux-saga": "^1.1.3",
"semver": "^7.3.4"
"keywords": [],
"author": "",
"license": "MIT",
"config": {
"commitizen": {
"path": "node_modules/cz-git"
}
},
"devDependencies": {
"@rollup/plugin-eslint": "^8.0.1",
"@types/glob": "^7.1.3",
"@types/node": "^14.14.35",
"@types/qs": "^6.9.7",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.8",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/semver": "^7.3.4",
"@typescript-eslint/eslint-plugin": "^4.0.0",
"@typescript-eslint/parser": "^4.0.0",
"@vitejs/plugin-react-refresh": "^1.3.1",
"babel-eslint": "^10.0.0",
"chalk": "^4.1.2",
"concurrently": "^6.0.0",
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@commitlint/cz-commitlint": "^18.6.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@waline/client": "^3.1.3",
"commitizen": "^4.3.0",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"electron": "16.0.4",
"electron-builder": "^22.14.2",
"electron-updater": "^4.6.1",
"esbuild": "^0.9.5",
"eslint": "^7.5.0",
"eslint-config-prettier": "^8.1.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"less": "^4.1.1",
"prettier": "2.2.1",
"rimraf": "^3.0.2",
"sass": "^1.32.8",
"typescript": "^4.2.4",
"vite": "^2.5.0"
"cspell": "^8.3.2",
"cz-git": "^1.8.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.10",
"prettier": "3.2.5",
"tsx": "^4.7.1",
"vitepress": "1.0.1",
"vue": "^3.4.15",
"zx": "^7.2.3"
},
"build": {
"productName": "在线视频下载",
"appId": "mediago.ziying.site",
"copyright": "caorushizi",
"artifactName": "media-downloader-setup-${version}.${ext}",
"directories": {
"output": "build"
},
"files": [
"dist/**/*",
"package.json"
],
"extraResources": [
".bin/**"
],
"win": {
"icon": "assets/icon.ico",
"requestedExecutionLevel": "requireAdministrator",
"target": [
{
"target": "nsis"
}
]
},
"dmg": {
"contents": []
},
"mac": {
"icon": "build/icons/icon.icns"
},
"linux": {
"icon": "build/icons"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "",
"uninstallerIcon": "",
"installerHeaderIcon": "",
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "",
"include": "",
"script": ""
"pnpm": {
"patchedDependencies": {
"@cliqz/adblocker@1.27.3": "patches/@cliqz__adblocker@1.27.3.patch"
}
}
}
+1
View File
@@ -0,0 +1 @@
./types
+23
View File
@@ -0,0 +1,23 @@
module.exports = {
env: {
node: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [],
ignorePatterns: ["app"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
"prettier/prettier": "warn",
"@typescript-eslint/no-explicit-any": "warn",
},
};
+7
View File
@@ -0,0 +1,7 @@
.bin
node_modules
build
dist
bin/Logs
release
types
+1
View File
@@ -0,0 +1 @@
types/
+1
View File
@@ -0,0 +1 @@
{}
+5
View File
@@ -0,0 +1,5 @@
node_modules
output
bin
mobile
plugin
+16
View File
@@ -0,0 +1,16 @@
{
"name": "mediago",
"version": "2.2.0",
"description": "在线视频下载器",
"main": "main/index.js",
"author": "",
"license": "MIT",
"dependencies": {
"@cliqz/adblocker-electron": "^1.27.3",
"@cliqz/adblocker-electron-preload": "^1.27.3",
"node-pty": "^1.0.0"
},
"devDependencies": {
"electron": "30.0.6"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

+77
View File
@@ -0,0 +1,77 @@
{
"name": "main",
"version": "0.1.0",
"description": "在线视频下载器",
"main": "main/index.js",
"scripts": {
"postinstall": "electron-rebuild -f -w",
"dev": "cross-env NODE_ENV=development VITE_CJS_IGNORE_WARNING=true tsx scripts/dev.ts",
"build": "cross-env NODE_ENV=production tsx scripts/build.ts",
"pack": "cross-env NODE_ENV=development tsx scripts/release.ts",
"types": "tsc",
"types:watch": "tsc -w",
"release": "cross-env NODE_ENV=production tsx scripts/release.ts",
"lint-staged": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@electron/rebuild": "^3.6.0",
"@rushstack/eslint-patch": "^1.7.0",
"@types/fs-extra": "^11.0.4",
"@types/lodash": "^4.14.202",
"@types/mime-types": "^2.1.4",
"@types/node": "^20.11.5",
"@types/node-fetch": "^2.6.11",
"@types/semver": "^7.5.6",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"chokidar": "^3.5.3",
"consola": "^3.2.3",
"cross-env": "^7.0.3",
"dotenv": "^16.3.2",
"electron": "30.0.6",
"electron-builder": "^24.9.1",
"electron-updater": "^6.1.7",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "6.1.1",
"prebuild-install": "^7.1.1",
"prettier": "3.2.5",
"semver": "^7.5.4",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"vite": "^5.0.12"
},
"dependencies": {
"@cliqz/adblocker-electron": "^1.27.3",
"@cliqz/adblocker-electron-preload": "^1.27.3",
"axios": "^1.6.5",
"better-sqlite3": "^9.3.0",
"cheerio": "1.0.0-rc.12",
"dayjs": "^1.11.10",
"electron-devtools-installer": "^3.2.0",
"electron-is-dev": "^3.0.1",
"electron-log": "^5.0.3",
"electron-store": "^8.1.0",
"execa": "^8.0.1",
"fs-extra": "^11.2.0",
"inversify": "^6.0.2",
"lint-staged": "^15.2.2",
"lodash": "^4.17.21",
"mime-types": "^2.1.35",
"node-fetch": "^3.3.2",
"node-pty": "^1.0.0",
"reflect-metadata": "^0.2.1",
"strip-ansi": "^7.1.0",
"typeorm": "^0.3.19"
}
}
+59
View File
@@ -0,0 +1,59 @@
import * as esbuild from "esbuild";
import {
mainResolve,
loadDotEnvDefined,
copyResource,
removeResource,
} from "./utils";
import { external } from "./config";
const mainDefined = loadDotEnvDefined();
removeResource([mainResolve("app/build")]);
removeResource([mainResolve("app/bin")]);
const path = "build/Release/better_sqlite3.node";
copyResource([
{
from: mainResolve("node_modules/better-sqlite3", path),
to: mainResolve("app", path),
},
{
from: mainResolve("bin"),
to: mainResolve("app/bin"),
},
]);
esbuild.build({
entryPoints: [mainResolve("src/index.ts")],
bundle: true,
platform: "node",
sourcemap: false,
target: ["node16.13"],
external,
define: {
"process.env.NODE_ENV": '"production"',
...mainDefined,
},
outdir: mainResolve("app/build/main"),
loader: { ".png": "file" },
minify: true,
plugins: [],
});
esbuild.build({
entryPoints: [mainResolve("src/preload.ts")],
bundle: true,
platform: "browser",
target: ["chrome89"],
sourcemap: false,
external,
define: {
"process.env.NODE_ENV": '"production"',
...mainDefined,
},
outdir: mainResolve("app/build/main"),
loader: { ".png": "file" },
minify: true,
});
+8
View File
@@ -0,0 +1,8 @@
export const external = [
"electron",
"nock",
"aws-sdk",
"mock-aws-s3",
"@cliqz/adblocker-electron-preload",
"node-pty",
];
+101
View File
@@ -0,0 +1,101 @@
import { ChildProcessWithoutNullStreams, spawn } from "child_process";
import electron from "electron";
import * as esbuild from "esbuild";
import chokidar from "chokidar";
import { loadDotEnvRuntime, mainResolve, copyResource } from "./utils";
import { external } from "./config";
import consola from "consola";
let electronProcess: ChildProcessWithoutNullStreams | null = null;
process.env.NODE_ENV = "development";
loadDotEnvRuntime();
async function copySource() {
const path = "build/Release/better_sqlite3.node";
copyResource([
{
from: mainResolve("node_modules/better-sqlite3", path),
to: mainResolve("app", path),
},
{
from: mainResolve("bin"),
to: mainResolve("app/bin"),
},
]);
}
const buildConfig: esbuild.BuildOptions = {
bundle: true,
platform: "node",
sourcemap: true,
target: ["node20.9"],
external,
define: {
// 开发环境中二进制可执行文件的路径
__bin__: `"${mainResolve("bin", process.platform).replace(/\\/g, "\\\\")}"`,
},
plugins: [],
outdir: mainResolve("app/build/main"),
loader: { ".png": "file" },
};
function startElectron() {
const args = ["--inspect=5858", mainResolve("app/build/main/index.js")];
electronProcess = spawn(String(electron), args);
electronProcess.stdout.on("data", (data) => {
consola.log(String(data));
});
electronProcess.stderr.on("data", (data) => {
consola.log(String(data));
});
}
function restartElectron() {
if (electronProcess && electronProcess.pid) {
if (process.platform === "darwin") {
spawn("kill", ["-9", String(electronProcess.pid)]);
} else {
process.kill(electronProcess.pid);
}
electronProcess = null;
startElectron();
}
}
async function start() {
const mainContext = await esbuild.context({
...buildConfig,
entryPoints: [mainResolve("src/index.ts")],
});
const preloadContext = await esbuild.context({
...buildConfig,
entryPoints: [mainResolve("src/preload.ts")],
platform: "browser",
});
const watcher = chokidar.watch("./src");
watcher.on("change", async () => {
await mainContext.rebuild();
await preloadContext.rebuild();
consola.log("watch build succeed.");
restartElectron();
});
try {
await mainContext.rebuild();
await preloadContext.rebuild();
await copySource();
await startElectron();
} catch (e) {
console.error(e);
process.exit();
}
}
start();
+115
View File
@@ -0,0 +1,115 @@
import { loadDotEnvRuntime, mainResolve, removeResource } from "./utils";
import * as builder from "electron-builder";
import semver from "semver";
import pkg from "../app/package.json";
import consola from "consola";
removeResource([mainResolve("release")]);
loadDotEnvRuntime();
if (semver.neq(process.env.APP_VERSION || "", pkg.version)) {
consola.log("请先同步构建版本和发布版本");
process.exit(0);
}
const options: builder.Configuration = {
productName: process.env.APP_NAME,
buildVersion: process.env.APP_VERSION,
appId: process.env.APP_ID,
copyright: process.env.APP_COPYRIGHT,
artifactName: "${productName}-setup-${buildVersion}.${ext}",
// FIXME: 这里屏蔽 node-pty 自动重构,因为会导致打包失败
npmRebuild: false,
directories: {
output: "./release",
},
files: [
{
from: "./build",
to: "./",
},
"./package.json",
],
extraResources: [
{
from: "./app/plugin",
to: "plugin",
},
{
from: "./app/bin/${platform}/",
to: "bin",
},
],
win: {
icon: "../assets/icon.ico",
target: [
{
target: "nsis",
},
],
},
dmg: {
contents: [
{
x: 410,
y: 150,
type: "link",
path: "/Applications",
},
{
x: 130,
y: 150,
type: "file",
},
],
},
mac: {
icon: "../assets/icon.icns",
target: {
target: "default",
arch: ["x64", "arm64"],
},
},
linux: {},
nsis: {
oneClick: true,
allowElevation: true,
allowToChangeInstallationDirectory: false,
installerIcon: "",
uninstallerIcon: "",
installerHeaderIcon: "",
createDesktopShortcut: true,
createStartMenuShortcut: true,
shortcutName: "",
include: "",
script: "",
},
publish: {
provider: "github",
repo: "mediago",
owner: "caorushizi",
releaseType: "release",
},
};
async function start() {
const target =
process.env.NODE_ENV === "development"
? builder.DIR_TARGET
: builder.DEFAULT_TARGET;
try {
const targets =
process.platform === "win32"
? builder.Platform.WINDOWS.createTarget(target)
: builder.Platform.MAC.createTarget(target);
await builder.build({
targets,
config: options,
});
} catch (e) {
consola.log(e);
}
}
start();
+72
View File
@@ -0,0 +1,72 @@
import { existsSync, cpSync, rmSync } from "fs";
import dotenv from "dotenv";
import { resolve } from "path";
import consola from "consola";
import fs from "fs-extra";
export const mainResolve = (...r: string[]) => resolve(__dirname, "..", ...r);
export const rootResolve = (...r: string[]) =>
resolve(__dirname, "../../..", ...r);
const nodeEnv = process.env.NODE_ENV;
consola.log("当前的环境是: ", nodeEnv);
function loadEnv(path: string) {
const result: Record<string, string> = {};
if (!existsSync(path)) {
return null;
}
const parsed = dotenv.parse(fs.readFileSync(path));
if (!parsed) {
return null;
}
Object.keys(parsed).forEach((key) => {
result[key] = parsed[key];
});
return result;
}
function loadDotEnv() {
const env = loadEnv(rootResolve(".env"));
const envMode = loadEnv(rootResolve(`.env.${nodeEnv}`));
const envModeLocal = loadEnv(rootResolve(`.env.${nodeEnv}.local`));
return { ...env, ...envMode, ...envModeLocal };
}
export function loadDotEnvRuntime() {
const env = loadDotEnv();
Object.keys(env).forEach((key) => {
if (process.env[key] != null || !env[key]) return;
process.env[key] = env[key];
});
}
export function loadDotEnvDefined() {
const env = loadDotEnv();
return Object.keys(env).reduce<Record<string, string>>((prev, cur) => {
if (!cur.startsWith("APP_")) return prev;
prev[`process.env.${[cur]}`] = JSON.stringify(env[cur]);
return prev;
}, {});
}
export function copyResource(resource: { from: string; to: string }[]) {
resource.forEach((r) => {
const { from, to } = r;
cpSync(from, to, {
recursive: true,
});
});
}
export function removeResource(resource: string[]) {
resource.forEach((r) => {
rmSync(r, { recursive: true, force: true });
});
}
+100
View File
@@ -0,0 +1,100 @@
import { inject, injectable } from "inversify";
import { DownloadStatus } from "./interfaces";
import { TYPES } from "./types";
import { Menu, Tray, app, nativeImage, nativeTheme } from "electron";
import TrayIcon from "./tray-icon.png";
import path from "path";
import MainWindow from "./windows/MainWindow";
import WebviewService from "./services/WebviewService";
import VideoRepository from "./repository/VideoRepository";
import ElectronDevtools from "./vendor/ElectronDevtools";
import ElectronStore from "./vendor/ElectronStore";
import ElectronUpdater from "./vendor/ElectronUpdater";
import TypeORM from "./vendor/TypeORM";
import ProtocolService from "./core/protocol";
import IpcHandlerService from "./core/ipc";
@injectable()
export default class ElectronApp {
constructor(
@inject(TYPES.MainWindow)
private readonly mainWindow: MainWindow,
@inject(TYPES.ProtocolService)
private readonly protocol: ProtocolService,
@inject(TYPES.ElectronUpdater)
private readonly updater: ElectronUpdater,
@inject(TYPES.IpcHandlerService)
private readonly ipc: IpcHandlerService,
@inject(TYPES.TypeORM)
private readonly db: TypeORM,
@inject(TYPES.WebviewService)
private readonly webview: WebviewService,
@inject(TYPES.VideoRepository)
private readonly videoRepository: VideoRepository,
@inject(TYPES.ElectronDevtools)
private readonly devTools: ElectronDevtools,
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
) {}
private async serviceInit(): Promise<void> {
this.mainWindow.init();
this.webview.init();
}
private async vendorInit() {
await this.db.init();
this.updater.init();
this.devTools.init();
}
async init(): Promise<void> {
this.protocol.create();
this.ipc.init();
// vendor
await this.vendorInit();
// service
await this.serviceInit();
app.on("activate", () => {
this.mainWindow.init();
});
this.initAppTheme();
this.resetDownloadStatus();
this.initTray();
}
initAppTheme(): void {
const theme = this.store.get("theme");
nativeTheme.themeSource = theme;
}
initTray() {
const iconPath = path.resolve(__dirname, TrayIcon);
const icon = nativeImage.createFromPath(iconPath);
const tray = new Tray(icon);
tray.setToolTip("在线视频下载");
tray.addListener("click", () => {
this.mainWindow.init();
});
const contextMenu = Menu.buildFromTemplate([
{ label: "显示主窗口", click: () => this.mainWindow.init() },
{ label: "退出 app", role: "quit" },
]);
tray.setContextMenu(contextMenu);
}
// 如果重启后还有正在下载的视频,就将状态改成下载失败
async resetDownloadStatus(): Promise<void> {
// 重启后如果还有 downloading 状态的数据, 全部重置为失败
const videos = await this.videoRepository.findWattingAndDownloadingVideos();
const videoIds = videos.map((video) => video.id);
await this.videoRepository.changeVideoStatus(
videoIds,
DownloadStatus.Failed,
);
}
}
@@ -0,0 +1,114 @@
import { IpcMainEvent } from "electron/main";
import { inject, injectable } from "inversify";
import { handle } from "../helper";
import {
type Controller,
DownloadItem,
DownloadItemPagination,
Task,
DownloadStatus,
} from "../interfaces";
import { TYPES } from "../types";
import MainWindow from "../windows/MainWindow";
import ElectronStore from "../vendor/ElectronStore";
import DownloadService from "../services/DownloadService";
import VideoRepository from "../repository/VideoRepository";
import WebviewService from "../services/WebviewService";
@injectable()
export default class DownloadController implements Controller {
constructor(
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
@inject(TYPES.VideoRepository)
private readonly videoRepository: VideoRepository,
@inject(TYPES.DownloadService)
private readonly downloadService: DownloadService,
@inject(TYPES.MainWindow)
private readonly mainWindow: MainWindow,
@inject(TYPES.WebviewService)
private readonly webviewService: WebviewService,
) {}
@handle("show-download-dialog")
async showDownloadDialog(e: IpcMainEvent, data: DownloadItem) {
const image = await this.webviewService.captureView();
this.webviewService.sendToWindow(
"show-download-dialog",
data,
image.toDataURL(),
);
}
@handle("add-download-item")
async addDownloadItem(e: IpcMainEvent, video: DownloadItem) {
const item = await this.videoRepository.addVideo(video);
// 这里向页面发送消息,通知页面更新
this.mainWindow.send("download-item-notifier", item);
return item;
}
@handle("add-download-items")
async addDownloadItems(e: IpcMainEvent, videos: DownloadItem[]) {
const items = await this.videoRepository.addVideos(videos);
// 这里向页面发送消息,通知页面更新
this.mainWindow.send("download-item-notifier", items);
return items;
}
@handle("edit-download-item")
async editDownloadItem(e: IpcMainEvent, video: DownloadItem) {
const item = await this.videoRepository.editVideo(video);
return item;
}
@handle("download-now")
async downloadNow(e: IpcMainEvent, video: DownloadItem) {
// 添加下载项
const item = await this.addDownloadItem(e, video);
// 开始下载
await this.startDownload(e, item.id);
return item;
}
@handle("get-download-items")
async getDownloadItems(e: IpcMainEvent, pagination: DownloadItemPagination) {
const videos = await this.videoRepository.findVideos(pagination);
return videos;
}
@handle("start-download")
async startDownload(e: IpcMainEvent, vid: number) {
// 查找将要下载的视频
const video = await this.videoRepository.findVideo(vid);
const { name, url, headers, type } = video;
const local = this.store.get("local");
// 从配置中添加参数
const deleteSegments = this.store.get("deleteSegments");
const task: Task = {
id: vid,
params: {
url,
type,
local,
name,
headers,
deleteSegments,
},
};
await this.videoRepository.changeVideoStatus(vid, DownloadStatus.Watting);
this.downloadService.addTask(task);
}
@handle("stop-download")
async stopDownload(e: IpcMainEvent, id: number) {
this.downloadService.stopTask(id);
}
@handle("delete-download-item")
async deleteDownloadItem(e: IpcMainEvent, id: number) {
return await this.videoRepository.deleteDownloadItem(id);
}
}
@@ -0,0 +1,255 @@
import {
dialog,
IpcMainEvent,
Menu,
MenuItem,
MenuItemConstructorOptions,
nativeTheme,
shell,
clipboard,
} from "electron";
import { Favorite } from "../entity/Favorite";
import { convertToAudio, db, workspace } from "../helper";
import { inject, injectable } from "inversify";
import { AppStore, EnvPath } from "../main";
import path from "path";
import { handle, getLocalIP } from "../helper";
import { type Controller } from "../interfaces";
import { TYPES } from "../types";
import fs from "fs-extra";
import MainWindow from "../windows/MainWindow";
import BrowserWindow from "../windows/BrowserWindow";
import ElectronStore from "../vendor/ElectronStore";
import WebviewService from "../services/WebviewService";
import FavoriteRepository from "../repository/FavoriteRepository";
import VideoRepository from "../repository/VideoRepository";
@injectable()
export default class HomeController implements Controller {
private sharedState: Record<string, any> = {};
constructor(
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
@inject(TYPES.FavoriteRepository)
private readonly favoriteRepository: FavoriteRepository,
@inject(TYPES.MainWindow)
private readonly mainWindow: MainWindow,
@inject(TYPES.VideoRepository)
private readonly videoRepository: VideoRepository,
@inject(TYPES.BrowserWindow)
private readonly browserWindow: BrowserWindow,
@inject(TYPES.WebviewService)
private readonly webviewService: WebviewService,
) {}
@handle("get-env-path")
async getEnvPath(): Promise<EnvPath> {
return {
binPath: __bin__,
dbPath: db,
workspace: workspace,
platform: process.platform,
local: this.store.get("local"),
};
}
@handle("get-favorites")
getFavorites() {
return this.favoriteRepository.findFavorites();
}
@handle("add-favorite")
addFavorite(e: IpcMainEvent, favorite: Favorite) {
return this.favoriteRepository.addFavorite(favorite);
}
@handle("remove-favorite")
removeFavorite(e: IpcMainEvent, id: number): Promise<void> {
return this.favoriteRepository.removeFavorite(id);
}
@handle("get-app-store")
getAppStore() {
return this.store.store;
}
@handle("on-favorite-item-context-menu")
async onFavoriteItemContextMenu(e: IpcMainEvent, id: number) {
const send = (action: string) => {
this.mainWindow.send("favorite-item-event", {
action,
payload: id,
});
};
const template: Array<MenuItemConstructorOptions | MenuItem> = [
{
label: "打开",
click: () => {
send("open");
},
},
{ type: "separator" },
{
label: "删除",
click: () => {
send("delete");
},
},
];
const menu = Menu.buildFromTemplate(template);
menu.popup();
}
@handle("select-download-dir")
async selectDownloadDir(): Promise<string> {
const window = this.mainWindow.window;
if (!window) return Promise.reject("未找到主窗口");
const result = await dialog.showOpenDialog(window, {
properties: ["openDirectory"],
});
if (!result.canceled) {
const dir = result.filePaths[0];
this.store.set("local", dir);
return dir;
}
return "";
}
@handle("set-app-store")
async setAppStore(e: IpcMainEvent, key: keyof AppStore, val: any) {
// useProxy
if (key === "useProxy") {
const proxy = this.store.get("proxy");
this.webviewService.setProxy(val, proxy);
}
// proxy
if (key === "proxy") {
const useProxy = this.store.get("useProxy");
useProxy && this.webviewService.setProxy(true, val);
}
// block
if (key === "blockAds") {
this.webviewService.setBlocking(val);
}
// theme
if (key === "theme") {
nativeTheme.themeSource = val;
}
// isMobile
if (key === "isMobile") {
this.webviewService.setUserAgent(val);
}
this.store.set(key, val);
}
@handle("open-dir")
async openDir(e: IpcMainEvent, dir: string) {
await shell.openPath(dir);
}
@handle("open-url")
async openUrl(e: IpcMainEvent, url: string) {
await shell.openExternal(url);
}
@handle("on-download-list-context-menu")
async downloadListContextMenu(e: IpcMainEvent, id: number) {
const send = (action: string) => {
this.mainWindow.send("download-item-event", {
action,
payload: id,
});
};
const item = await this.videoRepository.findVideo(id);
const template: Array<MenuItemConstructorOptions | MenuItem> = [
{
label: "拷贝链接地址",
click: () => {
clipboard.writeText(item.url || "");
},
},
{
label: "选择",
click: () => {
send("select");
},
},
{
label: "下载",
click: () => {
send("download");
},
},
{
label: "刷新",
click: () => {
send("refresh");
},
},
{ type: "separator" },
{
label: "删除",
click: () => {
send("delete");
},
},
];
const menu = Menu.buildFromTemplate(template);
menu.popup();
}
@handle("convert-to-audio")
async convertToAudio(e: IpcMainEvent, id: number) {
const video = await this.videoRepository.findVideo(id);
const local = this.store.get("local");
const input = path.join(local, `${video.name}.mp4`);
const output = path.join(local, `${video.name}.mp3`);
const exist = await fs.exists(input);
if (exist) {
return await convertToAudio(input, output);
} else {
return Promise.reject("未找到文件,可能是文件已经删除");
}
}
@handle("show-browser-window")
async showBrowserWindow() {
this.browserWindow.showWindow();
}
@handle("combine-to-home-page")
async combineToHomePage() {
// 关闭浏览器窗口
this.browserWindow.hideWindow();
// 修改设置中的属性
this.store.set("openInNewWindow", false);
}
@handle("get-local-ip")
async getLocalIp() {
return getLocalIP();
}
@handle("get-shared-state")
async getSharedState() {
return this.sharedState;
}
@handle("set-shared-state")
async setSharedState(event: IpcMainEvent, state: any) {
this.sharedState = state;
}
@handle("get-download-log")
async getDownloadLog(event: IpcMainEvent, id: number) {
const video = await this.videoRepository.findVideo(id);
return video.log || "";
}
}
@@ -0,0 +1,88 @@
import {
IpcMainEvent,
Menu,
MenuItem,
MenuItemConstructorOptions,
} from "electron";
import { inject, injectable } from "inversify";
import { handle } from "../helper";
import { type Controller } from "../interfaces";
import { TYPES } from "../types";
import WebviewService from "../services/WebviewService";
import ElectronStore from "../vendor/ElectronStore";
import { SniffingHelper } from "../services/SniffingHelperService";
@injectable()
export default class WebviewController implements Controller {
constructor(
@inject(TYPES.WebviewService)
private readonly webview: WebviewService,
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
@inject(TYPES.SniffingHelper)
private readonly sniffingHelper: SniffingHelper,
) {}
@handle("set-webview-bounds")
async setWebviewBounds(e: IpcMainEvent, bounds: Electron.Rectangle) {
this.webview.setBounds(bounds);
}
@handle("webview-load-url")
async browserViewLoadUrl(e: IpcMainEvent, url?: string): Promise<void> {
await this.webview.loadURL(url);
}
@handle("webview-url-contextmenu")
async webviewUrlContextMenu() {
const template: Array<MenuItemConstructorOptions | MenuItem> = [
{
label: "复制",
role: "copy",
},
{
label: "粘贴",
role: "paste",
},
];
const menu = Menu.buildFromTemplate(template);
menu.popup();
}
@handle("webview-go-back")
async webviewGoBack(): Promise<boolean> {
return this.webview.goBack();
}
@handle("webview-reload")
async webviewReload() {
await this.webview.reload();
}
@handle("webview-show")
async webviewShow() {
this.webview.show();
}
@handle("webview-hide")
async webviewHide() {
this.webview.hide();
}
@handle("webview-go-home")
async webviewGoHome() {
await this.webview.goHome();
}
@handle("webview-change-user-agent")
async webviewChangeUserAgent(e: IpcMainEvent, isMobile: boolean) {
this.webview.setUserAgent(isMobile);
this.store.set("isMobile", isMobile);
}
@handle("plugin-ready")
async pluginReady() {
this.sniffingHelper.pluginReady();
}
}
+64
View File
@@ -0,0 +1,64 @@
import { ipcMain } from "electron";
import { inject, injectable, multiInject } from "inversify";
import { Controller } from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import { error, success } from "../helper/utils";
@injectable()
export default class IpcHandlerService {
constructor(
@multiInject(TYPES.Controller)
private readonly controllers: Controller[],
@inject(TYPES.ElectronLogger)
private readonly logger: ElectronLogger,
) {}
private registerIpc(
controller: Controller,
propertyKey: string | symbol,
): void {
const property = controller[propertyKey];
if (typeof property !== "function") return;
const channel: string = Reflect.getMetadata(
"ipc-channel",
controller,
propertyKey,
);
if (!channel) return;
const ipcMethod: "on" | "handle" = Reflect.getMetadata(
"ipc-method",
controller,
propertyKey,
);
if (!ipcMethod) return;
ipcMain[ipcMethod](channel, async (...args: unknown[]) => {
try {
let res = property.call(controller, ...args);
if (res.then) {
res = await res;
}
return success(res);
} catch (e: unknown) {
this.logger.error(`处理 ipc [${channel}] 事件时异常: `, e);
if (e instanceof Error) {
return error(e.message);
} else {
return error(String(e));
}
}
});
}
init(): void {
for (const controller of this.controllers) {
const Class = Object.getPrototypeOf(controller);
Object.getOwnPropertyNames(Class).forEach((propertyKey) =>
this.registerIpc(controller, propertyKey),
);
}
}
}
+30
View File
@@ -0,0 +1,30 @@
import { protocol } from "electron";
import isDev from "electron-is-dev";
import { pathExists, readFile } from "fs-extra";
import { injectable } from "inversify";
import { join } from "path";
import { URL } from "url";
import { defaultScheme } from "../helper";
import mime from "mime-types";
@injectable()
export default class ProtocolService {
create(): void {
if (isDev) return;
protocol.handle(defaultScheme, async (req) => {
const pathName = new URL(req.url).pathname;
let filePath = join(__dirname, "../renderer", pathName);
const fileExist = await pathExists(filePath);
if (!fileExist) {
// 如果没有找到文件,直接返回 index.html react history 模式
filePath = join(__dirname, "../renderer/index.html");
}
const mimeType = mime.lookup(filePath);
const data = await readFile(filePath);
return new Response(data, {
headers: { "Content-Type": mimeType || "text/html" },
});
});
}
}
+3
View File
@@ -0,0 +1,3 @@
export interface Vendor {
init(): Promise<void>;
}
+43
View File
@@ -0,0 +1,43 @@
import { BrowserWindow, BrowserWindowConstructorOptions } from "electron";
import isDev from "electron-is-dev";
export default class Window {
window: BrowserWindow | null = null;
options: BrowserWindowConstructorOptions;
url: string;
constructor(options: BrowserWindowConstructorOptions) {
this.options = options;
}
create() {
if (!this.url) {
throw new Error("url is required");
}
const window = new BrowserWindow(this.options);
void window.loadURL(this.url);
window.once("ready-to-show", this.readyToShow);
window.on("close", this.windowClose);
return window;
}
readyToShow = () => {
if (!this.window) return;
this.window.show();
isDev && this.window.webContents.openDevTools();
};
windowClose = () => {
if (!this.window) return;
// 防止 webview 同时被销毁
this.window.setBrowserView(null);
// 销毁窗口
this.window = null;
};
}
+39
View File
@@ -0,0 +1,39 @@
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from "typeorm";
@Entity({
name: "favorite",
})
export class Favorite {
@PrimaryGeneratedColumn()
id: number;
@Column({
type: "text",
nullable: false,
})
title: string;
@Column({
type: "text",
nullable: false,
})
url: string;
@Column({
type: "text",
nullable: true,
})
icon?: string;
@CreateDateColumn()
createdDate: Date;
@UpdateDateColumn()
updatedDate: Date;
}
+68
View File
@@ -0,0 +1,68 @@
import { DownloadStatus, DownloadType } from "../interfaces";
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from "typeorm";
@Entity({
name: "video",
})
export class Video {
@PrimaryGeneratedColumn()
id: number;
@Column({
type: "text",
nullable: true,
unique: true,
})
name: string;
@Column({
type: "text",
nullable: false,
default: DownloadType.m3u8,
})
type: DownloadType;
@Column({
type: "text",
nullable: false,
})
url: string;
@Column({
type: "text",
nullable: true,
})
headers: string;
@Column({
type: "boolean",
default: false,
nullable: false,
})
isLive: boolean;
@Column({
type: "text",
nullable: false,
default: DownloadStatus.Ready,
})
status: DownloadStatus;
@Column({
type: "text",
default: "",
})
log: string;
@CreateDateColumn()
createdDate: Date;
@UpdateDateColumn()
updatedDate: Date;
}
+6
View File
@@ -0,0 +1,6 @@
/* eslint-disable no-var */
declare global {
var __bin__: string;
}
export {};
+13
View File
@@ -0,0 +1,13 @@
export const handle = (route: string) => {
return (target: any, propertyKey: string): void => {
Reflect.defineMetadata("ipc-method", "handle", target, propertyKey);
Reflect.defineMetadata("ipc-channel", route, target, propertyKey);
};
};
export const on = (route: string) => {
return (target: any, propertyName: string): void => {
Reflect.defineMetadata("ipc-method", "on", target, propertyName);
Reflect.defineMetadata("ipc-channel", route, target, propertyName);
};
};
+39
View File
@@ -0,0 +1,39 @@
import { spawn } from "child_process";
import { ffmpegPath } from "./variables";
export const convertToAudio = async (
input: string,
output: string,
): Promise<void> => {
return new Promise((resolve, reject) => {
const ffmpeg = spawn(ffmpegPath, [
"-y",
"-v",
"error",
"-i",
input,
"-acodec",
"mp3",
"-format",
"mp3",
output,
]);
let errData = "";
ffmpeg.stderr.on("data", (data) => {
errData += String(data);
});
ffmpeg.on("error", (err) => {
reject(err);
});
ffmpeg.on("close", (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(errData));
}
});
});
};
+41
View File
@@ -0,0 +1,41 @@
import os from "os";
import fetch from "node-fetch";
import https from "https";
export function getLocalIP() {
const interfaces = os.networkInterfaces();
let localIP = "";
// 遍历网络接口
for (const key in interfaces) {
const iface = interfaces[key];
if (!iface) continue;
// 过滤出 IPv4 地址且非回环地址
const filteredIface = iface.filter(
(details) => details.family === "IPv4" && !details.internal,
);
if (filteredIface.length > 0) {
localIP = filteredIface[0].address;
break;
}
}
return localIP;
}
function fetchWrapper(url: string) {
const options = {
agent: new https.Agent({
rejectUnauthorized: false,
}),
};
return fetch(url, options);
}
export { sleep, formatHeaders } from "./utils";
export * from "./variables";
export { on, handle } from "./decorator";
export { convertToAudio } from "./ffmpeg";
export { fetchWrapper as fetch };
+38
View File
@@ -0,0 +1,38 @@
import EventEmitter from "events";
export async function sleep(second = 1): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, second * 1000));
}
export function formatHeaders(headersStr: string): string {
const headers: Record<string, any> | null = JSON.parse(headersStr);
if (!headers) return "";
const formatted = Object.entries(headers)
.map(([key, value]) => `${key}:${value}`)
.join("|");
return formatted;
}
export const event = new EventEmitter();
export interface IpcResponse {
code: number;
message: string;
data: Record<string, any> | null;
}
export function success(data: Record<string, any>): IpcResponse {
return {
code: 0,
message: "success",
data,
};
}
export function error(message = "fail"): IpcResponse {
return {
code: -1,
message,
data: null,
};
}
+48
View File
@@ -0,0 +1,48 @@
import { app } from "electron";
import isDev from "electron-is-dev";
import { resolve } from "path";
const appPath = app.getAppPath();
export const appData = app.getPath("appData");
export const download = app.getPath("downloads");
export const isMac = process.platform === "darwin";
export const isWin = process.platform === "win32";
if (!isDev) {
global.__bin__ = resolve(appPath, "../bin");
}
export function resolveStatic(path: string) {
const relativePath = isDev ? "../.." : "..";
return resolve(appPath, relativePath, path);
}
export function resolveBin(path: string) {
if (isWin) {
path += ".exe";
}
return resolve(__bin__, path);
}
export const appName = process.env.APP_NAME || "mediago";
export const workspace = resolve(appData, appName);
export const defaultScheme = "mediago";
export const PERSIST_MEDIAGO = "persist:mediago";
export const PERSIST_WEBVIEW = "persist:webview";
export const db = resolve(workspace, "app.db");
// bin path
const downloaderBinName = isWin ? "N_m3u8DL-CLI" : "N_m3u8DL-RE";
export const ffmpegPath = resolveBin("ffmpeg");
export const biliDownloaderBin = resolveBin("BBDown");
export const m3u8DownloaderBin = resolveBin(downloaderBinName);
export const videoServerBin = resolveBin("server");
// plugin path
export const pluginPath = resolveStatic("plugin/index.js");
// user agent
export const pcUA =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
export const mobileUA =
"Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36";
+7
View File
@@ -0,0 +1,7 @@
declare module "*.svg";
declare module "*.png";
declare module "*.jpg";
declare module "*.jpeg";
declare module "*.gif";
declare module "*.bmp";
declare module "*.tiff";
+32
View File
@@ -0,0 +1,32 @@
import "reflect-metadata";
import { app, protocol } from "electron";
import { defaultScheme } from "./helper";
import { container } from "./inversify.config";
import { TYPES } from "./types";
import ElectronApp from "./app";
const gotTheLock = app.requestSingleInstanceLock();
const start = async (): Promise<void> => {
if (!gotTheLock) {
app.quit();
}
protocol.registerSchemesAsPrivileged([
{
scheme: defaultScheme,
privileges: {
secure: true,
standard: true,
},
},
]);
await app.whenReady();
const mediago = container.get<ElectronApp>(TYPES.ElectronApp);
mediago.init();
app.on("window-all-closed", () => {
// empty
});
};
void start();
+66
View File
@@ -0,0 +1,66 @@
export type Controller = Record<string | symbol, any>;
export interface DownloadItem {
id: number;
type: DownloadType;
name: string;
url: string;
headers?: string;
status?: DownloadStatus;
isLive?: boolean;
}
export enum DownloadFilter {
list = "list",
done = "done",
}
export interface DownloadItemPagination {
current?: number;
pageSize?: number;
filter?: DownloadFilter;
}
export interface VideoResponse {
total: number;
list: DownloadItem[];
}
export enum DownloadStatus {
Ready = "ready",
Watting = "watting",
Downloading = "downloading",
Stopped = "stopped",
Success = "success",
Failed = "failed",
}
export type Task = {
id: number;
params: Omit<DownloadParams, "id" | "abortSignal" | "callback">;
};
export interface DownloadProgress {
id: number;
type: string;
percent: string;
speed: string;
isLive: boolean;
}
export enum DownloadType {
m3u8 = "m3u8",
bilibili = "bilibili",
}
export interface DownloadParams {
id: number;
type: DownloadType;
url: string;
local: string;
name: string;
headers?: string;
abortSignal: AbortController;
proxy?: string;
deleteSegments?: boolean;
callback: (progress: DownloadProgress) => void;
}
+62
View File
@@ -0,0 +1,62 @@
import DownloadController from "./controller/DownloadController";
import HomeController from "./controller/HomeController";
import WebviewController from "./controller/WebviewController";
import { Container } from "inversify";
import FavoriteRepository from "./repository/FavoriteRepository";
import VideoRepository from "./repository/VideoRepository";
import WebviewService from "./services/WebviewService";
import ElectronApp from "./app";
import { Controller } from "./interfaces";
import { TYPES } from "./types";
import MainWindow from "./windows/MainWindow";
import BrowserWindow from "./windows/BrowserWindow";
import { SniffingHelper } from "./services/SniffingHelperService";
import DownloadService from "./services/DownloadService";
import ElectronLogger from "./vendor/ElectronLogger";
import ElectronUpdater from "./vendor/ElectronUpdater";
import TypeORM from "./vendor/TypeORM";
import ElectronDevtools from "./vendor/ElectronDevtools";
import ElectronStore from "./vendor/ElectronStore";
import IpcHandler from "./core/ipc";
import ProtocolService from "./core/protocol";
const container = new Container({
skipBaseClassChecks: true,
defaultScope: "Singleton",
autoBindInjectable: true,
});
container.bind<ElectronApp>(TYPES.ElectronApp).to(ElectronApp);
// services
container.bind<WebviewService>(TYPES.WebviewService).to(WebviewService);
container.bind<DownloadService>(TYPES.DownloadService).to(DownloadService);
container.bind<SniffingHelper>(TYPES.SniffingHelper).to(SniffingHelper);
// windows
container.bind<MainWindow>(TYPES.MainWindow).to(MainWindow);
container.bind<BrowserWindow>(TYPES.BrowserWindow).to(BrowserWindow);
// controller
container.bind<Controller>(TYPES.Controller).to(HomeController);
container.bind<Controller>(TYPES.Controller).to(WebviewController);
container.bind<Controller>(TYPES.Controller).to(DownloadController);
// repository
container.bind<VideoRepository>(TYPES.VideoRepository).to(VideoRepository);
container
.bind<FavoriteRepository>(TYPES.FavoriteRepository)
.to(FavoriteRepository);
// vendor
container.bind<ElectronDevtools>(TYPES.ElectronDevtools).to(ElectronDevtools);
container.bind<TypeORM>(TYPES.TypeORM).to(TypeORM);
container.bind<ElectronUpdater>(TYPES.ElectronUpdater).to(ElectronUpdater);
container.bind<ElectronLogger>(TYPES.ElectronLogger).to(ElectronLogger);
container.bind<ElectronStore>(TYPES.ElectronStore).to(ElectronStore);
// core
container.bind<ProtocolService>(TYPES.ProtocolService).to(ProtocolService);
container.bind<IpcHandler>(TYPES.IpcHandlerService).to(IpcHandler);
export { container };
+60
View File
@@ -0,0 +1,60 @@
import { Rectangle } from "electron";
import { type DownloadType } from "interfaces";
import { AppLanguage, AppTheme } from "./types";
declare interface EnvPath {
binPath: string;
dbPath: string;
workspace: string;
platform: string;
local: string;
}
declare interface BrowserWindowInitialVal {
url?: string;
sourceList?: WebSource[];
}
declare interface WebSource {
url: string;
type: DownloadType;
name: string;
headers?: string;
}
declare interface AppStore {
// 本地存储地址
local: string;
// 下载完成提示音
promptTone: boolean;
// 代理地址
proxy: string;
// 是否开启代理
useProxy: boolean;
// 下载完成后删除原始文件
deleteSegments: boolean;
// 新窗口打开浏览器
openInNewWindow: boolean;
mainBounds?: Rectangle;
browserBounds?: Rectangle;
blockAds: boolean;
// 主题
theme: AppTheme;
// 使用浏览器插件
useExtension: boolean;
// 是否使用手机UA
isMobile: boolean;
// 最大同时下载数
maxRunner: number;
// 语言
language: AppLanguage;
// 是否显示终端
showTerminal: boolean;
// 隐私模式
privacy: boolean;
}
declare interface BrowserStore {
url: string;
sourceList: WebSource[];
}
+154
View File
@@ -0,0 +1,154 @@
import { contextBridge, ipcRenderer } from "electron/renderer";
import { shell } from "electron/common";
import { AppStore, BrowserStore, EnvPath } from "./main";
import { type Favorite } from "./entity/Favorite";
import {
VideoResponse,
type DownloadItem,
type DownloadItemPagination,
} from "./interfaces";
import { Video } from "./entity/Video";
const apiFunctions: Record<string, any> = {};
const apiKey = "electron";
export type ElectronApi = typeof electronApi;
const electronApi = {
getEnvPath(): Promise<EnvPath> {
return ipcRenderer.invoke("get-env-path");
},
getFavorites(): Promise<Favorite[]> {
return ipcRenderer.invoke("get-favorites");
},
addFavorite(
favorite: Omit<Favorite, "id" | "createdDate" | "updatedDate">,
): Promise<Favorite> {
return ipcRenderer.invoke("add-favorite", favorite);
},
removeFavorite(id: number): Promise<void> {
return ipcRenderer.invoke("remove-favorite", id);
},
setWebviewBounds(rect: Electron.Rectangle): Promise<void> {
return ipcRenderer.invoke("set-webview-bounds", rect);
},
webviewGoBack(): Promise<boolean> {
return ipcRenderer.invoke("webview-go-back");
},
webviewReload(): Promise<void> {
return ipcRenderer.invoke("webview-reload");
},
webviewLoadURL(url?: string): Promise<void> {
return ipcRenderer.invoke("webview-load-url", url);
},
webviewGoHome(): Promise<void> {
return ipcRenderer.invoke("webview-go-home");
},
getAppStore(): Promise<AppStore> {
return ipcRenderer.invoke("get-app-store");
},
onSelectDownloadDir(): Promise<string> {
return ipcRenderer.invoke("select-download-dir");
},
setAppStore(
key: keyof AppStore,
val: AppStore[keyof AppStore],
): Promise<void> {
return ipcRenderer.invoke("set-app-store", key, val);
},
openDir(dir: string): Promise<void> {
return ipcRenderer.invoke("open-dir", dir);
},
addDownloadItem(video: Omit<DownloadItem, "id">): Promise<Video> {
return ipcRenderer.invoke("add-download-item", video);
},
addDownloadItems(videos: DownloadItem[]): Promise<Video[]> {
return ipcRenderer.invoke("add-download-items", videos);
},
getDownloadItems(p: DownloadItemPagination): Promise<VideoResponse> {
return ipcRenderer.invoke("get-download-items", p);
},
startDownload(vid: number): Promise<void> {
return ipcRenderer.invoke("start-download", vid);
},
openUrl(url: string): Promise<void> {
return ipcRenderer.invoke("open-url", url);
},
stopDownload(id: number): Promise<void> {
return ipcRenderer.invoke("stop-download", id);
},
onDownloadListContextMenu(id: number): Promise<void> {
return ipcRenderer.invoke("on-download-list-context-menu", id);
},
onFavoriteItemContextMenu(id: number): Promise<void> {
return ipcRenderer.invoke("on-favorite-item-context-menu", id);
},
deleteDownloadItem(id: number): Promise<void> {
return ipcRenderer.invoke("delete-download-item", id);
},
convertToAudio(id: number): Promise<void> {
return ipcRenderer.invoke("convert-to-audio", id);
},
rendererEvent(channel: string, funcId: string, listener: any): void {
const key = `${channel}-${funcId}`;
apiFunctions[key] = listener;
ipcRenderer.on(channel, listener);
},
removeEventListener(channel: string, funcId: string): void {
const key = `${channel}-${funcId}`;
const fun = apiFunctions[key];
ipcRenderer.removeListener(channel, fun);
delete apiFunctions[key];
},
showBrowserWindow(): Promise<void> {
return ipcRenderer.invoke("show-browser-window");
},
webviewHide(): Promise<void> {
return ipcRenderer.invoke("webview-hide");
},
webviewShow(): Promise<void> {
return ipcRenderer.invoke("webview-show");
},
webviewUrlContextMenu(): Promise<void> {
return ipcRenderer.invoke("webview-url-contextmenu");
},
downloadNow(video: Omit<DownloadItem, "id">): Promise<void> {
return ipcRenderer.invoke("download-now", video);
},
combineToHomePage(store: BrowserStore): Promise<void> {
return ipcRenderer.invoke("combine-to-home-page", store);
},
editDownloadItem(video: DownloadItem): Promise<void> {
return ipcRenderer.invoke("edit-download-item", video);
},
getLocalIP(): Promise<string> {
return ipcRenderer.invoke("get-local-ip");
},
openBrowser(url: string): Promise<void> {
return shell.openExternal(url);
},
getSharedState(): Promise<any> {
return ipcRenderer.invoke("get-shared-state");
},
setSharedState(state: any): Promise<void> {
return ipcRenderer.invoke("set-shared-state", state);
},
setUserAgent(isMobile: boolean): Promise<void> {
return ipcRenderer.invoke("webview-change-user-agent", isMobile);
},
downloadItem(data: Omit<DownloadItem, "id">) {
return ipcRenderer.invoke("add-download-item", data);
},
getDownloadLog(id: number): Promise<string> {
return ipcRenderer.invoke("get-download-log", id);
},
showDownloadDialog(data: Omit<DownloadItem, "id">[]) {
return ipcRenderer.invoke("show-download-dialog", data);
},
pluginReady() {
return ipcRenderer.invoke("plugin-ready");
},
};
contextBridge.exposeInMainWorld(apiKey, electronApi);
@@ -0,0 +1,42 @@
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import { Favorite } from "../entity/Favorite";
import TypeORM from "../vendor/TypeORM";
@injectable()
export default class FavoriteRepository {
constructor(
@inject(TYPES.TypeORM)
private readonly db: TypeORM,
) {}
async findFavorites(): Promise<Favorite[]> {
return await this.db.manager.find(Favorite, {
order: {
createdDate: "desc",
},
});
}
async addFavorite(favorite: Favorite): Promise<Favorite> {
const exist = await this.db.manager.findOne(Favorite, {
where: {
url: favorite.url,
},
});
if (exist) {
throw new Error("网址已经存在");
}
const item = new Favorite();
item.title = favorite.title;
item.url = favorite.url;
item.icon = favorite.icon;
return await this.db.manager.save(item);
}
async removeFavorite(id: number): Promise<void> {
await this.db.manager.getRepository(Favorite).delete(id);
}
}
@@ -0,0 +1,159 @@
import { Video } from "../entity/Video";
import { inject, injectable } from "inversify";
import {
DownloadFilter,
DownloadItem,
DownloadItemPagination,
DownloadStatus,
} from "../interfaces";
import { TYPES } from "../types";
import { In, Not } from "typeorm";
import TypeORM from "../vendor/TypeORM";
@injectable()
export default class VideoRepository {
constructor(
@inject(TYPES.TypeORM)
private readonly db: TypeORM,
) {}
async addVideo(video: Omit<DownloadItem, "id">) {
// 先判断有没有同名的视频
const exist = await this.findVideoByName(video.name);
if (exist) {
throw new Error("视频名称已存在,请更换视频名称");
}
const item = new Video();
item.name = video.name;
item.url = video.url;
item.type = video.type;
video.headers && (item.headers = video.headers);
return await this.db.manager.save(item);
}
async addVideos(videos: DownloadItem[]) {
const items = videos.map((video) => {
const item = new Video();
item.name = video.name;
item.url = video.url;
item.type = video.type;
video.headers && (item.headers = video.headers);
return item;
});
return await this.db.manager.save(items);
}
// 编辑视频
async editVideo(video: DownloadItem) {
const item = await this.db.appDataSource
.getRepository(Video)
.findOneBy({ id: video.id });
if (!item) {
throw new Error("视频不存在");
}
item.name = video.name;
item.url = video.url;
video.headers && (item.headers = video.headers);
return await this.db.manager.save(item);
}
// 查找所有视频
async findAllVideos() {
return await this.db.appDataSource.getRepository(Video).find({
order: {
createdDate: "DESC",
},
});
}
async findVideos(pagination: DownloadItemPagination) {
const {
current = 0,
pageSize = 50,
filter = DownloadFilter.list,
} = pagination;
const filterCondition =
filter === DownloadFilter.done
? DownloadStatus.Success
: Not(DownloadStatus.Success);
const [items, count] = await this.db.appDataSource
.getRepository(Video)
.findAndCount({
where: {
status: filterCondition,
},
order: {
createdDate: "ASC",
},
skip: (current - 1) * pageSize,
take: pageSize,
});
return {
total: count,
list: items,
};
}
async findVideo(id: number) {
const repository = this.db.appDataSource.getRepository(Video);
const video = await repository.findOneBy({ id });
if (!video) {
throw new Error("没有找到该视频");
}
return video;
}
async findVideoByName(name: string) {
return this.db.appDataSource.getRepository(Video).findOneBy({
name,
});
}
async changeVideoStatus(id: number | number[], status: DownloadStatus) {
const ids = !Array.isArray(id) ? [id] : id;
return this.db.appDataSource
.createQueryBuilder()
.update(Video)
.set({ status })
.where({ id: In(ids) })
.execute();
}
async changeVideoIsLive(id: number) {
const video = await this.findVideo(id);
video.isLive = true;
return this.db.manager.save(video);
}
async findWattingAndDownloadingVideos() {
return await this.db.appDataSource.getRepository(Video).find({
where: {
status: In([DownloadStatus.Downloading, DownloadStatus.Watting]),
},
});
}
async deleteDownloadItem(id: number) {
return await this.db.appDataSource.getRepository(Video).delete(id);
}
async findVideoByUrl(url: string) {
return this.db.appDataSource.getRepository(Video).findOneBy({
url,
});
}
async appendDownloadLog(id: number, message: string) {
const video = await this.findVideo(id);
video.log = video.log ? `${video.log}\n${message}` : message;
return await this.db.manager.save(video);
}
async getDownloadLog(id: number) {
const video = await this.findVideo(id);
return video.log;
}
}
@@ -0,0 +1,429 @@
import EventEmitter from "events";
import { inject, injectable } from "inversify";
import {
DownloadParams,
DownloadProgress,
DownloadStatus,
Task,
} from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import ElectronStore from "../vendor/ElectronStore";
import VideoRepository from "../repository/VideoRepository";
import { biliDownloaderBin, m3u8DownloaderBin } from "../helper";
import * as pty from "node-pty";
import stripAnsi from "strip-ansi";
interface DownloadContext {
// 是否为直播
isLive: boolean;
// 下载进度
percent: string;
// 下载速度
speed: string;
// 是否已经 ready
ready: boolean;
}
export interface DownloadOptions {
abortSignal: AbortController;
encoding?: string;
onMessage?: (ctx: DownloadContext, message: string) => void;
id: number;
}
interface Schema {
args: Record<string, { argsName: string[] | null }>;
consoleReg: {
percent: string;
speed: string;
error: string;
start: string;
isLive: string;
};
bin: string;
platform: string[];
type: string;
}
const processList: Schema[] = [
{
type: "m3u8",
platform: ["win32"],
bin: m3u8DownloaderBin,
args: {
url: {
argsName: null,
},
localDir: {
argsName: ["--workDir"],
},
name: {
argsName: ["--saveName"],
},
// headers: {
// argsName: ["--headers"],
// },
deleteSegments: {
argsName: ["--enableDelAfterDone"],
},
proxy: {
argsName: ["--proxyAddress"],
},
},
consoleReg: {
percent: "([\\d.]+)%",
speed: "([\\d.]+\\s[GMK]B/s)",
error: "ERROR",
start: "开始下载文件|开始录制",
isLive: "识别为直播流, 开始录制",
},
},
{
type: "m3u8",
platform: ["darwin"],
bin: m3u8DownloaderBin,
args: {
url: {
argsName: null,
},
localDir: {
argsName: ["--tmp-dir", "--save-dir"],
},
name: {
argsName: ["--save-name"],
},
// headers: {
// argsName: ["--headers"],
// },
deleteSegments: {
argsName: ["--del-after-done"],
},
proxy: {
argsName: ["--custom-proxy"],
},
},
consoleReg: {
percent: "([\\d.]+)%",
speed: "([\\d.]+[GMK]Bps)",
error: "ERROR",
start: "保存文件名:",
isLive: "检测到直播流",
},
},
{
type: "bilibili",
platform: ["win32", "darwin"],
bin: biliDownloaderBin,
args: {
url: {
argsName: null,
},
localDir: {
argsName: ["--work-dir"],
},
},
consoleReg: {
speed: "([\\d.]+\\s[GMK]B/s)",
percent: "([\\d.]+)%",
error: "ERROR",
start: "开始下载",
isLive: "检测到直播流",
},
},
];
@injectable()
export default class DownloadService extends EventEmitter {
private queue: Task[] = [];
private active: Task[] = [];
private limit: number;
private signal: Record<number, AbortController> = {};
constructor(
@inject(TYPES.ElectronLogger)
private readonly logger: ElectronLogger,
@inject(TYPES.VideoRepository)
private readonly videoRepository: VideoRepository,
@inject(TYPES.ElectronStore)
private readonly storeService: ElectronStore,
) {
super();
const maxRunner = this.storeService.get("maxRunner");
this.limit = maxRunner;
this.storeService.onDidChange("maxRunner", (maxRunner) => {
maxRunner && (this.limit = maxRunner);
});
}
async addTask(task: Task) {
this.queue.push(task);
this.runTask();
}
async stopTask(id: number) {
if (this.signal[id]) {
this.logger.info(`taskId: ${id} stop`);
this.signal[id].abort();
}
}
async execute(task: Task) {
try {
await this.videoRepository.changeVideoStatus(
task.id,
DownloadStatus.Downloading,
);
this.emit("download-start", task.id);
this.logger.info(`taskId: ${task.id} start`);
const controller = new AbortController();
this.signal[task.id] = controller;
const callback = (progress: DownloadProgress) => {
if (progress.type === "progress") {
this.emit("download-progress", progress);
} else if (progress.type === "ready") {
this.emit("download-ready-start", progress);
if (progress.isLive) {
this.removeTask(progress.id);
}
}
};
const params: DownloadParams = {
...task.params,
id: task.id,
abortSignal: controller,
callback,
};
const { proxy, useProxy } = this.storeService.store;
if (useProxy) {
params.proxy = proxy;
}
await this.process(params);
delete this.signal[task.id];
this.logger.info(`taskId: ${task.id} success`);
await this.videoRepository.changeVideoStatus(
task.id,
DownloadStatus.Success,
);
this.emit("download-success", task.id);
} catch (err: any) {
this.logger.info(`taskId: ${task.id} failed`);
if (err.message === "AbortError") {
// 下载暂停
await this.videoRepository.changeVideoStatus(
task.id,
DownloadStatus.Stopped,
);
this.emit("download-stop", task.id);
} else {
// 下载失败
await this.videoRepository.changeVideoStatus(
task.id,
DownloadStatus.Failed,
);
this.emit("download-failed", task.id, err);
}
} finally {
this.removeTask(task.id);
// 传输完成
if (this.queue.length === 0 && this.active.length === 0) {
// this.emit("download-finish");
}
}
}
removeTask(id: number) {
// 处理当前正在活动的任务
const doneId = this.active.findIndex((i) => i.id === id);
this.active.splice(doneId, 1);
// 处理完成的任务
if (this.active.length < this.limit) {
this.runTask();
}
}
runTask() {
while (this.active.length < this.limit && this.queue.length > 0) {
const task = this.queue.shift();
if (task) {
this.active.push(task);
this.execute(task);
}
}
}
private _execa(
binPath: string,
args: string[],
params: DownloadOptions,
): Promise<void> {
const { abortSignal, onMessage, id } = params;
return new Promise((resolve, reject) => {
const ptyProcess = pty.spawn(binPath, args, {
name: "xterm-color",
cols: 500,
rows: 500,
useConpty: false,
});
if (onMessage) {
const ctx: DownloadContext = {
ready: false,
isLive: false,
percent: "",
speed: "",
};
ptyProcess.onData((data) => {
try {
this.emit("download-message", id, data);
onMessage(ctx, stripAnsi(data));
} catch (err) {
reject(err);
}
});
}
abortSignal.signal.addEventListener("abort", () => {
ptyProcess.kill();
reject(new Error("AbortError"));
});
ptyProcess.onExit(({ exitCode }) => {
if (exitCode === 0) {
resolve();
} else {
reject(new Error("未知错误"));
}
});
});
}
async downloader(params: DownloadParams, schema: Schema): Promise<void> {
const {
id,
abortSignal,
url,
local,
name,
deleteSegments,
headers,
callback,
proxy,
} = params;
const spawnParams = [];
for (const key of Object.keys(schema.args)) {
const { argsName } = schema.args[key];
if (key === "url") {
argsName && spawnParams.push(...argsName);
spawnParams.push(url);
}
if (key === "localDir") {
argsName && argsName.forEach((i) => spawnParams.push(i, local));
}
if (key === "name") {
argsName && argsName.forEach((i) => spawnParams.push(i, name));
}
if (key === "headers") {
if (headers) {
const h: Record<string, unknown> = JSON.parse(headers);
Object.entries(h).forEach(([k, v]) => {
spawnParams.push("--header", `${k}: ${v}`);
});
}
}
if (key === "deleteSegments" && deleteSegments) {
argsName && spawnParams.push(...argsName);
}
if (key === "proxy" && proxy) {
argsName && argsName.forEach((i) => spawnParams.push(i, proxy));
}
}
const { consoleReg } = schema;
const isLiveReg = RegExp(consoleReg.isLive, "g");
const startDownloadReg = RegExp(consoleReg.start, "g");
const errorReg = RegExp(consoleReg.error, "g");
const speedReg = RegExp(consoleReg.speed, "g");
const percentReg = RegExp(consoleReg.percent, "g");
const onMessage = (ctx: DownloadContext, message: string) => {
// 解析是否为直播资源
if (isLiveReg.test(message)) {
ctx.isLive = true;
}
// 解析下载进度
const [, percent] = percentReg.exec(message) || [];
if (percent && Number(ctx.percent || 0) < Number(percent)) {
ctx.percent = percent;
}
// 解析下载速度
const [, speed] = speedReg.exec(message) || [];
if (speed) {
ctx.speed = speed;
}
if (startDownloadReg.test(message)) {
callback({
id,
type: "ready",
isLive: ctx.isLive,
speed: "",
percent: "",
});
ctx.ready = true;
return;
}
if (errorReg.test(message)) {
throw new Error(message);
}
if (ctx.ready && (ctx.percent || ctx.speed)) {
callback({
id,
type: "progress",
percent: ctx.percent || "",
speed: ctx.speed || "",
isLive: ctx.isLive,
});
}
};
this.logger.debug("download params: ", spawnParams);
await this._execa(schema.bin, spawnParams, {
id,
abortSignal,
onMessage,
});
}
async process(params: DownloadParams): Promise<void> {
const program = processList
.filter((i) => i.platform.includes(process.platform))
.filter((i) => i.type === params.type);
if (program.length === 0) {
return Promise.reject(new Error("不支持的下载类型"));
}
const schema = program[0];
await this.downloader(params, schema);
}
}
@@ -0,0 +1,134 @@
import { inject, injectable } from "inversify";
import { DownloadType } from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import EventEmitter from "events";
import { session } from "electron";
import { PERSIST_WEBVIEW } from "../helper";
import {
CallbackResponse,
OnBeforeRequestListenerDetails,
} from "electron/main";
export interface SourceParams {
url: string;
documentURL: string;
name: string;
type: DownloadType;
}
export interface SourceFilter {
hosts?: RegExp[];
matches?: RegExp[];
type: DownloadType;
schema?: Record<string, string>;
}
interface PageInfo {
title: string;
url: string;
}
const filterList: SourceFilter[] = [
{
matches: [/\.m3u8/],
type: DownloadType.m3u8,
},
{
// TODO: 合集、列表、收藏夹
hosts: [/^https?:\/\/(www\.)?bilibili.com\/video/],
type: DownloadType.bilibili,
schema: {
name: "title",
},
},
];
@injectable()
export class SniffingHelper extends EventEmitter {
private pageInfo: PageInfo = { title: "", url: "" };
private ready = false;
private queue: SourceParams[] = [];
constructor(
@inject(TYPES.ElectronLogger)
private readonly logger: ElectronLogger,
) {
super();
}
pluginReady() {
this.ready = true;
this.queue.forEach((item) => {
this.emit("source", item);
});
}
reset(pageInfo: PageInfo) {
this.pageInfo = pageInfo;
this.ready = false;
this.queue = [];
listLoop: for (const filter of filterList) {
if (filter.hosts) {
for (const host of filter.hosts) {
if (!host.test(pageInfo.url)) {
continue;
}
this.send({
url: pageInfo.url,
documentURL: pageInfo.url,
name: pageInfo.title,
type: filter.type,
});
break listLoop;
}
}
}
}
start() {
const viewSession = session.fromPartition(PERSIST_WEBVIEW);
viewSession.webRequest.onBeforeRequest(this.requestWillBeSent.bind(this));
}
send = (item: SourceParams) => {
this.logger.info(`在窗口中捕获视频链接: ${item.url}`);
// 等待 DOM 中浮窗加载完成
if (this.ready) {
this.emit("source", item);
} else {
this.queue.push(item);
}
};
private requestWillBeSent(
details: OnBeforeRequestListenerDetails,
callback: (response: CallbackResponse) => void,
): void {
const { url } = details;
const { title, url: documentURL } = this.pageInfo;
listLoop: for (const filter of filterList) {
if (filter.matches) {
for (const match of filter.matches) {
const u = new URL(url);
if (!match.test(u.pathname)) {
continue;
}
this.send({
url,
documentURL,
name: title,
type: filter.type,
});
break listLoop;
}
}
}
callback({});
}
}
@@ -0,0 +1,256 @@
import { WebContentsView, session } from "electron";
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import isDev from "electron-is-dev";
import { PERSIST_WEBVIEW, fetch, mobileUA, pcUA, pluginPath } from "../helper";
import { ElectronBlocker } from "@cliqz/adblocker-electron";
import ElectronLogger from "../vendor/ElectronLogger";
import ElectronStore from "../vendor/ElectronStore";
import MainWindow from "../windows/MainWindow";
import BrowserWindow from "../windows/BrowserWindow";
import VideoRepository from "../repository/VideoRepository";
import { SniffingHelper } from "./SniffingHelperService";
import { resolve } from "path";
import { readFileSync } from "fs-extra";
@injectable()
export default class WebviewService {
public view: WebContentsView;
private blocker?: ElectronBlocker;
constructor(
@inject(TYPES.MainWindow)
private readonly mainWindow: MainWindow,
@inject(TYPES.ElectronLogger)
private readonly logger: ElectronLogger,
@inject(TYPES.BrowserWindow)
private readonly browserWindow: BrowserWindow,
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
@inject(TYPES.VideoRepository)
private readonly videoRepository: VideoRepository,
@inject(TYPES.SniffingHelper)
private readonly sniffingHelper: SniffingHelper,
) {
// 初始化 blocker
this.initBlocker();
}
async init(): Promise<void> {
this.view = new WebContentsView({
webPreferences: {
partition: PERSIST_WEBVIEW,
preload: resolve(__dirname, "./preload.js"),
},
});
this.view.setBackgroundColor("#fff");
this.webContents.setAudioMuted(true);
const { useProxy, proxy, isMobile } = this.store.store;
this.setProxy(useProxy, proxy);
this.setUserAgent(isMobile);
this.webContents.on("dom-ready", async () => {
const baseInfo = {
title: this.webContents.getTitle(),
url: this.webContents.getURL(),
};
this.sniffingHelper.reset(baseInfo);
this.window.webContents.send("webview-dom-ready", baseInfo);
try {
if (isDev && process.env.DEBUG_PLUGINS === "true") {
const content =
'function addScript(src){const script=document.createElement("script");script.src=src;script.type="module";document.body.appendChild(script)}addScript("http://localhost:8080/src/main.ts");';
await this.webContents.executeJavaScript(content);
} else {
const content = readFileSync(pluginPath, "utf-8");
await this.webContents.executeJavaScript(content);
}
} catch (err) {
// empty
}
});
// 兼容网站在当前页面中打开
this.webContents.setWindowOpenHandler(({ url }) => {
this.loadURL(url, true);
return { action: "deny" };
});
this.sniffingHelper.start();
this.sniffingHelper.on("source", async (item) => {
// 这里需要判断是否使用浏览器插件
const useExtension = this.store.get("useExtension");
if (useExtension) {
this.webContents.send("webview-link-message", item);
} else {
const video = await this.videoRepository.findVideoByName(item.name);
if (video) {
item.name = `${item.name}-${Date.now()}`;
}
const res = await this.videoRepository.addVideo(item);
const mainWebContents = this.mainWindow.window?.webContents;
if (!mainWebContents) return;
// 这里向页面发送消息,通知页面更新
mainWebContents.send("download-item-notifier", res);
}
});
}
getBounds(): Electron.Rectangle {
return this.view.getBounds();
}
setBackgroundColor(color: string): void {
this.view.setBackgroundColor(color);
}
show() {
this.window.contentView.addChildView(this.view);
isDev && this.webContents.openDevTools();
}
hide() {
this.window.contentView.removeChildView(this.view);
isDev && this.webContents.closeDevTools();
}
setBounds(bounds: Electron.Rectangle): void {
this.view.setBounds(bounds);
}
async loadURL(url?: string, isNewWindow?: boolean) {
const canGoBack = this.webContents.canGoBack();
try {
this.webContents.stop();
await this.webContents.loadURL(url || "");
} catch (err: unknown) {
this.logger.error("加载 url 时出现错误: ", err);
throw err;
} finally {
if (!canGoBack && !isNewWindow) {
this.webContents.clearHistory();
}
}
}
async goBack() {
if (this.webContents.canGoBack()) {
this.webContents.goBack();
return true;
} else {
return false;
}
}
async reload() {
this.webContents.reload();
}
async goHome() {
this.webContents.stop();
this.webContents.clearHistory();
}
get window() {
if (this.browserWindow.window) return this.browserWindow.window;
if (this.mainWindow.window) return this.mainWindow.window;
throw new Error("未找到当前窗口");
}
private get session() {
return session.fromPartition(PERSIST_WEBVIEW);
}
private enableProxy(proxy: string) {
if (!proxy) {
this.logger.error("[proxy] 代理地址不能为空");
return;
}
// 处理 proxy 地址的合法性
if (!/https?:\/\//.test(proxy)) {
proxy = `http://${proxy}`;
}
this.session.setProxy({ proxyRules: proxy });
this.logger.info(`[proxy] 代理开启成功,代理地址为${proxy}`);
}
private disableProxy() {
this.session.setProxy({ proxyRules: "" });
this.logger.info("[proxy] 代理关闭成功");
}
setProxy(useProxy: boolean, proxy: string): void {
if (useProxy) {
this.enableProxy(proxy);
} else {
this.disableProxy();
}
}
setBlocking(enableBlocking: boolean): void {
if (enableBlocking) {
this.enableBlocking();
} else {
this.disableBlocking();
}
}
async initBlocker() {
this.blocker = await ElectronBlocker.fromPrebuiltAdsAndTracking(fetch);
const enableBlocking = this.store.get("blockAds");
this.setBlocking(enableBlocking);
}
private enableBlocking() {
if (!this.blocker) {
this.logger.error("开启 blocker 失败,未初始化");
return;
}
this.blocker.enableBlockingInSession(this.session);
this.logger.info("开启 blocker 成功");
}
private disableBlocking() {
if (!this.blocker) {
this.logger.error("关闭 blocker 失败,未初始化");
return;
}
if (!this.blocker.isBlockingEnabled(this.session)) {
return;
}
this.blocker.disableBlockingInSession(this.session);
this.logger.info("关闭 blocker 成功");
}
setUserAgent(isMobile?: boolean) {
if (isMobile) {
this.webContents.setUserAgent(mobileUA);
} else {
this.webContents.setUserAgent(pcUA);
}
this.logger.info("设置 user-agent 成功", isMobile);
}
get debugger() {
return this.webContents.debugger;
}
get webContents() {
return this.view.webContents;
}
captureView(): Promise<Electron.NativeImage> {
return this.view.webContents.capturePage();
}
sendToWindow(channel: string, ...args: unknown[]) {
this.window.webContents.send(channel, ...args);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

+35
View File
@@ -0,0 +1,35 @@
export const TYPES = {
ElectronApp: Symbol.for("ElectronApp"),
IpcHandlerService: Symbol.for("IpcHandlerService"),
Controller: Symbol.for("Controller"),
// repository
VideoRepository: Symbol.for("VideoRepository"),
FavoriteRepository: Symbol.for("FavoriteRepository"),
// windows
BrowserWindow: Symbol.for("BrowserWindow"),
MainWindow: Symbol.for("MainWindow"),
// services
WebviewService: Symbol.for("WebviewService"),
DownloadService: Symbol.for("DownloadService"),
SessionService: Symbol.for("SessionService"),
ProtocolService: Symbol.for("ProtocolService"),
SniffingHelper: Symbol.for("SniffingHelper"),
// vendor
ElectronLogger: Symbol.for("ElectronLogger"),
ElectronUpdater: Symbol.for("ElectronUpdater"),
ElectronStore: Symbol.for("ElectronStore"),
ElectronDevtools: Symbol.for("ElectronDevtools"),
TypeORM: Symbol.for("TypeORM"),
};
export enum AppTheme {
System = "system",
Light = "light",
Dark = "dark",
}
export enum AppLanguage {
System = "system",
ZH = "zh",
EN = "en",
}
+35
View File
@@ -0,0 +1,35 @@
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import isDev from "electron-is-dev";
import installExtension, {
REDUX_DEVTOOLS,
REACT_DEVELOPER_TOOLS,
} from "electron-devtools-installer";
import ElectronLogger from "./ElectronLogger";
import { Vendor } from "../core/vendor";
@injectable()
export default class DevToolsService implements Vendor {
constructor(
@inject(TYPES.ElectronLogger)
private readonly logger: ElectronLogger,
) {}
async init() {
if (!isDev) {
return;
}
// 开发环境中可以通过设置环境变量来控制是否加载开发者工具
if (!process.env.LOAD_DEVTOOLS) {
return;
}
try {
this.logger.debug("当前环境为开发环境,开始加载开发者工具");
await installExtension([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS]);
this.logger.debug("加载开发者工具成功");
} catch (err: unknown) {
this.logger.error("加载开发者工具失败", err);
}
}
}
+38
View File
@@ -0,0 +1,38 @@
import logger, { Logger } from "electron-log";
import { injectable } from "inversify";
import dayjs from "dayjs";
import path from "path";
import { appName, workspace } from "../helper";
import { Vendor } from "../core/vendor";
@injectable()
export default class ElectronLogger implements Vendor {
logger: Logger;
constructor() {
const datetime = dayjs().format("YYYY-MM-DD");
const logPath = path.resolve(workspace, `logs/${datetime}-${appName}.log`);
logger.transports.console.format = "{h}:{i}:{s} {text}";
logger.transports.file.getFile();
logger.transports.file.resolvePathFn = () => logPath;
this.logger = logger;
}
info(...args: unknown[]) {
return this.logger.info(...args);
}
warn(...args: unknown[]) {
return this.logger.warn(...args);
}
error(...args: unknown[]) {
return this.logger.error(...args);
}
debug(...args: unknown[]) {
return this.logger.debug(...args);
}
async init() {}
}

Some files were not shown because too many files have changed in this diff Show More