Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions plugins/lx-music-ztools/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Preserve upstream source bytes, including historical whitespace, for diffing.
vendor/lx/** -whitespace
8 changes: 8 additions & 0 deletions plugins/lx-music-ztools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
.superpowers/
src-ztools/preload/upstream/
src-ztools/dist/
artifacts/
test-results/
.env*
*.log
16 changes: 16 additions & 0 deletions plugins/lx-music-ztools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 更新日志

## 0.0.2 - 2026-11-10

- 默认入口切换为原 LX Music 界面,补齐 Webpack 与可读 CommonJS 服务构建。
- 支持 LX API 2.0.0 自定义音源的本地 JS、URL 导入与选择;脚本在隔离 Worker 中运行。
- 接通原播放器、列表和设置,验证受控音源解析播放、暂停/继续、后台播放与下一首。
- 去掉 LX 内部的缩小、关闭按钮及桌面窗口留白、圆角、阴影,内容铺满 ZTools 插件区域。
- 构建时安装插件运行依赖,确保插件中心从源码构建的 ZIP 包含所需模块。
- 当前为 Windows 开发版,不预置音源;下载、同步、开放 API 和系统集成仍在移植,真实用户音源/平台服务未全量验证。

## 0.0.1 - 2026-11-09

- 使用官方 Vue 模板建立插件框架。
- 接入生命周期、preload 诊断与存储探测。
- 增加构建、打包校验与发布演练。
201 changes: 201 additions & 0 deletions plugins/lx-music-ztools/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
55 changes: 55 additions & 0 deletions plugins/lx-music-ztools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# LX Music for ZTools

将 LX Music 2.12.6 移植到 ZTools 的开发项目,不依赖另装 LX 桌面版。当前版本为 **0.0.2 开发版**,完整移植仍在进行。

目前已验证原 LX 界面、自定义音源本地/URL 导入、隔离执行、受控音源解析与音频播放、暂停/继续、后台播放及下一首。下载、同步、开放 API 等功能尚未完成验证,详见 [功能与验证状态](docs/ztools/compatibility.md)。不预置第三方音源。

## 开发与安装

```powershell
npm ci
npm run build:ztools
```

本地代码和隔离测试中的安装记录不会自动出现在日常使用的 ZTools 中。把 `src-ztools/plugin.json` 导入 ZTools 开发项目,然后安装、启用项目,才能输入「洛雪音乐」「LX Music」或「lxmusic」打开插件。

```powershell
npm run pack
```

完整运行目录为 `src-ztools`,默认播放器入口为 `dist/lx.html`。构建包含原 LX Webpack 前端、逐模块可读 CommonJS 服务与隔离音源 Worker。ZIP 输出到工作目录同级的 `output/lx-music-ztools`,包含运行依赖,不需要开发服务器。

在 ZTools「设置 → 插件应用 → 导入本地插件」选择 ZIP,确认安装并启用,再输入 `lxmusic` 打开。音源在原 LX 设置的「自定义源管理」中通过本地 JS 或 URL 导入并选择。详见 [本地安装](docs/ztools/installation.md)。

## 验证

- `npm run build:ztools`:类型检查、前端和服务构建、插件安装目录校验。
- `npm run test:ztools`:桥接、SQLite 事务、数据、设置、网络、文件能力与音源契约。
- `npm run test:p0`:隔离音源、安全边界、宿主生命周期及存储能力。
- `npm run test:source`:受控音源协议和原界面本地/URL 导入流程。
- `npm run test:player`:原 LX 引擎播放受控 WAV,检查进度、暂停/继续、后台和下一首。
- `node scripts/test-install.mjs`:实际 ZIP 安装后搜索 `lxmusic` 并打开原播放器。
- `npm run test:publish`:调用官方 CLI 1.3.2,在新临时 Git 仓库中两次发布;GitHub 和认证被替换成测试响应,不创建线上 PR。
- `npm run test:host`:使用独立 Electron 运行本机 ZTools app.asar,测试数据写入独立临时目录。通过 `ZTOOLS_EXECUTABLE` 指定 Electron 可执行文件,通过 `ZTOOLS_APP` 指定 ZTools app.asar;两者均需已存在。宿主测试不使用用户真实配置。

原生移植测试报告位于 `artifacts/`。受控音源和音频结果不能代替用户真实音源、真实平台服务及人工听音验收。

## 真实发布

```powershell
gh auth status
npm run pack
git add .
git commit -m "chore: prepare release"
npm run publish:plugin
```

发布包装器复用已登录的 gh 凭据,通过 gh api 发送真实 GitHub REST 请求,并修正 CLI 1.3.2 在 Windows 下的 Git 参数引号;其余发布校验、Fork、上游同步与分支保护、提交、推送和 Draft PR 由官方 CLI 执行。缓存位于 `~/.config/ztools/lx-music-ztools-sparse`,凭据仅用于当前进程,完成后清除缓存 remote URL 中的凭据。

CLI 1.3.2 要求当前版本的日志标题 `## 0.0.2 - YYYY-MM-DD`、非默认图标以及干净的 Git 工作区。该版本会从最新 upstream/main 重建发布分支,并使用精确 force-with-lease 防止覆盖竞态提交;这与官网页面旧版“只追加、不改写”的描述不同。

Draft PR 创建后须补充截图、自检结果和明确的功能范围,再提交审核。当前以开发版范围送审,不宣称下载、同步等完整移植已经完成。

## 来源与许可

原 LX 源码基线为 `lyswhut/lx-music-desktop@323e4bac`,只读保留在 `vendor/lx`,沿用 Apache-2.0 许可证。适配代码、构建及宿主替换模块位于其外,出处见 `vendor/lx/UPSTREAM.md`。项目从 ZTools 官方 Vue 模板起步,是第三方移植开发,不是 LX 官方发行版。
Loading
Loading