Add editable portal page content

This commit is contained in:
2026-08-27 10:32:08 +08:00
parent 04a6027e1d
commit 7b009a3ddc
7 changed files with 300 additions and 22 deletions
+33 -1
View File
@@ -32,6 +32,7 @@ public sealed class MainForm : Form
private Button _btnImport = null!; private Button _btnImport = null!;
private Button _btnRefreshStatus = null!; private Button _btnRefreshStatus = null!;
private Button _btnSavePortal = null!; private Button _btnSavePortal = null!;
private Button _btnEditPortalContent = null!;
private string? _selectedDomain; private string? _selectedDomain;
private bool _closingBackupCreated; private bool _closingBackupCreated;
@@ -133,6 +134,8 @@ public sealed class MainForm : Form
_btnRefreshStatus.Click += (s, e) => RefreshStatus(); _btnRefreshStatus.Click += (s, e) => RefreshStatus();
_btnSavePortal = CreateButton("保存入口设置", 96); _btnSavePortal = CreateButton("保存入口设置", 96);
_btnSavePortal.Click += async (s, e) => await SavePortalSettingsAsync(); _btnSavePortal.Click += async (s, e) => await SavePortalSettingsAsync();
_btnEditPortalContent = CreateButton("主页内容", 96);
_btnEditPortalContent.Click += (s, e) => EditPortalContent();
panel.Controls.Add(CreateLabel("配置文件"), 0, 0); panel.Controls.Add(CreateLabel("配置文件"), 0, 0);
panel.Controls.Add(_txtConfigPath, 1, 0); panel.Controls.Add(_txtConfigPath, 1, 0);
@@ -153,7 +156,7 @@ public sealed class MainForm : Form
panel.Controls.Add(_lblStatus, 1, 3); panel.Controls.Add(_lblStatus, 1, 3);
panel.SetColumnSpan(_lblStatus, 2); panel.SetColumnSpan(_lblStatus, 2);
panel.Controls.Add(_btnRefreshStatus, 3, 3); panel.Controls.Add(_btnRefreshStatus, 3, 3);
panel.SetColumnSpan(_btnRefreshStatus, 2); panel.Controls.Add(_btnEditPortalContent, 4, 3);
return panel; return panel;
} }
@@ -467,6 +470,32 @@ public sealed class MainForm : Form
} }
} }
private void EditPortalContent()
{
using var dialog = new PortalContentDialog(_manager.PortalContent);
if (dialog.ShowDialog(this) != DialogResult.OK)
{
return;
}
try
{
_manager.UpdatePortalContent(
dialog.SiteName,
dialog.Headline,
dialog.Introduction);
MessageBox.Show(
"主页内容已保存并生成。刷新浏览器即可看到新内容。",
"NginxMan",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "NginxMan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void RefreshStatus() private void RefreshStatus()
{ {
if (!HasConfiguredNginxExe()) if (!HasConfiguredNginxExe())
@@ -481,6 +510,7 @@ public sealed class MainForm : Form
_btnStop.Enabled = false; _btnStop.Enabled = false;
_btnBackup.Enabled = true; _btnBackup.Enabled = true;
_btnImport.Enabled = true; _btnImport.Enabled = true;
_btnEditPortalContent.Enabled = true;
return; return;
} }
@@ -495,6 +525,7 @@ public sealed class MainForm : Form
_btnStop.Enabled = isRunning; _btnStop.Enabled = isRunning;
_btnBackup.Enabled = true; _btnBackup.Enabled = true;
_btnImport.Enabled = true; _btnImport.Enabled = true;
_btnEditPortalContent.Enabled = true;
} }
private async Task RunNginxAsync(string actionName, Func<int> action, bool expectedRunning) private async Task RunNginxAsync(string actionName, Func<int> action, bool expectedRunning)
@@ -546,6 +577,7 @@ public sealed class MainForm : Form
_btnStop.Enabled = enabled; _btnStop.Enabled = enabled;
_btnBackup.Enabled = enabled; _btnBackup.Enabled = enabled;
_btnImport.Enabled = enabled; _btnImport.Enabled = enabled;
_btnEditPortalContent.Enabled = enabled;
_btnRefreshStatus.Enabled = enabled; _btnRefreshStatus.Enabled = enabled;
} }
+61 -1
View File
@@ -53,6 +53,11 @@ public sealed class NginxManager
public int PortalListenPort => _config.PortalListenPort; public int PortalListenPort => _config.PortalListenPort;
public PortalContentSettings PortalContent => new(
_config.PortalSiteName,
_config.PortalHeadline,
_config.PortalIntroduction);
public string NginxExePath public string NginxExePath
{ {
get => _config.NginxExePath; get => _config.NginxExePath;
@@ -83,6 +88,14 @@ public sealed class NginxManager
SaveConfig(); SaveConfig();
} }
public void UpdatePortalContent(string siteName, string headline, string introduction)
{
_config.PortalSiteName = NormalizeLimitedText(siteName, "入口页名称", 80);
_config.PortalHeadline = NormalizeLimitedText(headline, "主页标题", 120);
_config.PortalIntroduction = NormalizeLimitedText(introduction, "主页简介", 500);
SaveConfig();
}
public void AddOrUpdateRoute( public void AddOrUpdateRoute(
string domain, string domain,
string upstream, string upstream,
@@ -218,7 +231,7 @@ public sealed class NginxManager
public void SaveConfig() public void SaveConfig()
{ {
File.WriteAllText(_configPath, JsonSerializer.Serialize(_config, JsonOptions), Encoding.UTF8); File.WriteAllText(_configPath, JsonSerializer.Serialize(_config, JsonOptions), Encoding.UTF8);
WebPortal.RenderTo(_dataDirectory, _config.Routes); WebPortal.RenderTo(_dataDirectory, PortalContent, _config.Routes);
} }
public string CreateBackup(string destinationPath) public string CreateBackup(string destinationPath)
@@ -367,6 +380,7 @@ public sealed class NginxManager
} }
NormalizeDataPaths(config); NormalizeDataPaths(config);
NormalizePortalContent(config);
NormalizeRouteMetadata(config.Routes); NormalizeRouteMetadata(config.Routes);
return config; return config;
@@ -486,6 +500,10 @@ public sealed class NginxManager
config.ErrorLogPath = NormalizePathSetting(config.ErrorLogPath, defaults.ErrorLogPath); config.ErrorLogPath = NormalizePathSetting(config.ErrorLogPath, defaults.ErrorLogPath);
config.PortalDomain = NormalizeOptionalDomain(config.PortalDomain ?? string.Empty); config.PortalDomain = NormalizeOptionalDomain(config.PortalDomain ?? string.Empty);
config.PortalListenPort = NormalizePort(config.PortalListenPort, "入口页监听端口"); config.PortalListenPort = NormalizePort(config.PortalListenPort, "入口页监听端口");
NormalizePortalContent(config);
config.PortalSiteName = NormalizeLimitedText(config.PortalSiteName, "入口页名称", 80);
config.PortalHeadline = NormalizeLimitedText(config.PortalHeadline, "主页标题", 120);
config.PortalIntroduction = NormalizeLimitedText(config.PortalIntroduction, "主页简介", 500);
config.Routes ??= []; config.Routes ??= [];
NormalizeDataPaths(config); NormalizeDataPaths(config);
NormalizeRouteMetadata(config.Routes); NormalizeRouteMetadata(config.Routes);
@@ -624,6 +642,9 @@ public sealed class NginxManager
ErrorLogPath = Path.Combine("data", "logs", "error.log"), ErrorLogPath = Path.Combine("data", "logs", "error.log"),
PortalDomain = string.Empty, PortalDomain = string.Empty,
PortalListenPort = 80, PortalListenPort = 80,
PortalSiteName = PortalContentSettings.DefaultSiteName,
PortalHeadline = PortalContentSettings.DefaultHeadline,
PortalIntroduction = PortalContentSettings.DefaultIntroduction,
Routes = [] Routes = []
}; };
@@ -682,6 +703,19 @@ public sealed class NginxManager
} }
} }
private static void NormalizePortalContent(NginxManagerConfig config)
{
config.PortalSiteName = string.IsNullOrWhiteSpace(config.PortalSiteName)
? PortalContentSettings.DefaultSiteName
: config.PortalSiteName.Trim();
config.PortalHeadline = string.IsNullOrWhiteSpace(config.PortalHeadline)
? PortalContentSettings.DefaultHeadline
: config.PortalHeadline.Trim();
config.PortalIntroduction = string.IsNullOrWhiteSpace(config.PortalIntroduction)
? PortalContentSettings.DefaultIntroduction
: config.PortalIntroduction.Trim();
}
private static bool IsLegacyPath(string path, string expectedPath) => private static bool IsLegacyPath(string path, string expectedPath) =>
string.Equals( string.Equals(
path.Replace('/', '\\'), path.Replace('/', '\\'),
@@ -782,6 +816,17 @@ public sealed class NginxManager
return value.Trim(); return value.Trim();
} }
private static string NormalizeLimitedText(string value, string fieldName, int maximumLength)
{
var normalized = NormalizeRequiredText(value, fieldName);
if (normalized.Length > maximumLength)
{
throw new ArgumentException($"{fieldName}不能超过 {maximumLength} 个字符。");
}
return normalized;
}
} }
public sealed record BackupImportResult( public sealed record BackupImportResult(
@@ -800,9 +845,24 @@ public sealed class NginxManagerConfig
public string ErrorLogPath { get; set; } = Path.Combine("logs", "error.log"); public string ErrorLogPath { get; set; } = Path.Combine("logs", "error.log");
public string PortalDomain { get; set; } = string.Empty; public string PortalDomain { get; set; } = string.Empty;
public int PortalListenPort { get; set; } = 80; public int PortalListenPort { get; set; } = 80;
public string PortalSiteName { get; set; } = PortalContentSettings.DefaultSiteName;
public string PortalHeadline { get; set; } = PortalContentSettings.DefaultHeadline;
public string PortalIntroduction { get; set; } = PortalContentSettings.DefaultIntroduction;
public List<RouteEntry> Routes { get; set; } = []; public List<RouteEntry> Routes { get; set; } = [];
} }
public sealed record PortalContentSettings(string SiteName, string Headline, string Introduction)
{
public const string DefaultSiteName = "服务导航";
public const string DefaultHeadline = "欢迎访问统一服务入口";
public const string DefaultIntroduction = "请选择下方网站或服务,点击卡片即可开始访问。";
public static PortalContentSettings Default { get; } = new(
DefaultSiteName,
DefaultHeadline,
DefaultIntroduction);
}
public sealed class RouteEntry public sealed class RouteEntry
{ {
public string Domain { get; set; } = string.Empty; public string Domain { get; set; } = string.Empty;
+152
View File
@@ -0,0 +1,152 @@
namespace NginxMan;
public sealed class PortalContentDialog : Form
{
private readonly TextBox _txtSiteName;
private readonly TextBox _txtHeadline;
private readonly TextBox _txtIntroduction;
public PortalContentDialog(PortalContentSettings content)
{
Text = "主页内容设置";
StartPosition = FormStartPosition.CenterParent;
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
MinimizeBox = false;
ShowInTaskbar = false;
ClientSize = new Size(610, 360);
Font = new Font("Microsoft YaHei UI", 9F);
var root = new TableLayoutPanel
{
Dock = DockStyle.Fill,
ColumnCount = 2,
RowCount = 6,
Padding = new Padding(18),
BackColor = Color.White
};
root.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100));
root.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
root.RowStyles.Add(new RowStyle(SizeType.Absolute, 42));
root.RowStyles.Add(new RowStyle(SizeType.Absolute, 44));
root.RowStyles.Add(new RowStyle(SizeType.Absolute, 44));
root.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
root.RowStyles.Add(new RowStyle(SizeType.Absolute, 34));
root.RowStyles.Add(new RowStyle(SizeType.Absolute, 42));
var description = new Label
{
Text = "这些文字会展示在统一入口页上。可以直接修改,也可以恢复默认示例。",
Dock = DockStyle.Fill,
TextAlign = ContentAlignment.MiddleLeft,
ForeColor = Color.FromArgb(70, 85, 96)
};
root.Controls.Add(description, 0, 0);
root.SetColumnSpan(description, 2);
_txtSiteName = CreateTextBox(content.SiteName, 80, "例如:服务导航");
_txtHeadline = CreateTextBox(content.Headline, 120, "例如:欢迎访问统一服务入口");
_txtIntroduction = CreateTextBox(
content.Introduction,
500,
"例如:请选择下方网站或服务,点击卡片即可开始访问。");
_txtIntroduction.Multiline = true;
_txtIntroduction.ScrollBars = ScrollBars.Vertical;
root.Controls.Add(CreateLabel("入口页名称"), 0, 1);
root.Controls.Add(_txtSiteName, 1, 1);
root.Controls.Add(CreateLabel("主页标题"), 0, 2);
root.Controls.Add(_txtHeadline, 1, 2);
root.Controls.Add(CreateLabel("主页简介"), 0, 3);
root.Controls.Add(_txtIntroduction, 1, 3);
var hint = new Label
{
Text = "入口页名称同时用于浏览器标签、页头名称和页脚名称。",
Dock = DockStyle.Fill,
TextAlign = ContentAlignment.MiddleLeft,
ForeColor = Color.FromArgb(100, 110, 120)
};
root.Controls.Add(hint, 1, 4);
var buttons = new FlowLayoutPanel
{
Dock = DockStyle.Fill,
FlowDirection = FlowDirection.RightToLeft,
WrapContents = false,
Padding = new Padding(0, 6, 0, 0)
};
var saveButton = CreateButton("保存", 86);
var cancelButton = CreateButton("取消", 86);
var defaultsButton = CreateButton("恢复默认示例", 116);
saveButton.Click += (s, e) => SaveAndClose();
cancelButton.DialogResult = DialogResult.Cancel;
defaultsButton.Click += (s, e) => LoadDefaults();
buttons.Controls.Add(saveButton);
buttons.Controls.Add(cancelButton);
buttons.Controls.Add(defaultsButton);
root.Controls.Add(buttons, 0, 5);
root.SetColumnSpan(buttons, 2);
AcceptButton = saveButton;
CancelButton = cancelButton;
Controls.Add(root);
}
public string SiteName => _txtSiteName.Text.Trim();
public string Headline => _txtHeadline.Text.Trim();
public string Introduction => _txtIntroduction.Text.Trim();
private void SaveAndClose()
{
if (string.IsNullOrWhiteSpace(SiteName) ||
string.IsNullOrWhiteSpace(Headline) ||
string.IsNullOrWhiteSpace(Introduction))
{
MessageBox.Show(
"入口页名称、主页标题和主页简介都不能为空。",
"NginxMan",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
DialogResult = DialogResult.OK;
Close();
}
private void LoadDefaults()
{
_txtSiteName.Text = PortalContentSettings.DefaultSiteName;
_txtHeadline.Text = PortalContentSettings.DefaultHeadline;
_txtIntroduction.Text = PortalContentSettings.DefaultIntroduction;
_txtSiteName.Focus();
}
private static TextBox CreateTextBox(string value, int maxLength, string placeholder) => new()
{
Text = value,
MaxLength = maxLength,
PlaceholderText = placeholder,
Dock = DockStyle.Fill,
BorderStyle = BorderStyle.FixedSingle
};
private static Label CreateLabel(string text) => new()
{
Text = text,
Dock = DockStyle.Fill,
TextAlign = ContentAlignment.MiddleLeft
};
private static Button CreateButton(string text, int width) => new()
{
Text = text,
Width = width,
Height = 28,
Margin = new Padding(8, 0, 0, 0),
FlatStyle = FlatStyle.Flat
};
}
+14 -2
View File
@@ -18,6 +18,7 @@ NginxMan 主要用于:
- **内置 Nginx**:首次运行时自动释放完整的 Windows Nginx 运行文件。 - **内置 Nginx**:首次运行时自动释放完整的 Windows Nginx 运行文件。
- **入口页设置**:用户可以设置或关闭入口页域名,并为入口页指定独立的监听端口。 - **入口页设置**:用户可以设置或关闭入口页域名,并为入口页指定独立的监听端口。
- **主页内容设置**:通过弹窗维护入口页名称、主页标题和主页简介,并提供可恢复的默认文字示例。
- **映射管理**:支持新增、修改和删除域名反向代理映射。 - **映射管理**:支持新增、修改和删除域名反向代理映射。
- **可配置端口**:入口页和每条代理映射均可使用 `1–65535` 范围内的端口。 - **可配置端口**:入口页和每条代理映射均可使用 `1–65535` 范围内的端口。
- **配置生成**:根据界面数据自动生成 `data/nginx.conf`。 - **配置生成**:根据界面数据自动生成 `data/nginx.conf`。
@@ -40,6 +41,9 @@ NginxMan 主要用于:
| --- | --- | --- | | --- | --- | --- |
| 入口页域名 | 用于访问统一入口页;留空表示关闭入口站点 | `portal.example.com` | | 入口页域名 | 用于访问统一入口页;留空表示关闭入口站点 | `portal.example.com` |
| 入口页端口 | 入口页对外监听的端口 | `8088` | | 入口页端口 | 入口页对外监听的端口 | `8088` |
| 入口页名称 | 显示在浏览器标签、页头和页脚 | `服务导航` |
| 主页标题 | 入口页最醒目的标题 | `欢迎访问统一服务入口` |
| 主页简介 | 标题下方的说明文字 | `请选择下方网站或服务,点击卡片即可开始访问。` |
入口页域名和端口不会写死在源码中,也不需要通过重新编译程序来修改。入口页会作为其监听端口的默认站点,避免未匹配请求误入某条代理映射。 入口页域名和端口不会写死在源码中,也不需要通过重新编译程序来修改。入口页会作为其监听端口的默认站点,避免未匹配请求误入某条代理映射。
@@ -76,6 +80,7 @@ bin\NginxMan.exe
1. 入口页域名,例如 `portal.example.com`。 1. 入口页域名,例如 `portal.example.com`。
2. 入口页端口,例如 `8088`。 2. 入口页端口,例如 `8088`。
3. 点击“保存入口设置”。 3. 点击“保存入口设置”。
4. 点击“主页内容”,填写入口页名称、主页标题和主页简介;也可以点击“恢复默认示例”。
若不需要统一入口页,将入口页域名留空并保存即可。此时程序不会在 Nginx 配置中生成入口站点,但代理映射仍可正常使用。 若不需要统一入口页,将入口页域名留空并保存即可。此时程序不会在 Nginx 配置中生成入口站点,但代理映射仍可正常使用。
@@ -135,6 +140,7 @@ app.example.com -> 服务器 IP
| 按钮 | 作用 | | 按钮 | 作用 |
| --- | --- | | --- | --- |
| 保存入口设置 | 保存入口页域名与监听端口;Nginx 运行时自动重新加载;域名留空表示关闭入口站点 | | 保存入口设置 | 保存入口页域名与监听端口;Nginx 运行时自动重新加载;域名留空表示关闭入口站点 |
| 主页内容 | 弹窗设置入口页名称、主页标题和主页简介,并可恢复默认文字示例 |
| 新增 | 使用当前表单内容创建一条新映射 | | 新增 | 使用当前表单内容创建一条新映射 |
| 保存修改 | 保存列表中当前选中映射的修改 | | 保存修改 | 保存列表中当前选中映射的修改 |
| 删除 | 删除当前选中的映射 | | 删除 | 删除当前选中的映射 |
@@ -214,6 +220,9 @@ data\backups\年年年年月月日日-时时分分秒秒-毫秒-auto-close.zip
"errorLogPath": "data\\logs\\error.log", "errorLogPath": "data\\logs\\error.log",
"portalDomain": "portal.example.com", "portalDomain": "portal.example.com",
"portalListenPort": 8088, "portalListenPort": 8088,
"portalSiteName": "服务导航",
"portalHeadline": "欢迎访问统一服务入口",
"portalIntroduction": "请选择下方网站或服务,点击卡片即可开始访问。",
"routes": [ "routes": [
{ {
"domain": "app.example.com", "domain": "app.example.com",
@@ -236,13 +245,16 @@ data\backups\年年年年月月日日-时时分分秒秒-毫秒-auto-close.zip
data\www\index.template.html data\www\index.template.html
``` ```
可以直接修改页面标题、颜色、布局和其他静态内容。程序生成入口页时,会将所有网站卡片插入以下占位符: 可以直接修改颜色、布局和其他静态内容。程序生成入口页时,会填充以下占位符:
```text ```text
{{NGINXMAN_PORTAL_SITE_NAME}}
{{NGINXMAN_PORTAL_HEADLINE}}
{{NGINXMAN_PORTAL_INTRODUCTION}}
{{NGINXMAN_SERVICE_CARDS}} {{NGINXMAN_SERVICE_CARDS}}
``` ```
请勿删除或修改该占位符,否则程序无法生成入口页。网站名称和简介在写入 HTML 前会自动转义,避免特殊字符破坏页面结构。 请勿删除或修改这些占位符,否则程序无法生成入口页。主页文字、网站名称和简介在写入 HTML 前会自动转义,避免特殊字符破坏页面结构。旧版本模板会在程序运行时自动升级到当前格式。
## 从源码构建 ## 从源码构建
+28 -9
View File
@@ -10,7 +10,10 @@ internal static class WebPortal
private const string TemplateFileName = "index.template.html"; private const string TemplateFileName = "index.template.html";
private const string OutputFileName = "index.html"; private const string OutputFileName = "index.html";
private const string ServiceCardsToken = "{{NGINXMAN_SERVICE_CARDS}}"; private const string ServiceCardsToken = "{{NGINXMAN_SERVICE_CARDS}}";
private const string TemplateVersionMarker = "<!-- NGINXMAN_TEMPLATE_VERSION:2 -->"; private const string SiteNameToken = "{{NGINXMAN_PORTAL_SITE_NAME}}";
private const string HeadlineToken = "{{NGINXMAN_PORTAL_HEADLINE}}";
private const string IntroductionToken = "{{NGINXMAN_PORTAL_INTRODUCTION}}";
private const string TemplateVersionMarker = "<!-- NGINXMAN_TEMPLATE_VERSION:3 -->";
private static readonly UTF8Encoding Utf8WithoutBom = new(false); private static readonly UTF8Encoding Utf8WithoutBom = new(false);
public static void ExtractTo(string dataDirectory) public static void ExtractTo(string dataDirectory)
@@ -58,26 +61,42 @@ internal static class WebPortal
} }
} }
public static string RenderTo(string dataDirectory, IReadOnlyList<RouteEntry> routes) public static string RenderTo(
string dataDirectory,
PortalContentSettings portalContent,
IReadOnlyList<RouteEntry> routes)
{ {
var targetDirectory = Path.Combine(dataDirectory, "www"); var targetDirectory = Path.Combine(dataDirectory, "www");
var templatePath = Path.Combine(targetDirectory, TemplateFileName); var templatePath = Path.Combine(targetDirectory, TemplateFileName);
if (!File.Exists(templatePath)) if (!File.Exists(templatePath) ||
!File.ReadAllText(templatePath, Encoding.UTF8).Contains(
TemplateVersionMarker,
StringComparison.Ordinal))
{ {
ExtractTo(dataDirectory); ExtractTo(dataDirectory);
} }
var template = File.ReadAllText(templatePath, Encoding.UTF8); var template = File.ReadAllText(templatePath, Encoding.UTF8);
if (!template.Contains(ServiceCardsToken, StringComparison.Ordinal)) var requiredTokens = new[]
{
ServiceCardsToken,
SiteNameToken,
HeadlineToken,
IntroductionToken
};
var missingToken = requiredTokens.FirstOrDefault(
token => !template.Contains(token, StringComparison.Ordinal));
if (missingToken is not null)
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
$"网页模板缺少入口占位符 {ServiceCardsToken}: {templatePath}"); $"网页模板缺少占位符 {missingToken}: {templatePath}");
} }
var content = template.Replace( var content = template
ServiceCardsToken, .Replace(SiteNameToken, Encode(portalContent.SiteName), StringComparison.Ordinal)
BuildServiceCards(routes), .Replace(HeadlineToken, Encode(portalContent.Headline), StringComparison.Ordinal)
StringComparison.Ordinal); .Replace(IntroductionToken, Encode(portalContent.Introduction), StringComparison.Ordinal)
.Replace(ServiceCardsToken, BuildServiceCards(routes), StringComparison.Ordinal);
var outputPath = Path.Combine(targetDirectory, OutputFileName); var outputPath = Path.Combine(targetDirectory, OutputFileName);
File.WriteAllText(outputPath, content, Utf8WithoutBom); File.WriteAllText(outputPath, content, Utf8WithoutBom);
return outputPath; return outputPath;
+3
View File
@@ -5,5 +5,8 @@
"errorLogPath": "logs/error.log", "errorLogPath": "logs/error.log",
"portalDomain": "", "portalDomain": "",
"portalListenPort": 80, "portalListenPort": 80,
"portalSiteName": "服务导航",
"portalHeadline": "欢迎访问统一服务入口",
"portalIntroduction": "请选择下方网站或服务,点击卡片即可开始访问。",
"routes": [] "routes": []
} }
+9 -9
View File
@@ -1,12 +1,12 @@
<!doctype html> <!doctype html>
<!-- NGINXMAN_TEMPLATE_VERSION:2 --> <!-- NGINXMAN_TEMPLATE_VERSION:3 -->
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="统一的网站与服务入口"> <meta name="description" content="{{NGINXMAN_PORTAL_INTRODUCTION}}">
<meta name="theme-color" content="#071521"> <meta name="theme-color" content="#071521">
<title>Service Portal | 服务入口</title> <title>{{NGINXMAN_PORTAL_SITE_NAME}}</title>
<style> <style>
:root { :root {
--ink: #eaf8ff; --ink: #eaf8ff;
@@ -356,14 +356,14 @@
<div class="glow" aria-hidden="true"></div> <div class="glow" aria-hidden="true"></div>
<div class="shell"> <div class="shell">
<header class="topbar"> <header class="topbar">
<div class="brand"><span class="brand-mark" aria-hidden="true"></span>SERVICE PORTAL</div> <div class="brand"><span class="brand-mark" aria-hidden="true"></span>{{NGINXMAN_PORTAL_SITE_NAME}}</div>
<div class="network-state">Network online</div> <div class="network-state">服务在线</div>
</header> </header>
<main> <main>
<p class="eyebrow">Unified service gateway</p> <p class="eyebrow">统一服务入口</p>
<h1>连接服务。<span>统一每一次访问。</span></h1> <h1>{{NGINXMAN_PORTAL_HEADLINE}}</h1>
<p class="intro">从一个入口抵达所有已配置的网站与服务。选择目标入口即可开始访问。</p> <p class="intro">{{NGINXMAN_PORTAL_INTRODUCTION}}</p>
<section class="services" aria-label="服务入口导航"> <section class="services" aria-label="服务入口导航">
{{NGINXMAN_SERVICE_CARDS}} {{NGINXMAN_SERVICE_CARDS}}
@@ -371,7 +371,7 @@
</main> </main>
<footer class="footer"> <footer class="footer">
<span>NginxMan Service Portal</span> <span>{{NGINXMAN_PORTAL_SITE_NAME}}</span>
<span>Secure connections · <span id="year"></span></span> <span>Secure connections · <span id="year"></span></span>
</footer> </footer>
</div> </div>