fix: remove GPL converter and bundle third-party license sources
parent
a57e97c4e1
commit
e18cf138a3
|
|
@ -20,6 +20,13 @@ on:
|
|||
- "skills/preloaded/**"
|
||||
- "testdata/**"
|
||||
- "docker/Dockerfile.app"
|
||||
- "LICENSE"
|
||||
- "THIRD_PARTY_NOTICES.md"
|
||||
- "licenses/**"
|
||||
- "internal/textconv/data/**"
|
||||
- "scripts/*licenses.sh"
|
||||
- "scripts/check-license-bundle.sh"
|
||||
- "cmd/desktop/build/windows/installer/project.nsi"
|
||||
- ".github/workflows/app.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
|
|
@ -36,6 +43,13 @@ on:
|
|||
- "skills/preloaded/**"
|
||||
- "testdata/**"
|
||||
- "docker/Dockerfile.app"
|
||||
- "LICENSE"
|
||||
- "THIRD_PARTY_NOTICES.md"
|
||||
- "licenses/**"
|
||||
- "internal/textconv/data/**"
|
||||
- "scripts/*licenses.sh"
|
||||
- "scripts/check-license-bundle.sh"
|
||||
- "cmd/desktop/build/windows/installer/project.nsi"
|
||||
- ".github/workflows/app.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
|
|
@ -72,6 +86,9 @@ jobs:
|
|||
- name: Download modules
|
||||
run: go mod download
|
||||
|
||||
- name: Verify third-party notices and source bundle
|
||||
run: bash ./scripts/check-license-bundle.sh
|
||||
|
||||
- name: Check formatting
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ jobs:
|
|||
ARCHIVE="WeKnora-lite_${{ steps.ver.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
mkdir -p "${ARCHIVE}/web"
|
||||
cp WeKnora-lite "${ARCHIVE}/"
|
||||
bash ./scripts/copy-licenses.sh "${ARCHIVE}"
|
||||
cp -r web/* "${ARCHIVE}/web/"
|
||||
cp .env.lite.example "${ARCHIVE}/"
|
||||
cp docs/LITE.md "${ARCHIVE}/README.md"
|
||||
|
|
@ -233,6 +234,7 @@ jobs:
|
|||
NSIS_FLAG="-nsis"
|
||||
fi
|
||||
|
||||
bash ./scripts/check-license-bundle.sh
|
||||
cd cmd/desktop
|
||||
wails build -clean \
|
||||
-tags "${BUILD_TAGS}" \
|
||||
|
|
@ -251,6 +253,7 @@ jobs:
|
|||
|
||||
mkdir -p "${RESOURCES}/config"
|
||||
mkdir -p "${RESOURCES}/migrations/sqlite"
|
||||
bash ./scripts/copy-licenses.sh "${RESOURCES}"
|
||||
|
||||
if [ -f .env.lite.example ]; then
|
||||
cp .env.lite.example "${RESOURCES}/.env"
|
||||
|
|
@ -283,6 +286,7 @@ jobs:
|
|||
ARCHIVE="WeKnora-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
mkdir -p "${ARCHIVE}"
|
||||
cp "cmd/desktop/build/bin/WeKnora Lite" "${ARCHIVE}/"
|
||||
bash ./scripts/copy-licenses.sh "${ARCHIVE}"
|
||||
if [ -f .env.lite.example ]; then
|
||||
cp .env.lite.example "${ARCHIVE}/"
|
||||
fi
|
||||
|
|
@ -297,21 +301,18 @@ jobs:
|
|||
tar czf "${ARCHIVE}.tar.gz" "${ARCHIVE}"
|
||||
shasum -a 256 "${ARCHIVE}.tar.gz" > "${ARCHIVE}.tar.gz.sha256"
|
||||
|
||||
# ── Windows: package NSIS installer or plain exe ──
|
||||
# ── Windows: NSIS installer includes licenses and corresponding source ──
|
||||
- name: Package Windows app
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
ARCHIVE="WeKnora-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
# Wails -nsis generates an installer named {app}-amd64-installer.exe
|
||||
INSTALLER="cmd/desktop/build/bin/WeKnora Lite-amd64-installer.exe"
|
||||
if [ -f "$INSTALLER" ]; then
|
||||
cp "$INSTALLER" "${ARCHIVE}_setup.exe"
|
||||
sha256sum "${ARCHIVE}_setup.exe" > "${ARCHIVE}_setup.exe.sha256"
|
||||
else
|
||||
cp "cmd/desktop/build/bin/WeKnora Lite.exe" "${ARCHIVE}.exe"
|
||||
sha256sum "${ARCHIVE}.exe" > "${ARCHIVE}.exe.sha256"
|
||||
fi
|
||||
# Do not publish a bare executable if NSIS was unavailable: the
|
||||
# installer also carries the notices/source and supports auto-update.
|
||||
test -f "$INSTALLER"
|
||||
cp "$INSTALLER" "${ARCHIVE}_setup.exe"
|
||||
sha256sum "${ARCHIVE}_setup.exe" > "${ARCHIVE}_setup.exe.sha256"
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
|
|
|
|||
5
LICENSE
5
LICENSE
|
|
@ -1,5 +1,8 @@
|
|||
Tencent is pleased to support the open source community by making this project available.
|
||||
|
||||
Additional component notices, licenses and corresponding source are supplied in
|
||||
THIRD_PARTY_NOTICES.md and the licenses/ directory. These supplement the notices below.
|
||||
|
||||
Copyright (C) 2025 Tencent. All rights reserved.
|
||||
|
||||
This project is licensed under the MIT License except for the third-party components listed below, which is licensed under different terms. Tencent does not impose any additional limitations beyond what is outlined in the respective licenses of these third-party components. Users must comply with all terms and conditions of original licenses of these third-party components and must ensure that the usage of the third party components adheres to all relevant laws and regulations.
|
||||
|
|
@ -3256,4 +3259,4 @@ You may obtain the source code and detailed information about this component at
|
|||
|
||||
|
||||
|
||||
Terms of the unknown:
|
||||
Terms of the unknown:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
# Third-party notices and corresponding source
|
||||
|
||||
This file supplements the third-party notices in `LICENSE`. The MIT license
|
||||
for WeKnora's own code does not replace the licenses of third-party components.
|
||||
Keep this file, `LICENSE`, and the `licenses/` directory with redistributed
|
||||
backend and desktop packages. Container distributions include them in `/app`;
|
||||
macOS applications include them in `Contents/Resources`.
|
||||
Windows installers place them next to the installed executable.
|
||||
|
||||
## Go MySQL Driver
|
||||
|
||||
- Component: `github.com/go-sql-driver/mysql`, version `v1.10.0`.
|
||||
- Used in backend and desktop binaries, including the Doris MySQL protocol driver.
|
||||
- License: Mozilla Public License 2.0, reproduced in
|
||||
[`licenses/go-sql-driver-mysql-MPL-2.0.txt`](licenses/go-sql-driver-mysql-MPL-2.0.txt).
|
||||
- Copyright: The Go-MySQL-Driver Authors; the original per-file notices and
|
||||
`AUTHORS` are preserved in the accompanying source archive.
|
||||
- Modifications by WeKnora: none. Dialer configuration is in separate WeKnora files.
|
||||
- Corresponding source, available under MPL-2.0:
|
||||
[`licenses/sources/mysql-v1.10.0.zip`](licenses/sources/mysql-v1.10.0.zip).
|
||||
The same version is available from the
|
||||
[Go module proxy](https://proxy.golang.org/github.com/go-sql-driver/mysql/@v/v1.10.0.zip)
|
||||
and [upstream repository](https://github.com/go-sql-driver/mysql/tree/v1.10.0).
|
||||
|
||||
## go-m1cpu
|
||||
|
||||
- Component: `github.com/shoenig/go-m1cpu`, version `v0.1.6`.
|
||||
- Used by the macOS backend/desktop dependency chain through gopsutil. It is
|
||||
absent from Linux backend build dependencies. Its source is included in all
|
||||
notice bundles for consistent packaging; this does not imply Linux linkage.
|
||||
- License: Mozilla Public License 2.0, reproduced in
|
||||
[`licenses/go-m1cpu-MPL-2.0.txt`](licenses/go-m1cpu-MPL-2.0.txt).
|
||||
- Attribution: the go-m1cpu project and its contributors. The complete original
|
||||
source and notices are preserved in the accompanying archive.
|
||||
- Modifications by WeKnora: none.
|
||||
- Corresponding source, available under MPL-2.0:
|
||||
[`licenses/sources/go-m1cpu-v0.1.6.zip`](licenses/sources/go-m1cpu-v0.1.6.zip).
|
||||
The same version is available from the
|
||||
[Go module proxy](https://proxy.golang.org/github.com/shoenig/go-m1cpu/@v/v0.1.6.zip)
|
||||
and [upstream repository](https://github.com/shoenig/go-m1cpu/tree/v0.1.6).
|
||||
|
||||
## OpenCC dictionary data
|
||||
|
||||
- Files: `internal/textconv/data/TSPhrases.txt` and `TSCharacters.txt`, copied
|
||||
unchanged from `github.com/longbridgeapp/opencc` version `v0.3.13`.
|
||||
- Attribution: the OpenCC and longbridge/opencc contributors.
|
||||
- License: Apache-2.0, reproduced in
|
||||
[`licenses/OpenCC-Apache-2.0.txt`](licenses/OpenCC-Apache-2.0.txt).
|
||||
- Source: [versioned dictionary directory](https://github.com/longbridgeapp/opencc/tree/v0.3.13/dictionary)
|
||||
and the two text files distributed with WeKnora's source.
|
||||
- Only dictionary data is retained. WeKnora uses its own standard-library lookup
|
||||
implementation; the upstream Go converter, `liuzl/da`, and GPL-licensed
|
||||
`cedar-go` code are not included.
|
||||
|
||||
## Build-only component
|
||||
|
||||
The Windows installer template in `cmd/desktop/build/windows/installer/project.nsi`
|
||||
is based on Wails v2.12.0's MIT-licensed default template, with local changes to
|
||||
install this notice/source bundle. Its license and copyright are reproduced in
|
||||
[`licenses/Wails-MIT.txt`](licenses/Wails-MIT.txt).
|
||||
|
||||
`cbindgen` 0.29.4 (MPL-2.0) generates the AnyDoc C ABI header during the Rust
|
||||
build. Its code/tool executable is not copied into the runtime image or release
|
||||
packages by the current build recipes. Generating the header does not copy the
|
||||
tool's implementation into the product. If distributing build environments or
|
||||
the tool itself, retain its license and provide its corresponding source too.
|
||||
|
||||
## Maintaining this bundle
|
||||
|
||||
When upgrading either MPL module, update the version, license, and matching
|
||||
source archive together. Archives are unmodified Go module proxy ZIPs, including
|
||||
their original copyright notices. Verify them with `go mod download -json` and
|
||||
the module's `go.sum` entry before updating. `scripts/check-license-bundle.sh`
|
||||
checks the pins and packaging inputs without downloading dependencies.
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
; Based on the Wails v2.12.0 default installer (MIT).
|
||||
; See licenses/Wails-MIT.txt. Local change: install the notice/source bundle.
|
||||
Unicode true
|
||||
|
||||
####
|
||||
## Please note: Template replacements don't work in this file. They are provided with default defines like
|
||||
## mentioned underneath.
|
||||
## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo.
|
||||
## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually
|
||||
## from outside of Wails for debugging and development of the installer.
|
||||
##
|
||||
## For development first make a wails nsis build to populate the "wails_tools.nsh":
|
||||
## > wails build --target windows/amd64 --nsis
|
||||
## Then you can call makensis on this file with specifying the path to your binary:
|
||||
## For a AMD64 only installer:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
|
||||
## For a ARM64 only installer:
|
||||
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
|
||||
## For a installer with both architectures:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
|
||||
####
|
||||
## The following information is taken from the ProjectInfo file, but they can be overwritten here.
|
||||
####
|
||||
## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}"
|
||||
## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}"
|
||||
## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}"
|
||||
## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}"
|
||||
## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}"
|
||||
###
|
||||
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
|
||||
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
||||
####
|
||||
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
|
||||
####
|
||||
## Include the wails tools
|
||||
####
|
||||
!include "wails_tools.nsh"
|
||||
|
||||
# The version information for this two must consist of 4 parts
|
||||
VIProductVersion "${INFO_PRODUCTVERSION}.0"
|
||||
VIFileVersion "${INFO_PRODUCTVERSION}.0"
|
||||
|
||||
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
|
||||
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
|
||||
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
|
||||
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
|
||||
|
||||
# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware
|
||||
ManifestDPIAware true
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
!define MUI_ICON "..\icon.ico"
|
||||
!define MUI_UNICON "..\icon.ico"
|
||||
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
|
||||
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
|
||||
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
|
||||
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
|
||||
!insertmacro MUI_PAGE_INSTFILES # Installing page.
|
||||
!insertmacro MUI_PAGE_FINISH # Finished installation page.
|
||||
|
||||
!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
|
||||
|
||||
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
|
||||
#!uninstfinalize 'signtool --file "%1"'
|
||||
#!finalize 'signtool --file "%1"'
|
||||
|
||||
Name "${INFO_PRODUCTNAME}"
|
||||
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
||||
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
||||
ShowInstDetails show # This will always show the installation details.
|
||||
|
||||
Function .onInit
|
||||
!insertmacro wails.checkArchitecture
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
!insertmacro wails.webview2runtime
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
!insertmacro wails.files
|
||||
|
||||
; Paths are relative to cmd/desktop/build/windows/installer.
|
||||
File "..\..\..\..\..\LICENSE"
|
||||
File "..\..\..\..\..\THIRD_PARTY_NOTICES.md"
|
||||
SetOutPath "$INSTDIR\licenses"
|
||||
File /r "..\..\..\..\..\licenses\*"
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
|
||||
!insertmacro wails.associateFiles
|
||||
!insertmacro wails.associateCustomProtocols
|
||||
|
||||
!insertmacro wails.writeUninstaller
|
||||
SectionEnd
|
||||
|
||||
Section "uninstall"
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
|
||||
|
||||
RMDir /r $INSTDIR
|
||||
|
||||
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
|
||||
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
|
||||
|
||||
!insertmacro wails.unassociateFiles
|
||||
!insertmacro wails.unassociateCustomProtocols
|
||||
|
||||
!insertmacro wails.deleteUninstaller
|
||||
SectionEnd
|
||||
|
|
@ -32,6 +32,7 @@ RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|||
COPY cmd/download cmd/download
|
||||
RUN go run cmd/download/duckdb/duckdb.go
|
||||
COPY . .
|
||||
RUN bash ./scripts/check-license-bundle.sh
|
||||
|
||||
# Get version and commit info for build injection
|
||||
ARG VERSION_ARG
|
||||
|
|
@ -120,6 +121,8 @@ COPY --from=builder /app/migrations ./migrations
|
|||
COPY --from=builder /app/dataset/samples ./dataset/samples
|
||||
COPY --from=builder /root/.duckdb /home/appuser/.duckdb
|
||||
COPY --from=builder /app/WeKnora .
|
||||
COPY LICENSE THIRD_PARTY_NOTICES.md ./
|
||||
COPY licenses ./licenses
|
||||
|
||||
# Copy and make entrypoint script executable
|
||||
COPY --from=builder /app/scripts/docker-entrypoint.sh ./scripts/docker-entrypoint.sh
|
||||
|
|
|
|||
9
go.mod
9
go.mod
|
|
@ -34,7 +34,6 @@ require (
|
|||
github.com/joho/godotenv v1.5.1
|
||||
github.com/ks3sdklib/aws-sdk-go v1.11.0
|
||||
github.com/larksuite/oapi-sdk-go/v3 v3.9.7
|
||||
github.com/longbridgeapp/opencc v0.3.13
|
||||
github.com/mark3labs/mcp-go v0.52.0
|
||||
github.com/matiasinsaurralde/go-e2b v0.1.1-0.20260808041540-fdc08ceaa1c1
|
||||
github.com/milvus-io/milvus/client/v2 v2.6.4
|
||||
|
|
@ -139,7 +138,7 @@ require (
|
|||
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect
|
||||
github.com/cockroachdb/redact v1.1.3 // indirect
|
||||
github.com/containerd/cgroups/v3 v3.0.3 // indirect
|
||||
github.com/containerd/errdefs v1.0.0 // indirect
|
||||
github.com/containerd/errdefs v1.0.0
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
|
|
@ -236,8 +235,6 @@ require (
|
|||
github.com/leaanthony/u v1.1.1 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect
|
||||
github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
|
|
@ -250,8 +247,8 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/moby/api v1.55.0 // indirect
|
||||
github.com/moby/moby/client v0.5.1 // indirect
|
||||
github.com/moby/moby/api v1.55.0
|
||||
github.com/moby/moby/client v0.5.1
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mozillazg/go-httpheader v0.2.1 // indirect
|
||||
|
|
|
|||
13
go.sum
13
go.sum
|
|
@ -1370,8 +1370,6 @@ github.com/Shopify/sarama v1.30.1/go.mod h1:hGgx05L/DiW8XYBXeJdKIN6V2QUy2H6JqME5
|
|||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0=
|
||||
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
||||
github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:ir/IFJU5xbja5UaBEQLjcvn7aAU01nqU/NUyOBEU+ew=
|
||||
github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:PRWNwWq0yifz6XDPZu48aSld8BWwBfr2JKB2bGWiEd4=
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
|
||||
|
|
@ -2221,12 +2219,6 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
|||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:qSmEGTgjkESUX5kPMSGJ4pcBUtYVDdkNzMrjQyvRvp0=
|
||||
github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:x7SghIWwLVcJObXbjK7S2ENsT1cAcdJcPl7dRaSFog0=
|
||||
github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d h1:hTRDIpJ1FjS9ULJuEzu69n3qTgc18eI+ztw/pJv47hs=
|
||||
github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d/go.mod h1:7xD3p0XnHvJFQ3t/stEJd877CSIMkH/fACVWen5pYnc=
|
||||
github.com/longbridgeapp/opencc v0.3.13 h1:H8r4oXL4s+oR3gbBb4tW4D26jT+Mc5+znzwAnXsx4ao=
|
||||
github.com/longbridgeapp/opencc v0.3.13/go.mod h1:jRuKtq8eLA+cZUu75XgMvkB/hFSXJbZDmij0v29lNaY=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e h1:Q6MvJtQK/iRcRtzAscm/zF23XxJlbECiGPyRicsX+Ak=
|
||||
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||
|
|
@ -2531,7 +2523,6 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
|
|||
github.com/sebdah/goldie/v2 v2.8.0 h1:dZb9wR8q5++oplmEiJT+U/5KyotVD+HNGCAc5gNr8rc=
|
||||
github.com/sebdah/goldie/v2 v2.8.0/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
|
||||
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4=
|
||||
|
|
@ -3978,6 +3969,8 @@ gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwy
|
|||
gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
|
||||
gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
|
||||
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
||||
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
|
||||
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
|
@ -4050,6 +4043,8 @@ modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
|||
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8=
|
||||
modernc.org/z v1.7.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ=
|
||||
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
|
||||
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Traditional-to-simplified dictionary data
|
||||
|
||||
`TSPhrases.txt` and `TSCharacters.txt` are unmodified copies from
|
||||
[longbridgeapp/opencc v0.3.13](https://github.com/longbridgeapp/opencc/tree/v0.3.13/dictionary),
|
||||
which distributes OpenCC dictionary data under Apache-2.0. Attribution belongs
|
||||
to the OpenCC and longbridge/opencc contributors. The full license is retained
|
||||
in [`licenses/OpenCC-Apache-2.0.txt`](../../../licenses/OpenCC-Apache-2.0.txt).
|
||||
|
||||
Only these two text dictionaries are retained. The Go converter, `liuzl/da`,
|
||||
and the GPL-licensed `cedar-go` implementation are not vendored or imported.
|
||||
The lookup implementation in the parent directory uses Go standard-library
|
||||
maps and preserves the previous t2s dictionary order and first-choice values.
|
||||
|
||||
SHA-256:
|
||||
|
||||
| File | Digest |
|
||||
| --- | --- |
|
||||
| TSCharacters.txt | 6b5a0a799bea2bb22c001f635eaa3fc2904310f0c08addbff275477a80ecf09a |
|
||||
| TSPhrases.txt | b2ef895dd4953b4bb77fc8ef8d26a2a9ca6d43a760ed9a1d767672cfafa6324f |
|
||||
|
||||
Dictionary updates can change FAQ normalization and persisted content hashes.
|
||||
Review them separately from converter changes; the historical corpus test pins
|
||||
the behavior of the original v0.3.13 converter on 13,177 inputs.
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,277 @@
|
|||
一目瞭然 一目了然
|
||||
上鍊 上链
|
||||
不瞭解 不了解
|
||||
么麼 幺麽
|
||||
么麽 幺麽
|
||||
乾乾淨淨 干干净净
|
||||
乾乾脆脆 干干脆脆
|
||||
乾元 乾元
|
||||
乾卦 乾卦
|
||||
乾嘉 乾嘉
|
||||
乾圖 乾图
|
||||
乾坤 乾坤
|
||||
乾坤一擲 乾坤一掷
|
||||
乾坤再造 乾坤再造
|
||||
乾坤大挪移 乾坤大挪移
|
||||
乾宅 乾宅
|
||||
乾斷 乾断
|
||||
乾旦 乾旦
|
||||
乾曜 乾曜
|
||||
乾清宮 乾清宫
|
||||
乾盛世 乾盛世
|
||||
乾紅 乾红
|
||||
乾綱 乾纲
|
||||
乾縣 乾县
|
||||
乾象 乾象
|
||||
乾造 乾造
|
||||
乾道 乾道
|
||||
乾陵 乾陵
|
||||
乾隆 乾隆
|
||||
乾隆年間 乾隆年间
|
||||
乾隆皇帝 乾隆皇帝
|
||||
二噁英 二𫫇英
|
||||
以免藉口 以免借口
|
||||
以功覆過 以功复过
|
||||
侔德覆載 侔德复载
|
||||
傢俱 家具
|
||||
傷亡枕藉 伤亡枕藉
|
||||
八濛山 八濛山
|
||||
凌藉 凌借
|
||||
出醜狼藉 出丑狼藉
|
||||
函覆 函复
|
||||
千鍾粟 千锺粟
|
||||
反反覆覆 反反复复
|
||||
反覆 反复
|
||||
反覆思維 反复思维
|
||||
反覆思量 反复思量
|
||||
反覆性 反复性
|
||||
名覆金甌 名复金瓯
|
||||
哪吒 哪吒
|
||||
回覆 回复
|
||||
壺裏乾坤 壶里乾坤
|
||||
大目乾連冥間救母變文 大目乾连冥间救母变文
|
||||
宫商角徵羽 宫商角徵羽
|
||||
射覆 射复
|
||||
尼乾陀 尼乾陀
|
||||
幺麼 幺麽
|
||||
幺麼小丑 幺麽小丑
|
||||
幺麼小醜 幺麽小丑
|
||||
康乾 康乾
|
||||
張法乾 张法乾
|
||||
彷彿 仿佛
|
||||
彷徨 彷徨
|
||||
徵弦 徵弦
|
||||
徵絃 徵弦
|
||||
徵羽摩柯 徵羽摩柯
|
||||
徵聲 徵声
|
||||
徵調 徵调
|
||||
徵音 徵音
|
||||
情有獨鍾 情有独钟 情有独锺
|
||||
憑藉 凭借
|
||||
憑藉着 凭借着
|
||||
手鍊 手链
|
||||
扭轉乾坤 扭转乾坤
|
||||
找藉口 找借口
|
||||
拉鍊 拉链
|
||||
拉鍊工程 拉链工程
|
||||
拜覆 拜复
|
||||
據瞭解 据了解
|
||||
文錦覆阱 文锦复阱
|
||||
於世成 於世成
|
||||
於乎 於乎
|
||||
於仲完 於仲完
|
||||
於倫 於伦
|
||||
於其一 於其一
|
||||
於則 於则
|
||||
於勇明 於勇明
|
||||
於呼哀哉 於呼哀哉
|
||||
於單 於单
|
||||
於坦 於坦
|
||||
於崇文 於崇文
|
||||
於忠祥 於忠祥
|
||||
於惟一 於惟一
|
||||
於戲 於戏
|
||||
於敖 於敖
|
||||
於梨華 於梨华
|
||||
於清言 於清言
|
||||
於潛 於潜
|
||||
於琳 於琳
|
||||
於穆 於穆
|
||||
於竹屋 於竹屋
|
||||
於菟 於菟
|
||||
於邑 於邑
|
||||
於陵子 於陵子
|
||||
旋乾轉坤 旋乾转坤
|
||||
旋轉乾坤 旋转乾坤
|
||||
旋轉乾坤之力 旋转乾坤之力
|
||||
明瞭 明了
|
||||
明覆 明复
|
||||
書中自有千鍾粟 书中自有千锺粟
|
||||
有序 有序
|
||||
朝乾夕惕 朝乾夕惕
|
||||
木吒 木吒
|
||||
李乾德 李乾德
|
||||
李澤鉅 李泽钜
|
||||
李鍊福 李链福
|
||||
李鍾郁 李锺郁
|
||||
樊於期 樊於期
|
||||
沈沒 沉没
|
||||
沈沒成本 沉没成本
|
||||
沈積 沉积
|
||||
沈船 沉船
|
||||
沈默 沉默
|
||||
流徵 流徵
|
||||
浪蕩乾坤 浪荡乾坤
|
||||
滑藉 滑借
|
||||
無序 无序
|
||||
牴牾 抵牾
|
||||
牴觸 抵触
|
||||
狐藉虎威 狐借虎威
|
||||
珍珠項鍊 珍珠项链
|
||||
甚鉅 甚钜
|
||||
申覆 申复
|
||||
畢昇 毕昇
|
||||
發覆 发复
|
||||
瞭如 了如
|
||||
瞭如指掌 了如指掌
|
||||
瞭望 瞭望
|
||||
瞭然 了然
|
||||
瞭然於心 了然于心
|
||||
瞭若指掌 了若指掌
|
||||
瞭解 了解
|
||||
瞭解到 了解到
|
||||
示覆 示复
|
||||
神祇 神祇
|
||||
稟覆 禀复
|
||||
竺乾 竺乾
|
||||
答覆 答复
|
||||
篤麼 笃麽
|
||||
簡單明瞭 简单明了
|
||||
籌畫 筹划
|
||||
素藉 素借
|
||||
老態龍鍾 老态龙钟 老态龙锺
|
||||
肘手鍊足 肘手链足
|
||||
茵藉 茵借
|
||||
萬鍾 万锺
|
||||
蒜薹 蒜薹
|
||||
蕓薹 芸薹
|
||||
蕩覆 荡复
|
||||
蕭乾 萧乾
|
||||
藉代 借代
|
||||
藉以 借以
|
||||
藉助 借助
|
||||
藉助於 借助于
|
||||
藉卉 借卉
|
||||
藉口 借口
|
||||
藉喻 借喻
|
||||
藉寇兵 借寇兵
|
||||
藉寇兵齎盜糧 借寇兵赍盗粮
|
||||
藉手 借手
|
||||
藉據 借据
|
||||
藉故 借故
|
||||
藉故推辭 借故推辞
|
||||
藉方 借方
|
||||
藉條 借条
|
||||
藉槁 借槁
|
||||
藉機 借机
|
||||
藉此 借此
|
||||
藉此機會 借此机会
|
||||
藉甚 借甚
|
||||
藉由 借由
|
||||
藉着 借着
|
||||
藉端 借端
|
||||
藉端生事 借端生事
|
||||
藉箸代籌 借箸代筹
|
||||
藉草枕塊 借草枕块
|
||||
藉藉 藉藉
|
||||
藉藉无名 藉藉无名
|
||||
藉詞 借词
|
||||
藉讀 借读
|
||||
藉資 借资
|
||||
衹得 只得
|
||||
衹見樹木 只见树木
|
||||
衹見樹木不見森林 只见树木不见森林
|
||||
袖裏乾坤 袖里乾坤
|
||||
覆上 复上
|
||||
覆住 复住
|
||||
覆信 复信
|
||||
覆冒 复冒
|
||||
覆呈 复呈
|
||||
覆命 复命
|
||||
覆墓 复墓
|
||||
覆宗 复宗
|
||||
覆帳 复帐
|
||||
覆幬 复帱
|
||||
覆成 复成
|
||||
覆按 复按
|
||||
覆文 复文
|
||||
覆杯 复杯
|
||||
覆校 复校
|
||||
覆瓿 复瓿
|
||||
覆盂 复盂
|
||||
覆盆 覆盆
|
||||
覆盆子 覆盆子
|
||||
覆盤 覆盘
|
||||
覆育 复育
|
||||
覆蕉尋鹿 复蕉寻鹿
|
||||
覆逆 复逆
|
||||
覆醢 复醢
|
||||
覆醬瓿 复酱瓿
|
||||
覆電 复电
|
||||
覆露 复露
|
||||
覆鹿尋蕉 复鹿寻蕉
|
||||
覆鹿遺蕉 复鹿遗蕉
|
||||
覆鼎 复鼎
|
||||
見覆 见复
|
||||
角徵 角徵
|
||||
角徵羽 角徵羽
|
||||
計畫 计划
|
||||
變徵 变徵
|
||||
變徵之聲 变徵之声
|
||||
變徵之音 变徵之音
|
||||
貂覆額 貂复额
|
||||
買臣覆水 买臣复水
|
||||
踅門瞭戶 踅门了户
|
||||
躪藉 躏借
|
||||
郭子乾 郭子乾
|
||||
酒逢知己千鍾少 酒逢知己千锺少
|
||||
酒逢知己千鍾少話不投機半句多 酒逢知己千锺少话不投机半句多
|
||||
醞藉 酝借
|
||||
重覆 重复
|
||||
金吒 金吒
|
||||
金鍊 金链
|
||||
鈞覆 钧复
|
||||
鉅子 钜子
|
||||
鉅萬 钜万
|
||||
鉅防 钜防
|
||||
鉸鍊 铰链
|
||||
銀鍊 银链
|
||||
錢鍾書 钱锺书
|
||||
鍊墜 链坠
|
||||
鍊子 链子
|
||||
鍊形 链形
|
||||
鍊條 链条
|
||||
鍊錘 链锤
|
||||
鍊鎖 链锁
|
||||
鍛鍾 锻锺
|
||||
鍾繇 钟繇 锺繇
|
||||
鍾萬梅 锺万梅
|
||||
鍾重發 锺重发
|
||||
鍾鍛 锺锻
|
||||
鍾馗 锺馗
|
||||
鎖鍊 锁链
|
||||
鐵鍊 铁链
|
||||
鑽石項鍊 钻石项链
|
||||
雁杳魚沈 雁杳鱼沉
|
||||
雖覆能復 虽覆能复
|
||||
電覆 电复
|
||||
露覆 露复
|
||||
項鍊 项链
|
||||
頗覆 颇复
|
||||
頸鍊 颈链
|
||||
顛乾倒坤 颠乾倒坤
|
||||
顛倒乾坤 颠倒乾坤
|
||||
顧藉 顾借
|
||||
麼些族 麽些族
|
||||
黄鍾公 黄锺公
|
||||
龍鍾 龙钟 龙锺
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
// Package textconv provides the text conversion used by FAQ normalization.
|
||||
package textconv
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// These Apache-2.0 dictionaries are pinned to the previous converter's data.
|
||||
// See data/README.md for provenance and licenses/OpenCC-Apache-2.0.txt.
|
||||
//
|
||||
//go:embed data/TSPhrases.txt
|
||||
var phrasesText string
|
||||
|
||||
//go:embed data/TSCharacters.txt
|
||||
var charactersText string
|
||||
|
||||
var traditionalToSimplified = newConverter(phrasesText, charactersText)
|
||||
|
||||
type dictionary struct {
|
||||
values map[string]string
|
||||
maxRunes int
|
||||
}
|
||||
|
||||
type converter []dictionary
|
||||
|
||||
func newConverter(texts ...string) converter {
|
||||
result := make(converter, 0, len(texts))
|
||||
for _, text := range texts {
|
||||
d := dictionary{values: make(map[string]string)}
|
||||
for line := range strings.SplitSeq(text, "\n") {
|
||||
key, alternatives, ok := strings.Cut(strings.TrimSpace(line), "\t")
|
||||
values := strings.Fields(alternatives)
|
||||
if !ok || key == "" || len(values) == 0 {
|
||||
continue
|
||||
}
|
||||
d.values[key] = values[0]
|
||||
d.maxRunes = max(d.maxRunes, utf8.RuneCountInString(key))
|
||||
}
|
||||
result = append(result, d)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// ToSimplified preserves the historical FAQ conversion: phrase dictionary
|
||||
// before character dictionary, longest match within each, first alternative.
|
||||
// Dictionaries are read-only after initialization, so conversion is concurrent-safe.
|
||||
func ToSimplified(text string) string {
|
||||
return traditionalToSimplified.convert(text)
|
||||
}
|
||||
|
||||
func (c converter) convert(text string) string {
|
||||
runes := []rune(text)
|
||||
var result strings.Builder
|
||||
result.Grow(len(text))
|
||||
for pos := 0; pos < len(runes); {
|
||||
matched := false
|
||||
for _, d := range c {
|
||||
// The previous converter searched at most ten input runes.
|
||||
limit := min(10, d.maxRunes, len(runes)-pos)
|
||||
for size := limit; size > 0; size-- {
|
||||
if replacement, ok := d.values[string(runes[pos:pos+size])]; ok {
|
||||
result.WriteString(replacement)
|
||||
pos += size
|
||||
matched = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if matched {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !matched {
|
||||
result.WriteRune(runes[pos])
|
||||
pos++
|
||||
}
|
||||
}
|
||||
return result.String()
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package textconv
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestToSimplified(t *testing.T) {
|
||||
for _, tc := range []struct{ input, want string }{
|
||||
{"", ""},
|
||||
{"請聯繫客服,開發環境", "请联系客服,开发环境"},
|
||||
{"乾隆年間乾乾淨淨的頭髮", "乾隆年间干干净净的头发"},
|
||||
{"一目瞭然,不瞭解?", "一目了然,不了解?"},
|
||||
{"😀臺灣ABC𠮷\x00後", "😀台湾ABC𠮷\x00后"},
|
||||
} {
|
||||
t.Run(tc.input, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got := ToSimplified(tc.input); got != tc.want {
|
||||
t.Errorf("ToSimplified(%q) = %q, want %q", tc.input, got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Captured from longbridgeapp/opencc v0.3.13's t2s conversion before removing
|
||||
// that dependency. Every dictionary key is exercised alone, in context and
|
||||
// repeated. Changing this digest requires reviewing FAQ hash compatibility.
|
||||
func TestHistoricalConversionCorpus(t *testing.T) {
|
||||
h := sha256.New()
|
||||
count := 0
|
||||
check := func(input string) {
|
||||
if _, err := fmt.Fprintf(h, "%s\x00%s\x00", input, ToSimplified(input)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
count++
|
||||
}
|
||||
for _, data := range []string{phrasesText, charactersText} {
|
||||
for _, line := range strings.Split(strings.TrimSuffix(data, "\n"), "\n") {
|
||||
key, _, _ := strings.Cut(line, "\t")
|
||||
for _, input := range []string{key, "前" + key + "後", key + key} {
|
||||
check(input)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, input := range []string{"乾隆年間乾乾淨淨的頭髮", "一目瞭然,不瞭解?", "請聯繫客服,開發環境", "😀臺灣ABC𠮷\x00後", "乾坤大挪移", "著作權與軟體開發", ""} {
|
||||
check(input)
|
||||
}
|
||||
const want = "f3afa240ee7460932bbef67207d23302c5d9722b70c1f706ce071d2f35bfbcc0"
|
||||
if got := fmt.Sprintf("%x", h.Sum(nil)); got != want || count != 13177 {
|
||||
t.Fatalf("historical conversion changed: count=%d digest=%s, want 13177/%s", count, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDictionaryPrecedenceAndAlternatives(t *testing.T) {
|
||||
c := newConverter("甲乙\t首選 次選\n甲乙丙\t最長\n", "甲乙丙丁\t不應優先\n丁\t尾\n")
|
||||
if got := c.convert("甲乙丙丁甲乙"); got != "最長尾首選" {
|
||||
t.Fatalf("phrase precedence/longest match/first alternative changed: %q", got)
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/longbridgeapp/opencc"
|
||||
"github.com/Tencent/WeKnora/internal/textconv"
|
||||
)
|
||||
|
||||
// FAQChunkMetadata 定义 FAQ 条目在 Chunk.Metadata 中的结构
|
||||
|
|
@ -571,18 +571,6 @@ const (
|
|||
URLKeepDomainAndPath
|
||||
)
|
||||
|
||||
// t2sConverter 繁体转简体转换器(单例)
|
||||
var t2sConverter *opencc.OpenCC
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
t2sConverter, err = opencc.New("t2s") // Traditional to Simplified
|
||||
if err != nil {
|
||||
// 初始化失败时使用空转换器,不影响其他功能
|
||||
t2sConverter = nil
|
||||
}
|
||||
}
|
||||
|
||||
// NormalizeQuestion 对问题文本进行归一化处理以提高向量匹配命中率
|
||||
// 处理顺序参考: query = convert_st(trim_url(query.lower().strip().strip("?。,;、:""!?.,;!:'\"")), 1)
|
||||
// 1. 去除首尾空白
|
||||
|
|
@ -749,14 +737,7 @@ func parseURL(raw string) (domain, path string) {
|
|||
|
||||
// toSimplified 繁体中文转简体中文
|
||||
func toSimplified(s string) string {
|
||||
if t2sConverter == nil {
|
||||
return s
|
||||
}
|
||||
result, err := t2sConverter.Convert(s)
|
||||
if err != nil {
|
||||
return s
|
||||
}
|
||||
return result
|
||||
return textconv.ToSimplified(s)
|
||||
}
|
||||
|
||||
// toHalfWidth 将全角字符转换为半角字符
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-Present Lea Anthony
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,362 @@
|
|||
Mozilla Public License, version 2.0
|
||||
|
||||
1. Definitions
|
||||
|
||||
1.1. "Contributor"
|
||||
|
||||
means each individual or legal entity that creates, contributes to the
|
||||
creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
|
||||
means the combination of the Contributions of others (if any) used by a
|
||||
Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
|
||||
means Source Code Form to which the initial Contributor has attached the
|
||||
notice in Exhibit A, the Executable Form of such Source Code Form, and
|
||||
Modifications of such Source Code Form, in each case including portions
|
||||
thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
a. that the initial Contributor has attached the notice described in
|
||||
Exhibit B to the Covered Software; or
|
||||
|
||||
b. that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the terms of
|
||||
a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
|
||||
means a work that combines Covered Software with other material, in a
|
||||
separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
|
||||
means having the right to grant, to the maximum extent possible, whether
|
||||
at the time of the initial grant or subsequently, any and all of the
|
||||
rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
|
||||
means any of the following:
|
||||
|
||||
a. any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered Software; or
|
||||
|
||||
b. any new file in Source Code Form that contains any Covered Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the License,
|
||||
by the making, using, selling, offering for sale, having made, import,
|
||||
or transfer of either its Contributions or its Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
|
||||
means either the GNU General Public License, Version 2.0, the GNU Lesser
|
||||
General Public License, Version 2.1, the GNU Affero General Public
|
||||
License, Version 3.0, or any later versions of those licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that controls, is
|
||||
controlled by, or is under common control with You. For purposes of this
|
||||
definition, "control" means (a) the power, direct or indirect, to cause
|
||||
the direction or management of such entity, whether by contract or
|
||||
otherwise, or (b) ownership of more than fifty percent (50%) of the
|
||||
outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
|
||||
2. License Grants and Conditions
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
a. under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
b. under Patent Claims of such Contributor to make, use, sell, offer for
|
||||
sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
a. for any code that a Contributor has removed from Covered Software; or
|
||||
|
||||
b. for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
c. under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights to
|
||||
grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
|
||||
Section 2.1.
|
||||
|
||||
|
||||
3. Responsibilities
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
a. such Covered Software must also be made available in Source Code Form,
|
||||
as described in Section 3.1, and You must inform recipients of the
|
||||
Executable Form how they can obtain a copy of such Source Code Form by
|
||||
reasonable means in a timely manner, at a charge no more than the cost
|
||||
of distribution to the recipient; and
|
||||
|
||||
b. You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter the
|
||||
recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty, or
|
||||
limitations of liability) contained within the Source Code Form of the
|
||||
Covered Software, except that You may alter any license notices to the
|
||||
extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this License
|
||||
with respect to some or all of the Covered Software due to statute,
|
||||
judicial order, or regulation then You must: (a) comply with the terms of
|
||||
this License to the maximum extent possible; and (b) describe the
|
||||
limitations and the code they affect. Such description must be placed in a
|
||||
text file included with all distributions of the Covered Software under
|
||||
this License. Except to the extent prohibited by statute or regulation,
|
||||
such description must be sufficiently detailed for a recipient of ordinary
|
||||
skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically if You
|
||||
fail to comply with any of its terms. However, if You become compliant,
|
||||
then the rights granted under this License from a particular Contributor
|
||||
are reinstated (a) provisionally, unless and until such Contributor
|
||||
explicitly and finally terminates Your grants, and (b) on an ongoing
|
||||
basis, if such Contributor fails to notify You of the non-compliance by
|
||||
some reasonable means prior to 60 days after You have come back into
|
||||
compliance. Moreover, Your grants from a particular Contributor are
|
||||
reinstated on an ongoing basis if such Contributor notifies You of the
|
||||
non-compliance by some reasonable means, this is the first time You have
|
||||
received notice of non-compliance with this License from such
|
||||
Contributor, and You become compliant prior to 30 days after Your receipt
|
||||
of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
|
||||
license agreements (excluding distributors and resellers) which have been
|
||||
validly granted by You or Your distributors under this License prior to
|
||||
termination shall survive termination.
|
||||
|
||||
6. Disclaimer of Warranty
|
||||
|
||||
Covered Software is provided under this License on an "as is" basis,
|
||||
without warranty of any kind, either expressed, implied, or statutory,
|
||||
including, without limitation, warranties that the Covered Software is free
|
||||
of defects, merchantable, fit for a particular purpose or non-infringing.
|
||||
The entire risk as to the quality and performance of the Covered Software
|
||||
is with You. Should any Covered Software prove defective in any respect,
|
||||
You (not any Contributor) assume the cost of any necessary servicing,
|
||||
repair, or correction. This disclaimer of warranty constitutes an essential
|
||||
part of this License. No use of any Covered Software is authorized under
|
||||
this License except under this disclaimer.
|
||||
|
||||
7. Limitation of Liability
|
||||
|
||||
Under no circumstances and under no legal theory, whether tort (including
|
||||
negligence), contract, or otherwise, shall any Contributor, or anyone who
|
||||
distributes Covered Software as permitted above, be liable to You for any
|
||||
direct, indirect, special, incidental, or consequential damages of any
|
||||
character including, without limitation, damages for lost profits, loss of
|
||||
goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses, even if such party shall have been
|
||||
informed of the possibility of such damages. This limitation of liability
|
||||
shall not apply to liability for death or personal injury resulting from
|
||||
such party's negligence to the extent applicable law prohibits such
|
||||
limitation. Some jurisdictions do not allow the exclusion or limitation of
|
||||
incidental or consequential damages, so this exclusion and limitation may
|
||||
not apply to You.
|
||||
|
||||
8. Litigation
|
||||
|
||||
Any litigation relating to this License may be brought only in the courts
|
||||
of a jurisdiction where the defendant maintains its principal place of
|
||||
business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions. Nothing
|
||||
in this Section shall prevent a party's ability to bring cross-claims or
|
||||
counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides that
|
||||
the language of a contract shall be construed against the drafter shall not
|
||||
be used to construe this License against a Contributor.
|
||||
|
||||
|
||||
10. Versions of the License
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses If You choose to distribute Source Code Form that is
|
||||
Incompatible With Secondary Licenses under the terms of this version of
|
||||
the License, the notice described in Exhibit B of this License must be
|
||||
attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular file,
|
||||
then You may include the notice in a location (such as a LICENSE file in a
|
||||
relevant directory) where a recipient would be likely to look for such a
|
||||
notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
|
||||
This Source Code Form is "Incompatible
|
||||
With Secondary Licenses", as defined by
|
||||
the Mozilla Public License, v. 2.0.
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0ceab2ec73ef7d1291bd7663dd39203ee7037ee9dccb6fc3381ad819bd8550d1 go-m1cpu-v0.1.6.zip
|
||||
dc93f5770556406e82bf750a980d2316f882a19d883a3689eadb820708c2b651 mysql-v1.10.0.zip
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
license_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${license_root}"
|
||||
|
||||
# A retained build-graph dependency would bring the GPL converter back even if
|
||||
# application code no longer imported it directly.
|
||||
if grep -Eq 'github.com/(longbridgeapp/opencc|liuzl/(da|cedar-go)|adamzy/cedar-go)([[:space:]]|$)' go.mod go.sum; then
|
||||
echo "Removed conversion dependencies have reappeared in go.mod/go.sum" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for module_pin in 'github.com/go-sql-driver/mysql v1.10.0' 'github.com/shoenig/go-m1cpu v0.1.6'; do
|
||||
read -r module_name module_version <<< "${module_pin}"
|
||||
actual_version="$(awk -v name="${module_name}" '$1 == name { print $2 }' go.mod)"
|
||||
if [ "${actual_version}" != "${module_version}" ]; then
|
||||
echo "Update the license/source bundle for ${module_name}: expected ${module_version}, got ${actual_version}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for file in LICENSE THIRD_PARTY_NOTICES.md licenses/OpenCC-Apache-2.0.txt \
|
||||
licenses/go-sql-driver-mysql-MPL-2.0.txt licenses/go-m1cpu-MPL-2.0.txt \
|
||||
licenses/Wails-MIT.txt; do
|
||||
test -s "${file}"
|
||||
done
|
||||
|
||||
cd licenses/sources
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
sha256sum -c SHA256SUMS
|
||||
else
|
||||
shasum -a 256 -c SHA256SUMS
|
||||
fi
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Include this directory unchanged alongside every backend/desktop distribution.
|
||||
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
|
||||
echo "Usage: $0 DESTINATION_DIRECTORY" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
license_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
license_dest="$1"
|
||||
bash "${license_root}/scripts/check-license-bundle.sh"
|
||||
mkdir -p "${license_dest}/licenses"
|
||||
cp "${license_root}/LICENSE" "${license_root}/THIRD_PARTY_NOTICES.md" "${license_dest}/"
|
||||
cp -R "${license_root}/licenses/." "${license_dest}/licenses/"
|
||||
|
|
@ -68,6 +68,7 @@ rm -rf "${DIST_DIR}"
|
|||
mkdir -p "${DIST_DIR}/web"
|
||||
|
||||
cp WeKnora-lite "${DIST_DIR}/"
|
||||
bash ./scripts/copy-licenses.sh "${DIST_DIR}"
|
||||
if [ -d web ] && [ -f web/index.html ]; then
|
||||
cp -r web/* "${DIST_DIR}/web/"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ cp -R "cmd/desktop/build/bin/${APP_BUNDLE}" "dist/"
|
|||
RESOURCES_DIR="${DIST_DIR}/Contents/Resources"
|
||||
mkdir -p "${RESOURCES_DIR}/config"
|
||||
mkdir -p "${RESOURCES_DIR}/migrations/sqlite"
|
||||
bash ./scripts/copy-licenses.sh "${RESOURCES_DIR}"
|
||||
|
||||
if [ -f .env.lite.example ]; then
|
||||
cp .env.lite.example "${RESOURCES_DIR}/.env"
|
||||
|
|
|
|||
Loading…
Reference in New Issue