0xJacky преди 1 година
родител
ревизия
8aa9363bbe

+ 2 - 2
.air.toml

@@ -15,9 +15,9 @@ full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
 # Watch these filename extensions.
 include_ext = ["go", "tpl", "tmpl", "html", "toml"]
 # Ignore these filename extensions or directories.
-exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules", "upload", "docs", "resources", .ts", ".vue", ".tsx", ".idea"]
+exclude_dir = ["assets", "tmp", "vendor", "app/node_modules", "upload", "docs", "resources", .ts", ".vue", ".tsx", ".idea"]
 # Watch these directories if you specified.
-include_dir = ["frontend/src/language"]
+include_dir = ["app/src/language"]
 # Exclude files.
 exclude_file = []
 # Exclude specific regular expressions.

+ 17 - 17
.github/workflows/build.yml

@@ -7,8 +7,8 @@ on:
         paths:
             - "**/*.js"
             - "**/*.vue"
-            - "frontend/package.json"
-            - "frontend/.env*"
+            - "app/package.json"
+            - "app/.env*"
             - "**/*.go"
             - "go.mod"
             - "go.sum"
@@ -21,8 +21,8 @@ on:
         paths:
             - "**/*.js"
             - "**/*.vue"
-            - "frontend/package.json"
-            - "frontend/.env*"
+            - "app/package.json"
+            - "app/.env*"
             - "**/*.go"
             - "go.mod"
             - "go.sum"
@@ -35,7 +35,7 @@ on:
             - published
 
 jobs:
-    build_frontend:
+    build_app:
         runs-on: ubuntu-latest
         steps:
             -   name: Checkout
@@ -51,35 +51,35 @@ jobs:
                     corepack enable
                     corepack prepare pnpm@latest --activate
                     pnpm install
-                working-directory: frontend
+                working-directory: app
 
             -   name: Build
                 run: |
                     npx browserslist@latest --update-db
                     pnpm build
-                working-directory: frontend
+                working-directory: app
 
-            -   name: Archive frontend artifacts
+            -   name: Archive app artifacts
                 uses: actions/upload-artifact@v3
                 with:
-                    name: frontend-dist
-                    path: frontend/dist
+                    name: app-dist
+                    path: app/dist
 
             -   name: Prepare publish
                 if: github.event_name == 'release'
                 run: |
-                    cp README*.md frontend/dist
-                    find frontend/dist -printf '%P\n' | tar -C frontend/dist --no-recursion -zcvf frontend-dist.tar.gz -T -
+                    cp README*.md app/dist
+                    find app/dist -printf '%P\n' | tar -C app/dist --no-recursion -zcvf app-dist.tar.gz -T -
 
             -   name: Publish
                 uses: softprops/action-gh-release@v1
                 if: github.event_name == 'release'
                 with:
-                    files: frontend-dist.tar.gz
+                    files: app-dist.tar.gz
 
     build:
         runs-on: ubuntu-latest
-        needs: build_frontend
+        needs: build_app
         strategy:
             matrix:
                 goos: [ linux, darwin ]
@@ -163,11 +163,11 @@ jobs:
                     echo "CXX=${{ env.ARCH_NAME }}-clang++" >> $GITHUB_ENV
                     echo "LD_FLAGS=-w" >> $GITHUB_ENV
 
-            -   name: Download frontend artifacts
+            -   name: Download app artifacts
                 uses: actions/download-artifact@v3
                 with:
-                    name: frontend-dist
-                    path: frontend/dist
+                    name: app-dist
+                    path: app/dist
 
             -   name: Build
                 run: |

+ 2 - 2
README-es.md

@@ -49,7 +49,7 @@ Para consultar la documentación, visite [nginxui.com](https://nginxui.com).
       <a href="#manual-build">Compilación manual</a>
       <ul>
         <li><a href="#prerequisites">Prerequisitos</a></li>
-        <li><a href="#build-frontend">Compilación del Frontend</a></li>
+        <li><a href="#build-app">Compilación del Frontend</a></li>
         <li><a href="#build-backend">Compilación del Backend</a></li>
       </ul>
     </li>
@@ -223,7 +223,7 @@ En plataformas que no tienen una versión de compilación oficial, pueden compil
 
 ### Compilación del Frontend
 
-Ejecute el siguiente comando en el directorio `frontend`.
+Ejecute el siguiente comando en el directorio `app`.
 
 ```shell
 yarn install

+ 1 - 1
README-zh_CN.md

@@ -217,7 +217,7 @@ docker run -dit \
 
 ### 构建前端
 
-请在 `frontend` 目录中执行以下命令。
+请在 `app` 目录中执行以下命令。
 
 ```shell
 yarn install

+ 1 - 1
README-zh_TW.md

@@ -222,7 +222,7 @@ docker run -dit \
 
 ### 建置前端
 
-請在 `frontend` 資料夾中執行以下命令。
+請在 `app` 資料夾中執行以下命令。
 
 ```shell
 yarn install

+ 3 - 3
README.md

@@ -58,7 +58,7 @@ English | [Español](README-es.md) | [简体中文](README-zh_CN.md) | [繁體
       <a href="#manual-build">Manual Build</a>
       <ul>
         <li><a href="#prerequisites">Prerequisites</a></li>
-        <li><a href="#build-frontend">Build Frontend</a></li>
+        <li><a href="#build-app">Build Frontend</a></li>
         <li><a href="#build-backend">Build Backend</a></li>
       </ul>
     </li>
@@ -283,7 +283,7 @@ On platforms that do not have an official build version, they can be built manua
 
 ### Build Frontend
 
-Please execute the following command in `frontend` directory.
+Please execute the following command in `app` directory.
 
 ```shell
 yarn install
@@ -292,7 +292,7 @@ yarn build
 
 ### Build Backend
 
-Please build the frontend first, and then execute the following command in the project root directory.
+Please build the app first, and then execute the following command in the project root directory.
 
 ```shell
 go build -o nginx-ui -v main.go

+ 5 - 5
api/cert.go

@@ -1,7 +1,7 @@
 package api
 
 import (
-	cert2 "github.com/0xJacky/Nginx-UI/internal/cert"
+	"github.com/0xJacky/Nginx-UI/internal/cert"
 	"github.com/0xJacky/Nginx-UI/internal/cert/dns"
 	"github.com/0xJacky/Nginx-UI/internal/logger"
 	"github.com/0xJacky/Nginx-UI/internal/nginx"
@@ -69,7 +69,7 @@ func IssueCert(c *gin.Context) {
 	}(ws)
 
 	// read
-	buffer := &cert2.ConfigPayload{}
+	buffer := &cert.ConfigPayload{}
 
 	err = ws.ReadJSON(buffer)
 
@@ -88,13 +88,13 @@ func IssueCert(c *gin.Context) {
 	logChan := make(chan string, 1)
 	errChan := make(chan error, 1)
 
-	go cert2.IssueCert(buffer, logChan, errChan)
+	go cert.IssueCert(buffer, logChan, errChan)
 
 	go handleIssueCertLogChan(ws, logChan)
 
 	// block, until errChan closes
 	for err = range errChan {
-		errLog := &cert2.AutoCertErrorLog{}
+		errLog := &cert.AutoCertErrorLog{}
 		errLog.SetCertModel(&certModel)
 		errLog.Exit("issue cert", err)
 
@@ -169,7 +169,7 @@ func getCert(c *gin.Context, certModel *model.Cert) {
 			sslCertificationBytes, _ = os.ReadFile(certModel.SSLCertificatePath)
 		}
 
-		pubKey, err := cert2.GetCertInfo(certModel.SSLCertificatePath)
+		pubKey, err := cert.GetCertInfo(certModel.SSLCertificatePath)
 
 		if err != nil {
 			ErrHandler(c, err)

+ 1 - 1
app/package.json

@@ -1,5 +1,5 @@
 {
-  "name": "nginx-ui-frontend-next",
+  "name": "nginx-ui-app-next",
   "private": true,
   "version": "2.0.0-beta.4",
   "type": "commonjs",

+ 1 - 1
app/src/language/es/app.po

@@ -6,7 +6,7 @@ msgstr ""
 "PO-Revision-Date: 2023-09-03 08:56+0000\n"
 "Last-Translator: Kcho <kcholoren@gmail.com>\n"
 "Language-Team: Spanish <https://weblate.nginxui.com/projects/nginx-ui/"
-"frontend/es/>\n"
+"app/es/>\n"
 "Language: es\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

+ 2 - 2
docs/guide/build.md

@@ -16,7 +16,7 @@ You should execute the following command to update browser list database before
 
 ## Build Frontend
 
-Please execute the following command in `frontend` directory.
+Please execute the following command in `app` directory.
 
 ```shell
 yarn install
@@ -27,7 +27,7 @@ yarn build
 ## Build Backend
 
 ::: warning
-Before building the backend, the frontend should be built first because the backend will embed the frontend distribution.
+Before building the backend, the app should be built first because the backend will embed the app distribution.
 :::
 
 Please execute the following command in the project root directory.

+ 1 - 1
docs/guide/nginx-ui-template.md

@@ -103,7 +103,7 @@ location ~ .*\.(jpg|png|js|css)$ {
 }
 ```
 
-When users input variable values in the frontend input boxes, the system will automatically generate new configuration content, as shown below:
+When users input variable values in the app input boxes, the system will automatically generate new configuration content, as shown below:
 
 <img src="/assets/nginx-ui-template/en/config-ui-after-input.png" width="350px" title="Config Modal" />
 

+ 2 - 2
docs/guide/project-structure.md

@@ -6,7 +6,7 @@
 .
 ├─ docs                    # documentations
 ├─ cmd                     # command-line tool
-├─ frontend                # frontend build with vue 3
+├─ app                # app build with vue 3
 ├─ server                  # backend build with golang
 ├─ resources               # additional resources, not for build
 ├─ template                # templates for nginx
@@ -35,7 +35,7 @@
 
 ```
 .
-├─ frontend
+├─ app
 │  ├─ public              # public resources
 │  ├─ src                 # source code
 │  │  ├─ api              # api to backend

+ 1 - 1
docs/zh_CN/guide/build.md

@@ -15,7 +15,7 @@
 
 ## 构建前端
 
-请在 `frontend` 目录中执行以下命令。
+请在 `app` 目录中执行以下命令。
 
 ```shell
 yarn install

+ 2 - 2
docs/zh_CN/guide/project-structure.md

@@ -6,7 +6,7 @@
 .
 ├─ docs                    # 文档目录
 ├─ cmd                     # 命令行工具
-├─ frontend                # 使用 Vue 3 构建的前端
+├─ app                # 使用 Vue 3 构建的前端
 ├─ server                  # 使用 Golang 构建的后端
 ├─ resources               # 其他资源,不参与构建
 ├─ template                # 用于 Nginx 的模板文件
@@ -35,7 +35,7 @@
 
 ```
 .
-├─ frontend
+├─ app
 │  ├─ public              # 公共资源
 │  ├─ src                 # 源代码
 │  │  ├─ api              # 向后端发起请求的 API

+ 1 - 1
docs/zh_TW/guide/build.md

@@ -15,7 +15,7 @@
 
 ## 構建前端
 
-請在 `frontend` 資料夾中執行以下命令。
+請在 `app` 資料夾中執行以下命令。
 
 ```shell
 yarn install

+ 2 - 2
docs/zh_TW/guide/project-structure.md

@@ -6,7 +6,7 @@
 .
 ├─ docs                    # 手冊資料夾
 ├─ cmd                     # 命令列工具
-├─ frontend                # 使用 Vue 3 構建的前端
+├─ app                # 使用 Vue 3 構建的前端
 ├─ server                  # 使用 Golang 構建的後端
 ├─ resources               # 其他資源,不參與構建
 ├─ template                # 用於 Nginx 的模板檔案
@@ -35,7 +35,7 @@
 
 ```
 .
-├─ frontend
+├─ app
 │  ├─ public              # 公共資源
 │  ├─ src                 # 原始碼
 │  │  ├─ api              # 向後端發起請求的 API

+ 14 - 14
router/middleware.go

@@ -1,19 +1,19 @@
 package router
 
 import (
-    "encoding/base64"
-    "github.com/0xJacky/Nginx-UI/app"
-    "github.com/0xJacky/Nginx-UI/internal/logger"
-    "github.com/0xJacky/Nginx-UI/model"
-    "github.com/0xJacky/Nginx-UI/settings"
-    "github.com/gin-contrib/static"
-    "github.com/gin-gonic/gin"
-    "github.com/spf13/cast"
-    "io/fs"
-    "net/http"
-    "path"
-    "runtime"
-    "strings"
+	"encoding/base64"
+	"github.com/0xJacky/Nginx-UI/app"
+	"github.com/0xJacky/Nginx-UI/internal/logger"
+	"github.com/0xJacky/Nginx-UI/model"
+	"github.com/0xJacky/Nginx-UI/settings"
+	"github.com/gin-contrib/static"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/cast"
+	"io/fs"
+	"net/http"
+	"path"
+	"runtime"
+	"strings"
 )
 
 func recovery() gin.HandlerFunc {
@@ -99,7 +99,7 @@ func (f serverFileSystemType) Exists(prefix string, _path string) bool {
 
 func mustFS(dir string) (serverFileSystem static.ServeFileSystem) {
 
-	sub, err := fs.Sub(frontend.DistFS, path.Join("dist", dir))
+	sub, err := fs.Sub(app.DistFS, path.Join("dist", dir))
 
 	if err != nil {
 		logger.Error(err)