Compare commits

..

No commits in common. "main" and "v1.10.8" have entirely different histories.

20 changed files with 280 additions and 250 deletions

25
.drone.yml Normal file

@ -0,0 +1,25 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: node:16.18-bullseye
commands:
- apt-get update
- apt-get install -y jq zip
- npm ci
- npm run test
- ./scripts/build-and-package.sh legacy
- ./scripts/build-and-package.sh extension
- ./scripts/build-and-package.sh modern
- name: upload artifact
image: node:16.18-bullseye
environment:
DRONE_GITEA_SERVER: https://git.unlock-music.dev
GITEA_API_KEY:
from_secret: GITEA_API_KEY
commands:
- ./scripts/upload-packages.sh

@ -1,42 +0,0 @@
name: Build
on:
workflow_dispatch:
push:
paths:
- "src/**/*"
- "package.json"
- "package-lock.json"
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened ]
paths:
- "src/**/*"
- "package.json"
- "package-lock.json"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
- name: Test
run: npm test
- name: Build all variants
run: npm run build:all
- name: Publish artifact
uses: christopherhx/gitea-upload-artifact@v4
with:
name: um-web-all
path: "um-*.zip"

47
.gitlab-ci.yml Normal file

@ -0,0 +1,47 @@
image: node:16
cache:
paths:
- node_modules/
stages:
- build
build-job:
stage: build
script: |
sed -i 's/deb.debian.org/mirrors.cloud.tencent.com/g' /etc/apt/sources.list
apt-get update
apt-get -y install zip
npm config set registry http://mirrors.cloud.tencent.com/npm/
npm ci
npm run build
tar -czf legacy.tar.gz -C ./dist .
cd dist
zip -rJ9 ../legacy.zip *
cd ..
npm run make-extension
cd dist
zip -rJ9 ../extension.zip *
cd ..
npm run build -- --modern
tar -czf modern.tar.gz -C ./dist .
cd dist
zip -rJ9 ../modern.zip *
cd ..
sha256sum *.tar.gz *.zip > sha256sum.txt
artifacts:
name: "$CI_JOB_NAME"
paths:
- legacy.zip
- legacy.tar.gz
- extension.zip
- modern.zip
- modern.tar.gz
- sha256sum.txt

@ -0,0 +1,76 @@
name: 解码错误报告 (填表)
about: 遇到文件解码失败的问题请选择该项。
title: '[Bug/Crypto] '
labels:
- bug
- crypto
body:
- type: textarea
id: what-happened
attributes:
label: 错误描述
description: 请描述你所遇到的问题,以及你期待的行为。
placeholder: ''
value: ''
validations:
required: true
- type: dropdown
id: version
attributes:
label: Unlock Music 版本
description: |
能够重现错误的版本,版本号通常在页面底部。
如果不确定,请升级到最新版确认问题是否解决。
multiple: true
options:
- 1.10.5 (仓库最新)
- 1.10.3 (官方 DEMO)
- 其它(请在错误描述中指定)
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: 产生错误的浏览器
multiple: true
options:
- 火狐 / Firefox
- Chrome
- Safari
- 其它基于 Chromium 的浏览器 (Edge、Brave、Opera 等)
- type: dropdown
id: music-platform
attributes:
label: 音乐平台
description: |
如果需要报告多个平台的问题,请每个平台提交一个新的 Issue。
请注意:播放器缓存文件不属于该项目支持的文件类型。
multiple: false
options:
- 其它 (请在错误描述指定)
- QQ 音乐
- Joox (QQ 音乐海外版)
- 虾米音乐
- 网易云音乐
- 酷我音乐
- 酷狗音乐
- 喜马拉雅
- 咪咕 3D
validations:
required: true
- type: textarea
id: logs
attributes:
label: 日志信息
description: 如果有请提供浏览器开发者控制台Console的错误日志
render: text
- type: checkboxes
id: terms
attributes:
label: 我已经阅读并确认下述内容
description: ''
options:
- label: 我已经检索过 Issue 列表,并确认这是一个为报告过的问题。
required: true
- label: 我有证据表明这是程序导致的问题(如不确认,可以通过 Telegram 讨论组 (https://t.me/unlock_music_chat) 进行讨论)
required: true

@ -9,26 +9,22 @@ labels:
--- ---
* 请按照此模板填写,否则可能立即被关闭。请将符合条件的 `[ ]` 更改为 `[x]` * 请按照此模板填写,否则可能立即被关闭
- [ ] 我确认已经搜索过 issue确认没有已报告的相同 issue - [x] 我确认已经搜索过Issue不存并确认相同的Issue
- [ ] 我有证据表明这是程序导致的问题(如不确认,可以通过 Telegram 讨论组 (https://t.me/unlock_music_chat) 进行讨论) - [x] 我有证据表明这是程序导致的问题(如不确认,可以通过 Telegram 讨论组 (https://t.me/unlock_music_chat) 进行讨论)
## Bug描述 ## Bug描述
简要地复述你遇到的 Bug 简要地复述你遇到的Bug
……
## 复现方法 ## 复现方法
描述复现方法,必要时请提供样本文件: 描述复现方法,必要时请提供样本文件
……
## 程序截图或浏览器开发者控制台Console的报错信息 ## 程序截图或浏览器开发者控制台Console的报错信息
…… 如果可以请提供二者之一
## 环境信息 ## 环境信息
@ -40,6 +36,5 @@ labels:
## 附加信息 ## 附加信息
如果有其他能够帮助确认问题的信息,请在下方填写 如果有,请提供其他能够帮助确认问题的信息到下方
……

@ -10,19 +10,20 @@ labels:
--- ---
<!-- ⚠ 请按照此模板填写,否则可能立即被关闭 --> <!-- ⚠ 请按照此模板填写,否则可能立即被关闭 -->
<!-- 提交前使用【Preview】预览提交的更改 --> <!-- 提交前使用【Preview】预览提交的更改 -->
## 背景和说明 ## 背景和说明
<!-- 简要说明产生此想法的背景和此想法的具体内容 --> <!-- 简要说明产生此想法的背景和此想法的具体内容 -->
## 实现途径
- 如果没有设计方案,请简要描述实现思路
- 如果你没有任何的实现思路,请通过 Telegram 讨论组 (https://t.me/unlock_music_chat) 进行讨论
## 附加信息 ## 附加信息
<!-- 更多你想要表达的内容 --> <!-- 更多你想要表达的内容 -->
## 额外选项
<!-- 请将符合条件的 `[ ]` 更改为 `[x]` -->
- [ ] 我可以自行实现并提交 PR。
- [ ] 我确认已经搜索过 issue确认没有已报告的相同 issue

@ -3,7 +3,7 @@ FROM --platform=$TARGETPLATFORM nginx:stable-alpine
LABEL org.opencontainers.image.title="Unlock Music" LABEL org.opencontainers.image.title="Unlock Music"
LABEL org.opencontainers.image.description="Unlock encrypted music file in browser" LABEL org.opencontainers.image.description="Unlock encrypted music file in browser"
LABEL org.opencontainers.image.authors="MengYX" LABEL org.opencontainers.image.authors="MengYX"
LABEL org.opencontainers.image.source="https://git.unlock-music.dev/um/web" LABEL org.opencontainers.image.source="https://github.com/ix64/unlock-music"
LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.licenses="MIT"
LABEL maintainer="MengYX" LABEL maintainer="MengYX"

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2019-2025 MengYX Copyright (c) 2019-2023 MengYX
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

@ -1,20 +1,20 @@
# Unlock Music 音乐解锁 # Unlock Music 音乐解锁
[![Build Status](https://git.unlock-music.dev/um/web/actions/workflows/build.yml/badge.svg)][ci] [![Build Status](https://ci.unlock-music.dev/api/badges/um/web/status.svg)](https://ci.unlock-music.dev/um/web)
- 在浏览器中解锁加密的音乐文件。 Unlock encrypted music file in the browser. - 在浏览器中解锁加密的音乐文件。 Unlock encrypted music file in the browser.
- Unlock Music 项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循[授权协议]。 - Unlock Music 项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循[授权协议]。
- Unlock Music 的 CLI 版本可以在 [unlock-music/cli] 找到,大批量转换建议使用 CLI 版本。 - Unlock Music 的 CLI 版本可以在 [unlock-music/cli] 找到,大批量转换建议使用 CLI 版本。
- 我们新建了 Telegram 群组 [`@unlock_music_chat`] ,欢迎加入! - 我们新建了 Telegram 群组 [`@unlock_music_chat`] ,欢迎加入!
- CI 自动构建已经部署,可以在 [Actions][ci] 下载 - CI 自动构建已经部署,可以在 [um-packages] 下载
> **WARNING** > **WARNING**
> 在本站 fork 不会起到备份的作用,只会浪费服务器储存空间。如无必要请勿 fork 该仓库。 > 在本站 fork 不会起到备份的作用,只会浪费服务器储存空间。如无必要请勿 fork 该仓库。
[授权协议]: https://git.unlock-music.dev/um/web/src/branch/main/LICENSE [授权协议]: https://git.unlock-music.dev/um/web/src/branch/master/LICENSE
[unlock-music/cli]: https://git.unlock-music.dev/um/cli [unlock-music/cli]: https://git.unlock-music.dev/um/cli
[`@unlock_music_chat`]: https://t.me/unlock_music_chat [`@unlock_music_chat`]: https://t.me/unlock_music_chat
[ci]: https://git.unlock-music.dev/um/web/actions?workflow=build.yml [um-packages]: https://git.unlock-music.dev/um/-/packages/generic/web-build/
## 特性 ## 特性
@ -45,7 +45,7 @@
### 使用预构建版本 ### 使用预构建版本
- 从 [Release] 或 [CI 构建][ci] 下载预构建的版本 - 从 [Release] 或 [CI 构建][um-packages] 下载预构建的版本
- :warning: 本地使用请下载`legacy版本``modern版本`只能通过 **http(s)协议** 访问) - :warning: 本地使用请下载`legacy版本``modern版本`只能通过 **http(s)协议** 访问)
- 解压缩后即可部署或本地使用(**请勿直接运行源代码** - 解压缩后即可部署或本地使用(**请勿直接运行源代码**
@ -54,7 +54,7 @@
### 自行构建 ### 自行构建
- 环境要求 - 环境要求
- nodejs (v22.x) - nodejs (v16.x)
- npm - npm
1. 获取项目源代码后安装相关依赖: 1. 获取项目源代码后安装相关依赖:

@ -19,11 +19,5 @@
"action": { "action": {
"default_icon": "img/icons/favicon-32x32.png", "default_icon": "img/icons/favicon-32x32.png",
"default_popup": "./popup.html" "default_popup": "./popup.html"
},
"browser_specific_settings": {
"gecko": {
"id": "addon@unlock-music.dev",
"strict_min_version": "128.0"
}
} }
} }

14
scripts/make-extension.js → make-extension.js Executable file → Normal file

@ -1,11 +1,7 @@
#!/usr/bin/env node
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const src = __dirname + "/src/extension/"
const DIR_ROOT = path.resolve(__dirname, "..") const dst = __dirname + "/dist"
const src = DIR_ROOT + "/src/extension/"
const dst = DIR_ROOT + "/dist"
fs.readdirSync(src).forEach(file => { fs.readdirSync(src).forEach(file => {
let srcPath = path.join(src, file) let srcPath = path.join(src, file)
let dstPath = path.join(dst, file) let dstPath = path.join(dst, file)
@ -13,10 +9,10 @@ fs.readdirSync(src).forEach(file => {
console.log(`Copy: ${srcPath} => ${dstPath}`) console.log(`Copy: ${srcPath} => ${dstPath}`)
}) })
const manifestRaw = fs.readFileSync(DIR_ROOT + "/extension-manifest.json", "utf-8") const manifestRaw = fs.readFileSync(__dirname + "/extension-manifest.json", "utf-8")
const manifest = JSON.parse(manifestRaw) const manifest = JSON.parse(manifestRaw)
const pkgRaw = fs.readFileSync(DIR_ROOT + "/package.json", "utf-8") const pkgRaw = fs.readFileSync(__dirname + "/package.json", "utf-8")
const pkg = JSON.parse(pkgRaw) const pkg = JSON.parse(pkgRaw)
verExt = pkg["version"] verExt = pkg["version"]
@ -25,5 +21,5 @@ if (verExt.includes("-")) verExt = verExt.split("-")[0]
manifest["version"] = `${verExt}.${pkg["ext_build"]}` manifest["version"] = `${verExt}.${pkg["ext_build"]}`
manifest["version_name"] = pkg["version"] manifest["version_name"] = pkg["version"]
fs.writeFileSync(DIR_ROOT + "/dist/manifest.json", JSON.stringify(manifest), "utf-8") fs.writeFileSync(__dirname + "/dist/manifest.json", JSON.stringify(manifest), "utf-8")
console.log("Write: manifest.json") console.log("Write: manifest.json")

12
package-lock.json generated

@ -5712,9 +5712,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001717", "version": "1.0.30001668",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001717.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz",
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==", "integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -25491,9 +25491,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001717", "version": "1.0.30001668",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001717.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz",
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==" "integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw=="
}, },
"case-sensitive-paths-webpack-plugin": { "case-sensitive-paths-webpack-plugin": {
"version": "2.4.0", "version": "2.4.0",

@ -14,11 +14,10 @@
"postinstall": "patch-package", "postinstall": "patch-package",
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"build:all": "./scripts/build-and-package.sh --all",
"test": "jest", "test": "jest",
"pretty": "prettier --write src/{**/*,*}.{js,ts,jsx,tsx,vue}", "pretty": "prettier --write src/{**/*,*}.{js,ts,jsx,tsx,vue}",
"pretty:check": "prettier --check src/{**/*,*}.{js,ts,jsx,tsx,vue}", "pretty:check": "prettier --check src/{**/*,*}.{js,ts,jsx,tsx,vue}",
"make-extension": "node ./scripts/make-extension.js" "make-extension": "node ./make-extension.js"
}, },
"dependencies": { "dependencies": {
"@babel/preset-typescript": "^7.16.5", "@babel/preset-typescript": "^7.16.5",

@ -1,21 +0,0 @@
diff --git a/node_modules/babel-loader/lib/cache.js b/node_modules/babel-loader/lib/cache.js
index fced210..6b0c137 100644
--- a/node_modules/babel-loader/lib/cache.js
+++ b/node_modules/babel-loader/lib/cache.js
@@ -91,15 +91,7 @@ const write = /*#__PURE__*/function () {
const filename = function (source, identifier, options) {
- // md4 hashing is not supported starting with node v17.0.0
- const majorNodeVersion = parseInt(process.versions.node.split(".")[0], 10);
- let hashType = "md4";
-
- if (majorNodeVersion >= 17) {
- hashType = "md5";
- }
-
- const hash = crypto.createHash(hashType);
+ const hash = crypto.createHash("sha256");
const contents = JSON.stringify({
source,
options,

@ -1,13 +0,0 @@
diff --git a/node_modules/copy-webpack-plugin/dist/postProcessPattern.js b/node_modules/copy-webpack-plugin/dist/postProcessPattern.js
index 8354f00..9bdf6ed 100644
--- a/node_modules/copy-webpack-plugin/dist/postProcessPattern.js
+++ b/node_modules/copy-webpack-plugin/dist/postProcessPattern.js
@@ -69,7 +69,7 @@ function postProcessPattern(globalRef, pattern, file) {
name: _package.name,
version: _package.version,
pattern,
- hash: _crypto.default.createHash('md4').update(content).digest('hex')
+ hash: _crypto.default.createHash('sha256').update(content).digest('hex')
});
return _cacache.default.get(globalRef.cacheDir, cacheKey).then(result => {
logger.debug(`getting cached transformation for '${file.absoluteFrom}'`);

@ -1,13 +0,0 @@
diff --git a/node_modules/terser-webpack-plugin/dist/index.js b/node_modules/terser-webpack-plugin/dist/index.js
index 6268f6b..1cb8f2c 100644
--- a/node_modules/terser-webpack-plugin/dist/index.js
+++ b/node_modules/terser-webpack-plugin/dist/index.js
@@ -214,7 +214,7 @@ class TerserPlugin {
// eslint-disable-next-line global-require
'terser-webpack-plugin': require('../package.json').version,
'terser-webpack-plugin-options': this.options,
- hash: _crypto.default.createHash('md4').update(input).digest('hex')
+ hash: _crypto.default.createHash('sha256').update(input).digest('hex')
};
task.cacheKeys = this.options.cacheKeys(defaultCacheKeys, file);
}

@ -1,26 +0,0 @@
diff --git a/node_modules/webpack/lib/optimize/SplitChunksPlugin.js b/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
index e7d560b..94a8401 100644
--- a/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
+++ b/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
@@ -22,7 +22,7 @@ const deterministicGroupingForModules = /** @type {function(DeterministicGroupin
const hashFilename = name => {
return crypto
- .createHash("md4")
+ .createHash("sha256")
.update(name)
.digest("hex")
.slice(0, 8);
diff --git a/node_modules/webpack/lib/util/createHash.js b/node_modules/webpack/lib/util/createHash.js
index 64de510..4cc3fc9 100644
--- a/node_modules/webpack/lib/util/createHash.js
+++ b/node_modules/webpack/lib/util/createHash.js
@@ -131,6 +131,8 @@ module.exports = algorithm => {
// TODO add non-cryptographic algorithm here
case "debug":
return new DebugHash();
+ case 'md4':
+ algorithm = "sha256";
default:
return new BulkUpdateDecorator(require("crypto").createHash(algorithm));
}

@ -11,12 +11,6 @@ case "$1" in
"modern") npm run build -- --modern ;; "modern") npm run build -- --modern ;;
"legacy") npm run build ;; "legacy") npm run build ;;
"extension") npm run make-extension ;; "extension") npm run make-extension ;;
"--all")
"$0" legacy
"$0" extension
"$0" modern
exit 0
;;
*) *)
echo "Unknown command: $1" echo "Unknown command: $1"
@ -24,7 +18,6 @@ case "$1" in
;; ;;
esac esac
cp README.md LICENSE dist/
mv dist "${DIST_NAME}" mv dist "${DIST_NAME}"
zip -rJ9 "${DIST_NAME}.zip" "${DIST_NAME}" zip -rJ9 "${DIST_NAME}.zip" "${DIST_NAME}"

19
scripts/upload-packages.sh Executable file

@ -0,0 +1,19 @@
#!/bin/sh
set -ex
cd "$(git rev-parse --show-toplevel)"
if [ -z "$GITEA_API_KEY" ]; then
echo "GITEA_API_KEY is empty, skip upload."
exit 0
fi
URL_BASE="$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build"
for ZIP_NAME in *.zip; do
UPLOAD_URL="${URL_BASE}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
sha256sum "${ZIP_NAME}"
curl -sLifu "um-release-bot:$GITEA_API_KEY" -T "${ZIP_NAME}" "${UPLOAD_URL}"
echo "Uploaded to: ${UPLOAD_URL}"
done

@ -11,13 +11,13 @@
</div> </div>
<div> <div>
目前支持 网易云音乐(ncm), QQ音乐(qmc, mflac, mgg), 酷狗音乐(kgm), 虾米音乐(xm), 酷我音乐(.kwm) 目前支持 网易云音乐(ncm), QQ音乐(qmc, mflac, mgg), 酷狗音乐(kgm), 虾米音乐(xm), 酷我音乐(.kwm)
<a href="https://git.unlock-music.dev/um/web/src/branch/main/README.md" target="_blank">更多</a> <a href="https://git.unlock-music.dev/um/web/src/branch/master/README.md" target="_blank">更多</a>
</div> </div>
<div> <div>
<!--如果进行二次开发此行版权信息不得移除且应明显地标注于页面上--> <!--如果进行二次开发此行版权信息不得移除且应明显地标注于页面上-->
<span>Copyright &copy; 2019 - {{ new Date().getFullYear() }} MengYX</span> <span>Copyright &copy; 2019 - {{ new Date().getFullYear() }} MengYX</span>
音乐解锁使用 音乐解锁使用
<a href="https://git.unlock-music.dev/um/web/src/branch/main/LICENSE" target="_blank">MIT许可协议</a> <a href="https://git.unlock-music.dev/um/web/src/branch/master/LICENSE" target="_blank">MIT许可协议</a>
开放源代码 开放源代码
</div> </div>
</el-footer> </el-footer>