Skip to content

Commit ded74bb

Browse files
committed
feat(wip): self check
1 parent 5911462 commit ded74bb

40 files changed

+1418
-69
lines changed

README-es.md

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Aceptamos traducciones a cualquier idioma.
109109
- [vue3-gettext](https://github.com/jshmrtn/vue3-gettext)
110110
- [vue3-ace-editor](https://github.com/CarterLi/vue3-ace-editor)
111111
- [Gonginx](https://github.com/tufanbarisyildirim/gonginx)
112+
- [lego](https://github.com/go-acme/lego)
112113

113114
## Cómo empezar
114115

README-vi_VN.md

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Chúng tôi hoan nghênh bản dịch sang bất kỳ ngôn ngữ nào.
121121
- [vue3-gettext](https://github.com/jshmrtn/vue3-gettext)
122122
- [vue3-ace-editor](https://github.com/CarterLi/vue3-ace-editor)
123123
- [Gonginx](https://github.com/tufanbarisyildirim/gonginx)
124+
- [lego](https://github.com/go-acme/lego)
124125

125126
## Bắt đầu
126127

README-zh_CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Nginx 网络管理界面,由 [0xJacky](https://jackyu.cn/) 与 [Hintay](https
102102
- [vue3-gettext](https://github.com/jshmrtn/vue3-gettext)
103103
- [vue3-ace-editor](https://github.com/CarterLi/vue3-ace-editor)
104104
- [Gonginx](https://github.com/tufanbarisyildirim/gonginx)
105+
- [lego](https://github.com/go-acme/lego)
105106

106107
## 入门指南
107108

README-zh_TW.md

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Nginx 網路管理介面,由 [0xJacky](https://jackyu.cn/) 與 [Hintay](https:
105105
- [vue3-gettext](https://github.com/jshmrtn/vue3-gettext)
106106
- [vue3-ace-editor](https://github.com/CarterLi/vue3-ace-editor)
107107
- [Gonginx](https://github.com/tufanbarisyildirim/gonginx)
108+
- [lego](https://github.com/go-acme/lego)
108109

109110
## 入門指南
110111

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ We welcome translations into any language.
120120
- [vue3-gettext](https://github.com/jshmrtn/vue3-gettext)
121121
- [vue3-ace-editor](https://github.com/CarterLi/vue3-ace-editor)
122122
- [Gonginx](https://github.com/tufanbarisyildirim/gonginx)
123+
- [lego](https://github.com/go-acme/lego)
123124

124125
## Getting Started
125126

api/system/router.go

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ func InitPublicRouter(r *gin.RouterGroup) {
1313
func InitPrivateRouter(r *gin.RouterGroup) {
1414
r.GET("upgrade/release", GetRelease)
1515
r.GET("upgrade/current", GetCurrentVersion)
16+
r.GET("self_check", SelfCheck)
17+
r.POST("self_check/:name/fix", SelfCheckFix)
1618
}
1719

1820
func InitWebSocketRouter(r *gin.RouterGroup) {

api/system/self_check.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package system
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/0xJacky/Nginx-UI/internal/self_check"
7+
"github.com/gin-gonic/gin"
8+
)
9+
10+
func SelfCheck(c *gin.Context) {
11+
report := self_check.Run()
12+
c.JSON(http.StatusOK, report)
13+
}
14+
15+
func SelfCheckFix(c *gin.Context) {
16+
result := self_check.AttemptFix(c.Param("name"))
17+
c.JSON(http.StatusOK, result)
18+
}

app/src/api/self_check.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { CosyError } from '@/lib/http'
2+
import http from '@/lib/http'
3+
4+
export interface Report {
5+
name: string
6+
err?: CosyError
7+
}
8+
9+
const selfCheck = {
10+
run(): Promise<Report[]> {
11+
return http.get('/self_check')
12+
},
13+
fix(taskName: string) {
14+
return http.post(`/self_check/${taskName}/fix`)
15+
},
16+
}
17+
18+
export default selfCheck

app/src/language/ar/app.po

+57-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ msgstr "المصادقة الثنائية"
2121
msgid "2FA Settings"
2222
msgstr "إعدادات المصادقة الثنائية"
2323

24-
#: src/routes/index.ts:283
24+
#: src/routes/index.ts:290
2525
msgid "About"
2626
msgstr "عن"
2727

@@ -199,6 +199,11 @@ msgstr "اطلب المساعدة من ChatGPT"
199199
msgid "Assistant"
200200
msgstr "المساعد"
201201

202+
#: src/views/system/SelfCheck/SelfCheck.vue:50
203+
#, fuzzy
204+
msgid "Attempt to fix"
205+
msgstr "محاولات"
206+
202207
#: src/views/preference/AuthSettings.vue:17
203208
msgid "Attempts"
204209
msgstr "محاولات"
@@ -389,6 +394,26 @@ msgstr "قناة"
389394
msgid "Check again"
390395
msgstr "تحقق مرة أخرى"
391396

397+
#: src/views/system/SelfCheck/tasks.ts:12
398+
msgid "Check if the nginx.conf includes the sites-enabled directory."
399+
msgstr ""
400+
401+
#: src/views/system/SelfCheck/tasks.ts:16
402+
msgid "Check if the nginx.conf includes the streams-enabled directory."
403+
msgstr ""
404+
405+
#: src/views/system/SelfCheck/tasks.ts:4
406+
msgid ""
407+
"Check if the sites-available and sites-enabled directory is under the nginx "
408+
"configuration directory."
409+
msgstr ""
410+
411+
#: src/views/system/SelfCheck/tasks.ts:8
412+
msgid ""
413+
"Check if the streams-available and streams-enabled directory is under the "
414+
"nginx configuration directory."
415+
msgstr ""
416+
392417
#: src/language/constants.ts:13
393418
msgid "Cleaning environment variables"
394419
msgstr "تنظيف متغيرات البيئة"
@@ -1132,7 +1157,7 @@ msgstr "أدخل الرمز من التطبيق:"
11321157
msgid "Input the recovery code:"
11331158
msgstr "أدخل رمز الاسترداد:"
11341159

1135-
#: src/routes/index.ts:305 src/views/other/Install.vue:136
1160+
#: src/routes/index.ts:312 src/views/other/Install.vue:136
11361161
msgid "Install"
11371162
msgstr "تثبيت"
11381163

@@ -1269,7 +1294,7 @@ msgstr "أماكن"
12691294
msgid "Log"
12701295
msgstr "سجل"
12711296

1272-
#: src/routes/index.ts:311 src/views/other/Login.vue:246
1297+
#: src/routes/index.ts:318 src/views/other/Login.vue:246
12731298
msgid "Login"
12741299
msgstr "تسجيل الدخول"
12751300

@@ -1434,6 +1459,14 @@ msgstr "Nginx"
14341459
msgid "Nginx Access Log Path"
14351460
msgstr "مسار سجل الوصول لـ Nginx"
14361461

1462+
#: src/views/system/SelfCheck/tasks.ts:11
1463+
msgid "Nginx Conf Include Sites Enabled"
1464+
msgstr ""
1465+
1466+
#: src/views/system/SelfCheck/tasks.ts:15
1467+
msgid "Nginx Conf Include Streams Enabled"
1468+
msgstr ""
1469+
14371470
#: src/views/site/site_edit/SiteEdit.vue:223
14381471
#: src/views/stream/StreamEdit.vue:207
14391472
msgid "Nginx Configuration Parse Error"
@@ -1512,7 +1545,7 @@ msgstr "سر العقدة"
15121545
msgid "Not After"
15131546
msgstr "ليس بعد"
15141547

1515-
#: src/routes/index.ts:317
1548+
#: src/routes/index.ts:324
15161549
msgid "Not Found"
15171550
msgstr "غير موجود"
15181551

@@ -1813,6 +1846,10 @@ msgstr "يقرأ"
18131846
msgid "Receive"
18141847
msgstr "يستقبل"
18151848

1849+
#: src/views/system/SelfCheck/SelfCheck.vue:42
1850+
msgid "Recheck"
1851+
msgstr ""
1852+
18161853
#: src/components/StdDesign/StdDataDisplay/StdBulkActions.vue:43
18171854
#: src/components/StdDesign/StdDataDisplay/StdTable.vue:544
18181855
msgid "Recover"
@@ -2102,6 +2139,10 @@ msgstr "تم نسخ السر"
21022139
msgid "Selector"
21032140
msgstr "المحدد"
21042141

2142+
#: src/routes/index.ts:283 src/views/system/SelfCheck/SelfCheck.vue:37
2143+
msgid "Self Check"
2144+
msgstr ""
2145+
21052146
#: src/views/dashboard/ServerAnalytic.vue:348
21062147
#: src/views/dashboard/ServerAnalytic.vue:35
21072148
msgid "Send"
@@ -2114,7 +2155,7 @@ msgstr "إرسال"
21142155
#: src/components/StdDesign/StdDataDisplay/StdBatchEdit.vue:53
21152156
#: src/components/StdDesign/StdDataDisplay/StdBulkActions.vue:70
21162157
#: src/components/StdDesign/StdDataDisplay/StdTable.vue:194
2117-
#: src/views/config/components/Mkdir.vue:38
2158+
#: src/lib/http/index.ts:129 src/views/config/components/Mkdir.vue:38
21182159
#: src/views/config/components/Rename.vue:45
21192160
#: src/views/config/ConfigEditor.vue:111
21202161
#: src/views/environment/BatchUpgrader.vue:59
@@ -2184,6 +2225,11 @@ msgstr "فئات الموقع"
21842225
msgid "Site Logs"
21852226
msgstr "سجلات الموقع"
21862227

2228+
#: src/views/system/SelfCheck/tasks.ts:3
2229+
#, fuzzy
2230+
msgid "Sites Directory"
2231+
msgstr "مجلد"
2232+
21872233
#: src/routes/index.ts:56
21882234
msgid "Sites List"
21892235
msgstr "قائمة المواقع"
@@ -2230,6 +2276,11 @@ msgstr "متوقف"
22302276
msgid "Storage"
22312277
msgstr "تخزين"
22322278

2279+
#: src/views/system/SelfCheck/tasks.ts:7
2280+
#, fuzzy
2281+
msgid "Streams Directory"
2282+
msgstr "مجلد"
2283+
22332284
#: src/constants/index.ts:19 src/views/notification/notificationColumns.tsx:36
22342285
msgid "Success"
22352286
msgstr "نجاح"
@@ -2590,7 +2641,7 @@ msgstr "محدث في"
25902641
msgid "Updated successfully"
25912642
msgstr "تم التحديث بنجاح"
25922643

2593-
#: src/routes/index.ts:290 src/views/environment/Environment.vue:55
2644+
#: src/routes/index.ts:297 src/views/environment/Environment.vue:55
25942645
#: src/views/system/Upgrade.vue:145 src/views/system/Upgrade.vue:228
25952646
msgid "Upgrade"
25962647
msgstr "ترقية"

app/src/language/en/app.po

+56-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgstr ""
1717
msgid "2FA Settings"
1818
msgstr ""
1919

20-
#: src/routes/index.ts:283
20+
#: src/routes/index.ts:290
2121
msgid "About"
2222
msgstr "About"
2323

@@ -209,6 +209,10 @@ msgstr ""
209209
msgid "Assistant"
210210
msgstr ""
211211

212+
#: src/views/system/SelfCheck/SelfCheck.vue:50
213+
msgid "Attempt to fix"
214+
msgstr ""
215+
212216
#: src/views/preference/AuthSettings.vue:17
213217
msgid "Attempts"
214218
msgstr ""
@@ -401,6 +405,26 @@ msgstr ""
401405
msgid "Check again"
402406
msgstr ""
403407

408+
#: src/views/system/SelfCheck/tasks.ts:12
409+
msgid "Check if the nginx.conf includes the sites-enabled directory."
410+
msgstr ""
411+
412+
#: src/views/system/SelfCheck/tasks.ts:16
413+
msgid "Check if the nginx.conf includes the streams-enabled directory."
414+
msgstr ""
415+
416+
#: src/views/system/SelfCheck/tasks.ts:4
417+
msgid ""
418+
"Check if the sites-available and sites-enabled directory is under the nginx "
419+
"configuration directory."
420+
msgstr ""
421+
422+
#: src/views/system/SelfCheck/tasks.ts:8
423+
msgid ""
424+
"Check if the streams-available and streams-enabled directory is under the "
425+
"nginx configuration directory."
426+
msgstr ""
427+
404428
#: src/language/constants.ts:13
405429
msgid "Cleaning environment variables"
406430
msgstr ""
@@ -1175,7 +1199,7 @@ msgstr ""
11751199
msgid "Input the recovery code:"
11761200
msgstr ""
11771201

1178-
#: src/routes/index.ts:305 src/views/other/Install.vue:136
1202+
#: src/routes/index.ts:312 src/views/other/Install.vue:136
11791203
msgid "Install"
11801204
msgstr "Install"
11811205

@@ -1327,7 +1351,7 @@ msgstr "Locations"
13271351
msgid "Log"
13281352
msgstr "Login"
13291353

1330-
#: src/routes/index.ts:311 src/views/other/Login.vue:246
1354+
#: src/routes/index.ts:318 src/views/other/Login.vue:246
13311355
msgid "Login"
13321356
msgstr "Login"
13331357

@@ -1496,6 +1520,14 @@ msgstr ""
14961520
msgid "Nginx Access Log Path"
14971521
msgstr ""
14981522

1523+
#: src/views/system/SelfCheck/tasks.ts:11
1524+
msgid "Nginx Conf Include Sites Enabled"
1525+
msgstr ""
1526+
1527+
#: src/views/system/SelfCheck/tasks.ts:15
1528+
msgid "Nginx Conf Include Streams Enabled"
1529+
msgstr ""
1530+
14991531
#: src/views/site/site_edit/SiteEdit.vue:223
15001532
#: src/views/stream/StreamEdit.vue:207
15011533
#, fuzzy
@@ -1579,7 +1611,7 @@ msgstr ""
15791611
msgid "Not After"
15801612
msgstr ""
15811613

1582-
#: src/routes/index.ts:317
1614+
#: src/routes/index.ts:324
15831615
msgid "Not Found"
15841616
msgstr "Not Found"
15851617

@@ -1878,6 +1910,10 @@ msgstr "Reads"
18781910
msgid "Receive"
18791911
msgstr "Receive"
18801912

1913+
#: src/views/system/SelfCheck/SelfCheck.vue:42
1914+
msgid "Recheck"
1915+
msgstr ""
1916+
18811917
#: src/components/StdDesign/StdDataDisplay/StdBulkActions.vue:43
18821918
#: src/components/StdDesign/StdDataDisplay/StdTable.vue:544
18831919
msgid "Recover"
@@ -2193,6 +2229,10 @@ msgstr ""
21932229
msgid "Selector"
21942230
msgstr ""
21952231

2232+
#: src/routes/index.ts:283 src/views/system/SelfCheck/SelfCheck.vue:37
2233+
msgid "Self Check"
2234+
msgstr ""
2235+
21962236
#: src/views/dashboard/ServerAnalytic.vue:348
21972237
#: src/views/dashboard/ServerAnalytic.vue:35
21982238
msgid "Send"
@@ -2205,7 +2245,7 @@ msgstr "Send"
22052245
#: src/components/StdDesign/StdDataDisplay/StdBatchEdit.vue:53
22062246
#: src/components/StdDesign/StdDataDisplay/StdBulkActions.vue:70
22072247
#: src/components/StdDesign/StdDataDisplay/StdTable.vue:194
2208-
#: src/views/config/components/Mkdir.vue:38
2248+
#: src/lib/http/index.ts:129 src/views/config/components/Mkdir.vue:38
22092249
#: src/views/config/components/Rename.vue:45
22102250
#: src/views/config/ConfigEditor.vue:111
22112251
#: src/views/environment/BatchUpgrader.vue:59
@@ -2274,6 +2314,11 @@ msgstr ""
22742314
msgid "Site Logs"
22752315
msgstr "Sites List"
22762316

2317+
#: src/views/system/SelfCheck/tasks.ts:3
2318+
#, fuzzy
2319+
msgid "Sites Directory"
2320+
msgstr "Directive"
2321+
22772322
#: src/routes/index.ts:56
22782323
msgid "Sites List"
22792324
msgstr "Sites List"
@@ -2326,6 +2371,11 @@ msgstr ""
23262371
msgid "Storage"
23272372
msgstr "Storage"
23282373

2374+
#: src/views/system/SelfCheck/tasks.ts:7
2375+
#, fuzzy
2376+
msgid "Streams Directory"
2377+
msgstr "Directive"
2378+
23292379
#: src/constants/index.ts:19 src/views/notification/notificationColumns.tsx:36
23302380
msgid "Success"
23312381
msgstr ""
@@ -2671,7 +2721,7 @@ msgstr "Updated at"
26712721
msgid "Updated successfully"
26722722
msgstr "Saved successfully"
26732723

2674-
#: src/routes/index.ts:290 src/views/environment/Environment.vue:55
2724+
#: src/routes/index.ts:297 src/views/environment/Environment.vue:55
26752725
#: src/views/system/Upgrade.vue:145 src/views/system/Upgrade.vue:228
26762726
msgid "Upgrade"
26772727
msgstr ""

0 commit comments

Comments
 (0)