diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index d4357541..178b2c71 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -67,6 +67,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} provenance: false sbom: false + outputs: oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true,type=image image-build-debian: name: image-build-debian runs-on: ubuntu-22.04 @@ -121,6 +122,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} provenance: false sbom: false + outputs: oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true,type=image image-build-builder: name: image-build-builder runs-on: ubuntu-22.04 @@ -173,3 +175,4 @@ jobs: labels: ${{ steps.meta.outputs.labels }} provenance: false sbom: false + outputs: oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true,type=image diff --git a/Makefile b/Makefile index 82c50694..189036c3 100644 --- a/Makefile +++ b/Makefile @@ -78,10 +78,10 @@ endif ## Docker: docker-build: ## Use the dockerfile to build the sigma image - docker buildx build --build-arg USE_MIRROR=$(USE_MIRROR) -f build/Dockerfile --platform $(DOCKER_PLATFORMS) --progress plain --output type=docker,name=$(DOCKER_REGISTRY)/$(BINARY_NAME):latest,push=false,oci-mediatypes=true . + docker buildx build --build-arg USE_MIRROR=$(USE_MIRROR) -f build/Dockerfile --platform $(DOCKER_PLATFORMS) --progress plain --output type=docker,name=$(DOCKER_REGISTRY)/$(BINARY_NAME):latest,push=false,oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true . docker-build-builder: ## Use the dockerfile to build the sigma-builder image - docker buildx build --build-arg USE_MIRROR=$(USE_MIRROR) -f build/Dockerfile.builder --platform $(DOCKER_PLATFORMS) --progress plain --output type=docker,name=$(DOCKER_REGISTRY)/$(BINARY_NAME)-builder:latest,push=false,oci-mediatypes=true . + docker buildx build --build-arg USE_MIRROR=$(USE_MIRROR) -f build/Dockerfile.builder --platform $(DOCKER_PLATFORMS) --progress plain --output type=docker,name=$(DOCKER_REGISTRY)/$(BINARY_NAME)-builder:latest,push=false,oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true . ## Misc: migration-create: ## Create a new migration file diff --git a/build/Dockerfile b/build/Dockerfile index e2e9a9dc..6b0cd961 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -34,7 +34,6 @@ FROM alpine:${ALPINE_VERSION} as trivy ARG USE_MIRROR=false ARG TRIVY_VERSION=0.49.0 -ARG ORAS_VERSION=1.0.0 ARG TARGETOS TARGETARCH SHELL ["/bin/ash", "-eo", "pipefail", "-c"] @@ -51,16 +50,9 @@ RUN set -eux && \ tar -xzf trivy_"${TRIVY_VERSION}"_"${TRIVYOS}"-"${TRIVYARCH}".tar.gz && \ mv trivy /usr/local/bin/trivy && \ rm trivy_"${TRIVY_VERSION}"_"${TRIVYOS}"-"${TRIVYARCH}".tar.gz && \ - wget -q -O oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz https://github.com/oras-project/oras/releases/download/v"${ORAS_VERSION}"/oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - tar -xzf oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - mv oras /usr/local/bin/oras && \ - rm oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - oras pull ghcr.io/aquasecurity/trivy-db:2 && \ mkdir -p /opt/trivy/ && \ - mv ./db.tar.gz /opt/trivy/db.tar.gz && \ - cd /opt/trivy && \ - tar -xzf db.tar.gz && \ - rm db.tar.gz + trivy --cache-dir /opt/trivy/ image --download-java-db-only --no-progress && \ + trivy --cache-dir /opt/trivy/ image --download-db-only --no-progress FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION} as builder @@ -99,8 +91,7 @@ RUN set -eux && \ COPY --from=syft /usr/local/bin/syft /usr/local/bin/syft COPY --from=trivy /usr/local/bin/trivy /usr/local/bin/trivy -COPY --from=trivy /opt/trivy/trivy.db /opt/trivy/db/trivy.db -COPY --from=trivy /opt/trivy/metadata.json /opt/trivy/db/metadata.json +COPY --from=trivy /opt/trivy/ /opt/trivy/ COPY ./conf/config.yaml /etc/sigma/config.yaml COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma /usr/local/bin/sigma diff --git a/build/Dockerfile.debian b/build/Dockerfile.debian index b3856ba6..7f101e24 100644 --- a/build/Dockerfile.debian +++ b/build/Dockerfile.debian @@ -35,7 +35,6 @@ FROM alpine:${ALPINE_VERSION} as trivy ARG USE_MIRROR=false ARG TRIVY_VERSION=0.49.0 -ARG ORAS_VERSION=1.0.0 ARG TARGETOS TARGETARCH RUN set -eux && \ @@ -50,16 +49,9 @@ RUN set -eux && \ tar -xzf trivy_"${TRIVY_VERSION}"_"${TRIVYOS}"-"${TRIVYARCH}".tar.gz && \ mv trivy /usr/local/bin/trivy && \ rm trivy_"${TRIVY_VERSION}"_"${TRIVYOS}"-"${TRIVYARCH}".tar.gz && \ - wget -q -O oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz https://github.com/oras-project/oras/releases/download/v"${ORAS_VERSION}"/oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - tar -xzf oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - mv oras /usr/local/bin/oras && \ - rm oras_"${ORAS_VERSION}"_"${TARGETOS}"_"${TARGETARCH}".tar.gz && \ - oras pull ghcr.io/aquasecurity/trivy-db:2 && \ mkdir -p /opt/trivy/ && \ - mv ./db.tar.gz /opt/trivy/db.tar.gz && \ - cd /opt/trivy && \ - tar -xzf db.tar.gz && \ - rm db.tar.gz + trivy --cache-dir /opt/trivy/ image --download-java-db-only --no-progress && \ + trivy --cache-dir /opt/trivy/ image --download-db-only --no-progress FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION} as builder @@ -123,8 +115,7 @@ RUN set -eux && \ COPY --from=syft /usr/local/bin/syft /usr/local/bin/syft COPY --from=trivy /usr/local/bin/trivy /usr/local/bin/trivy -COPY --from=trivy /opt/trivy/trivy.db /opt/trivy/db/trivy.db -COPY --from=trivy /opt/trivy/metadata.json /opt/trivy/db/metadata.json +COPY --from=trivy /opt/trivy/ /opt/trivy/ COPY ./conf/config.yaml /etc/sigma/config.yaml COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma /usr/local/bin/sigma diff --git a/conf/config-dev.yaml b/conf/config-dev.yaml index 00fd009a..5d547389 100644 --- a/conf/config-dev.yaml +++ b/conf/config-dev.yaml @@ -75,7 +75,7 @@ http: # in docker-compose, it will be set to the registry service which is used to pull image from registry, eg: http://registry:3000 # if http.tls.enabled is true, internalEndpoint should start with https:// # eg: http://sigma.test.io, http://sigma.test.io:3000, https://sigma.test.io:30080 - internalEndpoint: http://10.3.197.34:3000 + internalEndpoint: http://192.168.0.102:3000 # eg: http://sigma-distribution:3000 internalDistributionEndpoint: tls: diff --git a/go.mod b/go.mod index 422cc178..5fd545a0 100644 --- a/go.mod +++ b/go.mod @@ -5,18 +5,18 @@ go 1.21.6 require ( code.gitea.io/sdk/gitea v0.17.1 github.com/BurntSushi/toml v1.3.2 - github.com/IBM/sarama v1.42.1 + github.com/IBM/sarama v1.42.2 github.com/Masterminds/sprig/v3 v3.2.3 github.com/alicebob/miniredis/v2 v2.31.1 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible github.com/anchore/syft v0.101.0 github.com/aquasecurity/trivy v0.49.0 - github.com/aws/aws-sdk-go v1.50.13 + github.com/aws/aws-sdk-go v1.50.17 github.com/bytedance/json v0.0.0-20190516032711-0d89175f1949 github.com/caarlos0/env/v9 v9.0.0 github.com/casbin/casbin/v2 v2.82.0 github.com/casbin/gorm-adapter/v3 v3.20.0 - github.com/containers/podman/v4 v4.9.2 + github.com/containers/podman/v4 v4.9.3 github.com/deckarep/golang-set/v2 v2.6.0 github.com/distribution/distribution/v3 v3.0.0-alpha.1 github.com/distribution/reference v0.5.0 @@ -67,9 +67,9 @@ require ( github.com/xanzy/go-gitlab v0.97.0 go.uber.org/mock v0.4.0 golang.org/x/crypto v0.19.0 - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a golang.org/x/net v0.21.0 - golang.org/x/oauth2 v0.16.0 + golang.org/x/oauth2 v0.17.0 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.5.4 gorm.io/driver/postgres v1.5.6 @@ -148,7 +148,7 @@ require ( github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect - github.com/eapache/go-resiliency v1.4.0 // indirect + github.com/eapache/go-resiliency v1.5.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect @@ -281,7 +281,7 @@ require ( github.com/pborman/indent v1.2.1 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/pierrec/lz4/v4 v4.1.18 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pkg/profile v1.7.0 // indirect @@ -346,13 +346,13 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/mod v0.14.0 // indirect + golang.org/x/mod v0.15.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.17.0 // indirect + golang.org/x/tools v0.18.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect diff --git a/go.sum b/go.sum index b5f2dc6f..ac1a400b 100644 --- a/go.sum +++ b/go.sum @@ -109,8 +109,8 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= -github.com/IBM/sarama v1.42.1 h1:wugyWa15TDEHh2kvq2gAy1IHLjEjuYOYgXz/ruC/OSQ= -github.com/IBM/sarama v1.42.1/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ= +github.com/IBM/sarama v1.42.2 h1:VoY4hVIZ+WQJ8G9KNY/SQlWguBQXQ9uvFPOnrcu8hEw= +github.com/IBM/sarama v1.42.2/go.mod h1:FLPGUGwYqEs62hq2bVG6Io2+5n+pS6s/WOXVKWSLFtE= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -219,8 +219,8 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.50.13 h1:yeXram2g7q8uKkQkAEeZyk9FmPzxI4UpGwAZGZtEGmM= -github.com/aws/aws-sdk-go v1.50.13/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.50.17 h1:KsbzUKDgGNlkDHGvoQDhiJ63a9jtZd+O+/s3pTOr/ns= +github.com/aws/aws-sdk-go v1.50.17/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= github.com/aws/aws-sdk-go-v2/config v1.26.6 h1:Z/7w9bUqlRI0FFQpetVuFYEsjzE3h7fpU6HuGmfPL/o= @@ -455,8 +455,8 @@ github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgU github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= github.com/containers/ocicrypt v1.1.9 h1:2Csfba4jse85Raxk5HIyEk8OwZNjRvfkhEGijOjIdEM= github.com/containers/ocicrypt v1.1.9/go.mod h1:dTKx1918d8TDkxXvarscpNVY+lyPakPNFN4jwA9GBys= -github.com/containers/podman/v4 v4.9.2 h1:qURD2JZ//J/CaUSgu3lnYoKULfyxY39IdfDcv3H3Yts= -github.com/containers/podman/v4 v4.9.2/go.mod h1:J2qLop+mWjAOxh0QQyYPdnPA3jI6ay2eU0OKakgMniQ= +github.com/containers/podman/v4 v4.9.3 h1:3tEnvIqijxBYtILRdHcbn0UNHAyUiQ1Y5hcvkYmutZA= +github.com/containers/podman/v4 v4.9.3/go.mod h1:J2qLop+mWjAOxh0QQyYPdnPA3jI6ay2eU0OKakgMniQ= github.com/containers/psgo v1.8.0 h1:2loGekmGAxM9ir5OsXWEfGwFxorMPYnc6gEDsGFQvhY= github.com/containers/psgo v1.8.0/go.mod h1:T8ZxnX3Ur4RvnhxFJ7t8xJ1F48RhiZB4rSrOaR/qGHc= github.com/containers/storage v1.43.0/go.mod h1:uZ147thiIFGdVTjMmIw19knttQnUCl3y9zjreHrg11s= @@ -568,8 +568,8 @@ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:Htrtb github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/eapache/go-resiliency v1.4.0 h1:3OK9bWpPk5q6pbFAaYSEwD9CLUSHG8bnZuqX2yMt3B0= -github.com/eapache/go-resiliency v1.4.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= +github.com/eapache/go-resiliency v1.5.0 h1:dRsaR00whmQD+SgVKlq/vCRFNgtEb5yppyeVos3Yce0= +github.com/eapache/go-resiliency v1.5.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 h1:Oy0F4ALJ04o5Qqpdz8XLIpNA3WM/iSIXqxtqo7UGVws= github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= @@ -1390,8 +1390,8 @@ github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6 github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= -github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= @@ -1840,8 +1840,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1870,8 +1870,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1956,8 +1956,8 @@ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2213,8 +2213,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/consts/consts.go b/pkg/consts/consts.go index bf3707e7..f63bd43f 100644 --- a/pkg/consts/consts.go +++ b/pkg/consts/consts.go @@ -64,6 +64,8 @@ const ( InsertBatchSize = 10 // MaxNamespaceMember ... MaxNamespaceMember = 10 + // MaxWebhooks ... + MaxWebhooks = 5 // ObsPresignMaxTtl ObsPresignMaxTtl = time.Minute * 30 ) diff --git a/pkg/handlers/webhooks/webhooks_post.go b/pkg/handlers/webhooks/webhooks_post.go index 063c1157..2327e5f4 100644 --- a/pkg/handlers/webhooks/webhooks_post.go +++ b/pkg/handlers/webhooks/webhooks_post.go @@ -72,7 +72,7 @@ func (h *handler) PostWebhook(c echo.Context) error { log.Error().Err(err).Msg("Get webhook count failed") return xerrors.NewHTTPError(c, xerrors.HTTPErrCodeInternalError, err.Error()) } - if total > 5 { + if total > consts.MaxWebhooks { log.Error().Int64("total", total).Msg("Reached the maximum webhooks") return xerrors.NewHTTPError(c, xerrors.HTTPErrCodeBadRequest, "Reached the maximum webhooks") } diff --git a/web/package.json b/web/package.json index 1c5ccfb9..74005bf2 100644 --- a/web/package.json +++ b/web/package.json @@ -52,5 +52,11 @@ "typescript": "^5.3.3", "vite": "^5.1.1" }, - "packageManager": "yarn@4.0.2" + "packageManager": "yarn@4.0.2", + "importSort": { + ".js, .jsx, .es6, .es, .mjs, .ts, .tsx": { + "parser": "babylon", + "style": "renke" + } + } } diff --git a/web/src/App.tsx b/web/src/App.tsx index b477830d..6796995d 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -14,36 +14,31 @@ * limitations under the License. */ -import { Toaster } from 'react-hot-toast'; +import { Route, Routes, useNavigate } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; -import { Routes, Route, useNavigate } from 'react-router-dom'; +import { Toaster } from 'react-hot-toast'; -import Tag from "./pages/Tag"; +import BuilderRunnerList from './pages/Builder/RunnerList'; +import BuilderRunnerLog from './pages/Builder/RunnerLog'; +import BuildersSetup from './pages/Builder/Setup'; +import CodeRepositoryHome from './pages/CodeRepository'; +import CodeRepositoryList from './pages/CodeRepository/List'; +import DaemonTaskRecords from "./pages/DaemonTask/Records"; +import DaemonTaskRunners from "./pages/DaemonTask/Runners"; +import DaemonTasks from "./pages/DaemonTask/Tasks"; import Home from "./pages/Home"; import Login from "./pages/Login"; -import Namespaces from "./pages/Namespace"; -import Repositories from "./pages/Repository"; -import Summary from './pages/Repository/Summary'; import LoginCallback from './pages/Login/Callback'; import NamespaceMember from "./pages/Namespace/Member"; import NamespaceSummary from "./pages/Namespace/Summary"; import NamespaceWebhooks from "./pages/Namespace/Webhook"; - -import DaemonTasks from "./pages/DaemonTask/Tasks"; -import DaemonTaskRunners from "./pages/DaemonTask/Runners"; -import DaemonTaskRecords from "./pages/DaemonTask/Records"; - -import CodeRepositoryHome from './pages/CodeRepository'; -import CodeRepositoryList from './pages/CodeRepository/List'; - -import BuildersSetup from './pages/Builder/Setup'; -import BuilderRunnerList from './pages/Builder/RunnerList'; -import BuilderRunnerLog from './pages/Builder/RunnerLog'; - +import Namespaces from "./pages/Namespace"; +import Repositories from "./pages/Repository"; import Setting from './pages/Setting'; import SettingUsers from './pages/Setting/Users'; - -import { setupAxiosInterceptor } from './utils/request' +import Summary from './pages/Repository/Summary'; +import Tag from "./pages/Tag"; +import { setupAxiosInterceptor } from './utils/request'; const localServer = process.env.NODE_ENV === "development" ? "http://127.0.0.1:3000" : ""; // const localServer = process.env.NODE_ENV === "development" ? "https://sigma.tosone.cn" : ""; diff --git a/web/src/components/Footer/index.tsx b/web/src/components/Footer/index.tsx index beb6c9ad..d88b2548 100644 --- a/web/src/components/Footer/index.tsx +++ b/web/src/components/Footer/index.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ +import { AiOutlineGithub, AiOutlineTwitter } from "react-icons/ai"; import { Link } from "react-router-dom"; -import { AiOutlineTwitter, AiOutlineGithub } from "react-icons/ai"; export default function Footer() { return ( diff --git a/web/src/components/Menu/index.tsx b/web/src/components/Menu/index.tsx index c003c5ad..f79a40f3 100644 --- a/web/src/components/Menu/index.tsx +++ b/web/src/components/Menu/index.tsx @@ -16,15 +16,15 @@ import _ from 'lodash'; import axios from "axios"; -import { useClickAway } from 'react-use'; import { Dialog, Transition } from "@headlessui/react"; import { Fragment, useEffect, useRef, useState } from "react"; -import { Link, useSearchParams, useNavigate } from 'react-router-dom'; +import { Link, useNavigate, useSearchParams } from 'react-router-dom'; +import { useClickAway } from 'react-use'; import Regex from "../../utils/regex"; import Toast from "../../components/Notification"; +import { IEndpoint, IHTTPError, INamespaceItem, INamespaceList, ISystemConfig, IUserSelf, IVersion } from "../../interfaces"; import { setupAutoRefreshToken, teardownAutoRefreshToken } from "../../utils/refreshToken" -import { INamespaceItem, INamespaceList, IHTTPError, IUserSelf, IEndpoint, IVersion, ISystemConfig } from "../../interfaces"; export default function ({ localServer, item, namespace, namespace_id, repository, repository_id, tag, selfClick }: { localServer: string, item: string, namespace?: string, namespace_id?: string, repository?: string, repository_id?: string, tag?: string, selfClick?: boolean }) { const [showProfileMenu, setShowProfileMenu] = useState(false); diff --git a/web/src/components/Notification/index.tsx b/web/src/components/Notification/index.tsx index 5f5951d1..a91a828b 100644 --- a/web/src/components/Notification/index.tsx +++ b/web/src/components/Notification/index.tsx @@ -14,13 +14,13 @@ * limitations under the License. */ +import "./index.css"; + +import { ExclamationTriangleIcon, InboxIcon } from '@heroicons/react/24/outline'; import { toast } from 'react-toastify'; -import { InboxIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline'; import { INotification } from "../../interfaces"; -import "./index.css"; - export default function (noti: INotification) { const id = toast('fake-toast', { position: "top-right", diff --git a/web/src/components/svg/docker.tsx b/web/src/components/svg/docker.tsx index e88ce493..856ca8eb 100644 --- a/web/src/components/svg/docker.tsx +++ b/web/src/components/svg/docker.tsx @@ -15,14 +15,14 @@ */ export default function () { - return ( - - + - + - ); + ); } diff --git a/web/src/main.tsx b/web/src/main.tsx index c746fcbb..13827236 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -14,19 +14,19 @@ * limitations under the License. */ -import ReactDOM from 'react-dom/client'; -import { HashRouter as Router } from 'react-router-dom'; import 'react-toastify/dist/ReactToastify.css'; +import './index.css'; + +import ReactDOM from 'react-dom/client'; import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc'; -import timezone from 'dayjs/plugin/timezone'; import relativeTime from 'dayjs/plugin/relativeTime'; +import timezone from 'dayjs/plugin/timezone'; +import utc from 'dayjs/plugin/utc'; +import { HashRouter as Router } from 'react-router-dom'; import App from './App'; -import './index.css'; - dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(relativeTime); diff --git a/web/src/pages/Builder/RunnerList.tsx b/web/src/pages/Builder/RunnerList.tsx index 131e112b..ac4f7cd8 100644 --- a/web/src/pages/Builder/RunnerList.tsx +++ b/web/src/pages/Builder/RunnerList.tsx @@ -16,21 +16,28 @@ import axios from "axios"; import dayjs from "dayjs"; -import { Tooltip } from 'flowbite'; -import { useNavigate } from 'react-router-dom'; -import { Fragment, useEffect, useState } from "react"; import { Dialog, Transition } from "@headlessui/react"; +import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from "react-helmet-async"; -import { Link, useSearchParams, useParams } from "react-router-dom"; +import { Link, useParams, useSearchParams } from "react-router-dom"; +import { Tooltip } from 'flowbite'; +import { useNavigate } from 'react-router-dom'; -import Settings from "../../Settings"; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; -import Toast from "../../components/Notification"; -import Pagination from "../../components/Pagination"; +import Menu from "../../components/Menu"; import OrderHeader from "../../components/OrderHeader"; - -import { IRepositoryItem, IHTTPError, IBuilderItem, IOrder, IBuilderRunnerItem, IBuilderRunnerList, IRunOrRerunRunnerResponse } from "../../interfaces"; +import Pagination from "../../components/Pagination"; +import Settings from "../../Settings"; +import Toast from "../../components/Notification"; +import { + IBuilderItem, + IBuilderRunnerItem, + IBuilderRunnerList, + IHTTPError, + IOrder, + IRepositoryItem, + IRunOrRerunRunnerResponse +} from "../../interfaces"; export default function ({ localServer }: { localServer: string }) { const navigate = useNavigate(); diff --git a/web/src/pages/Builder/RunnerLog.tsx b/web/src/pages/Builder/RunnerLog.tsx index 94c8e57a..a95e3e0a 100644 --- a/web/src/pages/Builder/RunnerLog.tsx +++ b/web/src/pages/Builder/RunnerLog.tsx @@ -17,17 +17,18 @@ import 'xterm/css/xterm.css'; import axios from "axios"; -import { Terminal } from "xterm"; -import { FitAddon } from "xterm-addon-fit"; -import { useState, useEffect } from 'react'; -import { useNavigate } from 'react-router-dom'; import { AttachAddon } from 'xterm-addon-attach'; +import { FitAddon } from "xterm-addon-fit"; import { Helmet, HelmetProvider } from "react-helmet-async"; -import { Link, useSearchParams, useParams } from "react-router-dom"; +import { Link, useParams, useSearchParams } from "react-router-dom"; +import { Terminal } from "xterm"; +import { useEffect, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; +import Menu from "../../components/Menu"; import Toast from "../../components/Notification"; +import { IBuilderItem, IBuilderRunnerItem, IEndpoint, IHTTPError, IRepositoryItem, IRunOrRerunRunnerResponse } from "../../interfaces"; let term = new Terminal({ fontFamily: 'Menlo, Monaco, "Courier New", monospace', @@ -38,7 +39,6 @@ let term = new Terminal({ convertEol: true, }); -import { IRepositoryItem, IHTTPError, IBuilderItem, IEndpoint, IBuilderRunnerItem, IRunOrRerunRunnerResponse } from "../../interfaces"; export default function ({ localServer }: { localServer: string }) { const navigate = useNavigate(); diff --git a/web/src/pages/Builder/Setup.tsx b/web/src/pages/Builder/Setup.tsx index f65c81f9..041a4068 100644 --- a/web/src/pages/Builder/Setup.tsx +++ b/web/src/pages/Builder/Setup.tsx @@ -14,24 +14,22 @@ * limitations under the License. */ +import * as monaco from 'monaco-editor'; import _ from 'lodash'; import axios from "axios"; -import * as monaco from 'monaco-editor'; +import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; import Editor, { loader } from '@monaco-editor/react'; +import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid'; +import { Combobox, Listbox, Transition } from '@headlessui/react'; import { Fragment, useEffect, useState } from 'react'; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { Listbox, Transition, Combobox } from '@headlessui/react'; -import { ChevronUpDownIcon, CheckIcon } from '@heroicons/react/20/solid'; -import { useSearchParams, useParams, useNavigate } from 'react-router-dom'; +import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; -import Settings from '../../Settings'; import Header from '../../components/Header'; import HeaderMenu from '../../components/Menu'; +import Settings from '../../Settings'; import Toast from "../../components/Notification"; - -import { IHTTPError, INamespaceList, INamespaceItem, IRepositoryItem, IRepositoryList, ICodeRepositoryOwnerItem, ICodeRepositoryItem, ICodeRepositoryProviderItem, ICodeRepositoryProviderList, ICodeRepositoryList, ICodeRepositoryOwnerList, ICodeRepositoryBranchItem, ICodeRepositoryBranchList, IBuilderItem } from '../../interfaces'; - -import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +import { IBuilderItem, ICodeRepositoryBranchItem, ICodeRepositoryBranchList, ICodeRepositoryItem, ICodeRepositoryList, ICodeRepositoryOwnerItem, ICodeRepositoryOwnerList, ICodeRepositoryProviderItem, ICodeRepositoryProviderList, IHTTPError, INamespaceItem, INamespaceList, IRepositoryItem, IRepositoryList } from '../../interfaces'; self.MonacoEnvironment = { getWorker() { diff --git a/web/src/pages/CodeRepository/List.tsx b/web/src/pages/CodeRepository/List.tsx index 41f17f0e..571ce331 100644 --- a/web/src/pages/CodeRepository/List.tsx +++ b/web/src/pages/CodeRepository/List.tsx @@ -14,22 +14,29 @@ * limitations under the License. */ -import _ from 'lodash'; -import axios from 'axios'; -import dayjs from 'dayjs'; -import { Listbox, Transition } from '@headlessui/react'; -import { useParams, useNavigate } from 'react-router-dom'; -import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { ChevronUpDownIcon } from '@heroicons/react/20/solid'; import { Fragment, useEffect, useRef, useState } from 'react'; +import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { + ICodeRepositoryItem, + ICodeRepositoryList, + ICodeRepositoryOwnerItem, + ICodeRepositoryOwnerList, + ICodeRepositoryUser3rdParty, + IHTTPError, + IOrder +} from '../../interfaces'; +import { Listbox, Transition } from '@headlessui/react'; +import { useNavigate, useParams } from 'react-router-dom'; -import Settings from '../../Settings'; -import HeaderMenu from '../../components/Menu'; +import { ChevronUpDownIcon } from '@heroicons/react/20/solid'; import Header from '../../components/Header'; -import Toast from "../../components/Notification"; +import HeaderMenu from '../../components/Menu'; import Pagination from '../../components/Pagination'; - -import { IHTTPError, IOrder, ICodeRepositoryOwnerList, ICodeRepositoryOwnerItem, ICodeRepositoryItem, ICodeRepositoryList, ICodeRepositoryUser3rdParty } from '../../interfaces'; +import Settings from '../../Settings'; +import Toast from "../../components/Notification"; +import _ from 'lodash'; +import axios from 'axios'; +import dayjs from 'dayjs'; function classNames(...classes: Array) { return classes.filter(Boolean).join(' ') diff --git a/web/src/pages/CodeRepository/index.tsx b/web/src/pages/CodeRepository/index.tsx index de3e0c3d..8149f103 100644 --- a/web/src/pages/CodeRepository/index.tsx +++ b/web/src/pages/CodeRepository/index.tsx @@ -14,16 +14,21 @@ * limitations under the License. */ -import axios from "axios"; -import { useNavigate } from 'react-router-dom'; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from "react-helmet-async"; +import { + ICodeRepositoryProviderItem, + ICodeRepositoryProviderList, + IEndpoint, + IHTTPError, + IOauth2ClientID +} from '../../interfaces'; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; +import Menu from "../../components/Menu"; import Toast from "../../components/Notification"; - -import { IHTTPError, ICodeRepositoryProviderList, ICodeRepositoryProviderItem, IEndpoint, IOauth2ClientID } from '../../interfaces'; +import axios from "axios"; +import { useNavigate } from 'react-router-dom'; export default function ({ localServer }: { localServer: string }) { const [providers, setProviders] = useState(); diff --git a/web/src/pages/DaemonTask/Records.tsx b/web/src/pages/DaemonTask/Records.tsx index ad06bc9d..bf7d9742 100644 --- a/web/src/pages/DaemonTask/Records.tsx +++ b/web/src/pages/DaemonTask/Records.tsx @@ -16,16 +16,16 @@ import axios from "axios"; import dayjs from 'dayjs'; -import { Tooltip } from 'flowbite'; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { useParams, useSearchParams, Link, useLocation } from 'react-router-dom'; +import { Link, useLocation, useParams, useSearchParams } from 'react-router-dom'; +import { Tooltip } from 'flowbite'; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; +import Pagination from "../../components/Pagination"; +import Settings from "../../Settings"; import { IGcArtifactRecordList, IHTTPError, IOrder } from "../../interfaces"; export default function ({ localServer }: { localServer: string }) { diff --git a/web/src/pages/DaemonTask/Runners.tsx b/web/src/pages/DaemonTask/Runners.tsx index 7eb9b3d1..182474fc 100644 --- a/web/src/pages/DaemonTask/Runners.tsx +++ b/web/src/pages/DaemonTask/Runners.tsx @@ -14,19 +14,19 @@ * limitations under the License. */ +import Toast from 'react-hot-toast'; import axios from "axios"; import dayjs from 'dayjs'; -import { Tooltip } from 'flowbite'; -import Toast from 'react-hot-toast'; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { useParams, useSearchParams, Link, useNavigate, useLocation } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom'; +import { Tooltip } from 'flowbite'; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; +import Pagination from "../../components/Pagination"; +import Settings from "../../Settings"; import { IGcArtifactRunnerList, IGcBlobRunnerList, IGcRepositoryRunnerList, IGcTagRunnerList, IHTTPError, IOrder } from "../../interfaces"; export default function ({ localServer }: { localServer: string }) { diff --git a/web/src/pages/DaemonTask/Tasks.tsx b/web/src/pages/DaemonTask/Tasks.tsx index e128e23f..fdd671dc 100644 --- a/web/src/pages/DaemonTask/Tasks.tsx +++ b/web/src/pages/DaemonTask/Tasks.tsx @@ -14,22 +14,22 @@ * limitations under the License. */ +import Toast from 'react-hot-toast'; import axios from "axios"; import dayjs from 'dayjs'; import parser from 'cron-parser'; -import { Tooltip } from 'flowbite'; -import Toast from 'react-hot-toast'; +import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid'; +import { Dialog, Listbox, Menu, Transition } from "@headlessui/react"; +import { EllipsisVerticalIcon } from "@heroicons/react/20/solid"; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { EllipsisVerticalIcon } from "@heroicons/react/20/solid"; -import { Dialog, Listbox, Menu, Transition } from "@headlessui/react"; -import { ChevronUpDownIcon, CheckIcon } from '@heroicons/react/20/solid'; -import { useParams, useSearchParams, Link, useLocation, useNavigate } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom'; +import { Tooltip } from 'flowbite'; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; +import Settings from "../../Settings"; import { IGcArtifactRule, IGcArtifactRunnerItem, diff --git a/web/src/pages/Home/index.tsx b/web/src/pages/Home/index.tsx index 2bf67de1..8245e3d7 100644 --- a/web/src/pages/Home/index.tsx +++ b/web/src/pages/Home/index.tsx @@ -16,11 +16,10 @@ import { Fragment } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { ScaleIcon } from '@heroicons/react/24/outline'; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; - -import { ScaleIcon } from '@heroicons/react/24/outline'; +import Menu from "../../components/Menu"; const cards = [ { name: 'Account balance1', href: '#', icon: ScaleIcon, amount: '$30,659.45' }, diff --git a/web/src/pages/Login/Callback.tsx b/web/src/pages/Login/Callback.tsx index 9a26bfd6..4e7e673d 100644 --- a/web/src/pages/Login/Callback.tsx +++ b/web/src/pages/Login/Callback.tsx @@ -14,14 +14,14 @@ * limitations under the License. */ -import axios from "axios"; -import { useState, useEffect } from "react"; +import "./index.css"; + +import { IHTTPError, IUserLoginResponse, IUserSelf } from "../../interfaces"; +import { useEffect, useState } from "react"; import { useParams, useSearchParams } from "react-router-dom"; import Toast from "../../components/Notification"; -import { IHTTPError, IUserSelf, IUserLoginResponse } from "../../interfaces"; - -import "./index.css"; +import axios from "axios"; export default function ({ localServer }: { localServer: string }) { const { provider } = useParams<{ provider: string }>(); diff --git a/web/src/pages/Login/index.tsx b/web/src/pages/Login/index.tsx index f798c881..f7a8f853 100644 --- a/web/src/pages/Login/index.tsx +++ b/web/src/pages/Login/index.tsx @@ -14,13 +14,13 @@ * limitations under the License. */ -import axios from "axios"; -import { useState, useEffect } from "react"; -import { useNavigate } from "react-router-dom"; import { Helmet, HelmetProvider } from "react-helmet-async"; +import { IEndpoint, IHTTPError, IOauth2ClientID, IUserLoginResponse } from "../../interfaces"; +import { useEffect, useState } from "react"; import Notification from "../../components/Notification"; -import { IHTTPError, IUserLoginResponse, IOauth2ClientID, IEndpoint } from "../../interfaces"; +import axios from "axios"; +import { useNavigate } from "react-router-dom"; export default function Login({ localServer }: { localServer: string }) { const navigate = useNavigate(); @@ -71,7 +71,7 @@ export default function Login({ localServer }: { localServer: string }) { Notification({ level: "warning", title: errorcode.title, message: errorcode.description }); } }); - }, []) + }, []); useEffect(() => { // if user have already login redirect to home axios.get(localServer + "/api/v1/users/self").then(response => { diff --git a/web/src/pages/Namespace/Member.tsx b/web/src/pages/Namespace/Member.tsx index 75881a75..be34bacc 100644 --- a/web/src/pages/Namespace/Member.tsx +++ b/web/src/pages/Namespace/Member.tsx @@ -14,19 +14,19 @@ * limitations under the License. */ -import axios from "axios"; import Toast from 'react-hot-toast'; +import axios from "axios"; +import { CheckIcon, ChevronUpDownIcon, EllipsisVerticalIcon } from '@heroicons/react/20/solid'; +import { Combobox, Dialog, Listbox, Menu, Transition } from "@headlessui/react"; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { useParams, Link, useSearchParams } from 'react-router-dom'; -import { ChevronUpDownIcon, CheckIcon, EllipsisVerticalIcon } from '@heroicons/react/20/solid'; -import { Dialog, Listbox, Menu, Transition, Combobox } from "@headlessui/react"; +import { Link, useParams, useSearchParams } from 'react-router-dom'; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; +import Pagination from "../../components/Pagination"; +import Settings from "../../Settings"; import { IHTTPError, INamespaceItem, INamespaceRoleItem as INamespaceMemberItem, INamespaceRoleList, IUserItem, IUserList } from "../../interfaces"; const namespaceRoles = [ @@ -179,18 +179,18 @@ export default function Member({ localServer }: { localServer: string }) { > Members - {/* - Webhook - */} Daemon task + + Webhook + ) } diff --git a/web/src/pages/Namespace/Summary.tsx b/web/src/pages/Namespace/Summary.tsx index d9bb09fc..f394aa0a 100644 --- a/web/src/pages/Namespace/Summary.tsx +++ b/web/src/pages/Namespace/Summary.tsx @@ -16,20 +16,20 @@ import "bytemd/dist/index.css"; +import "./index.css"; + import axios from "axios"; import gfm from "@bytemd/plugin-gfm"; -import { useEffect, useState } from "react"; import { Editor, Viewer } from "@bytemd/react"; import { Helmet, HelmetProvider } from "react-helmet-async"; -import { Link, useSearchParams, useParams } from "react-router-dom"; +import { Link, useParams, useSearchParams } from "react-router-dom"; +import { useEffect, useState } from "react"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; import { IHTTPError, INamespaceItem } from "../../interfaces"; -import "./index.css"; - export default function ({ localServer }: { localServer: string }) { const { namespace } = useParams<{ namespace: string }>(); const [searchParams] = useSearchParams(); @@ -113,18 +113,18 @@ export default function ({ localServer }: { localServer: string }) { > Members - {/* - Webhook - */} Daemon task + + Webhook + ) } /> diff --git a/web/src/pages/Namespace/Webhook.tsx b/web/src/pages/Namespace/Webhook.tsx index 3645b89d..c68ec5dd 100644 --- a/web/src/pages/Namespace/Webhook.tsx +++ b/web/src/pages/Namespace/Webhook.tsx @@ -14,18 +14,18 @@ * limitations under the License. */ +import "./index.css"; + import axios from "axios"; -import { useParams, Link } from 'react-router-dom'; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { Link, useParams } from 'react-router-dom'; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; +import Menu from "../../components/Menu"; import Pagination from "../../components/Pagination"; import Settings from "../../Settings"; -import "./index.css"; - export default function Repository({ localServer }: { localServer: string }) { const { namespace } = useParams<{ namespace: string }>(); @@ -58,18 +58,18 @@ export default function Repository({ localServer }: { localServer: string }) { > Users - - Webhook - Daemon task + + Webhook + ) } /> diff --git a/web/src/pages/Namespace/index.tsx b/web/src/pages/Namespace/index.tsx index 228fdd02..855702dc 100644 --- a/web/src/pages/Namespace/index.tsx +++ b/web/src/pages/Namespace/index.tsx @@ -14,27 +14,26 @@ * limitations under the License. */ +import "./index.css"; + import axios from "axios"; import dayjs from 'dayjs'; -import { useNavigate } from 'react-router-dom'; +import { Dialog, Menu, Transition } from "@headlessui/react"; +import { EllipsisVerticalIcon, ExclamationTriangleIcon } from '@heroicons/react/20/solid'; import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from "react-helmet-async"; -import { Dialog, Transition, Menu } from "@headlessui/react"; -import { EllipsisVerticalIcon, ExclamationTriangleIcon } from '@heroicons/react/20/solid'; +import { useNavigate } from 'react-router-dom'; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; -import Quota from "../../components/Quota"; -import calcUnit from "../../utils/calcUnit"; import Header from "../../components/Header"; -import Toast from "../../components/Notification"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; import OrderHeader from "../../components/OrderHeader"; +import Pagination from "../../components/Pagination"; +import Quota from "../../components/Quota"; import QuotaSimple from "../../components/QuotaSimple"; - -import "./index.css"; - -import { INamespaceItem, INamespaceList, IHTTPError, IOrder, IUserSelf } from "../../interfaces"; +import Settings from "../../Settings"; +import Toast from "../../components/Notification"; +import calcUnit from "../../utils/calcUnit"; +import { IHTTPError, INamespaceItem, INamespaceList, IOrder, IUserSelf } from "../../interfaces"; import { NamespaceRole, UserRole } from "../../interfaces/enums"; export default function Namespace({ localServer }: { localServer: string }) { diff --git a/web/src/pages/Repository/Summary.tsx b/web/src/pages/Repository/Summary.tsx index 54cfe926..ec1dd344 100644 --- a/web/src/pages/Repository/Summary.tsx +++ b/web/src/pages/Repository/Summary.tsx @@ -16,19 +16,19 @@ import "bytemd/dist/index.css"; +import "./index.css"; + import axios from "axios"; import gfm from "@bytemd/plugin-gfm"; -import { useEffect, useState } from "react"; import { Editor, Viewer } from "@bytemd/react"; import { Helmet, HelmetProvider } from "react-helmet-async"; -import { Link, useSearchParams, useParams } from "react-router-dom"; +import { Link, useParams, useSearchParams } from "react-router-dom"; +import { useEffect, useState } from "react"; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; +import Menu from "../../components/Menu"; import Toast from "../../components/Notification"; -import { IRepositoryItem, IHTTPError, ISystemConfig } from "../../interfaces"; - -import "./index.css"; +import { IHTTPError, IRepositoryItem, ISystemConfig } from "../../interfaces"; export default function ({ localServer }: { localServer: string }) { const { namespace } = useParams<{ namespace: string }>(); diff --git a/web/src/pages/Repository/index.tsx b/web/src/pages/Repository/index.tsx index 5aefc797..07c7d7ab 100644 --- a/web/src/pages/Repository/index.tsx +++ b/web/src/pages/Repository/index.tsx @@ -14,30 +14,30 @@ * limitations under the License. */ +import "./index.css"; + import axios from "axios"; import dayjs from "dayjs"; -import { useDebounce } from "react-use"; -import { Fragment, useEffect, useState } from "react"; -import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { Dialog, Transition, Menu } from "@headlessui/react"; +import { Dialog, Menu, Transition } from "@headlessui/react"; import { EllipsisVerticalIcon } from "@heroicons/react/20/solid"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; -import { useParams, useSearchParams, Link, useNavigate } from 'react-router-dom'; +import { Fragment, useEffect, useState } from "react"; +import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom'; +import { useDebounce } from "react-use"; -import Settings from "../../Settings"; -import IMenu from "../../components/Menu"; -import Quota from "../../components/Quota"; -import calcUnit from "../../utils/calcUnit"; import Header from "../../components/Header"; -import Toast from "../../components/Notification"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; +import Notification from "../../components/Notification"; import OrderHeader from "../../components/OrderHeader"; +import Pagination from "../../components/Pagination"; +import Quota from "../../components/Quota"; import QuotaSimple from "../../components/QuotaSimple"; -import Notification from "../../components/Notification"; +import Settings from "../../Settings"; +import Toast from "../../components/Notification"; +import calcUnit from "../../utils/calcUnit"; +import { IHTTPError, INamespaceItem, IOrder, IRepositoryItem, IRepositoryList, IUserSelf } from "../../interfaces"; import { NamespaceRole, UserRole } from "../../interfaces/enums"; -import { IRepositoryItem, IRepositoryList, IHTTPError, IOrder, IUserSelf, INamespaceItem } from "../../interfaces"; - -import "./index.css"; export default function ({ localServer }: { localServer: string }) { const [repositoryList, setRepositoryList] = useState({} as IRepositoryList); @@ -236,18 +236,18 @@ export default function ({ localServer }: { localServer: string }) { > Members - {/* - Webhook - */} Daemon task + + Webhook + ) } diff --git a/web/src/pages/Setting/Users.tsx b/web/src/pages/Setting/Users.tsx index a3d842a7..719645a1 100644 --- a/web/src/pages/Setting/Users.tsx +++ b/web/src/pages/Setting/Users.tsx @@ -14,22 +14,22 @@ * limitations under the License. */ -import dayjs from "dayjs"; import axios from "axios"; -import { useParams, Link } from 'react-router-dom'; +import dayjs from "dayjs"; +import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid'; +import { Dialog, Listbox, Transition } from "@headlessui/react"; import { Fragment, useEffect, useState } from "react"; -import { Dialog, Transition, Listbox } from "@headlessui/react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { ChevronUpDownIcon, CheckIcon } from '@heroicons/react/20/solid'; +import { Link, useParams } from 'react-router-dom'; -import Regex from "../../utils/regex"; -import Settings from "../../Settings"; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; -import Toast from "../../components/Notification"; -import Pagination from "../../components/Pagination"; +import Menu from "../../components/Menu"; import OrderHeader from "../../components/OrderHeader"; +import Pagination from "../../components/Pagination"; import QuotaSimple from "../../components/QuotaSimple"; +import Regex from "../../utils/regex"; +import Settings from "../../Settings"; +import Toast from "../../components/Notification"; import { IHTTPError, IOrder, IUserItem, IUserList } from "../../interfaces"; const supportRoles = [ diff --git a/web/src/pages/Setting/index.tsx b/web/src/pages/Setting/index.tsx index f21fca3a..efa550fe 100644 --- a/web/src/pages/Setting/index.tsx +++ b/web/src/pages/Setting/index.tsx @@ -15,14 +15,14 @@ */ import axios from "axios"; -import { useDebounce } from "react-use"; -import { useParams, Link } from 'react-router-dom'; -import { Fragment, useEffect, useState } from "react"; import { Dialog, Transition } from "@headlessui/react"; +import { Fragment, useEffect, useState } from "react"; import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { Link, useParams } from 'react-router-dom'; +import { useDebounce } from "react-use"; -import Menu from "../../components/Menu"; import Header from "../../components/Header"; +import Menu from "../../components/Menu"; export default function ({ localServer }: { localServer: string }) { return ( diff --git a/web/src/pages/Tag/index.tsx b/web/src/pages/Tag/index.tsx index 8fea8c7f..e1733e02 100644 --- a/web/src/pages/Tag/index.tsx +++ b/web/src/pages/Tag/index.tsx @@ -16,26 +16,38 @@ import axios from "axios"; import dayjs from 'dayjs'; -import { Tooltip } from 'flowbite'; import humanFormat from "human-format"; -import { useCopyToClipboard } from 'react-use'; -import { Fragment, useEffect, useState } from "react"; -import { Helmet, HelmetProvider } from 'react-helmet-async'; -import { Dialog, Transition, Menu } from "@headlessui/react"; +import { Dialog, Menu, Transition } from "@headlessui/react"; import { EllipsisVerticalIcon } from '@heroicons/react/20/solid'; -import { Link, useSearchParams, useParams } from 'react-router-dom'; import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'; +import { Fragment, useEffect, useState } from "react"; +import { Helmet, HelmetProvider } from 'react-helmet-async'; +import { Link, useParams, useSearchParams } from 'react-router-dom'; +import { Tooltip } from 'flowbite'; +import { useCopyToClipboard } from 'react-use'; -import Settings from "../../Settings"; -import { trimHTTP } from "../../utils"; -import IMenu from "../../components/Menu"; import Header from "../../components/Header"; -import Toast from "../../components/Notification"; -import Pagination from "../../components/Pagination"; +import IMenu from "../../components/Menu"; import Notification from "../../components/Notification"; +import Pagination from "../../components/Pagination"; +import Settings from "../../Settings"; +import Toast from "../../components/Notification"; import distros, { distroName } from '../../utils/distros'; +import { + IArtifact, + IEndpoint, + IHTTPError, + IImageConfig, + INamespaceItem, + ISbom, + ISystemConfig, + ITagItem, + ITagList, + IUserSelf, + IVuln +} from "../../interfaces"; import { NamespaceRole, UserRole } from "../../interfaces/enums"; -import { ITagList, IHTTPError, IEndpoint, IArtifact, IVuln, ISbom, IImageConfig, ISystemConfig, IUserSelf, INamespaceItem, ITagItem } from "../../interfaces"; +import { trimHTTP } from "../../utils"; export default function Tag({ localServer }: { localServer: string }) { const [tagList, setTagList] = useState({} as ITagList); diff --git a/web/src/utils/refreshToken.ts b/web/src/utils/refreshToken.ts index c082fb75..42b65636 100644 --- a/web/src/utils/refreshToken.ts +++ b/web/src/utils/refreshToken.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import axios from "axios"; - import { IUserLoginResponse } from "../interfaces"; +import axios from "axios"; let REFRESH_TOKEN_INTERVAL: ReturnType | null;