Skip to content

Commit ed2beb4

Browse files
committed
feat: allow firewall rule for any network profile
1 parent b92eb6c commit ed2beb4

5 files changed

Lines changed: 5 additions & 6 deletions

File tree

lib/EasyInk.Net/EasyInk.Printer/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ build-installer.bat 1.2.3-beta.1
171171

172172
- Windows 7 SP1 及以上。
173173
- .NET Framework 4.8 运行时。
174-
- 局域网访问依赖 Windows 防火墙入站规则。安装器会为默认端口 `18080` 添加 `EasyInk Printer HTTP 18080` 规则;若运行时改端口,应用会提示管理员授权并为新端口添加专用/域网络入站规则。
175-
- Windows 网络类型需要为专用网络或域网络;若当前网络是公用网络,Windows 仍可能拦截局域网入站访问。
174+
- 局域网访问依赖 Windows 防火墙入站规则。安装器会为默认端口 `18080` 添加 `EasyInk Printer HTTP 18080` 规则;若运行时改端口,应用会提示管理员授权并为新端口添加覆盖专用、域和公用网络的入站规则,以适配门店、仓库、收银机等网络常被 Windows 识别为公用网络的场景。
176175
- 发布目录保留 `x86\SQLite.Interop.dll``x64\SQLite.Interop.dll`
177176
- 若启用 SumatraPDF fallback,发布目录保留 `SumatraPDF\SumatraPDF.exe`

lib/EasyInk.Net/EasyInk.Printer/installer.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType:
4444

4545
[Run]
4646
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall delete rule name=""EasyInk Printer HTTP 18080"""; Flags: runhidden
47-
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall add rule name=""EasyInk Printer HTTP 18080"" dir=in action=allow protocol=TCP localport=18080 profile=private,domain"; Flags: runhidden
47+
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall add rule name=""EasyInk Printer HTTP 18080"" dir=in action=allow protocol=TCP localport=18080 profile=any"; Flags: runhidden
4848
Filename: "{app}\EasyInk.Printer.exe"; Description: "Launch EasyInk Printer"; Flags: nowait postinstall skipifsilent
4949

5050
[UninstallRun]

lib/EasyInk.Net/EasyInk.Printer/src/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ private static CommandResult EnsureFirewallRule(int port)
595595
{
596596
var ruleName = GetFirewallRuleName(port);
597597
RunNetsh($"advfirewall firewall delete rule name=\"{ruleName}\"");
598-
return RunNetsh($"advfirewall firewall add rule name=\"{ruleName}\" dir=in action=allow protocol=TCP localport={port} profile=private,domain");
598+
return RunNetsh($"advfirewall firewall add rule name=\"{ruleName}\" dir=in action=allow protocol=TCP localport={port} profile=any");
599599
}
600600

601601
private static string BuildCommandFailureMessage(params CommandResult[] results)

lib/EasyInk.Net/EasyInk.Printer/src/Resources/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"App_NeedUrlAcl_Message": "EasyInk Printer requires network listening permission to start the HTTP service, and a Windows Firewall inbound rule to support LAN access.\n\nThis operation only needs to be performed once and requires administrator authorization.\nThe application will restart automatically after registration.",
88
"App_NeedUrlAcl_Title": "Network Permission Required",
9-
"App_NeedFirewall_Message": "The EasyInk Printer HTTP service has started, but Windows Firewall does not have an inbound rule for port {0}.\n\nTo allow LAN devices to access the print service through this computer's IP address, allow the application to add a Private/Domain network inbound rule. Administrator authorization is required, and the application will restart automatically after registration.\n\nIf the current Windows network type is Public, switch it to Private first.",
9+
"App_NeedFirewall_Message": "The EasyInk Printer HTTP service has started, but Windows Firewall does not have an inbound rule for port {0}.\n\nTo allow LAN devices to access the print service through this computer's IP address, allow the application to add an inbound rule. This rule covers Private, Domain, and Public networks to support retail, warehouse, and POS environments where Windows may classify the LAN as Public. Administrator authorization is required, and the application will restart automatically after registration.",
1010
"App_NeedFirewall_Title": "LAN Access Permission Required",
1111

1212
"App_CloseConfirm_Message": "Closing the window will stop the print service and interrupt submitted print jobs.\nAre you sure you want to exit?",

lib/EasyInk.Net/EasyInk.Printer/src/Resources/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"App_NeedUrlAcl_Message": "EasyInk Printer 需要注册网络监听权限才能启动 HTTP 服务,并添加 Windows 防火墙入站规则以支持局域网访问。\n\n此操作仅需执行一次,需要管理员授权。\n注册完成后应用将自动重启。",
88
"App_NeedUrlAcl_Title": "需要注册网络权限",
9-
"App_NeedFirewall_Message": "EasyInk Printer HTTP 服务已启动,但尚未添加端口 {0} 的 Windows 防火墙入站规则。\n\n若需要局域网设备通过本机 IP 访问打印服务,请允许应用添加专用/域网络入站规则。此操作需要管理员授权,完成后应用将自动重启。\n\n如果当前 Windows 网络类型是公用网络,请先切换为专用网络",
9+
"App_NeedFirewall_Message": "EasyInk Printer HTTP 服务已启动,但尚未添加端口 {0} 的 Windows 防火墙入站规则。\n\n若需要局域网设备通过本机 IP 访问打印服务,请允许应用添加入站规则。此规则会覆盖专用、域和公用网络,以适配门店、仓库、收银机等 Windows 网络类型可能被识别为公用网络的场景。此操作需要管理员授权,完成后应用将自动重启",
1010
"App_NeedFirewall_Title": "需要放行局域网访问",
1111

1212
"App_CloseConfirm_Message": "关闭窗口后打印服务将停止运行,已提交的打印任务会中断。\n确定要退出吗?",

0 commit comments

Comments
 (0)