Add license check for compiling
This commit is contained in:
parent
175212c1f8
commit
f4943b8eee
18
WeChatFerry/DISCLAIMER.md
Normal file
18
WeChatFerry/DISCLAIMER.md
Normal file
@ -0,0 +1,18 @@
|
||||
# 免责声明
|
||||
|
||||
1. **本工具为开源项目,仅提供基础功能,供用户进行合法的学习、研究和非商业用途**。禁止将本工具用于任何违法或侵权行为。
|
||||
|
||||
2. **二次开发者的责任**:
|
||||
- 任何基于本工具进行的二次开发、修改或衍生产品,其行为及后果由二次开发者独立承担,与本工具贡献者无关。
|
||||
- **禁止使用贡献者的姓名、项目名称或相关信息作为二次开发产品的背书或推广手段**。
|
||||
- 建议二次开发者在其衍生产品中添加自己的免责声明,明确责任归属。
|
||||
|
||||
3. **用户责任**:
|
||||
- 使用本工具或其衍生产品的所有后果由用户自行承担。原贡献者不对因直接或间接使用本工具而导致的任何损失、责任或争议负责。
|
||||
|
||||
4. **法律约束**:
|
||||
- 用户和二次开发者须遵守《中华人民共和国网络安全法》、《中华人民共和国著作权法》等相关法律法规。
|
||||
- 本工具涉及的所有第三方商标或产品名称,其权利归权利人所有,作者与第三方无任何直接或间接关联。
|
||||
|
||||
5. **作者保留权利**:
|
||||
- 本工具作者保留随时修改、更新、删除或终止本工具的权利,无需事先通知或承担任何义务。
|
44
WeChatFerry/license_check.bat
Normal file
44
WeChatFerry/license_check.bat
Normal file
@ -0,0 +1,44 @@
|
||||
@echo off
|
||||
chcp 65001 > nul
|
||||
cd /d %~dp0
|
||||
|
||||
if "%CI%" == "true" (
|
||||
echo 自动化编译环境,跳过手动确认。
|
||||
echo 用户已接受开源协议 > license_accepted.flag
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
:: 检查是否已接受协议
|
||||
if exist ".license_accepted.flag" (
|
||||
echo 用户已接受免责声明
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
:: 检查免责声明文件是否存在
|
||||
if not exist "DISCLAIMER.md" (
|
||||
echo 错误:未找到免责声明文件 DISCLAIMER.md。
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 生成临时文件并读取免责声明
|
||||
type "DISCLAIMER.md" > temp_disclaimer.txt
|
||||
|
||||
:: 使用 PowerShell 显示弹窗
|
||||
powershell -NoProfile -Command ^
|
||||
"$text = Get-Content -Raw -Path 'temp_disclaimer.txt';" ^
|
||||
"Add-Type -AssemblyName PresentationFramework;" ^
|
||||
"$result = [System.Windows.MessageBox]::Show($text, '免责声明', 'OKCancel', 'Warning');" ^
|
||||
"if ($result -ne 'OK') { exit 1 }"
|
||||
|
||||
:: 检查 PowerShell 执行结果
|
||||
if %errorlevel% neq 0 (
|
||||
echo 错误:用户未接受免责声明。停止生成。
|
||||
del temp_disclaimer.txt
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 用户接受免责声明,创建标志文件
|
||||
echo 用户已接受免责声明 > .license_accepted.flag
|
||||
del temp_disclaimer.txt
|
||||
echo 用户已接受免责声明
|
||||
exit /b 0
|
@ -112,7 +112,9 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
<Command>call "$(SolutionDir)license_check.bat"
|
||||
if errorlevel 1 exit 1
|
||||
cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
@ -161,7 +163,9 @@ xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferry</Com
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
<Command>call "$(SolutionDir)license_check.bat"
|
||||
if errorlevel 1 exit 1
|
||||
cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
@ -211,7 +215,9 @@ xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferry</Com
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Message>Generating PB files</Message>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
<Command>call "$(SolutionDir)license_check.bat"
|
||||
if errorlevel 1 exit 1
|
||||
cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
|
Loading…
Reference in New Issue
Block a user