dsh-sidebar-media-player 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -31,26 +31,6 @@ import { basename, dirname, extname, join, parse as parsePath, resolve } from 'n
31
31
  // 在线 QQ 音乐底层(扫码登录 / 取链 / 歌词)。原样拷入本目录,MIT,来自 dsh-music-player v1.0.4。
32
32
  import * as QQ from './qq.js'
33
33
  import { decryptHex as qrcDecryptHex, parseQrc as qrcParse } from './qrc.js'
34
- import { spawn } from 'node:child_process'
35
-
36
- /**
37
- * 找本机 Chromium 系浏览器(Edge 优先,其次 Chrome)。
38
- * 「免费时长」自动化外壳要靠它开 --app 窗口;找不到返回空串,路由会明确报错。
39
- */
40
- function findBrowserExecutable() {
41
- const pf = process.env.ProgramFiles || 'C:\\Program Files'
42
- const pf86 = process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)'
43
- const cands = [
44
- join(pf86, 'Microsoft', 'Edge', 'Application', 'msedge.exe'),
45
- join(pf, 'Microsoft', 'Edge', 'Application', 'msedge.exe'),
46
- join(pf, 'Google', 'Chrome', 'Application', 'chrome.exe'),
47
- join(pf86, 'Google', 'Chrome', 'Application', 'chrome.exe')
48
- ]
49
- for (const p of cands) {
50
- try { if (existsSync(p)) return p } catch { /* 忽略单条探测失败 */ }
51
- }
52
- return ''
53
- }
54
34
 
55
35
  /** Plugin identity — 必须与 package.json 的 name 一致,client bundle 靠它对上号。 */
56
36
  export const name = 'dsh-sidebar-media-player'
@@ -1686,53 +1666,6 @@ async function handleQQ(url, request, response) {
1686
1666
  writeJson(response, 200, { ok: true, result: await QQ.getNewSongs(Number.isFinite(type) ? type : 5, qq.cookie) })
1687
1667
  return
1688
1668
  }
1689
- // ── 免费时长:自动化「看广告换免费时长」外壳 ──────────────────────────
1690
- // 边界必须说清:QQ 音乐「浏览 15 秒免费听 5 分钟」是客户端内的私有机制,
1691
- // 网页版没有对应入口 —— 所以这里做的是**自动化外壳**:开一个独立的浏览器
1692
- // app 窗口(各自独立 user-data-dir,支持多开)→ 到秒数自动 taskkill。
1693
- // 真实时长是否到账取决于 QQ 音乐服务端;本地累计由客户端负责,不伪造奖励。
1694
- if (pathname === `${QQ_PATH}/free/open` && method === 'POST') {
1695
- const body = await readJsonBody(request)
1696
- const rawUrl = (body && typeof body.url === 'string' && body.url !== '') ? body.url : 'https://y.qq.com/'
1697
- let u = null
1698
- try { u = new URL(rawUrl) } catch { u = null }
1699
- if (u === null || (u.protocol !== 'https:' && u.protocol !== 'http:')) {
1700
- writeJson(response, 400, { ok: false, error: 'bad url' })
1701
- return
1702
- }
1703
- const sec = Math.max(5, Math.min(120, Number(body && body.seconds) || 15))
1704
- const want = Math.max(1, Math.min(6, Number(body && body.count) || 1))
1705
- const browser = findBrowserExecutable()
1706
- if (browser === '') {
1707
- writeJson(response, 500, { ok: false, error: 'no-chromium-browser' })
1708
- return
1709
- }
1710
- const opened = []
1711
- for (let i = 0; i < want; i++) {
1712
- try {
1713
- const profileDir = join(homedir(), '.dsh', 'free-ad-profiles', 'p' + Date.now() + '_' + i + '_' + Math.random().toString(36).slice(2, 6))
1714
- mkdirSync(profileDir, { recursive: true })
1715
- const child = spawn(browser, [
1716
- '--app=' + u.href,
1717
- '--no-first-run',
1718
- '--no-default-browser-check',
1719
- '--disable-features=Translate',
1720
- '--user-data-dir=' + profileDir
1721
- ], { detached: true, stdio: 'ignore' })
1722
- child.unref()
1723
- const pid = child.pid
1724
- opened.push({ pid, profileDir })
1725
- if (typeof pid === 'number' && pid > 0) {
1726
- const t = setTimeout(function () {
1727
- try { spawn('taskkill', ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore' }) } catch { /* 进程可能已自行退出 */ }
1728
- }, sec * 1000)
1729
- if (t && typeof t.unref === 'function') t.unref()
1730
- }
1731
- } catch { /* 单个窗口开失败不影响其它 */ }
1732
- }
1733
- writeJson(response, 200, { ok: true, opened, seconds: sec })
1734
- return
1735
- }
1736
1669
  if (pathname === `${QQ_PATH}/lyric` && method === 'GET') {
1737
1670
  // 参数名 songmid(母本同名);别名 `mid` 也接受,别的什么都不认。
1738
1671
  const songmid = (url.searchParams.get('songmid') || url.searchParams.get('mid') || '').trim()
@@ -1762,6 +1695,12 @@ async function handleQQ(url, request, response) {
1762
1695
  ok: true,
1763
1696
  hasLyric: true,
1764
1697
  source: 'qq-qrc',
1698
+ // 加法(母本没有):interval 秒 + 歌手/歌名/专辑。客户端用它兜底总时长
1699
+ // (QQ 代理流没有 Content-Length → <audio>.duration 恒 NaN)与条上「歌手」副标题。
1700
+ interval: Number(info.interval) || 0,
1701
+ artist: info.artist || '',
1702
+ title: info.title || '',
1703
+ album: info.album || '',
1765
1704
  // 母本键名,逐字数据;照抄母本的前端读它做逐字高亮。
1766
1705
  wordLines: q.lines,
1767
1706
  // 加法(母本没有):同一份逐字数据投影成统一 {t,text} 形状,
@@ -1776,7 +1715,17 @@ async function handleQQ(url, request, response) {
1776
1715
  }
1777
1716
  const { lyric, trans } = await QQ.getLyric(songmid, qq.cookie)
1778
1717
  const lrc = qqParseLrc(lyric)
1779
- writeJson(response, 200, { ok: true, hasLyric: lrc.length > 0, lrc, trans: qqParseLrc(trans) })
1718
+ // 加法:与 QRC 分支同形状,补 interval / 歌手等元信息(info 可能为 null,逐项兜底)
1719
+ writeJson(response, 200, {
1720
+ ok: true,
1721
+ hasLyric: lrc.length > 0,
1722
+ lrc,
1723
+ trans: qqParseLrc(trans),
1724
+ interval: (info && Number(info.interval)) || 0,
1725
+ artist: (info && info.artist) || '',
1726
+ title: (info && info.title) || '',
1727
+ album: (info && info.album) || '',
1728
+ })
1780
1729
  return
1781
1730
  }
1782
1731
  if (pathname === `${QQ_PATH}/lyric-words` && method === 'GET') {
package/locale/en.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "dsh-sidebar-media-player",
3
+ "meta": {
4
+ "title": "Sidebar media player",
5
+ "description": "Unified audio and video viewer for the sidebar: mp4/webm/mov and mp3/wav/flac play inline with a draggable Range(206) scrubber, live spectrum and pitch readout (Hz + note + cents), same-name subtitles and lyrics. Adds a player panel (QQ Music online library with favourites synced to the account, local music library) and a capsule bar that can sit above the input box, at the bottom, or be hidden. Third-party hobby tool, not an official QQ Music product and not affiliated with Tencent; it only plays the user's own QQ Music playlists, takes no part in any official campaign, and the repository is taken down on a rights-holder request.",
6
+ "detail": "docs/DETAIL.md"
7
+ }
8
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "dsh-sidebar-media-player",
3
+ "meta": {
4
+ "title": "侧边栏多媒体播放器",
5
+ "description": "侧边栏统一音视频播放器:视频与音频共用一个 viewer,进度条可拖动(自建 Range(206) 流式),带实时频谱与音准读数(Hz + 音名 + 音分),自动加载同名字幕与歌词;另有播放器面板(QQ 音乐在线曲库,收藏与账号「我喜欢」同源;本地音乐库)与一条可停在输入框上方、页面底部或完全隐藏的胶囊播放条。(第三方爱好者工具,非 QQ 音乐官方产品,与腾讯无隶属关系;仅用于播放自己账号的 QQ 音乐列表,不支持也不参与任何官方活动;版权归腾讯 / QQ 音乐,收到侵权通知即删库。)",
6
+ "detail": "docs/DETAIL.zh.md"
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,65 +1,69 @@
1
- {
2
- "name": "dsh-sidebar-media-player",
3
- "version": "0.2.4",
4
- "description": "Unified audio + video player for dsh-better-sidebar: one file viewer for mp4/webm/mov/m4v/ogv and mp3/wav/flac/ogg/opus/m4a/aac, with a draggable whole-track scrubber, live spectrum bars and pitch (Hz + note name), streamed from a Range(206) host route so seeking really works.",
5
- "type": "module",
6
- "main": "lib/index.js",
7
- "files": [
8
- "lib/**",
9
- "cordis.patch.yml",
10
- "README.md",
11
- "CHANGELOG.md",
12
- "screenshots.json",
13
- "docs/screenshots/**",
14
- "!lib/*.bak*",
15
- "!lib/**/*.bak*",
16
- "!lib/*.BROKEN*"
17
- ],
18
- "exports": {
19
- ".": "./lib/index.js",
20
- "./client": {
21
- "default": "./lib/client.js"
22
- },
23
- "./package.json": "./package.json"
24
- },
25
- "keywords": [
26
- "dsh",
27
- "dsh-plugin",
28
- "deepseek-harness",
29
- "better-sidebar",
30
- "media",
31
- "audio",
32
- "video",
33
- "player",
34
- "spectrum",
35
- "pitch",
36
- "file-viewer",
37
- "range-request"
38
- ],
39
- "license": "MIT",
40
- "author": "loyalchiiina",
41
- "repository": {
42
- "type": "git",
43
- "url": "git+https://github.com/loyalchiiina/dsh-sidebar-media-player.git"
44
- },
45
- "engines": {
46
- "node": "^22.19.0 || >=24.0.0",
47
- "dsh": ">=0.2.2-rc.1"
48
- },
49
- "peerDependencies": {
50
- "@deepseek-ai/cordis": "^4.0.2",
51
- "@deepseek-ai/dsh": ">=0.2.2-rc.1"
52
- },
53
- "dsh": {
54
- "bundle": {
55
- "patch": "./cordis.patch.yml"
56
- },
57
- "client": {
58
- "inject": [
59
- "@deepseek-ai/dsh-client-runtime",
60
- "@deepseek-ai/dsh-client-ui-slots"
61
- ],
62
- "platform": "web"
63
- }
64
- }
65
- }
1
+ {
2
+ "name": "dsh-sidebar-media-player",
3
+ "version": "0.2.6",
4
+ "description": "Unified audio + video player for dsh-better-sidebar: a sidebar viewer for mp4/webm/mov/m4v/ogv and mp3/wav/flac/ogg/opus/m4a/aac with a draggable Range(206) scrubber, live spectrum and pitch, plus a player panel (QQ Music online library with favourites synced to the account, local music library), subtitles, lyrics with 5 effects, and a capsule bar that can dock above the input box, sit at the bottom, or be hidden. Third-party hobby tool, not an official QQ Music product; the capsule UI and the QQ Music API layer are adapted from an upstream MIT project (dsh-music-player v1.0.4), while the sidebar move, buttons, UI rework and main features are original.",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "files": [
8
+ "lib/**",
9
+ "cordis.patch.yml",
10
+ "README.md",
11
+ "CHANGELOG.md",
12
+ "screenshots.json",
13
+ "icon.svg",
14
+ "locale/*.json",
15
+ "docs/**",
16
+ "!lib/*.bak*",
17
+ "!lib/**/*.bak*",
18
+ "!lib/*.BROKEN*"
19
+ ],
20
+ "exports": {
21
+ ".": "./lib/index.js",
22
+ "./client": {
23
+ "default": "./lib/client.js"
24
+ },
25
+ "./package.json": "./package.json",
26
+ "./icon": "./icon.svg",
27
+ "./locale/*.json": "./locale/*.json"
28
+ },
29
+ "keywords": [
30
+ "dsh",
31
+ "dsh-plugin",
32
+ "deepseek-harness",
33
+ "better-sidebar",
34
+ "media",
35
+ "audio",
36
+ "video",
37
+ "player",
38
+ "spectrum",
39
+ "pitch",
40
+ "file-viewer",
41
+ "range-request"
42
+ ],
43
+ "license": "MIT",
44
+ "author": "loyalchiiina",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/loyalchiiina/dsh-sidebar-media-player.git"
48
+ },
49
+ "engines": {
50
+ "node": "^22.19.0 || >=24.0.0",
51
+ "dsh": ">=0.2.2-rc.1"
52
+ },
53
+ "peerDependencies": {
54
+ "@deepseek-ai/cordis": "^4.0.2",
55
+ "@deepseek-ai/dsh": ">=0.2.2-rc.1"
56
+ },
57
+ "dsh": {
58
+ "bundle": {
59
+ "patch": "./cordis.patch.yml"
60
+ },
61
+ "client": {
62
+ "inject": [
63
+ "@deepseek-ai/dsh-client-runtime",
64
+ "@deepseek-ai/dsh-client-ui-slots"
65
+ ],
66
+ "platform": "web"
67
+ }
68
+ }
69
+ }