浏览代码

fix: nil pointer panic occurs before install

0xJacky 2 年之前
父节点
当前提交
9f469c972e
共有 5 个文件被更改,包括 9 次插入4 次删除
  1. 3 2
      frontend/.gitignore
  2. 1 0
      frontend/.yarnrc.yml
  3. 1 1
      frontend/docs/guide/nginx-proxy-example.md
  4. 1 1
      frontend/docs/index.md
  5. 3 0
      server/model/cert.go

+ 3 - 2
frontend/.gitignore

@@ -7,10 +7,13 @@ yarn-error.log*
 pnpm-debug.log*
 pnpm-debug.log*
 lerna-debug.log*
 lerna-debug.log*
 
 
+# deps
 node_modules
 node_modules
 dist
 dist
 dist-ssr
 dist-ssr
 *.local
 *.local
+.vitepress/cache/
+.yarn
 
 
 # Editor directories and files
 # Editor directories and files
 .vscode/*
 .vscode/*
@@ -22,5 +25,3 @@ dist-ssr
 *.njsproj
 *.njsproj
 *.sln
 *.sln
 *.sw?
 *.sw?
-.vitepress/cache
-.yarn

+ 1 - 0
frontend/.yarnrc.yml

@@ -0,0 +1 @@
+nodeLinker: node-modules

+ 1 - 1
frontend/docs/guide/nginx-proxy-example.md

@@ -1,7 +1,7 @@
 # Example of Nginx Reverse Proxy
 # Example of Nginx Reverse Proxy
 
 
 In this guide, we'll walk you through the process of configuring an Nginx server to redirect HTTP traffic to HTTPS and
 In this guide, we'll walk you through the process of configuring an Nginx server to redirect HTTP traffic to HTTPS and
-set up a reverse proxy for the Nginx UI running on http://127.0.0.1:9000/.
+set up a reverse proxy for the Nginx UI running on `http://127.0.0.1:9000/`.
 
 
 ```nginx
 ```nginx
 server {
 server {

+ 1 - 1
frontend/docs/index.md

@@ -12,7 +12,7 @@ hero:
     actions:
     actions:
         -   theme: brand
         -   theme: brand
             text: Get Started
             text: Get Started
-            link: /markdown-examples
+            link: /guide/about
         -   theme: alt
         -   theme: alt
             text: View on Github
             text: View on Github
             link: https://github.com/0xJacky/nginx-ui
             link: https://github.com/0xJacky/nginx-ui

+ 3 - 0
server/model/cert.go

@@ -46,6 +46,9 @@ func (c *Cert) Insert() error {
 
 
 func GetAutoCertList() (c []*Cert) {
 func GetAutoCertList() (c []*Cert) {
 	var t []*Cert
 	var t []*Cert
+	if db == nil {
+		return
+	}
 	db.Where("auto_cert", AutoCertEnabled).Find(&t)
 	db.Where("auto_cert", AutoCertEnabled).Find(&t)
 
 
 	// check if this domain is enabled
 	// check if this domain is enabled