diff --git a/Dockerfile b/Dockerfile index f3f79c6f..665dd3ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM alpine:3.20 ENV LANG=zh_CN.UTF-8 \ TZ=Asia/Shanghai \ PS1="\u@\h:\w \$ " -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ - && apk add --update --no-cache \ +# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ +RUN apk add --update --no-cache \ nginx \ nginx-mod-stream \ nginx-mod-http-headers-more \ diff --git a/README.md b/README.md index a04c7339..9a2c26b2 100644 --- a/README.md +++ b/README.md @@ -84,9 +84,9 @@ Path : JDK安装目录\bin ``` Linux: mkdir /home/nginxWebUI/ - wget -O /home/nginxWebUI/nginxWebUI.jar https://file.nginxwebui.cn/nginxWebUI-4.1.4.jar + wget -O /home/nginxWebUI/nginxWebUI.jar https://file.nginxwebui.cn/nginxWebUI-4.1.5.jar -Windows: 直接使用浏览器下载 https://file.nginxwebui.cn/nginxWebUI-4.1.4.jar 到 D:/home/nginxWebUI/nginxWebUI.jar +Windows: 直接使用浏览器下载 https://file.nginxwebui.cn/nginxWebUI-4.1.5.jar 到 D:/home/nginxWebUI/nginxWebUI.jar ``` 有新版本只需要修改路径中的版本即可 @@ -137,6 +137,10 @@ yum install docker ``` docker pull cym1102/nginxwebui:latest + +或者 + +docker pull registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest ``` 3.启动容器: @@ -148,6 +152,15 @@ docker run -itd \ --net=host \ --restart=always \ cym1102/nginxwebui:latest + +或者 + +docker run -itd \ + -v /home/nginxWebUI:/home/nginxWebUI \ + -e BOOT_OPTIONS="--server.port=8080" \ + --net=host \ + --restart=always \ + registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest ``` 注意: @@ -178,6 +191,20 @@ services: privileged: true network_mode: "host" +或者 + +version: "3.2" +services: + nginxWebUi-server: + image: registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest + volumes: + - type: bind + source: "/home/nginxWebUI" + target: "/home/nginxWebUI" + environment: + BOOT_OPTIONS: "--server.port=8080" + privileged: true + network_mode: "host" ``` diff --git a/README_EN.md b/README_EN.md index 09fa453e..f0a22c28 100644 --- a/README_EN.md +++ b/README_EN.md @@ -80,9 +80,9 @@ reboot ``` Linux: mkdir /home/nginxWebUI/ - wget -O /home/nginxWebUI/nginxWebUI.jar https://file.nginxwebui.cn/nginxWebUI-4.1.4.jar + wget -O /home/nginxWebUI/nginxWebUI.jar https://file.nginxwebui.cn/nginxWebUI-4.1.5.jar -Windows: Download directly from your browser https://file.nginxwebui.cn/nginxWebUI-4.1.4.jar into D:/home/nginxWebUI/ +Windows: Download directly from your browser https://file.nginxwebui.cn/nginxWebUI-4.1.5.jar into D:/home/nginxWebUI/ ``` With a new version, you just need to change the version in the path @@ -133,6 +133,10 @@ yum install docker ``` docker pull cym1102/nginxwebui:latest + +or + +docker pull registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest ``` 3.start container @@ -144,6 +148,15 @@ docker run -itd \ --net=host \ --restart=always \ cym1102/nginxwebui:latest + +or + +docker run -itd \ + -v /home/nginxWebUI:/home/nginxWebUI \ + -e BOOT_OPTIONS="--server.port=8080" \ + --net=host \ + --restart=always \ + registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest ``` notice: @@ -173,7 +186,21 @@ services: BOOT_OPTIONS: "--server.port=8080" privileged: true network_mode: "host" + +or +version: "3.2" +services: + nginxWebUi-server: + image: registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest + volumes: + - type: bind + source: "/home/nginxWebUI" + target: "/home/nginxWebUI" + environment: + BOOT_OPTIONS: "--server.port=8080" + privileged: true + network_mode: "host" ``` diff --git a/buildx.sh b/buildx.sh index 8f8d517c..e32dc139 100644 --- a/buildx.sh +++ b/buildx.sh @@ -9,10 +9,9 @@ set -o pipefail ## 基本信息 -repo="cym1102/nginxwebui" -arch="linux/386,linux/amd64,linux/arm64,linux/arm/v7" +arch="linux/amd64,linux/arm64" ver=$(cat pom.xml | grep -A1 nginxWebUI | grep version | grep -oP "\d+\.\d+\.\d+") -echo "构建镜像:$repo" +echo "构建镜像:nginxwebui" echo "构建架构:$arch" echo "构建版本:$ver" @@ -34,8 +33,10 @@ docker buildx build \ --cache-from "type=local,src=/tmp/.buildx-cache" \ --cache-to "type=local,dest=/tmp/.buildx-cache" \ --platform "$arch" \ - --tag ${repo}:${ver} \ - --tag ${repo}:latest \ + --tag cym1102/nginxwebui:${ver} \ + --tag cym1102/nginxwebui:latest \ + --tag registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:${ver} \ + --tag registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest \ --push \ . diff --git a/pom.xml b/pom.xml index 8681ef74..728fcafb 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.cym nginxWebUI - 4.1.4 + 4.1.5 UTF-8 diff --git a/src/main/java/com/cym/controller/adminPage/ExportController.java b/src/main/java/com/cym/controller/adminPage/ExportController.java index eceb6f4b..13107856 100644 --- a/src/main/java/com/cym/controller/adminPage/ExportController.java +++ b/src/main/java/com/cym/controller/adminPage/ExportController.java @@ -10,6 +10,8 @@ import org.noear.solon.annotation.Controller; import org.noear.solon.annotation.Inject; import org.noear.solon.annotation.Mapping; +import org.noear.solon.annotation.Produces; +import org.noear.solon.boot.web.MimeType; import org.noear.solon.core.handle.Context; import org.noear.solon.core.handle.DownloadedFile; import org.noear.solon.core.handle.ModelAndView; @@ -18,11 +20,8 @@ import org.slf4j.LoggerFactory; import com.cym.ext.AsycPack; -import com.cym.model.Cert; -import com.cym.model.CertCode; import com.cym.service.CertService; import com.cym.service.ConfService; -import com.cym.sqlhelper.utils.ConditionAndWrapper; import com.cym.utils.BaseController; import cn.hutool.core.date.DateUtil; @@ -55,9 +54,10 @@ public DownloadedFile dataExport(Context context) { DownloadedFile downloadedFile = new DownloadedFile("application/octet-stream", new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)), date + ".json"); return downloadedFile; } - + + @Produces(MimeType.TEXT_HTML_VALUE) @Mapping(value = "dataImport") - public void dataImport(UploadedFile file, Context context) throws IOException { + public String dataImport(UploadedFile file, Context context) throws IOException { if (file != null) { File tempFile = new File(homeConfig.home + "temp" + File.separator + file.getName().replace("..", "")); FileUtil.mkdir(tempFile.getParentFile()); @@ -69,7 +69,7 @@ public void dataImport(UploadedFile file, Context context) throws IOException { confService.setAsycPack(asycPack); } - context.redirect("/adminPage/export?over=true"); + return " "; } @Mapping("logExport") diff --git a/src/main/java/com/cym/model/Location.java b/src/main/java/com/cym/model/Location.java index dc95a19f..ad567ad9 100644 --- a/src/main/java/com/cym/model/Location.java +++ b/src/main/java/com/cym/model/Location.java @@ -29,10 +29,21 @@ public class Location extends BaseModel { */ @InitValue("0") Integer type; - + @JsonIgnore String locationParamJson; + /** + * 重定向路径 + */ + String returnUrl; + + /** + * 重定向是否携带源路径 0否 1是(默认) + */ + @InitValue("1") + Integer returnPath; + /** * 动态代理目标 (例:http://10.10.10.1:8080/) */ @@ -72,7 +83,7 @@ public class Location extends BaseModel { */ @InitValue("$host") String headerHost; - + /** * 是否开启websocket支持 0否(默认) 1是 */ @@ -89,14 +100,15 @@ public class Location extends BaseModel { * 描述 */ String descr; - - /** - * 重定向路径 - */ - String returnUrl; - - + public Integer getReturnPath() { + return returnPath; + } + + public void setReturnPath(Integer returnPath) { + this.returnPath = returnPath; + } + public String getReturnUrl() { return returnUrl; } diff --git a/src/main/java/com/cym/service/ConfService.java b/src/main/java/com/cym/service/ConfService.java index f14dece8..d1545969 100644 --- a/src/main/java/com/cym/service/ConfService.java +++ b/src/main/java/com/cym/service/ConfService.java @@ -638,7 +638,7 @@ public NgxBlock bulidBlockServer(Server server, ConfExt confExt) { } else if (location.getType() == 4) { // 重定向 ngxParam = new NgxParam(); - ngxParam.addValue("return 301 " + location.getReturnUrl() + "$request_uri"); + ngxParam.addValue("return 301 " + location.getReturnUrl() + (location.getReturnPath() == 1 ? "$request_uri" : "")); ngxBlockLocation.addEntry(ngxParam); } @@ -937,7 +937,7 @@ public void replace(String nginxPath, String nginxContent, List subConte FileUtil.writeString(subContent.get(i), tagert, StandardCharsets.UTF_8); // 清空 } } - + // 写入周边配置文件 ClassPathResource resource = new ClassPathResource("conf.zip"); InputStream inputStream = resource.getStream(); diff --git a/src/main/resources/WEB-INF/view/adminPage/export/index.html b/src/main/resources/WEB-INF/view/adminPage/export/index.html index f02c8ebc..f09c70c6 100644 --- a/src/main/resources/WEB-INF/view/adminPage/export/index.html +++ b/src/main/resources/WEB-INF/view/adminPage/export/index.html @@ -17,7 +17,7 @@ ${menuStr.export} -
+
@@ -35,7 +35,7 @@
- + diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 1f78005a..daf03d44 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -499,6 +499,7 @@ serverStr.portUserdList = \u4EE5\u4E0B\u7AEF\u53E3\u88AB\u5360\u7528 serverStr.protocols = ssl\u534F\u8BAE\u7248\u672C serverStr.proxyTarget = \u4EE3\u7406\u76EE\u6807 serverStr.proxyType = \u4EE3\u7406\u7C7B\u578B +serverStr.returnPath = \u643A\u5E26\u539F\u8DEF\u5F84 serverStr.rewriteListen = \u4ECE\u8BE5\u7AEF\u53E3\u8DF3\u8F6C serverStr.rootModel = root\u6A21\u5F0F serverStr.selectCert = \u9009\u62E9\u5185\u7F6E\u8BC1\u4E66 diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties index 0016f4c4..957f6ec8 100644 --- a/src/main/resources/messages_en_US.properties +++ b/src/main/resources/messages_en_US.properties @@ -499,6 +499,7 @@ serverStr.portUserdList = The following ports are occupied. serverStr.protocols = SSL protocols serverStr.proxyTarget = Proxy target serverStr.proxyType = Proxy type +serverStr.returnPath = With original path serverStr.rewriteListen = Jump from this port serverStr.rootModel = root model serverStr.selectCert = Built-in Certificate diff --git a/src/main/resources/messages_zh_TW.properties b/src/main/resources/messages_zh_TW.properties index 3ee5def1..9bb8c679 100644 --- a/src/main/resources/messages_zh_TW.properties +++ b/src/main/resources/messages_zh_TW.properties @@ -499,6 +499,7 @@ serverStr.portUserdList = \u4EE5\u4E0B\u7AEF\u53E3\u88AB\u5360\u7528 serverStr.protocols = ssl\u5354\u8B70\u7248\u672C serverStr.proxyTarget = \u4EE3\u7406\u76EE\u6A19 serverStr.proxyType = \u4EE3\u7406\u985E\u578B +serverStr.returnPath = \u651C\u5E36\u539F\u8DEF\u5F91 serverStr.rewriteListen = \u5F9E\u8A72\u7AEF\u53E3\u8DF3\u8F49 serverStr.rootModel = root\u6A21\u5F0F serverStr.selectCert = \u9078\u64C7\u5167\u7F6E\u8B49\u66F8 diff --git a/src/main/resources/nginx.conf b/src/main/resources/nginx.conf index 29bc085f..00653c24 100644 --- a/src/main/resources/nginx.conf +++ b/src/main/resources/nginx.conf @@ -1,117 +1,5 @@ - -#user nobody; worker_processes 1; -#error_log logs/error.log; -#error_log logs/error.log notice; -#error_log logs/error.log info; - -#pid logs/nginx.pid; - - events { worker_connections 1024; } - - -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - - #gzip on; - - server { - listen 80; - server_name localhost; - - #charset koi8-r; - - #access_log logs/host.access.log main; - - location / { - root html; - index index.html index.htm; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root html; - } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} - } - - - # another virtual host using mix of IP-, name-, and port-based configuration - # - #server { - # listen 8000; - # listen somename:8080; - # server_name somename alias another.alias; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - - - # HTTPS server - # - #server { - # listen 443 ssl; - # server_name localhost; - - # ssl_certificate cert.pem; - # ssl_certificate_key cert.key; - - # ssl_session_cache shared:SSL:1m; - # ssl_session_timeout 5m; - - # ssl_ciphers HIGH:!aNULL:!MD5; - # ssl_prefer_server_ciphers on; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - -} diff --git a/src/main/resources/static/doc/CertApiController.html b/src/main/resources/static/doc/CertApiController.html index bf24c41c..be6f02a3 100644 --- a/src/main/resources/static/doc/CertApiController.html +++ b/src/main/resources/static/doc/CertApiController.html @@ -6,7 +6,7 @@ nginxWebUI - +