diff --git a/src/SopHelper.Avalonia/VVMs/MainWindow/LicenseWindow.cs b/src/SopHelper.Avalonia/VVMs/MainWindow/LicenseWindow.cs index 72c1a47..92eb070 100644 --- a/src/SopHelper.Avalonia/VVMs/MainWindow/LicenseWindow.cs +++ b/src/SopHelper.Avalonia/VVMs/MainWindow/LicenseWindow.cs @@ -20,9 +20,10 @@ public sealed class LicenseWindow : Window var panel = new StackPanel { Margin = new Thickness(24), Spacing = 12 }; panel.Children.Add(new TextBlock { Text = "试用与授权", FontSize = 22 }); var status = new TextBlock { Name = "LicenseStatus", TextWrapping = TextWrapping.Wrap, - Text = service?.Check().Message ?? "无法读取磁盘硬件信息:" + initializationError + "。请排除问题后重启软件。" }; + Text = service?.Check().Message ?? "无法读取本机授权信息:" + initializationError + "。请排除问题后重启软件。" }; panel.Children.Add(status); - panel.Children.Add(new TextBlock { Text = "本机磁盘机器码(请提供给软件发行方)" }); + // 界面只显示“本机机器码”,不说明取自哪类硬件,避免用户把实现细节当提示语对外转述。 + panel.Children.Add(new TextBlock { Text = "本机机器码(请提供给软件发行方)" }); var machine = new TextBox { Name = "LicenseMachineCode", Text = service?.Machine ?? "无法获取", IsReadOnly = true }; panel.Children.Add(machine); var copy = new Button { Content = "复制机器码", IsEnabled = service is not null }; @@ -32,7 +33,7 @@ public sealed class LicenseWindow : Window catch (Exception error) { status.Text = "复制失败,请手动选择机器码复制:" + error.Message; } }; panel.Children.Add(copy); - panel.Children.Add(new TextBlock { Text = "短期码延长一个自然月;长期码永久有效。授权仅限本机磁盘硬件。", TextWrapping = TextWrapping.Wrap }); + panel.Children.Add(new TextBlock { Text = "短期码延长一个自然月;长期码永久有效。", TextWrapping = TextWrapping.Wrap }); var code = new TextBox { Name = "LicenseCodeInput", PlaceholderText = "粘贴完整授权码", AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Height = 110 }; panel.Children.Add(code); diff --git a/src/SopHelper.CrossPlatform.Engine/Licensing/LicenseService.cs b/src/SopHelper.CrossPlatform.Engine/Licensing/LicenseService.cs index 15949b7..92c4490 100644 --- a/src/SopHelper.CrossPlatform.Engine/Licensing/LicenseService.cs +++ b/src/SopHelper.CrossPlatform.Engine/Licensing/LicenseService.cs @@ -85,7 +85,8 @@ public sealed class LicenseService using var lease = AcquireLease(); var grant = Verify(code); var now = _clock(); - if (grant.Machine != Machine) throw new InvalidOperationException("授权码与本机硬件不匹配。"); + // 面向用户只说“本机”,不暴露机器码取自哪类硬件;排障时按机器码字符串比对即可定位。 + if (grant.Machine != Machine) throw new InvalidOperationException("授权码与本机不匹配,请核对机器码后重新获取授权码。"); if (grant.IssuedUtc > now.AddMinutes(5)) throw new InvalidOperationException("授权码签发时间晚于系统时间,请校准时间。"); var state = Load(now); if (!state.Permanent && now < state.LastUtc.AddMinutes(-5)) @@ -132,7 +133,7 @@ public sealed class LicenseService // 只有该历史机器码能由本机硬件重新算出时才认这条记录,并把字段改写为当前机器码; // 复制他机记录或因更换硬件得到的历史码都算不出来,继续拒绝,禁止借升级重置试用或续期。 if (!_legacyMachines.Value.Contains(state.Machine)) - throw new InvalidDataException("硬件已更换或授权记录来自其他电脑,请联系发行方。"); + throw new InvalidDataException("授权记录与本机不匹配,请联系发行方。"); state = state with { Machine = Machine }; } if (state.StartedUtc == default || state.LastUtc < state.StartedUtc || state.ExpiresUtc <= state.StartedUtc @@ -159,8 +160,9 @@ public sealed class LicenseService { public void Dispose() { mutex.ReleaseMutex(); mutex.Dispose(); } } + // 界面文案只说用户需要知道的结果,不展示硬件绑定等内部实现细节;绑定方式仅由排障工具输出。 private static LicenseStatus Describe(State state, DateTimeOffset now) => state.Permanent - ? new(true, true, null, "永久授权(已绑定本机磁盘硬件)") + ? new(true, true, null, "永久授权") : new(now < state.ExpiresUtc, false, state.ExpiresUtc, $"{(state.UsedIds.Count == 0 ? "试用" : "短期授权")}{(now < state.ExpiresUtc ? "有效至" : "已到期于")} {state.ExpiresUtc.ToLocalTime():yyyy-MM-dd HH:mm},{(now < state.ExpiresUtc ? "可输入授权码续期" : "请输入授权码后继续使用")}。");