Prechádzať zdrojové kódy

bugfix: 修复部分已知问题

tuon 1 rok pred
rodič
commit
0d428546b0

+ 7 - 0
README.md

@@ -6,6 +6,13 @@
 - 项目的web前端基于react开发,使用vite构建工具;
 - 后端使用golang语言开发(菜鸟学习中)
 
+## demos and docs
+[在线demo](http://demos.tonyandmoney.cn/nginx-ui/#/) \
+账号: demo \
+密码: demo
+
+[在线文档](https://portal.tonyandmoney.cn/common/notes/html/pages/list?type=nginx-ui)
+
 ## 构建
 项目构建基于docker-compose, 分为两种情况
 - 基础镜像为nginx

+ 6 - 2
src/pages/nginx/components/location/config.json

@@ -212,14 +212,16 @@
           "title": "正则表达式",
           "type": "string",
           "width": 180,
-          "description": "必须填写正则表达式和跳转路径才能生效"
+          "description": "必须填写正则表达式和跳转路径才能生效",
+          "required": false
         },
         {
           "key": "replacement",
           "title": "跳转路径",
           "type": "string",
           "placeholder": "跳转后的内容",
-          "width": 300
+          "width": 300,
+          "required": false
         },
         {
           "width": 120,
@@ -227,6 +229,8 @@
           "title": "flag",
           "type": "select",
           "option": ["last","break","redirect","permanent"],
+          "value": "permanent",
+          "required": false,
           "description": "last: 相当于Apache的【L】标记,表示完成rewrite;\nbreak:本条规则匹配完成即终止,不在匹配后面的任何规则;\nredirect: 返回302临时重定向,浏览器地址栏会显示跳转后的URL地址,爬虫不会更新url;\npermanent:返回301永久重定向,浏览器地址栏会显示跳转后的URL地址,爬虫更新url;"
         }
       ]

+ 2 - 2
src/pages/nginx/components/location/utils.ts

@@ -40,7 +40,7 @@ export const renderLocation = (origin: INginxLocation) => {
     lines.push(`location ${loc.match.regex || ''} ${loc.match.path || '/'} {`)
 
     if (loc.rewrite && loc.rewrite.replacement && loc.rewrite.regex){
-        lines.push(`    rewrite ${loc.rewrite.regex} ${loc.rewrite.replacement} ${loc.rewrite.flag || ''};`)
+        lines.push(`    rewrite ${loc.rewrite.regex} ${loc.rewrite.replacement} ${loc.rewrite.flag || 'permanent'};`)
     }
 
     (loc.add_header || []).forEach(h=>{
@@ -105,4 +105,4 @@ export const renderLocation = (origin: INginxLocation) => {
     lines.push(`####   ${loc.name || loc.id} end...`)
     lines.push('')
     return lines
-}
+}