fix: build error

This commit is contained in:
0xJacky 2023-11-26 19:01:50 +08:00
parent e5a5889931
commit 8aa9363bbe
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
17 changed files with 58 additions and 58 deletions

View file

@ -15,9 +15,9 @@ full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
# Watch these filename extensions. # Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html", "toml"] include_ext = ["go", "tpl", "tmpl", "html", "toml"]
# Ignore these filename extensions or directories. # 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. # Watch these directories if you specified.
include_dir = ["frontend/src/language"] include_dir = ["app/src/language"]
# Exclude files. # Exclude files.
exclude_file = [] exclude_file = []
# Exclude specific regular expressions. # Exclude specific regular expressions.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,7 +16,7 @@ You should execute the following command to update browser list database before
## Build Frontend ## Build Frontend
Please execute the following command in `frontend` directory. Please execute the following command in `app` directory.
```shell ```shell
yarn install yarn install
@ -27,7 +27,7 @@ yarn build
## Build Backend ## Build Backend
::: warning ::: 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. Please execute the following command in the project root directory.

View file

@ -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" /> <img src="/assets/nginx-ui-template/en/config-ui-after-input.png" width="350px" title="Config Modal" />

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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