From 66da194b054aef9c8ad536b9b390a96dda54a048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E5=B7=9D=E7=99=BD=E6=B5=AA?= <1679659@qq.com> Date: Mon, 30 Nov 2026 00:03:29 -0700 Subject: [PATCH] feat(legal,ui): bundle full third-party licenses and add About license viewer --- .github/workflows/release.yml | 2 +- NOTICE.md | 15 ++++-- frontend/package.json.md5 | 2 +- frontend/src/components/AboutPage.tsx | 67 ++++++++++++++++++++++++++- frontend/src/i18n.ts | 12 +++++ frontend/src/styles/app.css | 7 +++ frontend/wailsjs/go/app/App.d.ts | 2 + frontend/wailsjs/go/app/App.js | 4 ++ frontend/wailsjs/go/models.ts | 14 ++++++ internal/app/license.go | 30 ++++++++++++ main.go | 7 +++ patches/LICENSE | 11 +++++ patches/README.md | 2 +- scripts/pack-runtime.ps1 | 37 ++++++++++++++- 14 files changed, 203 insertions(+), 9 deletions(-) create mode 100644 internal/app/license.go create mode 100644 patches/LICENSE diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 145252c..67fe314 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,7 +105,7 @@ jobs: if ($LASTEXITCODE) { throw "wails build failed ($LASTEXITCODE)" } Copy-Item (Join-Path 'build\bin' "reims-go-$tag-windows-amd64.exe") $guiOut $zipOut = [IO.Path]::ChangeExtension($guiOut, '.zip') - Compress-Archive -LiteralPath $guiOut -DestinationPath $zipOut -CompressionLevel Optimal -Force + Compress-Archive -LiteralPath @($guiOut, 'LICENSE', 'NOTICE.md') -DestinationPath $zipOut -CompressionLevel Optimal -Force $lines = @(Get-Item -LiteralPath $guiOut, $zipOut | ForEach-Object { $h = (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLowerInvariant() "$h $($_.Name)" diff --git a/NOTICE.md b/NOTICE.md index 6f4ed59..4613955 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -3,7 +3,14 @@ `Reims-Go` itself (Go backend and desktop frontend) is licensed under the Apache License, Version 2.0 (see `LICENSE`). That license applies to Reims-Go's own code only and is separate from the portable runtime bundle it invokes as an external -child process. +child process. Local compatibility patches under `patches/` are licensed under +terms compatible with their target upstream projects (see `patches/LICENSE`). + +The Reims-Go desktop executable also incorporates open-source Go and frontend +libraries (including Wails, React, Radix UI, Lucide, Inter font, Go `golang.org/x` +packages, `klauspost/compress`, and `ulikunitz/xz`) under permissive licenses +(MIT, BSD, ISC, and SIL OFL 1.1); see `go.mod` and `frontend/package.json` for +the complete dependency list. The portable runtime bundle (`reims-runtime-win-x64-.tar.zst`) contains precompiled binaries built from the following upstream open-source projects. @@ -15,16 +22,16 @@ Each runtime release ships the matching source package, `NOTICE.md`, and - License: `GPL-2.0-or-later OR LGPL-3.0-or-later` 2. **metal2vulkan / metal2vulkan-runtime** - Upstream: https://github.com/steelbrain/metal2vulkan - - License: See upstream repository license + - License: `GPL-2.0-or-later OR LGPL-3.0-or-later` 3. **reims-util** - Upstream: https://github.com/steelbrain/reims-util - - License: See upstream repository license + - License: `GPL-2.0-or-later OR LGPL-3.0-or-later` 4. **QEMU (qemu-reims-vgpu fork)** - Upstream: https://github.com/steelbrain/qemu-reims-vgpu - License: `GPL-2.0-only` / `GPL-2.0-or-later` (and component licenses in QEMU) 5. **MSYS2 CLANG64 runtime libraries, libva, Mesa vaon12** - Upstream: https://github.com/msys2/MINGW-packages - - License: Respective open-source licenses of each packaged DLL + - License: Respective open-source licenses of each packaged DLL (bundled under `licenses/msys2/` in the runtime archive) No Apple proprietary files, macOS installers, recovery images, or SMC keys are included in this repository or in any runtime bundle. diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index 14d193b..ef76fed 100644 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -fd01023ab020f4fa559696be6708a9a3 \ No newline at end of file +640cefb23cef4711cf51530e8a87140c \ No newline at end of file diff --git a/frontend/src/components/AboutPage.tsx b/frontend/src/components/AboutPage.tsx index 9f13aef..fb5b38b 100644 --- a/frontend/src/components/AboutPage.tsx +++ b/frontend/src/components/AboutPage.tsx @@ -1,9 +1,11 @@ -import { Copy, Download, ExternalLink, RotateCw } from 'lucide-react' +import { Copy, Download, ExternalLink, RotateCw, Scale } from 'lucide-react' import React, { useEffect, useState } from 'react' import { I18nKey, t } from '../i18n' import { taskDetail } from '../lib/tasks' import { AppUpdateInfo, Locale, Task } from '../types' import { Button, IconButton } from '../ui/controls' +import { Modal } from '../ui/dialog' +import { Segmented } from '../ui/settings' import { api } from '../wails' import { REPO_URL } from './TitleMenus' import type { UpdatePhase } from './UpdateCapsule' @@ -38,6 +40,18 @@ export const AboutPage: React.FC = ({ const [qqInstalled, setQQInstalled] = useState(null) const [openingQQ, setOpeningQQ] = useState(false) const [qqLaunchErr, setQQLaunchErr] = useState('') + const [licenseOpen, setLicenseOpen] = useState(false) + const [licenseTab, setLicenseTab] = useState<'notice' | 'license'>('notice') + const [licenses, setLicenses] = useState<{ license: string; notice: string } | null>(null) + + const openLicenses = () => { + setLicenseOpen(true) + if (!licenses) { + api.GetLicenseTexts() + .then((res) => setLicenses({ license: res?.license ?? '', notice: res?.notice ?? '' })) + .catch((e) => onError(tr('failGeneric'), e)) + } + } const runUpdateCheck = async (force: boolean) => { setCheckingUpdate(true) @@ -176,6 +190,20 @@ export const AboutPage: React.FC = ({ +
+
+
{tr('aboutLicensesTitle')}
+
{tr('aboutLicensesSub')}
+
+
+ + +
+
@@ -216,6 +244,43 @@ export const AboutPage: React.FC = ({
+ {licenseOpen && ( + setLicenseOpen(false)} + > +
+ +
+              {licenses
+                ? (licenseTab === 'notice' ? licenses.notice : licenses.license)
+                : '…'}
+            
+
+
+ + +
+
+ )}
) } diff --git a/frontend/src/i18n.ts b/frontend/src/i18n.ts index 9efa1e8..d44a5e9 100644 --- a/frontend/src/i18n.ts +++ b/frontend/src/i18n.ts @@ -92,6 +92,12 @@ const dict = { aboutCommunity: '社区与支持', aboutProjectSub: 'GitHub 上的源码、发布版本与使用文档', aboutIssueSub: '遇到问题或有功能建议,在 GitHub 提交 Issue', + aboutLicensesTitle: '开源许可与声明', + aboutLicensesSub: 'Apache-2.0 协议与第三方开源组件声明(离线可查)', + aboutLicensesView: '查看', + aboutLicensesTabNotice: '第三方声明', + aboutLicensesTabLicense: 'Apache-2.0 协议', + aboutLicensesOpenGitHub: '在 GitHub 查看', settingsGeneral: '常规', settingsAppearance: '外观与语言', settingsAbout: '关于', @@ -890,6 +896,12 @@ const dict = { aboutCommunity: 'Community & support', aboutProjectSub: 'Source code, releases and docs on GitHub', aboutIssueSub: 'Report a problem or suggest a feature on GitHub', + aboutLicensesTitle: 'Open-source licenses', + aboutLicensesSub: 'Apache-2.0 license and third-party notices (available offline)', + aboutLicensesView: 'View', + aboutLicensesTabNotice: 'Third-party notices', + aboutLicensesTabLicense: 'Apache-2.0 License', + aboutLicensesOpenGitHub: 'View on GitHub', settingsGeneral: 'General', settingsAppearance: 'Appearance & language', settingsAbout: 'About', diff --git a/frontend/src/styles/app.css b/frontend/src/styles/app.css index dcf87b9..e597763 100644 --- a/frontend/src/styles/app.css +++ b/frontend/src/styles/app.css @@ -693,6 +693,13 @@ h1, h2, h3, p { margin: 0; } .about-hero-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; } .about-hero-text h1 { font-size: 22px; font-weight: var(--fw-strong); letter-spacing: -0.02em; color: var(--text); } .about-hero-text p { margin: 0; font-size: var(--fs-13); color: var(--text-2); line-height: 1.5; } +.license-modal-body { gap: var(--sp-3); } +.license-pre { + margin: 0; padding: 14px 16px; min-height: 260px; max-height: 52vh; overflow: auto; + border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-1); + font-family: var(--font-mono); font-size: var(--fs-12); line-height: 1.55; color: var(--text-2); + white-space: pre-wrap; word-break: break-word; user-select: text; +} .section-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-active); color: var(--text-3); font-size: 11px; font-weight: var(--fw-medium); text-align: center; } .installer-row { min-height: 62px; } .installer-art, .release-art { display: block; flex-shrink: 0; overflow: hidden; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 5px rgba(15, 23, 42, 0.12); } diff --git a/frontend/wailsjs/go/app/App.d.ts b/frontend/wailsjs/go/app/App.d.ts index 181dad2..d4c0bba 100644 --- a/frontend/wailsjs/go/app/App.d.ts +++ b/frontend/wailsjs/go/app/App.d.ts @@ -79,6 +79,8 @@ export function FocusVMWindow(arg1:string):Promise; export function GetActiveTheme():Promise; +export function GetLicenseTexts():Promise; + export function GetPluginSettings(arg1:string,arg2:string):Promise>; export function GetPluginUIContributions():Promise; diff --git a/frontend/wailsjs/go/app/App.js b/frontend/wailsjs/go/app/App.js index 7385a11..88a23e1 100644 --- a/frontend/wailsjs/go/app/App.js +++ b/frontend/wailsjs/go/app/App.js @@ -142,6 +142,10 @@ export function GetActiveTheme() { return window['go']['app']['App']['GetActiveTheme'](); } +export function GetLicenseTexts() { + return window['go']['app']['App']['GetLicenseTexts'](); +} + export function GetPluginSettings(arg1, arg2) { return window['go']['app']['App']['GetPluginSettings'](arg1, arg2); } diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index 4daf392..5c180c9 100644 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -152,6 +152,20 @@ export namespace app { return a; } } + export class LicenseTexts { + license: string; + notice: string; + + static createFrom(source: any = {}) { + return new LicenseTexts(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.license = source["license"]; + this.notice = source["notice"]; + } + } export class PendingChange { field: string; from: string; diff --git a/internal/app/license.go b/internal/app/license.go new file mode 100644 index 0000000..7f3a3ad --- /dev/null +++ b/internal/app/license.go @@ -0,0 +1,30 @@ +package app + +import "sync" + +// LicenseTexts holds the embedded LICENSE and NOTICE.md texts bundled into the +// executable so users can inspect them offline from the About page. +type LicenseTexts struct { + License string `json:"license"` + Notice string `json:"notice"` +} + +var embeddedLicenses struct { + mu sync.RWMutex + data LicenseTexts +} + +// RegisterLicenseTexts stores the repository's LICENSE and NOTICE.md text +// embedded by package main. +func RegisterLicenseTexts(license, notice string) { + embeddedLicenses.mu.Lock() + embeddedLicenses.data = LicenseTexts{License: license, Notice: notice} + embeddedLicenses.mu.Unlock() +} + +// GetLicenseTexts returns the embedded Apache-2.0 LICENSE and NOTICE.md texts. +func (a *App) GetLicenseTexts() LicenseTexts { + embeddedLicenses.mu.RLock() + defer embeddedLicenses.mu.RUnlock() + return embeddedLicenses.data +} diff --git a/main.go b/main.go index c4af2ef..dba7dff 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,12 @@ var assets embed.FS //go:embed assets/logo.png var trayIconPNG []byte +//go:embed LICENSE +var licenseText string + +//go:embed NOTICE.md +var noticeText string + func main() { args := os.Args[1:] if cli.IsCommand(args) { @@ -37,6 +43,7 @@ func main() { cancel() } + app.RegisterLicenseTexts(licenseText, noticeText) desktopApp, hooks := app.New(trayIconPNG, launch) err := wails.Run(&options.App{ Title: "Reims-Go", diff --git a/patches/LICENSE b/patches/LICENSE new file mode 100644 index 0000000..42d8969 --- /dev/null +++ b/patches/LICENSE @@ -0,0 +1,11 @@ +# Licensing for `patches/` + +Unlike the rest of the Reims-Go repository (which is licensed under the Apache +License, Version 2.0), patch files in this directory are intended to be applied +to and contributed back to their respective upstream repositories. To maintain +strict license compatibility with each target codebase: + +- `qemu-*.patch` (targeting `vendor/qemu` / QEMU) are licensed under + **GPL-2.0-or-later**. +- `reims-*.patch` (targeting `steelbrain/reims-vgpu` / `reims-ctl`) are + dual-licensed under **GPL-2.0-or-later OR LGPL-3.0-or-later**. diff --git a/patches/README.md b/patches/README.md index 358dbf2..e559487 100644 --- a/patches/README.md +++ b/patches/README.md @@ -7,7 +7,7 @@ 1. **不长期维护 fork**:所有底层修复优先向上游仓库([`steelbrain/reims-vgpu`](https://github.com/steelbrain/reims-vgpu) / [`steelbrain/qemu-reims-vgpu`](https://github.com/steelbrain/qemu-reims-vgpu))提交 PR,目标是补丁队列清零。 2. **人工提 PR,冲突即停**:更新上游基线时由 [`scripts/apply-patch-series.ps1`](../scripts/apply-patch-series.ps1) 按顺序执行 `git apply --check`。已合入上游(反向检查通过)的补丁会自动跳过并开 Issue 提醒退役;遇到冲突时立刻中止构建,不自动改写补丁。 3. **文件格式约束**:所有 `.patch` 文件必须为 **无 BOM、LF 行尾**(由 `.gitattributes` 中的 `*.patch -text` 约束),避免 `git apply` 在 Windows 上失败。 -4. **来源透明**:每个运行时包的 `manifest.json` 与 `patches/` 目录必须如实记录实际应用的全部补丁及哈希。 +4. **来源透明与协议兼容**:每个运行时包的 `manifest.json` 与 `patches/` 目录必须如实记录实际应用的全部补丁及哈希;本目录补丁不适用根目录的 Apache-2.0,而是遵循目标上游兼容协议(详见 [`patches/LICENSE`](LICENSE))。 --- diff --git a/scripts/pack-runtime.ps1 b/scripts/pack-runtime.ps1 index d4db09a..29d7fa4 100644 --- a/scripts/pack-runtime.ps1 +++ b/scripts/pack-runtime.ps1 @@ -283,6 +283,9 @@ if ($keyFiles.Count -ne 5 -or (Compare-Object $expectedKeyFiles $keyFiles)) { Copy-Item -LiteralPath (Join-Path $repoRoot 'NOTICE.md') -Destination "$bundleDir\NOTICE.md" foreach ($ps in $patchSpecs) { Copy-Item -LiteralPath (Join-Path $patchesDir $ps.Name) -Destination "$bundleDir\patches\" } Copy-Item -LiteralPath (Join-Path $patchesDir 'README.md') -Destination "$bundleDir\patches\README.md" +if (Test-Path -LiteralPath (Join-Path $patchesDir 'LICENSE')) { + Copy-Item -LiteralPath (Join-Path $patchesDir 'LICENSE') -Destination "$bundleDir\patches\LICENSE" +} # The order the patches above were applied in (only those really applied). Write-Utf8 "$bundleDir\patches\series.txt" ((($patchSpecs | ForEach-Object { '{0,-11} {1}' -f $_.Target, $_.Name }) -join "`n") + "`n") $licenses = @{ @@ -303,16 +306,34 @@ $bash = Join-Path $Msys2 'usr\bin\bash.exe' $dlls = @(Get-ChildItem -LiteralPath "$bundleDir\qemu\bin" -Filter '*.dll' -File | Sort-Object Name) $pkgLines = [Collections.Generic.List[string]]::new() $pkgSet = [ordered]@{} +$pkgNames = [ordered]@{} foreach ($d in $dlls) { $owner = (& $bash -lc "LC_ALL=C pacman -Qqo /clang64/bin/$($d.Name) 2>/dev/null" | Select-Object -First 1) if ($owner) { $ver = (& $bash -lc "LC_ALL=C pacman -Q $owner" | Select-Object -First 1).Split(' ')[1] $pkgLines.Add("$($d.Name)`t$owner`t$ver") $pkgSet["$owner $ver"] = $true + $pkgNames[$owner] = $true } else { $pkgLines.Add("$($d.Name)`t(not from an MSYS2 package: built with qemu, source in the source package)`t-") } } +# Bundle each MSYS2 package's installed license texts under licenses/msys2/. +$msysLicRoot = Join-Path $bundleDir 'licenses\msys2' +foreach ($owner in $pkgNames.Keys) { + $licFiles = @(& $bash -lc "LC_ALL=C pacman -Ql $owner 2>/dev/null" | ForEach-Object { + if ($_ -match '^\S+\s+(/clang64/share/licenses/.+)$' -and -not $Matches[1].EndsWith('/')) { $Matches[1] } + }) + foreach ($lf in $licFiles) { + $rel = $lf.Substring('/clang64/share/licenses/'.Length) + $srcFile = Join-Path $Msys2 ($lf.TrimStart('/') -replace '/', '\') + if (Test-Path -LiteralPath $srcFile -PathType Leaf) { + $dstFile = Join-Path $msysLicRoot ($rel -replace '/', '\') + [void][IO.Directory]::CreateDirectory((Split-Path -Parent $dstFile)) + Copy-Item -LiteralPath $srcFile -Destination $dstFile -Force + } + } +} $msysText = @" # DLLs bundled in qemu/bin and the MSYS2 CLANG64 packages they come from # (pacman -Qo on the build machine, $(Get-Date -Format 'yyyy-MM-dd')). @@ -322,7 +343,7 @@ $msysText = @" # The same files are also at: # https://repo.msys2.org/mingw/sources/ (-.src.tar.zst, by pkgbase) # https://github.com/msys2/MINGW-packages (build recipes) -# Licenses: see each package's /clang64/share/licenses// in MSYS2. +# Licenses: bundled under licenses/msys2/ from each package's /clang64/share/licenses/ in MSYS2. DLL`tPACKAGE`tVERSION $($pkgLines -join "`n") @@ -355,6 +376,20 @@ if (-not $utilTree) { throw "reims-util source at $utilCommit not found under $c if (-not $m2vTree) { throw "metal2vulkan source at $m2vCommit not found under $checkouts" } Export-GitTree $utilTree $utilCommit (Join-Path $srcDir "reims-util-$($utilCommit.Substring(0, 7))") Export-GitTree $m2vTree $m2vCommit (Join-Path $srcDir "metal2vulkan-$($m2vCommit.Substring(0, 7))") +foreach ($extra in @( + @{ Name = 'reims-util'; Tree = $utilTree }, + @{ Name = 'metal2vulkan'; Tree = $m2vTree } +)) { + foreach ($lf in @('LICENSE', 'LICENSE.txt', 'LICENSE.md', 'COPYING', 'COPYING.LIB')) { + $srcLic = Join-Path $extra.Tree $lf + if (Test-Path -LiteralPath $srcLic -PathType Leaf) { + Copy-Item -LiteralPath $srcLic -Destination (Join-Path "$bundleDir\licenses" "$($extra.Name)-$lf") -Force + } + } + if (Test-Path -LiteralPath (Join-Path $extra.Tree 'LICENSES') -PathType Container) { + Copy-Item -Path (Join-Path $extra.Tree 'LICENSES\*') -Destination "$bundleDir\licenses\" -Recurse -Force + } +} New-Item -ItemType Directory -Force -Path "$srcDir\patches" | Out-Null Copy-Item -Path "$bundleDir\patches\*" -Destination "$srcDir\patches\"