fix(license): 移除会泄露 .lic 内容的「期望授权串」;关于页改为授权指南 + 官网 sincos.cc 入口
- 安全修复:关于页不再显示期望授权串(等同 .lic,公开即可绕过授权) - 去掉「提交授权申请」邮件按钮(邮件体验差),改为「授权指南」步骤说明 - 关于页新增官网 web 图标,点击导航到 https://sincos.cc - 移除 LicenseService.submitApplication;重新构建 dist
This commit is contained in:
@@ -129,30 +129,4 @@ class LicenseService {
|
||||
return String.fromCharCodes(fwd.codeUnits.reversed);
|
||||
}
|
||||
|
||||
/// 提交授权申请:通过网络(默认邮件客户端)把 MAC 与发件人信息发送到指定邮箱。
|
||||
///
|
||||
/// 返回 true 表示已成功唤起邮件客户端。
|
||||
Future<bool> submitApplication({required String sender, String? note}) async {
|
||||
const String to = 'liuyu65@126.com';
|
||||
final String mac = _info.mac ?? '(读取失败)';
|
||||
final String subject = Uri.encodeComponent('时序图设计器 V1.1.1 授权申请');
|
||||
final String body = Uri.encodeComponent(
|
||||
'MAC 地址:$mac\n'
|
||||
'发件人信息:$sender\n'
|
||||
'备注:${note ?? '(无)'}\n'
|
||||
'软件版本:V1.1.1\n',
|
||||
);
|
||||
final String url = 'mailto:$to?subject=$subject&body=$body';
|
||||
try {
|
||||
await Process.run('rundll32', <String>['url.dll,FileProtocolHandler', url]);
|
||||
return true;
|
||||
} catch (_) {
|
||||
try {
|
||||
await Process.run('cmd', <String>['/c', 'start', '', url], runInShell: true);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+59
-55
@@ -1671,7 +1671,18 @@ class HelpDialog extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 「关于」页:软件信息 + 授权状态 + 本机 MAC + 提交授权申请。
|
||||
/// 用系统默认程序打开网址(官网导航)。
|
||||
Future<void> _openUrl(String url) async {
|
||||
try {
|
||||
await Process.run('rundll32', <String>['url.dll,FileProtocolHandler', url]);
|
||||
} catch (_) {
|
||||
try {
|
||||
await Process.run('cmd', <String>['/c', 'start', '', url], runInShell: true);
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
/// 「关于」页:软件信息 + 授权状态 + 本机 MAC + 授权指南 + 官网入口。
|
||||
Widget _about(BuildContext context, Tokens t) {
|
||||
final LicenseInfo info = LicenseService.instance.info;
|
||||
final String lic = info.valid
|
||||
@@ -1692,6 +1703,8 @@ class HelpDialog extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
Widget guideLine(String s) =>
|
||||
Text(s, style: TextStyle(color: t.sub, fontSize: 11.5, height: 1.7));
|
||||
return ListView(
|
||||
padding: const EdgeInsets.only(top: 14),
|
||||
children: <Widget>[
|
||||
@@ -1699,68 +1712,59 @@ class HelpDialog extends StatelessWidget {
|
||||
row('设计人', '呆头鹅'),
|
||||
row('版本', 'V1.1.1'),
|
||||
row('授权状态', lic, vc: info.valid ? t.ok : t.danger),
|
||||
// 注意:绝不能展示「期望授权串」——它等同于 .lic 内容,公开即可被绕过授权。
|
||||
row('本机 MAC', info.mac ?? '读取失败'),
|
||||
row('授权申请邮箱', 'liuyu65@126.com'),
|
||||
if (!info.valid) row('期望授权串', info.expected ?? '(无法获取 MAC)'),
|
||||
row('版权声明', 'Copyright © 2026 呆头鹅。保留所有权利。'),
|
||||
row('用途', '面向 PLC 流程节拍 / 相位角设计;未经许可不得用于商业再分发。'),
|
||||
const SizedBox(height: 4),
|
||||
if (!info.valid)
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FilledButton.icon(
|
||||
onPressed: () => _submitApplication(context),
|
||||
icon: const Icon(Icons.outgoing_mail, size: 16),
|
||||
label: const Text('提交授权申请(发送 MAC 到 liuyu65@126.com)'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'申请授权:请把上方的「本机 MAC」发送到邮箱 liuyu65@126.com 申请授权;'
|
||||
'收到 .lic 文件后放入软件目录下的 license 文件夹,重启软件即可导出 SVG / PNG。',
|
||||
style: TextStyle(color: t.dim, fontSize: 11.5, height: 1.6),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 弹出「提交授权申请」对话框,收集发件人信息后唤起系统邮件客户端。
|
||||
Future<void> _submitApplication(BuildContext context) async {
|
||||
final TextEditingController ctrl = TextEditingController();
|
||||
final String? sender = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext ctx) => AlertDialog(
|
||||
title: const Text('提交授权申请'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
const SizedBox(height: 6),
|
||||
// 官网入口(点击图标导航到 sincos.cc)。
|
||||
Row(
|
||||
children: <Widget>[
|
||||
const Text('将把本机 MAC 地址与以下发件人信息发送到 liuyu65@126.com:'),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
controller: ctrl,
|
||||
autofocus: true,
|
||||
decoration: const InputDecoration(labelText: '发件人信息(单位 / 姓名 / 联系方式)'),
|
||||
InkWell(
|
||||
onTap: () => _openUrl('https://sincos.cc'),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Icon(Icons.public, size: 20, color: t.accent),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text('官网:', style: TextStyle(color: t.dim, fontSize: 12)),
|
||||
InkWell(
|
||||
onTap: () => _openUrl('https://sincos.cc'),
|
||||
child: Text('sincos.cc',
|
||||
style: TextStyle(color: t.accent, fontSize: 12.5, decoration: TextDecoration.underline)),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('取消')),
|
||||
FilledButton(onPressed: () => Navigator.pop(ctx, ctrl.text.trim()), child: const Text('发送')),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// 授权指南(替代原来的邮件申请按钮)。
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: t.info,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: t.line),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Icon(Icons.menu_book_outlined, size: 16, color: t.accent),
|
||||
const SizedBox(width: 6),
|
||||
Text('授权指南', style: TextStyle(color: t.accent, fontSize: 12.5, fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
guideLine('1. 复制上方「本机 MAC」。'),
|
||||
guideLine('2. 访问官网 sincos.cc,或把 MAC 发送到邮箱 liuyu65@126.com 申请授权。'),
|
||||
guideLine('3. 收到 .lic 文件后,放入软件目录下的 license 文件夹,重启软件即可导出 SVG / PNG。'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
ctrl.dispose();
|
||||
if (sender == null) return;
|
||||
final bool ok = await LicenseService.instance
|
||||
.submitApplication(sender: sender.isEmpty ? '(未填写)' : sender);
|
||||
if (context.mounted) {
|
||||
await showMessage(
|
||||
context,
|
||||
ok ? '已发起申请' : '发送失败',
|
||||
ok ? '已调用系统邮件客户端,请确认后发送到 liuyu65@126.com。' : '无法唤起邮件客户端,请手动将 MAC 发送到 liuyu65@126.com。',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 渲染帮助中的一个条目列表,每行左侧为标题、右侧为说明。
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"format-version":[1,0,0],"native-assets":{}}
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"format-version":[1,0,0],"native-assets":{}}
|
||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 and Windows 11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user