fix(notification): render external notification placeholders

This commit is contained in:
0xJacky
2026-04-28 09:05:52 +08:00
parent 30908f3c28
commit 0301578295
20 changed files with 5576 additions and 4189 deletions
+14
View File
@@ -79,6 +79,20 @@ This project is a web-based NGINX management interface built with Go backend and
- **Backend**: `go generate ./...`, `go build ./...`, run `go test ./... -race -cover`; for release artifacts reuse the README command with `-tags=jsoniter -ldflags "$LD_FLAGS ..."`.
- **Demo stack**: `docker-compose -f docker-compose-demo.yml up` to bootstrap the sample environment
## Release Workflow
- Start releases from the `dev` branch with a clean working tree.
- Run `./version.sh` outside the sandbox to update the version, rebuild the frontend, and refresh generated artifacts that require network access.
- Prepare release notes in a temporary local markdown file such as `release-notes-vX.Y.Z.md`.
- Follow the existing three-section release note style: `Features`, `Bug Fixes`, and `Contributors`.
- Write contributor names using GitHub handles when they are known from the merged PR, not raw git author names.
- Do not commit the release note markdown file. Keep it untracked and use it directly for the tag annotation and GitHub Release body.
- Commit only the version-preparation artifacts with `chore: prepare vX.Y.Z`.
- Create an annotated tag from the release note file. If local GPG signing blocks tag creation in the sandbox, create the tag outside the sandbox with `git -c tag.gpgSign=false tag -a vX.Y.Z -F release-notes-vX.Y.Z.md`.
- Push both `dev` and the release tag with `git push origin dev vX.Y.Z`.
- Publish the release with `gh release create vX.Y.Z --verify-tag --title vX.Y.Z -F release-notes-vX.Y.Z.md --discussion-category Announcements`.
- The release flow is expected to create the GitHub Release and the linked Discussion post, then GitHub Actions handles binary, Docker, Homebrew, WinGet, and branch-sync automation.
## Language Requirements
- **All code comments, documentation, and communication must be in English**
- Maintain consistency and accessibility across the codebase
+337 -283
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+121 -96
View File
@@ -303,7 +303,7 @@ msgstr ""
msgid "All Components"
msgstr ""
#: src/components/Notification/notifications.ts:193
#: src/components/Notification/notifications.ts:201
#: src/language/constants.ts:58
msgid "All Recovery Codes Have Been Used"
msgstr ""
@@ -813,7 +813,7 @@ msgstr ""
msgid "Cannot compare: Missing content"
msgstr ""
#: src/constants/errors/config.ts:6
#: src/constants/errors/config.ts:10
msgid "Cannot delete protected path"
msgstr ""
@@ -821,7 +821,7 @@ msgstr ""
msgid "Cannot delete server_name while DNS is linked. Clear DNS link first."
msgstr ""
#: src/constants/errors/config.ts:9
#: src/constants/errors/config.ts:13
msgid "Cannot delete the nginx config directory"
msgstr ""
@@ -846,17 +846,25 @@ msgstr ""
msgid "certificate"
msgstr ""
#: src/components/Notification/notifications.ts:42
#: src/components/Notification/notifications.ts:50
msgid "Certificate %{name} has expired"
msgstr ""
#: src/components/Notification/notifications.ts:46
#: src/components/Notification/notifications.ts:50
msgid "Certificate %{name} renewal failed: %{error}"
msgstr ""
#: src/components/Notification/notifications.ts:42
msgid "Certificate %{name} renewed successfully"
msgstr ""
#: src/components/Notification/notifications.ts:54
#: src/components/Notification/notifications.ts:58
#: src/components/Notification/notifications.ts:62
msgid "Certificate %{name} will expire in %{days} days"
msgstr ""
#: src/components/Notification/notifications.ts:58
#: src/components/Notification/notifications.ts:66
msgid "Certificate %{name} will expire in 1 day"
msgstr ""
@@ -868,17 +876,17 @@ msgstr ""
msgid "Certificate decode error"
msgstr ""
#: src/components/Notification/notifications.ts:45
#: src/components/Notification/notifications.ts:53
msgid "Certificate Expiration Notice"
msgstr ""
#: src/components/Notification/notifications.ts:41
#: src/components/Notification/notifications.ts:49
msgid "Certificate Expired"
msgstr ""
#: src/components/Notification/notifications.ts:49
#: src/components/Notification/notifications.ts:53
#: src/components/Notification/notifications.ts:57
#: src/components/Notification/notifications.ts:61
#: src/components/Notification/notifications.ts:65
msgid "Certificate Expiring Soon"
msgstr ""
@@ -1030,9 +1038,9 @@ msgid ""
"Check if the nginx access log path exists. By default, this path is obtained "
"from 'nginx -V'. If it cannot be obtained or the obtained path does not "
"point to a valid, existing file, an error will be reported. In this case, "
"you need to modify the configuration file to specify the access log path."
"Refer to the docs for more details: https://nginxui.com/zh_CN/guide/config-"
"nginx.html#accesslogpath"
"you need to modify the configuration file to specify the access log "
"path.Refer to the docs for more details: https://nginxui.com/zh_CN/guide/"
"config-nginx.html#accesslogpath"
msgstr ""
#: src/language/generate.ts:11
@@ -1650,11 +1658,11 @@ msgstr ""
msgid "Delete"
msgstr ""
#: src/components/Notification/notifications.ts:86
#: src/components/Notification/notifications.ts:94
msgid "Delete %{path} on %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:90
#: src/components/Notification/notifications.ts:98
msgid "Delete %{path} on %{node_name} successfully"
msgstr ""
@@ -1670,36 +1678,37 @@ msgstr ""
msgid "Delete Permanently"
msgstr ""
#: src/components/Notification/notifications.ts:85
#: src/components/Notification/notifications.ts:93
msgid "Delete Remote Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:89
#: src/components/Notification/notifications.ts:97
msgid "Delete Remote Config Success"
msgstr ""
#: src/components/Notification/notifications.ts:97 src/language/constants.ts:50
#: src/components/Notification/notifications.ts:105
#: src/language/constants.ts:50
msgid "Delete Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:101
#: src/components/Notification/notifications.ts:109
#: src/language/constants.ts:49
msgid "Delete Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:153
#: src/components/Notification/notifications.ts:161
msgid "Delete Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:157
#: src/components/Notification/notifications.ts:165
msgid "Delete Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:98
#: src/components/Notification/notifications.ts:106
msgid "Delete site %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:102
#: src/components/Notification/notifications.ts:110
msgid "Delete site %{name} from %{node} successfully"
msgstr ""
@@ -1707,11 +1716,11 @@ msgstr ""
msgid "Delete site: %{site_name}"
msgstr ""
#: src/components/Notification/notifications.ts:154
#: src/components/Notification/notifications.ts:162
msgid "Delete stream %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:158
#: src/components/Notification/notifications.ts:166
msgid "Delete stream %{name} from %{node} successfully"
msgstr ""
@@ -1754,7 +1763,7 @@ msgstr ""
msgid "Destination file already exists"
msgstr ""
#: src/constants/errors/config.ts:3
#: src/constants/errors/config.ts:7
msgid "Destination file: {0} already exists"
msgstr ""
@@ -1841,53 +1850,53 @@ msgstr ""
msgid "Disable auto-renewal failed for %{name}"
msgstr ""
#: src/components/Notification/notifications.ts:105
#: src/components/Notification/notifications.ts:113
#: src/language/constants.ts:52
msgid "Disable Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:129
#: src/components/Notification/notifications.ts:137
msgid "Disable Remote Site Maintenance Error"
msgstr ""
#: src/components/Notification/notifications.ts:133
#: src/components/Notification/notifications.ts:141
msgid "Disable Remote Site Maintenance Success"
msgstr ""
#: src/components/Notification/notifications.ts:109
#: src/components/Notification/notifications.ts:117
#: src/language/constants.ts:51
msgid "Disable Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:161
#: src/components/Notification/notifications.ts:169
msgid "Disable Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:165
#: src/components/Notification/notifications.ts:173
msgid "Disable Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:106
#: src/components/Notification/notifications.ts:114
msgid "Disable site %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:110
#: src/components/Notification/notifications.ts:118
msgid "Disable site %{name} from %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:130
#: src/components/Notification/notifications.ts:138
msgid "Disable site %{name} maintenance on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:134
#: src/components/Notification/notifications.ts:142
msgid "Disable site %{name} maintenance on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:162
#: src/components/Notification/notifications.ts:170
msgid "Disable stream %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:166
#: src/components/Notification/notifications.ts:174
msgid "Disable stream %{name} from %{node} successfully"
msgstr ""
@@ -2241,53 +2250,53 @@ msgstr ""
msgid "Enable Proxy Cache"
msgstr ""
#: src/components/Notification/notifications.ts:113
#: src/components/Notification/notifications.ts:121
#: src/language/constants.ts:54
msgid "Enable Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:121
#: src/components/Notification/notifications.ts:129
msgid "Enable Remote Site Maintenance Error"
msgstr ""
#: src/components/Notification/notifications.ts:125
#: src/components/Notification/notifications.ts:133
msgid "Enable Remote Site Maintenance Success"
msgstr ""
#: src/components/Notification/notifications.ts:117
#: src/components/Notification/notifications.ts:125
#: src/language/constants.ts:53
msgid "Enable Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:169
#: src/components/Notification/notifications.ts:177
msgid "Enable Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:173
#: src/components/Notification/notifications.ts:181
msgid "Enable Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:122
#: src/components/Notification/notifications.ts:130
msgid "Enable site %{name} maintenance on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:126
#: src/components/Notification/notifications.ts:134
msgid "Enable site %{name} maintenance on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:114
#: src/components/Notification/notifications.ts:122
msgid "Enable site %{name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:118
#: src/components/Notification/notifications.ts:126
msgid "Enable site %{name} on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:170
#: src/components/Notification/notifications.ts:178
msgid "Enable stream %{name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:174
#: src/components/Notification/notifications.ts:182
msgid "Enable stream %{name} on %{node} successfully"
msgstr ""
@@ -2389,7 +2398,7 @@ msgstr ""
msgid "Error"
msgstr ""
#: src/components/Notification/detailRender.tsx:72
#: src/components/Notification/detailRender.tsx:77
msgid "Error details"
msgstr ""
@@ -2497,7 +2506,7 @@ msgstr ""
msgid "External notification configuration not found"
msgstr ""
#: src/components/Notification/notifications.ts:93
#: src/components/Notification/notifications.ts:101
msgid "External Notification Test"
msgstr ""
@@ -2984,6 +2993,18 @@ msgstr ""
msgid "File"
msgstr ""
#: src/constants/errors/config.ts:4
msgid "File content contains invalid control characters"
msgstr ""
#: src/constants/errors/config.ts:5
msgid "File content contains restricted nginx directive: {0}"
msgstr ""
#: src/constants/errors/config.ts:3
msgid "File content must be valid UTF-8 text"
msgstr ""
#: src/language/constants.ts:32
msgid "File exists"
msgstr ""
@@ -2992,11 +3013,15 @@ msgstr ""
msgid "File index rebuild started successfully for %{path}"
msgstr ""
#: src/constants/errors/config.ts:2
msgid "File name is not allowed: {0}"
msgstr ""
#: src/views/other/Error.vue:8
msgid "File Not Found"
msgstr ""
#: src/constants/errors/config.ts:7
#: src/constants/errors/config.ts:11
msgid "File or directory not found: {0}"
msgstr ""
@@ -4538,7 +4563,7 @@ msgstr ""
msgid "Nginx Reload Command"
msgstr ""
#: src/constants/errors/config.ts:5 src/constants/errors/site.ts:7
#: src/constants/errors/config.ts:9 src/constants/errors/site.ts:7
#: src/constants/errors/stream.ts:6
msgid "Nginx reload failed: {0}"
msgstr ""
@@ -4575,7 +4600,7 @@ msgstr ""
msgid "Nginx Test Config Command"
msgstr ""
#: src/constants/errors/config.ts:4 src/constants/errors/site.ts:6
#: src/constants/errors/config.ts:8 src/constants/errors/site.ts:6
#: src/constants/errors/stream.ts:5
msgid "Nginx test failed: {0}"
msgstr ""
@@ -5055,7 +5080,7 @@ msgstr ""
msgid "Path not in granted access paths: {0}"
msgstr ""
#: src/constants/errors/cert.ts:7 src/constants/errors/config.ts:2
#: src/constants/errors/cert.ts:7 src/constants/errors/config.ts:6
msgid "Path: {0} is not under the nginx conf dir: {1}"
msgstr ""
@@ -5213,7 +5238,7 @@ msgid ""
"select one of the credentialsbelow to request the API of the DNS provider."
msgstr ""
#: src/components/Notification/notifications.ts:194
#: src/components/Notification/notifications.ts:202
#: src/language/constants.ts:59
msgid ""
"Please generate new recovery codes in the preferences immediately to prevent "
@@ -5715,53 +5740,53 @@ msgstr ""
msgid "Rename"
msgstr ""
#: src/components/Notification/notifications.ts:78
#: src/components/Notification/notifications.ts:86
msgid "Rename %{orig_path} to %{new_path} on %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:82
#: src/components/Notification/notifications.ts:90
msgid "Rename %{orig_path} to %{new_path} on %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:77 src/language/constants.ts:42
#: src/components/Notification/notifications.ts:85 src/language/constants.ts:42
msgid "Rename Remote Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:81 src/language/constants.ts:41
#: src/components/Notification/notifications.ts:89 src/language/constants.ts:41
msgid "Rename Remote Config Success"
msgstr ""
#: src/components/Notification/notifications.ts:137
#: src/components/Notification/notifications.ts:145
#: src/language/constants.ts:56
msgid "Rename Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:141
#: src/components/Notification/notifications.ts:149
#: src/language/constants.ts:55
msgid "Rename Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:177
#: src/components/Notification/notifications.ts:185
msgid "Rename Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:181
#: src/components/Notification/notifications.ts:189
msgid "Rename Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:138
#: src/components/Notification/notifications.ts:146
msgid "Rename site %{name} to %{new_name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:142
#: src/components/Notification/notifications.ts:150
msgid "Rename site %{name} to %{new_name} on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:178
#: src/components/Notification/notifications.ts:186
msgid "Rename stream %{name} to %{new_name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:182
#: src/components/Notification/notifications.ts:190
msgid "Rename stream %{name} to %{new_name} on %{node} successfully"
msgstr ""
@@ -5784,11 +5809,11 @@ msgstr ""
msgid "Renew Certificate"
msgstr ""
#: src/language/constants.ts:36
#: src/components/Notification/notifications.ts:45 src/language/constants.ts:36
msgid "Renew Certificate Error"
msgstr ""
#: src/language/constants.ts:35
#: src/components/Notification/notifications.ts:41 src/language/constants.ts:35
msgid "Renew Certificate Success"
msgstr ""
@@ -6098,37 +6123,37 @@ msgstr ""
msgid "Save Order"
msgstr ""
#: src/components/Notification/notifications.ts:145
#: src/components/Notification/notifications.ts:153
#: src/language/constants.ts:48
msgid "Save Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:149
#: src/components/Notification/notifications.ts:157
#: src/language/constants.ts:47
msgid "Save Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:185
#: src/components/Notification/notifications.ts:193
msgid "Save Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:189
#: src/components/Notification/notifications.ts:197
msgid "Save Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:146
#: src/components/Notification/notifications.ts:154
msgid "Save site %{name} to %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:150
#: src/components/Notification/notifications.ts:158
msgid "Save site %{name} to %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:186
#: src/components/Notification/notifications.ts:194
msgid "Save stream %{name} to %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:190
#: src/components/Notification/notifications.ts:198
msgid "Save stream %{name} to %{node} successfully"
msgstr ""
@@ -6382,14 +6407,14 @@ msgstr ""
#: src/constants/errors/nginx_log.ts:8
msgid ""
"Settings.NginxLogSettings.AccessLogPath is empty, refer to https://nginxui."
"com/guide/config-nginx.html for more information"
"Settings.NginxLogSettings.AccessLogPath is empty, refer to https://"
"nginxui.com/guide/config-nginx.html for more information"
msgstr ""
#: src/constants/errors/nginx_log.ts:7
msgid ""
"Settings.NginxLogSettings.ErrorLogPath is empty, refer to https://nginxui."
"com/guide/config-nginx.html for more information"
"Settings.NginxLogSettings.ErrorLogPath is empty, refer to https://"
"nginxui.com/guide/config-nginx.html for more information"
msgstr ""
#: src/views/install/components/InstallView.vue:147
@@ -6739,35 +6764,35 @@ msgstr ""
msgid "Sync Certificate"
msgstr ""
#: src/components/Notification/notifications.ts:62
#: src/components/Notification/notifications.ts:70
msgid "Sync Certificate %{cert_name} to %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:66
#: src/components/Notification/notifications.ts:74
msgid "Sync Certificate %{cert_name} to %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:61 src/language/constants.ts:39
#: src/components/Notification/notifications.ts:69 src/language/constants.ts:39
msgid "Sync Certificate Error"
msgstr ""
#: src/components/Notification/notifications.ts:65 src/language/constants.ts:38
#: src/components/Notification/notifications.ts:73 src/language/constants.ts:38
msgid "Sync Certificate Success"
msgstr ""
#: src/components/Notification/notifications.ts:70
#: src/components/Notification/notifications.ts:78
msgid "Sync config %{config_name} to %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:74
#: src/components/Notification/notifications.ts:82
msgid "Sync config %{config_name} to %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:69 src/language/constants.ts:45
#: src/components/Notification/notifications.ts:77 src/language/constants.ts:45
msgid "Sync Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:73 src/language/constants.ts:44
#: src/components/Notification/notifications.ts:81 src/language/constants.ts:44
msgid "Sync Config Success"
msgstr ""
@@ -7060,11 +7085,11 @@ msgstr ""
#: src/language/curd.ts:46
msgid ""
"This field should only contain letters, unicode characters, numbers, and -"
"_./:"
"This field should only contain letters, unicode characters, numbers, and "
"-_./:"
msgstr ""
#: src/components/Notification/notifications.ts:94
#: src/components/Notification/notifications.ts:102
msgid "This is a test message sent at %{timestamp} from Nginx UI."
msgstr ""
@@ -7320,7 +7345,7 @@ msgstr ""
msgid "Traffic"
msgstr ""
#: src/components/Notification/detailRender.tsx:65
#: src/components/Notification/detailRender.tsx:71
msgid "Translating error..."
msgstr ""
@@ -7795,7 +7820,7 @@ msgid ""
"localhost domain. This may expose sensitive information."
msgstr ""
#: src/constants/errors/config.ts:8
#: src/constants/errors/config.ts:12
msgid "You are not allowed to delete a file outside of the nginx config path"
msgstr ""
+383 -321
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+111 -85
View File
@@ -310,7 +310,7 @@ msgstr ""
msgid "All Components"
msgstr ""
#: src/components/Notification/notifications.ts:193
#: src/components/Notification/notifications.ts:201
#: src/language/constants.ts:58
msgid "All Recovery Codes Have Been Used"
msgstr ""
@@ -815,7 +815,7 @@ msgstr ""
msgid "Cannot compare: Missing content"
msgstr ""
#: src/constants/errors/config.ts:6
#: src/constants/errors/config.ts:10
msgid "Cannot delete protected path"
msgstr ""
@@ -823,7 +823,7 @@ msgstr ""
msgid "Cannot delete server_name while DNS is linked. Clear DNS link first."
msgstr ""
#: src/constants/errors/config.ts:9
#: src/constants/errors/config.ts:13
msgid "Cannot delete the nginx config directory"
msgstr ""
@@ -848,17 +848,25 @@ msgstr ""
msgid "certificate"
msgstr ""
#: src/components/Notification/notifications.ts:42
#: src/components/Notification/notifications.ts:50
msgid "Certificate %{name} has expired"
msgstr ""
#: src/components/Notification/notifications.ts:46
#: src/components/Notification/notifications.ts:50
msgid "Certificate %{name} renewal failed: %{error}"
msgstr ""
#: src/components/Notification/notifications.ts:42
msgid "Certificate %{name} renewed successfully"
msgstr ""
#: src/components/Notification/notifications.ts:54
#: src/components/Notification/notifications.ts:58
#: src/components/Notification/notifications.ts:62
msgid "Certificate %{name} will expire in %{days} days"
msgstr ""
#: src/components/Notification/notifications.ts:58
#: src/components/Notification/notifications.ts:66
msgid "Certificate %{name} will expire in 1 day"
msgstr ""
@@ -870,17 +878,17 @@ msgstr ""
msgid "Certificate decode error"
msgstr ""
#: src/components/Notification/notifications.ts:45
#: src/components/Notification/notifications.ts:53
msgid "Certificate Expiration Notice"
msgstr ""
#: src/components/Notification/notifications.ts:41
#: src/components/Notification/notifications.ts:49
msgid "Certificate Expired"
msgstr ""
#: src/components/Notification/notifications.ts:49
#: src/components/Notification/notifications.ts:53
#: src/components/Notification/notifications.ts:57
#: src/components/Notification/notifications.ts:61
#: src/components/Notification/notifications.ts:65
msgid "Certificate Expiring Soon"
msgstr ""
@@ -1621,11 +1629,11 @@ msgstr ""
msgid "Delete"
msgstr ""
#: src/components/Notification/notifications.ts:86
#: src/components/Notification/notifications.ts:94
msgid "Delete %{path} on %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:90
#: src/components/Notification/notifications.ts:98
msgid "Delete %{path} on %{node_name} successfully"
msgstr ""
@@ -1641,37 +1649,37 @@ msgstr ""
msgid "Delete Permanently"
msgstr ""
#: src/components/Notification/notifications.ts:85
#: src/components/Notification/notifications.ts:93
msgid "Delete Remote Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:89
#: src/components/Notification/notifications.ts:97
msgid "Delete Remote Config Success"
msgstr ""
#: src/components/Notification/notifications.ts:97
#: src/components/Notification/notifications.ts:105
#: src/language/constants.ts:50
msgid "Delete Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:101
#: src/components/Notification/notifications.ts:109
#: src/language/constants.ts:49
msgid "Delete Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:153
#: src/components/Notification/notifications.ts:161
msgid "Delete Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:157
#: src/components/Notification/notifications.ts:165
msgid "Delete Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:98
#: src/components/Notification/notifications.ts:106
msgid "Delete site %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:102
#: src/components/Notification/notifications.ts:110
msgid "Delete site %{name} from %{node} successfully"
msgstr ""
@@ -1679,11 +1687,11 @@ msgstr ""
msgid "Delete site: %{site_name}"
msgstr ""
#: src/components/Notification/notifications.ts:154
#: src/components/Notification/notifications.ts:162
msgid "Delete stream %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:158
#: src/components/Notification/notifications.ts:166
msgid "Delete stream %{name} from %{node} successfully"
msgstr ""
@@ -1726,7 +1734,7 @@ msgstr ""
msgid "Destination file already exists"
msgstr ""
#: src/constants/errors/config.ts:3
#: src/constants/errors/config.ts:7
msgid "Destination file: {0} already exists"
msgstr ""
@@ -1813,53 +1821,53 @@ msgstr ""
msgid "Disable auto-renewal failed for %{name}"
msgstr ""
#: src/components/Notification/notifications.ts:105
#: src/components/Notification/notifications.ts:113
#: src/language/constants.ts:52
msgid "Disable Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:129
#: src/components/Notification/notifications.ts:137
msgid "Disable Remote Site Maintenance Error"
msgstr ""
#: src/components/Notification/notifications.ts:133
#: src/components/Notification/notifications.ts:141
msgid "Disable Remote Site Maintenance Success"
msgstr ""
#: src/components/Notification/notifications.ts:109
#: src/components/Notification/notifications.ts:117
#: src/language/constants.ts:51
msgid "Disable Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:161
#: src/components/Notification/notifications.ts:169
msgid "Disable Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:165
#: src/components/Notification/notifications.ts:173
msgid "Disable Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:106
#: src/components/Notification/notifications.ts:114
msgid "Disable site %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:110
#: src/components/Notification/notifications.ts:118
msgid "Disable site %{name} from %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:130
#: src/components/Notification/notifications.ts:138
msgid "Disable site %{name} maintenance on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:134
#: src/components/Notification/notifications.ts:142
msgid "Disable site %{name} maintenance on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:162
#: src/components/Notification/notifications.ts:170
msgid "Disable stream %{name} from %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:166
#: src/components/Notification/notifications.ts:174
msgid "Disable stream %{name} from %{node} successfully"
msgstr ""
@@ -2218,53 +2226,53 @@ msgstr ""
msgid "Enable Proxy Cache"
msgstr ""
#: src/components/Notification/notifications.ts:113
#: src/components/Notification/notifications.ts:121
#: src/language/constants.ts:54
msgid "Enable Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:121
#: src/components/Notification/notifications.ts:129
msgid "Enable Remote Site Maintenance Error"
msgstr ""
#: src/components/Notification/notifications.ts:125
#: src/components/Notification/notifications.ts:133
msgid "Enable Remote Site Maintenance Success"
msgstr ""
#: src/components/Notification/notifications.ts:117
#: src/components/Notification/notifications.ts:125
#: src/language/constants.ts:53
msgid "Enable Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:169
#: src/components/Notification/notifications.ts:177
msgid "Enable Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:173
#: src/components/Notification/notifications.ts:181
msgid "Enable Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:122
#: src/components/Notification/notifications.ts:130
msgid "Enable site %{name} maintenance on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:126
#: src/components/Notification/notifications.ts:134
msgid "Enable site %{name} maintenance on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:114
#: src/components/Notification/notifications.ts:122
msgid "Enable site %{name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:118
#: src/components/Notification/notifications.ts:126
msgid "Enable site %{name} on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:170
#: src/components/Notification/notifications.ts:178
msgid "Enable stream %{name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:174
#: src/components/Notification/notifications.ts:182
msgid "Enable stream %{name} on %{node} successfully"
msgstr ""
@@ -2364,7 +2372,7 @@ msgstr ""
msgid "Error"
msgstr ""
#: src/components/Notification/detailRender.tsx:72
#: src/components/Notification/detailRender.tsx:77
msgid "Error details"
msgstr ""
@@ -2467,7 +2475,7 @@ msgstr ""
msgid "External notification configuration not found"
msgstr ""
#: src/components/Notification/notifications.ts:93
#: src/components/Notification/notifications.ts:101
msgid "External Notification Test"
msgstr ""
@@ -2955,6 +2963,18 @@ msgstr ""
msgid "File"
msgstr ""
#: src/constants/errors/config.ts:4
msgid "File content contains invalid control characters"
msgstr ""
#: src/constants/errors/config.ts:5
msgid "File content contains restricted nginx directive: {0}"
msgstr ""
#: src/constants/errors/config.ts:3
msgid "File content must be valid UTF-8 text"
msgstr ""
#: src/language/constants.ts:32
msgid "File exists"
msgstr ""
@@ -2963,11 +2983,15 @@ msgstr ""
msgid "File index rebuild started successfully for %{path}"
msgstr ""
#: src/constants/errors/config.ts:2
msgid "File name is not allowed: {0}"
msgstr ""
#: src/views/other/Error.vue:8
msgid "File Not Found"
msgstr ""
#: src/constants/errors/config.ts:7
#: src/constants/errors/config.ts:11
msgid "File or directory not found: {0}"
msgstr ""
@@ -4481,7 +4505,7 @@ msgstr ""
msgid "Nginx Reload Command"
msgstr ""
#: src/constants/errors/config.ts:5
#: src/constants/errors/config.ts:9
#: src/constants/errors/site.ts:7
#: src/constants/errors/stream.ts:6
msgid "Nginx reload failed: {0}"
@@ -4519,7 +4543,7 @@ msgstr ""
msgid "Nginx Test Config Command"
msgstr ""
#: src/constants/errors/config.ts:4
#: src/constants/errors/config.ts:8
#: src/constants/errors/site.ts:6
#: src/constants/errors/stream.ts:5
msgid "Nginx test failed: {0}"
@@ -4994,7 +5018,7 @@ msgid "Path not in granted access paths: {0}"
msgstr ""
#: src/constants/errors/cert.ts:7
#: src/constants/errors/config.ts:2
#: src/constants/errors/config.ts:6
msgid "Path: {0} is not under the nginx conf dir: {1}"
msgstr ""
@@ -5142,7 +5166,7 @@ msgstr ""
msgid "Please first add credentials in Certification > DNS Credentials, and then select one of the credentialsbelow to request the API of the DNS provider."
msgstr ""
#: src/components/Notification/notifications.ts:194
#: src/components/Notification/notifications.ts:202
#: src/language/constants.ts:59
msgid "Please generate new recovery codes in the preferences immediately to prevent lockout."
msgstr ""
@@ -5646,55 +5670,55 @@ msgstr ""
msgid "Rename"
msgstr ""
#: src/components/Notification/notifications.ts:78
#: src/components/Notification/notifications.ts:86
msgid "Rename %{orig_path} to %{new_path} on %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:82
#: src/components/Notification/notifications.ts:90
msgid "Rename %{orig_path} to %{new_path} on %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:77
#: src/components/Notification/notifications.ts:85
#: src/language/constants.ts:42
msgid "Rename Remote Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:81
#: src/components/Notification/notifications.ts:89
#: src/language/constants.ts:41
msgid "Rename Remote Config Success"
msgstr ""
#: src/components/Notification/notifications.ts:137
#: src/components/Notification/notifications.ts:145
#: src/language/constants.ts:56
msgid "Rename Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:141
#: src/components/Notification/notifications.ts:149
#: src/language/constants.ts:55
msgid "Rename Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:177
#: src/components/Notification/notifications.ts:185
msgid "Rename Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:181
#: src/components/Notification/notifications.ts:189
msgid "Rename Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:138
#: src/components/Notification/notifications.ts:146
msgid "Rename site %{name} to %{new_name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:142
#: src/components/Notification/notifications.ts:150
msgid "Rename site %{name} to %{new_name} on %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:178
#: src/components/Notification/notifications.ts:186
msgid "Rename stream %{name} to %{new_name} on %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:182
#: src/components/Notification/notifications.ts:190
msgid "Rename stream %{name} to %{new_name} on %{node} successfully"
msgstr ""
@@ -5717,10 +5741,12 @@ msgstr ""
msgid "Renew Certificate"
msgstr ""
#: src/components/Notification/notifications.ts:45
#: src/language/constants.ts:36
msgid "Renew Certificate Error"
msgstr ""
#: src/components/Notification/notifications.ts:41
#: src/language/constants.ts:35
msgid "Renew Certificate Success"
msgstr ""
@@ -6030,37 +6056,37 @@ msgstr ""
msgid "Save Order"
msgstr ""
#: src/components/Notification/notifications.ts:145
#: src/components/Notification/notifications.ts:153
#: src/language/constants.ts:48
msgid "Save Remote Site Error"
msgstr ""
#: src/components/Notification/notifications.ts:149
#: src/components/Notification/notifications.ts:157
#: src/language/constants.ts:47
msgid "Save Remote Site Success"
msgstr ""
#: src/components/Notification/notifications.ts:185
#: src/components/Notification/notifications.ts:193
msgid "Save Remote Stream Error"
msgstr ""
#: src/components/Notification/notifications.ts:189
#: src/components/Notification/notifications.ts:197
msgid "Save Remote Stream Success"
msgstr ""
#: src/components/Notification/notifications.ts:146
#: src/components/Notification/notifications.ts:154
msgid "Save site %{name} to %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:150
#: src/components/Notification/notifications.ts:158
msgid "Save site %{name} to %{node} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:186
#: src/components/Notification/notifications.ts:194
msgid "Save stream %{name} to %{node} failed"
msgstr ""
#: src/components/Notification/notifications.ts:190
#: src/components/Notification/notifications.ts:198
msgid "Save stream %{name} to %{node} successfully"
msgstr ""
@@ -6667,38 +6693,38 @@ msgstr ""
msgid "Sync Certificate"
msgstr ""
#: src/components/Notification/notifications.ts:62
#: src/components/Notification/notifications.ts:70
msgid "Sync Certificate %{cert_name} to %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:66
#: src/components/Notification/notifications.ts:74
msgid "Sync Certificate %{cert_name} to %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:61
#: src/components/Notification/notifications.ts:69
#: src/language/constants.ts:39
msgid "Sync Certificate Error"
msgstr ""
#: src/components/Notification/notifications.ts:65
#: src/components/Notification/notifications.ts:73
#: src/language/constants.ts:38
msgid "Sync Certificate Success"
msgstr ""
#: src/components/Notification/notifications.ts:70
#: src/components/Notification/notifications.ts:78
msgid "Sync config %{config_name} to %{node_name} failed"
msgstr ""
#: src/components/Notification/notifications.ts:74
#: src/components/Notification/notifications.ts:82
msgid "Sync config %{config_name} to %{node_name} successfully"
msgstr ""
#: src/components/Notification/notifications.ts:69
#: src/components/Notification/notifications.ts:77
#: src/language/constants.ts:45
msgid "Sync Config Error"
msgstr ""
#: src/components/Notification/notifications.ts:73
#: src/components/Notification/notifications.ts:81
#: src/language/constants.ts:44
msgid "Sync Config Success"
msgstr ""
@@ -6969,7 +6995,7 @@ msgstr ""
msgid "This field should only contain letters, unicode characters, numbers, and -_./:"
msgstr ""
#: src/components/Notification/notifications.ts:94
#: src/components/Notification/notifications.ts:102
msgid "This is a test message sent at %{timestamp} from Nginx UI."
msgstr ""
@@ -7190,7 +7216,7 @@ msgstr ""
msgid "Traffic"
msgstr ""
#: src/components/Notification/detailRender.tsx:65
#: src/components/Notification/detailRender.tsx:71
msgid "Translating error..."
msgstr ""
@@ -7664,7 +7690,7 @@ msgstr ""
msgid "You are accessing this terminal over an insecure HTTP connection on a non-localhost domain. This may expose sensitive information."
msgstr ""
#: src/constants/errors/config.ts:8
#: src/constants/errors/config.ts:12
msgid "You are not allowed to delete a file outside of the nginx config path"
msgstr ""
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+10
View File
@@ -5,6 +5,7 @@ import (
"github.com/BurntSushi/toml"
"log"
"os"
"sort"
"strings"
)
@@ -59,6 +60,15 @@ func init() {
c.Links = nil
configurations = append(configurations, c)
}
sort.SliceStable(configurations, func(i, j int) bool {
leftName := strings.ToLower(configurations[i].Name)
rightName := strings.ToLower(configurations[j].Name)
if leftName == rightName {
return strings.ToLower(configurations[i].Code) < strings.ToLower(configurations[j].Code)
}
return leftName < rightName
})
}
func GetProvidersList() []Config {
+15
View File
@@ -4,6 +4,7 @@ import (
"github.com/0xJacky/Nginx-UI/internal/cert/config"
"github.com/BurntSushi/toml"
"log"
"sort"
"strings"
"testing"
)
@@ -14,6 +15,20 @@ func CheckIfErr(err error) {
}
}
func TestGetProvidersListSortedByName(t *testing.T) {
providers := GetProvidersList()
if !sort.SliceIsSorted(providers, func(i, j int) bool {
leftName := strings.ToLower(providers[i].Name)
rightName := strings.ToLower(providers[j].Name)
if leftName == rightName {
return strings.ToLower(providers[i].Code) < strings.ToLower(providers[j].Code)
}
return leftName < rightName
}) {
t.Fatal("providers are not sorted by name")
}
}
func TestConfigEnv(t *testing.T) {
filenames, err := config.ListConfigs()
CheckIfErr(err)
+11 -1
View File
@@ -7,6 +7,7 @@ import (
"github.com/0xJacky/Nginx-UI/internal/translation"
"github.com/0xJacky/Nginx-UI/model"
"github.com/0xJacky/Nginx-UI/query"
"github.com/0xJacky/pofile"
"github.com/uozi-tech/cosy/logger"
)
@@ -109,8 +110,17 @@ func (n *ExternalMessage) GetContent(lang string) string {
content, err := dict.Translate(n.Notification.Content, n.Notification.Details)
if err != nil {
return n.Notification.Content
return renderNotificationContent(n.Notification.Content, n.Notification.Details)
}
return content
}
func renderNotificationContent(content string, details any) string {
rendered, err := pofile.Dict{content: content}.Translate(content, details)
if err != nil {
return content
}
return rendered
}
+66
View File
@@ -0,0 +1,66 @@
package notification
import (
"testing"
"github.com/0xJacky/Nginx-UI/internal/translation"
"github.com/0xJacky/Nginx-UI/model"
"github.com/0xJacky/pofile"
)
func withTranslationDict(t *testing.T, dict map[string]pofile.Dict) {
t.Helper()
original := translation.Dict
translation.Dict = dict
t.Cleanup(func() {
translation.Dict = original
})
}
func TestExternalMessageGetContentTranslatesAndInterpolates(t *testing.T) {
withTranslationDict(t, map[string]pofile.Dict{
"zh_CN": {
"Certificate %{name} renewed successfully": "CERT %{name} OK",
},
"en": {},
})
msg := &ExternalMessage{
Notification: &model.Notification{
Content: "Certificate %{name} renewed successfully",
Details: map[string]any{
"name": "example.com",
},
},
}
got := msg.GetContent("zh_CN")
want := "CERT example.com OK"
if got != want {
t.Fatalf("GetContent() = %q, want %q", got, want)
}
}
func TestExternalMessageGetContentInterpolatesMissingTranslationKey(t *testing.T) {
withTranslationDict(t, map[string]pofile.Dict{
"en": {},
})
msg := &ExternalMessage{
Notification: &model.Notification{
Content: "Certificate %{name} renewal failed: %{error}",
Details: map[string]any{
"name": "example.com",
"error": "timeout",
},
},
}
got := msg.GetContent("en")
want := "Certificate example.com renewal failed: timeout"
if got != want {
t.Fatalf("GetContent() = %q, want %q", got, want)
}
}