From ad1aa5b2f9e194c84381212fc6f9896810050fe1 Mon Sep 17 00:00:00 2001 From: Hossein Abaiyani <40549604+hosseinabaiyani@users.noreply.github.com> Date: Thu, 11 May 2023 13:08:44 +0330 Subject: [PATCH 1/2] Cleaner Docker file with much lighter base image (#387) * updated dockerfile * updated dockerfile * Update Dockerfile added platform * added iran.dat * added iran.dat --------- Co-authored-by: Hossein Abaiyani --- DockerInit.sh | 22 +++++++++++++++ Dockerfile | 75 +++++++++------------------------------------------ 2 files changed, 35 insertions(+), 62 deletions(-) create mode 100755 DockerInit.sh diff --git a/DockerInit.sh b/DockerInit.sh new file mode 100755 index 00000000..0b83457c --- /dev/null +++ b/DockerInit.sh @@ -0,0 +1,22 @@ +#!/bin/sh +if [ $1 == "amd64" ]; then + ARCH="64"; + FNAME="amd64"; +elif [ $1 == "arm64" ]; then + ARCH="arm64-v8a" + FNAME="arm64"; +else + ARCH="64"; + FNAME="amd64"; +fi +mkdir -p build/bin +cd build/bin +wget "https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-${ARCH}.zip" +unzip "Xray-linux-${ARCH}.zip" +rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat iran.dat +mv xray "xray-linux-${FNAME}" +wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" +wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" +wget "https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat" + +cd ../../ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index be21bd15..6114d548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,69 +1,20 @@ -# Use the official Golang image as the base image -FROM --platform=$BUILDPLATFORM golang:1.20 as builder -ARG TARGETOS TARGETARCH -# Set up the working directory +#Build latest x-ui from source +FROM --platform=$BUILDPLATFORM golang:1.20.4-alpine AS builder WORKDIR /app - -# Copy the Go modules and download the dependencies -COPY go.mod go.sum ./ -RUN go mod download - -# Copy the source code +ARG TARGETARCH +RUN apk --no-cache --update add build-base gcc wget unzip COPY . . +RUN env CGO_ENABLED=1 go build -o build/x-ui main.go +RUN ./DockerInit.sh "$TARGETARCH" -RUN if [ "$TARGETARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-linux-gnu -y; fi - -# Build the X-ui binary -RUN if [ "$TARGETARCH" = "arm64" ]; then \ - CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ - elif [ "$TARGETARCH" = "amd64" ]; then \ - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ - fi - -# Start a new stage using the base image -FROM ubuntu:20.04 - -# Set up the working directory +#Build app image using latest x-ui +FROM alpine +ENV TZ=Asia/Tehran WORKDIR /app -# Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release /app/x-ui/xui-release -COPY x-ui.service /app/x-ui/x-ui.service -COPY x-ui.sh /app/x-ui/x-ui.sh +RUN apk add ca-certificates tzdata -# Set up the runtime environment -RUN apt-get update && apt-get install -y \ - wget \ - unzip \ - tzdata \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /app/x-ui/bin - -# Download and set up the required files -RUN arch=$(uname -m) && \ - if [ "$arch" = "aarch64" ]; then \ - wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ - && unzip Xray-linux-arm64-v8a.zip \ - && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ - && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-arm64; \ - elif [ "$arch" = "x86_64" ]; then \ - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ - && unzip Xray-linux-64.zip \ - && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ - && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-amd64; \ - fi - -WORKDIR /app/x-ui -RUN chmod +x /app/x-ui/x-ui.sh - -# Set the entrypoint -ENTRYPOINT ["/app/x-ui/xui-release"] +COPY --from=builder /app/build/ /app/ +VOLUME [ "/etc/x-ui" ] +ENTRYPOINT [ "/app/x-ui" ] From 7b3628d33b73b448277734f09264bacf10ff6e11 Mon Sep 17 00:00:00 2001 From: Tara Rostami <132676256+TaraRostami@users.noreply.github.com> Date: Thu, 11 May 2023 14:04:35 +0330 Subject: [PATCH 2/2] Optimized Settings UI (#408) * Update custom.css * Update setting.html * Update settings.html * Update antd.min.css * Update antd.min.css * Update settings.html * Update custom.css * Update custom.css * Update antd.min.css * Update setting.html * Update custom.css --- web/assets/ant-design-vue@1.7.2/antd.min.css | 22 ++++++++--------- web/assets/css/custom.css | 26 ++++++++++++++++++-- web/html/xui/component/setting.html | 14 +++++++---- web/html/xui/settings.html | 6 ++--- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/web/assets/ant-design-vue@1.7.2/antd.min.css b/web/assets/ant-design-vue@1.7.2/antd.min.css index 4de7fad0..5b198eaa 100644 --- a/web/assets/ant-design-vue@1.7.2/antd.min.css +++ b/web/assets/ant-design-vue@1.7.2/antd.min.css @@ -1236,18 +1236,18 @@ span.ant-radio+*{padding-right:8px;padding-left:8px} .ant-radio-button-wrapper:first-child{border-left:1px solid #d9d9d9;border-radius:4px 0 0 4px} .ant-radio-button-wrapper:last-child{border-radius:0 4px 4px 0} .ant-radio-button-wrapper:first-child:last-child{border-radius:4px} -.ant-radio-button-wrapper:hover{position:relative;color:#1890ff} +.ant-radio-button-wrapper:hover{position:relative;color:#009670} .ant-radio-button-wrapper:focus-within{outline:3px solid rgba(24,144,255,.06)} .ant-radio-button-wrapper .ant-radio-inner,.ant-radio-button-wrapper input[type=checkbox],.ant-radio-button-wrapper input[type=radio]{width:0;height:0;opacity:0;pointer-events:none} -.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){z-index:1;color:#1890ff;background:#fff;border-color:#1890ff;box-shadow:-1px 0 0 0 #1890ff} -.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before{background-color:#1890ff!important;opacity:.1} -.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child{border-color:#1890ff;box-shadow:none!important} -.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{color:#40a9ff;border-color:#40a9ff;box-shadow:-1px 0 0 0 #40a9ff} -.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active{color:#096dd9;border-color:#096dd9;box-shadow:-1px 0 0 0 #096dd9} +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){z-index:1;color:#009670;background:#fff;border-color:#009670;box-shadow:-1px 0 0 0 #009670} +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before{background-color:#009670!important;opacity:.1} +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child{border-color:#009670;box-shadow:none!important} +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{color:#009670;border-color:#009670;box-shadow:-1px 0 0 0 #009670} +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active{color:#076e54;border-color:#076e54;box-shadow:-1px 0 0 0 #076e54} .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within{outline:3px solid rgba(24,144,255,.06)} -.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){color:#fff;background:#1890ff;border-color:#1890ff} -.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{color:#fff;background:#40a9ff;border-color:#40a9ff} -.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active{color:#fff;background:#096dd9;border-color:#096dd9} +.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){color:#fff;background:#009670;border-color:#009670} +.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{color:#fff;background:#009670;border-color:#009670} +.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active{color:#fff;background:#076e54;border-color:#076e54} .ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within{outline:3px solid rgba(24,144,255,.06)} .ant-radio-button-wrapper-disabled{cursor:not-allowed} .ant-radio-button-wrapper-disabled,.ant-radio-button-wrapper-disabled:first-child,.ant-radio-button-wrapper-disabled:hover{color:rgba(0,0,0,.25);background-color:#f5f5f5;border-color:#d9d9d9} @@ -1357,7 +1357,7 @@ to{transform:scale(1.6);opacity:0} .ant-tabs-vertical.ant-tabs-card.ant-tabs-right .ant-tabs-card-bar.ant-tabs-right-bar .ant-tabs-tab-active{margin-left:-1px;padding-left:18px} .ant-tabs .ant-tabs-card-bar.ant-tabs-bottom-bar .ant-tabs-tab{height:auto;border-top:0;border-bottom:1px solid #e8e8e8;border-radius:0 0 4px 4px} .ant-tabs .ant-tabs-card-bar.ant-tabs-bottom-bar .ant-tabs-tab-active{padding-top:1px;padding-bottom:0;color:#1890ff} -.ant-tabs{box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,.65);font-size:14px;font-variant:tabular-nums;line-height:1.5;list-style:none;font-feature-settings:"tnum";position:relative;overflow:hidden;zoom:1;border-radius:1.5rem;box-shadow:0 1px 7px -1px #0000005c;transition:all .3s;background-color: white} +.ant-tabs{box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,.65);font-size:14px;font-variant:tabular-nums;line-height:1.5;list-style:none;font-feature-settings:"tnum";position:relative;overflow:hidden;zoom:1;border-radius:1.5rem;/*box-shadow:0 1px 7px -1px #0000005c;*/transition:all .3s;background-color: white} .ant-tabs:hover{box-shadow:0 3px 12px -.8px #0000005c} .ant-tabs:after,.ant-tabs:before{display:table;content:""} .ant-tabs:after{clear:both} @@ -2980,7 +2980,7 @@ textarea.ant-time-picker-input{max-width:100%;height:auto;min-height:32px;line-h .ant-divider,.ant-divider-vertical{position:relative;top:-.06em;display:inline-block;width:1px;height:.9em;margin:0 8px;vertical-align:middle} .ant-divider-horizontal{display:block;clear:both;width:100%;min-width:100%;height:1px;margin:24px 0} .ant-divider-horizontal.ant-divider-with-text-center,.ant-divider-horizontal.ant-divider-with-text-left,.ant-divider-horizontal.ant-divider-with-text-right{display:table;margin:0 0;color:rgba(0,0,0,.85);font-weight:500;font-size:16px;white-space:nowrap;text-align:center;background:0 0} -.ant-divider-horizontal.ant-divider-with-text-center:after,.ant-divider-horizontal.ant-divider-with-text-center:before,.ant-divider-horizontal.ant-divider-with-text-left:after,.ant-divider-horizontal.ant-divider-with-text-left:before,.ant-divider-horizontal.ant-divider-with-text-right:after,.ant-divider-horizontal.ant-divider-with-text-right:before{position:relative;top:50%;display:table-cell;width:50%;border-top:1px solid rgb(0 150 112);transform:translateY(50%);content:""} +.ant-divider-horizontal.ant-divider-with-text-center:after,.ant-divider-horizontal.ant-divider-with-text-center:before,.ant-divider-horizontal.ant-divider-with-text-left:after,.ant-divider-horizontal.ant-divider-with-text-left:before,.ant-divider-horizontal.ant-divider-with-text-right:after,.ant-divider-horizontal.ant-divider-with-text-right:before{position:relative;top:50%;display:table-cell;width:50%;border-top:1px solid rgb(0 150 112 / 50%);transform:translateY(50%);content:""} .ant-divider-horizontal.ant-divider-with-text-left .ant-divider-inner-text,.ant-divider-horizontal.ant-divider-with-text-right .ant-divider-inner-text{display:inline-block;padding:0 10px} .ant-divider-horizontal.ant-divider-with-text-left:before{top:50%;width:5%} .ant-divider-horizontal.ant-divider-with-text-left:after,.ant-divider-horizontal.ant-divider-with-text-right:before{top:50%;width:95%} diff --git a/web/assets/css/custom.css b/web/assets/css/custom.css index 7cdfe711..e726d087 100644 --- a/web/assets/css/custom.css +++ b/web/assets/css/custom.css @@ -198,7 +198,29 @@ body { .ant-card-dark:hover { border-color: #e8e8e8; - box-shadow: 0 1px 10px -1px rgb(76, 88, 126); + box-shadow: 0 1px 10px -1px rgb(154 175 238 / 70%); +} + +.ant-setting-textarea { + margin-top: 1.5rem; + min-height: 300px !important; + /*max-height: 800px !important;*/ +} + +.ant-card-dark-box-nohover{ + padding: 0 20px 20px !important; + box-shadow: 0 1px 10px -1px rgb(154 175 238 / 0%) !important; +} +.ant-card-dark-box-nohover:hover{ + box-shadow: 0 1px 10px -1px rgb(154 175 238 / 0%) !important; + /*background-color: rgb(36 44 58 / 50%);*/ +} + +.ant-card-dark-securitybox-nohover{ + box-shadow: 0 1px 10px -1px rgb(154 175 238 / 0%) !important; +} +.ant-card-dark-securitybox-nohover:hover{ + box-shadow: 0 1px 10px -1px rgb(154 175 238 / 0%) !important; } /* .ant-card-bordered:hover { @@ -393,7 +415,7 @@ body { } .ant-card-dark .ant-radio-button-wrapper:hover { - color: #177ddc; + color: #009670; } .ant-card-dark .ant-btn-primary { diff --git a/web/html/xui/component/setting.html b/web/html/xui/component/setting.html index efd61684..568f03de 100644 --- a/web/html/xui/component/setting.html +++ b/web/html/xui/component/setting.html @@ -1,6 +1,13 @@ {{define "component/settingListItem"}} - + + + + + + + + @@ -11,9 +18,6 @@ - @@ -29,4 +33,4 @@ template: `{{template "component/settingListItem"}}`, }); -{{end}} \ No newline at end of file +{{end}} diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index b35b2ac9..d50822c2 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -36,7 +36,7 @@ {{ i18n "pages.settings.save" }} {{ i18n "pages.settings.restartPanel" }} - + @@ -75,7 +75,7 @@ - + @@ -139,7 +139,7 @@ {{ i18n "pages.settings.templates.title"}} - +