From 94e355b9f328b2c98d768ba6206d6d11c2135e4d Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 14:37:52 +0900 Subject: [PATCH 001/161] =?UTF-8?q?refactor:=20application.properties?= =?UTF-8?q?=EC=9D=98=20=EA=B8=B0=EB=B3=B8=EA=B0=92=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/resources/application.properties diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..85a7101 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,24 @@ +server.name=gitanimals-render +server.port=8080 + +spring.datasource.url=jdbc:mysql://localhost:3306/gitanimalsrender +spring.datasource.username= +spring.datasource.password= +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver + +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +spring.jpa.hibernate.ddl-auto=update +spring.jpa.open-in-view=false + +netx.mode=redis +netx.host=localhost +netx.port=6379 +netx.group=render +netx.node-id=1 +netx.node-name=render-1 +netx.recovery-milli=1000 +netx.orphan-milli=60000 +netx.backpressure=40 +netx.logging.level=warn + +github.token= From 8b9cd448fbb7b724a519efdd4b74f95862f91d45 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 14:53:15 +0900 Subject: [PATCH 002/161] =?UTF-8?q?ci:=20=EB=B0=B0=ED=8F=AC=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=9D=84=20=EA=B5=AC=EC=84=B1=ED=95=98=EA=B3=A0=20cd?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 93 +++++++++++++++++++++++ Dockerfile | 26 +++++++ src/main/resources/application.properties | 6 +- 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..4db4296 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,93 @@ +name: πŸŽ‡ Deployer + +on: + push: + branches: + - 'release' + +jobs: + build: + name: build and set image + runs-on: ubuntu-latest + strategy: + matrix: + kotlin-version: [ 1.9.22 ] + java-version: [ 21 ] + steps: + - name: checkout code + uses: actions/checkout@v3 + with: + submodules: true + + - name: Set up JDK 21 and Kotlin 1.9.22 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: ${{ matrix.java-version }} + kotlin-version: ${{ matrix.kotlin-version }} + + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + + - name: build server + run: ./gradlew build -x test + + - name: docker arm64 build set up - qemu + uses: docker/setup-qemu-action@v2 + + - name: docker arm64 build set up - buildx + uses: docker/setup-buildx-action@v2 + + - name: login github container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: extract version + run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" + id: extract_version_name + + - name: push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/arm64/v8 + push: true + tags: | + ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + build-args: | + "DB_URL=${{ secrets.DB_URL }}" + "DB_USERNAME=${{ secrets.DB_USERNAME }}" + "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" + "GITHUB_TOKEN=${{ secrets.GH_TOKEN }}" + "REDIS_HOST=${{ secrets.REDIS_HOST }}" + "REDIS_PORT=${{ secrets.REDIS_PORT }}" + + - name: create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.extract_version_name.outputs.version }} + release_name: ${{ steps.extract_version_name.outputs.version }} + + deploy: + needs: build + name: deploy + runs-on: self-hosted + steps: + - name: extract version + run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" + id: extract_version_name + + - name: run server + run: | + sudo docker pull ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm + sudo docker run -d -p ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a116c04 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM arm64v8/openjdk:21 + +ARG DB_URL +ARG DB_USERNAME +ARG DB_PASSWORD +ARG GITHUB_TOKEN +ARG REDIS_HOST +ARG REDIS_PORT + +ARG JAR_FILE=./build/libs/*.jar +COPY ${JAR_FILE} gitanimals-render.jar + +ENV db_url=${DB_URL} \ + db_username=${DB_USERNAME} \ + db_password=${DB_PASSWORD} \ + github_token=${GITHUB_TOKEN} \ + redis_host=${REDIS_HOST} \ + redis_port=${REDIS_PORT} + +ENTRYPOINT java -jar gitanimals-render.jar \ + --spring.datasource.url=${db_url} \ + --spring.datasource.username=${db_username} \ + --spring.datasource.password=${db_password} \ + --netx.host=${redis_host} \ + --netx.port=${redis_port} \ + --github.token=${github_token} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 85a7101..2e1ac24 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ server.name=gitanimals-render server.port=8080 -spring.datasource.url=jdbc:mysql://localhost:3306/gitanimalsrender +spring.datasource.url= spring.datasource.username= spring.datasource.password= spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -11,8 +11,8 @@ spring.jpa.hibernate.ddl-auto=update spring.jpa.open-in-view=false netx.mode=redis -netx.host=localhost -netx.port=6379 +netx.host= +netx.port= netx.group=render netx.node-id=1 netx.node-name=render-1 From 6701dc1f9ac9d8882e57f8fea350dccce20cc489 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:02:24 +0900 Subject: [PATCH 003/161] =?UTF-8?q?ci:=20tags=EB=A5=BC=20gitanimals-render?= =?UTF-8?q?=20->=20gitanimals=20=EB=A1=9C=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4db4296..ca5c3de 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,9 @@ on: push: branches: - 'release' + pull_request: + branches: + - 'release' jobs: build: @@ -60,7 +63,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" @@ -88,6 +91,6 @@ jobs: - name: run server run: | - sudo docker pull ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + sudo docker pull ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm sudo docker run -d -p ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} From 7327bf9cf23550a4c7aeaf6a87e5cc73274ccb0f Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:05:17 +0900 Subject: [PATCH 004/161] =?UTF-8?q?ci:=20gitanimals=EC=97=90=20render?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca5c3de..9dd5d02 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} + ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" @@ -91,6 +91,6 @@ jobs: - name: run server run: | - sudo docker pull ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} + sudo docker pull ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm sudo docker run -d -p ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} From f4278da6638ae1839ddff7b8f0a768a5ef01ac85 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:08:39 +0900 Subject: [PATCH 005/161] =?UTF-8?q?ci:=20tag=EB=A5=BC=20=EA=B0=95=EC=A0=9C?= =?UTF-8?q?=EB=A1=9C=20fix=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9dd5d02..84182cb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,8 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} +# ${{ steps.extract_version_name.outputs.version }} + ghcr.io/devxb/gitanimals:0.0.2 build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" @@ -91,6 +92,6 @@ jobs: - name: run server run: | - sudo docker pull ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + sudo docker pull ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm - sudo docker run -d -p ghcr.io/devxb/gitanimals-render:${{ steps.extract_version_name.outputs.version }} + sudo docker run -d -p ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} From d93495dd82c773de5b8e1b77020c05d5db42b929 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:09:31 +0900 Subject: [PATCH 006/161] =?UTF-8?q?ci:=20=EC=A3=BC=EC=84=9D=EC=9D=84=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 84182cb..86eb564 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,6 @@ jobs: platforms: linux/arm64/v8 push: true tags: | -# ${{ steps.extract_version_name.outputs.version }} ghcr.io/devxb/gitanimals:0.0.2 build-args: | "DB_URL=${{ secrets.DB_URL }}" From 6d70da850578c8dc995eca8e9d0259901e5e7e5c Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:13:28 +0900 Subject: [PATCH 007/161] =?UTF-8?q?ci:=20ghcr=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=EC=97=90=20devxb=EB=A5=BC=20=EC=82=AD=EC=A0=9C=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 86eb564..dcb433a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb/gitanimals:0.0.2 + ghcr.io/gitanimals:0.0.2 build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" From 7ae5c2a5b6d73172e2a08b8dc8742a7071b7911b Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:15:38 +0900 Subject: [PATCH 008/161] =?UTF-8?q?ci:=20ghcr=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=EC=97=90=20devxb=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EA=B3=A0,=20gitanimals-render=EB=A5=BC=20=ED=83=9C=EA=B7=B8?= =?UTF-8?q?=EB=A1=9C=20=EB=BA=80=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dcb433a..2c51851 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/gitanimals:0.0.2 + ghcr.io/devxb:gitanimals-0.0.2 build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" From 1b350b320f14b823c68daf80f3b0853d638989f0 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:31:36 +0900 Subject: [PATCH 009/161] =?UTF-8?q?ci:=20ghcr=20=ED=86=A0=ED=81=B0?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2c51851..3cbed9b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -50,7 +50,7 @@ jobs: with: registry: ghcr.io username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.GHCR_TOKEN }} - name: extract version run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" @@ -63,7 +63,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb:gitanimals-0.0.2 + ghcr.io/devxb/gitanimals:0.0.2 build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" From ccb5c78eb1ae790ade1a3e5293f9ab892759f70f Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:39:59 +0900 Subject: [PATCH 010/161] =?UTF-8?q?ci:=20=EB=B2=84=EC=A0=84=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EC=9D=84=20pr=20=EC=A0=9C=EB=AA=A9=EC=97=90=EB=A7=9E?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3cbed9b..5b23ca2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,9 +4,6 @@ on: push: branches: - 'release' - pull_request: - branches: - - 'release' jobs: build: @@ -63,7 +60,7 @@ jobs: platforms: linux/arm64/v8 push: true tags: | - ghcr.io/devxb/gitanimals:0.0.2 + ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} build-args: | "DB_URL=${{ secrets.DB_URL }}" "DB_USERNAME=${{ secrets.DB_USERNAME }}" @@ -93,4 +90,4 @@ jobs: run: | sudo docker pull ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm - sudo docker run -d -p ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} + sudo docker run -d -p 8080:8080 ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} From 444c16fc3f9e6836f4a8c11c1ed978a70deff5d4 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:43:16 +0900 Subject: [PATCH 011/161] =?UTF-8?q?ci:=20create=20release=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5b23ca2..359bff3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,14 +69,6 @@ jobs: "REDIS_HOST=${{ secrets.REDIS_HOST }}" "REDIS_PORT=${{ secrets.REDIS_PORT }}" - - name: create release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.extract_version_name.outputs.version }} - release_name: ${{ steps.extract_version_name.outputs.version }} - deploy: needs: build name: deploy From 5e1905ddc9de93342ddac9e649af670c2a5d2eb8 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:49:36 +0900 Subject: [PATCH 012/161] =?UTF-8?q?fix:=20ClasspathResource=EC=97=90=20cla?= =?UTF-8?q?sspath:=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/domain/Svgs.kt | 96 +++++++++---------- .../render/infra/GithubContributionApi.kt | 4 +- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index e0b35de..5cdf095 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -3,145 +3,145 @@ package org.gitanimals.render.domain import org.springframework.core.io.ClassPathResource import java.nio.charset.Charset -val whiteFieldSvg: String = ClassPathResource("persona/field/white-field.svg") +val whiteFieldSvg: String = ClassPathResource("classpath:persona/field/white-field.svg") .getContentAsString(Charset.defaultCharset()) -val snowyFieldSvg: String = ClassPathResource("persona/field/snowy-field.svg") +val snowyFieldSvg: String = ClassPathResource("classpath:persona/field/snowy-field.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSvg: String = ClassPathResource("persona/animal/goose.svg") +val gooseSvg: String = ClassPathResource("classpath:persona/animal/goose.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSunglassesSvg: String = ClassPathResource("persona/animal/goose-sunglasses.svg") +val gooseSunglassesSvg: String = ClassPathResource("classpath:persona/animal/goose-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val gooseKotlinSvg: String = ClassPathResource("persona/animal/goose-kotlin.svg") +val gooseKotlinSvg: String = ClassPathResource("classpath:persona/animal/goose-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val gooseJavaSvg: String = ClassPathResource("persona/animal/goose-java.svg") +val gooseJavaSvg: String = ClassPathResource("classpath:persona/animal/goose-java.svg") .getContentAsString(Charset.defaultCharset()) -val gooseJsSvg: String = ClassPathResource("persona/animal/goose-js.svg") +val gooseJsSvg: String = ClassPathResource("classpath:persona/animal/goose-js.svg") .getContentAsString(Charset.defaultCharset()) -val gooseNodeSvg: String = ClassPathResource("persona/animal/goose-node.svg") +val gooseNodeSvg: String = ClassPathResource("classpath:persona/animal/goose-node.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSwiftSvg: String = ClassPathResource("persona/animal/goose-swift.svg") +val gooseSwiftSvg: String = ClassPathResource("classpath:persona/animal/goose-swift.svg") .getContentAsString(Charset.defaultCharset()) -val gooseLinuxSvg: String = ClassPathResource("persona/animal/goose-linux.svg") +val gooseLinuxSvg: String = ClassPathResource("classpath:persona/animal/goose-linux.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSpringSvg: String = ClassPathResource("persona/animal/goose-spring.svg") +val gooseSpringSvg: String = ClassPathResource("classpath:persona/animal/goose-spring.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSvg: String = ClassPathResource("persona/animal/little-chick.svg") +val littleChickSvg: String = ClassPathResource("classpath:persona/animal/little-chick.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSunglassesSvg: String = ClassPathResource("persona/animal/little-chick-sunglasses.svg") +val littleChickSunglassesSvg: String = ClassPathResource("classpath:persona/animal/little-chick-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickKotlinSvg: String = ClassPathResource("persona/animal/little-chick-kotlin.svg") +val littleChickKotlinSvg: String = ClassPathResource("classpath:persona/animal/little-chick-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickJavaSvg: String = ClassPathResource("persona/animal/little-chick-java.svg") +val littleChickJavaSvg: String = ClassPathResource("classpath:persona/animal/little-chick-java.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickJsSvg: String = ClassPathResource("persona/animal/little-chick-js.svg") +val littleChickJsSvg: String = ClassPathResource("classpath:persona/animal/little-chick-js.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickNodeSvg: String = ClassPathResource("persona/animal/little-chick-node.svg") +val littleChickNodeSvg: String = ClassPathResource("classpath:persona/animal/little-chick-node.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSwiftSvg: String = ClassPathResource("persona/animal/little-chick-swift.svg") +val littleChickSwiftSvg: String = ClassPathResource("classpath:persona/animal/little-chick-swift.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickLinuxSvg: String = ClassPathResource("persona/animal/little-chick-linux.svg") +val littleChickLinuxSvg: String = ClassPathResource("classpath:persona/animal/little-chick-linux.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSpringSvg: String = ClassPathResource("persona/animal/little-chick-spring.svg") +val littleChickSpringSvg: String = ClassPathResource("classpath:persona/animal/little-chick-spring.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSvg: String = ClassPathResource("persona/animal/penguin.svg") +val penguinSvg: String = ClassPathResource("classpath:persona/animal/penguin.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSunglassesSvg: String = ClassPathResource("persona/animal/penguin-sunglasses.svg") +val penguinSunglassesSvg: String = ClassPathResource("classpath:persona/animal/penguin-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val penguinKotlinSvg: String = ClassPathResource("persona/animal/penguin-kotlin.svg") +val penguinKotlinSvg: String = ClassPathResource("classpath:persona/animal/penguin-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val penguinJavaSvg: String = ClassPathResource("persona/animal/penguin-java.svg") +val penguinJavaSvg: String = ClassPathResource("classpath:persona/animal/penguin-java.svg") .getContentAsString(Charset.defaultCharset()) -val penguinJsSvg: String = ClassPathResource("persona/animal/penguin-js.svg") +val penguinJsSvg: String = ClassPathResource("classpath:persona/animal/penguin-js.svg") .getContentAsString(Charset.defaultCharset()) -val penguinNodeSvg: String = ClassPathResource("persona/animal/penguin-node.svg") +val penguinNodeSvg: String = ClassPathResource("classpath:persona/animal/penguin-node.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSwiftSvg: String = ClassPathResource("persona/animal/penguin-swift.svg") +val penguinSwiftSvg: String = ClassPathResource("classpath:persona/animal/penguin-swift.svg") .getContentAsString(Charset.defaultCharset()) -val penguinLinuxSvg: String = ClassPathResource("persona/animal/penguin-linux.svg") +val penguinLinuxSvg: String = ClassPathResource("classpath:persona/animal/penguin-linux.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSpringSvg: String = ClassPathResource("persona/animal/penguin-spring.svg") +val penguinSpringSvg: String = ClassPathResource("classpath:persona/animal/penguin-spring.svg") .getContentAsString(Charset.defaultCharset()) -val pigSvg: String = ClassPathResource("persona/animal/pig.svg") +val pigSvg: String = ClassPathResource("classpath:persona/animal/pig.svg") .getContentAsString(Charset.defaultCharset()) -val pigSunglassesSvg: String = ClassPathResource("persona/animal/pig-sunglasses.svg") +val pigSunglassesSvg: String = ClassPathResource("classpath:persona/animal/pig-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val pigKotlinSvg: String = ClassPathResource("persona/animal/pig-kotlin.svg") +val pigKotlinSvg: String = ClassPathResource("classpath:persona/animal/pig-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val pigJavaSvg: String = ClassPathResource("persona/animal/pig-java.svg") +val pigJavaSvg: String = ClassPathResource("classpath:persona/animal/pig-java.svg") .getContentAsString(Charset.defaultCharset()) -val pigJsSvg: String = ClassPathResource("persona/animal/pig-js.svg") +val pigJsSvg: String = ClassPathResource("classpath:persona/animal/pig-js.svg") .getContentAsString(Charset.defaultCharset()) -val pigNodeSvg: String = ClassPathResource("persona/animal/pig-node.svg") +val pigNodeSvg: String = ClassPathResource("classpath:persona/animal/pig-node.svg") .getContentAsString(Charset.defaultCharset()) -val pigSwiftSvg: String = ClassPathResource("persona/animal/pig-swift.svg") +val pigSwiftSvg: String = ClassPathResource("classpath:persona/animal/pig-swift.svg") .getContentAsString(Charset.defaultCharset()) -val pigLinuxSvg: String = ClassPathResource("persona/animal/pig-linux.svg") +val pigLinuxSvg: String = ClassPathResource("classpath:persona/animal/pig-linux.svg") .getContentAsString(Charset.defaultCharset()) -val pigSpringSvg: String = ClassPathResource("persona/animal/pig-spring.svg") +val pigSpringSvg: String = ClassPathResource("classpath:persona/animal/pig-spring.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedSvg: String = ClassPathResource("persona/animal/slime-red.svg") +val slimeRedSvg: String = ClassPathResource("classpath:persona/animal/slime-red.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedKotlinSvg: String = ClassPathResource("persona/animal/slime-red-kotlin.svg") +val slimeRedKotlinSvg: String = ClassPathResource("classpath:persona/animal/slime-red-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedJavaSvg: String = ClassPathResource("persona/animal/slime-red-java.svg") +val slimeRedJavaSvg: String = ClassPathResource("classpath:persona/animal/slime-red-java.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedJsSvg: String = ClassPathResource("persona/animal/slime-red-js.svg") +val slimeRedJsSvg: String = ClassPathResource("classpath:persona/animal/slime-red-js.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedNodeSvg: String = ClassPathResource("persona/animal/slime-red-node.svg") +val slimeRedNodeSvg: String = ClassPathResource("classpath:persona/animal/slime-red-node.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedSwiftSvg: String = ClassPathResource("persona/animal/slime-red-swift.svg") +val slimeRedSwiftSvg: String = ClassPathResource("classpath:persona/animal/slime-red-swift.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedLinuxSvg: String = ClassPathResource("persona/animal/slime-red-linux.svg") +val slimeRedLinuxSvg: String = ClassPathResource("classpath:persona/animal/slime-red-linux.svg") .getContentAsString(Charset.defaultCharset()) -val slimeBlueSvg: String = ClassPathResource("persona/animal/slime-blue.svg") +val slimeBlueSvg: String = ClassPathResource("classpath:persona/animal/slime-blue.svg") .getContentAsString(Charset.defaultCharset()) -val slimeGreenSvg: String = ClassPathResource("persona/animal/slime-green.svg") +val slimeGreenSvg: String = ClassPathResource("classpath:persona/animal/slime-green.svg") .getContentAsString(Charset.defaultCharset()) val largeTextSvgs = lazy { @@ -161,7 +161,7 @@ val largeTextSvgs = lazy { map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } - map["-"] = ClassPathResource("persona/text/large/hyphens.svg") + map["-"] = ClassPathResource("classpath:persona/text/large/hyphens.svg") .getContentAsString(Charset.defaultCharset()) map }.value diff --git a/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt b/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt index 660b804..9c6d4f3 100644 --- a/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt +++ b/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt @@ -120,11 +120,11 @@ class GithubContributionApi( private const val YEAR_FIX = "*{year}" private val contributionYearQuery: String = - ClassPathResource("github-graphql/contribution-year.graphql") + ClassPathResource("classpath:github-graphql/contribution-year.graphql") .getContentAsString(Charset.defaultCharset()) private val contributionCountByYearQuery = - ClassPathResource("github-graphql/contribution-count-by-year.graphql") + ClassPathResource("classpath:github-graphql/contribution-count-by-year.graphql") .getContentAsString(Charset.defaultCharset()) } } From 47cc4a22c8907484306f70a199321ac063f75774 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 15:54:36 +0900 Subject: [PATCH 013/161] =?UTF-8?q?fix:=20=EB=B9=A0=EC=A7=84=20classpath:?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98=EA=B3=A0=20=EC=86=8C?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EC=97=90=20=EB=B0=91=EC=A4=84=EC=9D=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/Svgs.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 5cdf095..b01da61 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -147,17 +147,17 @@ val slimeGreenSvg: String = ClassPathResource("classpath:persona/animal/slime-gr val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { - val path = "persona/text/large/$i.svg" + val path = "classpath:persona/text/large/$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } for (i in 'a'..'z') { - val path = "persona/text/large/$i.svg" + val path = "classpath:persona/text/large/_$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } for (i in 0..9) { - val path = "persona/text/large/$i.svg" + val path = "classpath:persona/text/large/$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } @@ -169,7 +169,7 @@ val largeTextSvgs = lazy { val mediumNumberSvgs = lazy { val list = mutableListOf() for (i in 0..9) { - val path = "persona/text/medium/$i.svg" + val path = "classpath:persona/text/medium/$i.svg" list.add( ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) @@ -181,7 +181,7 @@ val mediumNumberSvgs = lazy { val numberSvgs = lazy { val list = mutableListOf() for (i in 0..9) { - val path = "persona/text/small/$i.svg" + val path = "classpath:persona/text/small/$i.svg" list.add( ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) From a227e10df88db9ea888edaf930b39c9c51181641 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 22:23:30 +0900 Subject: [PATCH 014/161] =?UTF-8?q?docs:=20Readme=EC=9D=98=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=82=AC=EB=A1=80=EB=A5=BC=20=EC=8B=A4=EC=A0=9C=20?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76be155..ead8b02 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 방식쀑 ν•˜λ‚˜λ₯Ό λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. ```markdown -[![gitanimals](http://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) +[![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) ``` ```html @@ -59,7 +59,7 @@ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ - +docs/pets.svg ## From 367892978060f3f3eedccb150e4a25aabec0f7e0 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 22:27:49 +0900 Subject: [PATCH 015/161] =?UTF-8?q?refactor:=20Cache-Control=20=EC=9D=84?= =?UTF-8?q?=201=EC=B4=88=EB=A1=9C=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/controller/AnimationController.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index e9b59cd..96e8813 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -1,6 +1,9 @@ package org.gitanimals.render.controller +import jakarta.servlet.http.HttpServletResponse import org.gitanimals.render.app.AnimationFacade +import org.springframework.http.HttpHeaders +import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -13,7 +16,8 @@ class AnimationController( ) { @GetMapping(value = ["/{username}"], produces = ["image/svg+xml"]) - fun getSvgAnimation(@PathVariable("username") username: String): String { + fun getSvgAnimation(@PathVariable("username") username: String, response: HttpServletResponse): String { + response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=1") return animationFacade.getSvgAnimationByUsername(username) } } From 304aea84d8a9cd806d9c5f27b272c511706f227f Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 22:28:23 +0900 Subject: [PATCH 016/161] =?UTF-8?q?ci:=20spring-server=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=ED=8F=AC=ED=8A=B8=EB=A5=BC=208081=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 359bff3..4698121 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -82,4 +82,4 @@ jobs: run: | sudo docker pull ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm - sudo docker run -d -p 8080:8080 ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} + sudo docker run -d -p 8081:8080 ghcr.io/devxb/gitanimals:${{ steps.extract_version_name.outputs.version }} From 76471ccc7b257c4c466223110f99195014ea2c24 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:30:25 +0900 Subject: [PATCH 017/161] =?UTF-8?q?docs:=20=EC=A0=81=EC=9A=A9=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=EB=A5=BC=20=EC=8B=A4=EC=A0=9C=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=98=88=EC=8B=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ead8b02..d5c30e1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@
- + docs/sample.svg @@ -59,7 +59,7 @@ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -docs/pets.svg +docs/pets.svg ## From cfa1b78b45f3d69c7885e56c29b15ac7a3414adb Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 11 Apr 2024 22:40:33 +0900 Subject: [PATCH 018/161] =?UTF-8?q?refactor:=20github=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=EC=BA=90=EC=8B=9C?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/AnimationController.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index 96e8813..56afc4e 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -2,8 +2,6 @@ package org.gitanimals.render.controller import jakarta.servlet.http.HttpServletResponse import org.gitanimals.render.app.AnimationFacade -import org.springframework.http.HttpHeaders -import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -16,8 +14,16 @@ class AnimationController( ) { @GetMapping(value = ["/{username}"], produces = ["image/svg+xml"]) - fun getSvgAnimation(@PathVariable("username") username: String, response: HttpServletResponse): String { - response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=1") + fun getSvgAnimation( + @PathVariable("username") username: String, + response: HttpServletResponse + ): String { + response.noCache() return animationFacade.getSvgAnimationByUsername(username) } + + fun HttpServletResponse.noCache(): HttpServletResponse { + this.setHeader("Cache-Control", "no-cache, no-store, must-revalidate") + return this + } } From edc6f10fffe565d23a190bec96a461b170da46cb Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:30:25 +0900 Subject: [PATCH 019/161] =?UTF-8?q?docs:=20=EC=A0=81=EC=9A=A9=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=EB=A5=BC=20=EC=8B=A4=EC=A0=9C=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=98=88=EC=8B=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ead8b02..d5c30e1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@
- + docs/sample.svg @@ -59,7 +59,7 @@ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -docs/pets.svg +docs/pets.svg ## From bbfc31cc95b79e4d419e046272ec86e200afb069 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 14:30:05 +0900 Subject: [PATCH 020/161] =?UTF-8?q?build:=20netx=EC=9D=98=20logging=20leve?= =?UTF-8?q?l=EC=9D=84=20info=EB=A1=9C=20=EC=98=AC=EB=A6=B0=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2e1ac24..bb001ee 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -19,6 +19,6 @@ netx.node-name=render-1 netx.recovery-milli=1000 netx.orphan-milli=60000 netx.backpressure=40 -netx.logging.level=warn +netx.logging.level=info github.token= From ec2bf46cb771424ad0ec537b325b4bb3661c9b40 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 16:57:38 +0900 Subject: [PATCH 021/161] =?UTF-8?q?feat:=20=EC=83=88=EB=A1=9C=EC=9A=B4=20?= =?UTF-8?q?=ED=8E=AB=EC=9D=84=20=EC=A7=80=EA=B8=89=ED=95=A0=EB=95=8C,=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=EA=B0=80=20=EB=93=B1=EB=A1=9D=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=95=84=20=EC=83=9D=EA=B8=B0=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.gradle | 2 +- .../org/gitanimals/render/domain/Persona.kt | 4 +- .../org/gitanimals/render/domain/Svgs.kt | 107 +++++++++--------- .../org/gitanimals/render/domain/User.kt | 14 ++- .../gitanimals/render/domain/UserService.kt | 3 +- .../render/domain/value/Contribution.kt | 2 +- .../render/infra/GithubContributionApi.kt | 4 +- src/main/resources/application.properties | 6 +- 8 files changed, 75 insertions(+), 67 deletions(-) diff --git a/settings.gradle b/settings.gradle index 9ed56e5..9c4c72a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ -rootProject.name = 'gitanimals-render' +rootProject.name = 'gitanimals' diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 9e3a4dd..f8f84e3 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -18,12 +18,12 @@ class Persona( @Embedded val level: Level, -) : AbstractTime() { @JsonIgnore @JoinColumn(name = "user_id") @ManyToOne(fetch = FetchType.LAZY, optional = false) - lateinit var user: User + var user: User? = null, +) : AbstractTime() { constructor( type: PersonaType, diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index b01da61..fd4ac5d 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -1,167 +1,168 @@ package org.gitanimals.render.domain import org.springframework.core.io.ClassPathResource +import org.springframework.util.ClassUtils import java.nio.charset.Charset -val whiteFieldSvg: String = ClassPathResource("classpath:persona/field/white-field.svg") +val whiteFieldSvg: String = ClassPathResource("persona/field/white-field.svg") .getContentAsString(Charset.defaultCharset()) -val snowyFieldSvg: String = ClassPathResource("classpath:persona/field/snowy-field.svg") +val snowyFieldSvg: String = ClassPathResource("persona/field/snowy-field.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSvg: String = ClassPathResource("classpath:persona/animal/goose.svg") +val gooseSvg: String = ClassPathResource("persona/animal/goose.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSunglassesSvg: String = ClassPathResource("classpath:persona/animal/goose-sunglasses.svg") +val gooseSunglassesSvg: String = ClassPathResource("persona/animal/goose-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val gooseKotlinSvg: String = ClassPathResource("classpath:persona/animal/goose-kotlin.svg") +val gooseKotlinSvg: String = ClassPathResource("persona/animal/goose-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val gooseJavaSvg: String = ClassPathResource("classpath:persona/animal/goose-java.svg") +val gooseJavaSvg: String = ClassPathResource("persona/animal/goose-java.svg") .getContentAsString(Charset.defaultCharset()) -val gooseJsSvg: String = ClassPathResource("classpath:persona/animal/goose-js.svg") +val gooseJsSvg: String = ClassPathResource("persona/animal/goose-js.svg") .getContentAsString(Charset.defaultCharset()) -val gooseNodeSvg: String = ClassPathResource("classpath:persona/animal/goose-node.svg") +val gooseNodeSvg: String = ClassPathResource("persona/animal/goose-node.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSwiftSvg: String = ClassPathResource("classpath:persona/animal/goose-swift.svg") +val gooseSwiftSvg: String = ClassPathResource("persona/animal/goose-swift.svg") .getContentAsString(Charset.defaultCharset()) -val gooseLinuxSvg: String = ClassPathResource("classpath:persona/animal/goose-linux.svg") +val gooseLinuxSvg: String = ClassPathResource("persona/animal/goose-linux.svg") .getContentAsString(Charset.defaultCharset()) -val gooseSpringSvg: String = ClassPathResource("classpath:persona/animal/goose-spring.svg") +val gooseSpringSvg: String = ClassPathResource("persona/animal/goose-spring.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSvg: String = ClassPathResource("classpath:persona/animal/little-chick.svg") +val littleChickSvg: String = ClassPathResource("persona/animal/little-chick.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSunglassesSvg: String = ClassPathResource("classpath:persona/animal/little-chick-sunglasses.svg") +val littleChickSunglassesSvg: String = ClassPathResource("persona/animal/little-chick-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickKotlinSvg: String = ClassPathResource("classpath:persona/animal/little-chick-kotlin.svg") +val littleChickKotlinSvg: String = ClassPathResource("persona/animal/little-chick-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickJavaSvg: String = ClassPathResource("classpath:persona/animal/little-chick-java.svg") +val littleChickJavaSvg: String = ClassPathResource("persona/animal/little-chick-java.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickJsSvg: String = ClassPathResource("classpath:persona/animal/little-chick-js.svg") +val littleChickJsSvg: String = ClassPathResource("persona/animal/little-chick-js.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickNodeSvg: String = ClassPathResource("classpath:persona/animal/little-chick-node.svg") +val littleChickNodeSvg: String = ClassPathResource("persona/animal/little-chick-node.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSwiftSvg: String = ClassPathResource("classpath:persona/animal/little-chick-swift.svg") +val littleChickSwiftSvg: String = ClassPathResource("persona/animal/little-chick-swift.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickLinuxSvg: String = ClassPathResource("classpath:persona/animal/little-chick-linux.svg") +val littleChickLinuxSvg: String = ClassPathResource("persona/animal/little-chick-linux.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSpringSvg: String = ClassPathResource("classpath:persona/animal/little-chick-spring.svg") +val littleChickSpringSvg: String = ClassPathResource("persona/animal/little-chick-spring.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSvg: String = ClassPathResource("classpath:persona/animal/penguin.svg") +val penguinSvg: String = ClassPathResource("persona/animal/penguin.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSunglassesSvg: String = ClassPathResource("classpath:persona/animal/penguin-sunglasses.svg") +val penguinSunglassesSvg: String = ClassPathResource("persona/animal/penguin-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val penguinKotlinSvg: String = ClassPathResource("classpath:persona/animal/penguin-kotlin.svg") +val penguinKotlinSvg: String = ClassPathResource("persona/animal/penguin-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val penguinJavaSvg: String = ClassPathResource("classpath:persona/animal/penguin-java.svg") +val penguinJavaSvg: String = ClassPathResource("persona/animal/penguin-java.svg") .getContentAsString(Charset.defaultCharset()) -val penguinJsSvg: String = ClassPathResource("classpath:persona/animal/penguin-js.svg") +val penguinJsSvg: String = ClassPathResource("persona/animal/penguin-js.svg") .getContentAsString(Charset.defaultCharset()) -val penguinNodeSvg: String = ClassPathResource("classpath:persona/animal/penguin-node.svg") +val penguinNodeSvg: String = ClassPathResource("persona/animal/penguin-node.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSwiftSvg: String = ClassPathResource("classpath:persona/animal/penguin-swift.svg") +val penguinSwiftSvg: String = ClassPathResource("persona/animal/penguin-swift.svg") .getContentAsString(Charset.defaultCharset()) -val penguinLinuxSvg: String = ClassPathResource("classpath:persona/animal/penguin-linux.svg") +val penguinLinuxSvg: String = ClassPathResource("persona/animal/penguin-linux.svg") .getContentAsString(Charset.defaultCharset()) -val penguinSpringSvg: String = ClassPathResource("classpath:persona/animal/penguin-spring.svg") +val penguinSpringSvg: String = ClassPathResource("persona/animal/penguin-spring.svg") .getContentAsString(Charset.defaultCharset()) -val pigSvg: String = ClassPathResource("classpath:persona/animal/pig.svg") +val pigSvg: String = ClassPathResource("persona/animal/pig.svg") .getContentAsString(Charset.defaultCharset()) -val pigSunglassesSvg: String = ClassPathResource("classpath:persona/animal/pig-sunglasses.svg") +val pigSunglassesSvg: String = ClassPathResource("persona/animal/pig-sunglasses.svg") .getContentAsString(Charset.defaultCharset()) -val pigKotlinSvg: String = ClassPathResource("classpath:persona/animal/pig-kotlin.svg") +val pigKotlinSvg: String = ClassPathResource("persona/animal/pig-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val pigJavaSvg: String = ClassPathResource("classpath:persona/animal/pig-java.svg") +val pigJavaSvg: String = ClassPathResource("persona/animal/pig-java.svg") .getContentAsString(Charset.defaultCharset()) -val pigJsSvg: String = ClassPathResource("classpath:persona/animal/pig-js.svg") +val pigJsSvg: String = ClassPathResource("persona/animal/pig-js.svg") .getContentAsString(Charset.defaultCharset()) -val pigNodeSvg: String = ClassPathResource("classpath:persona/animal/pig-node.svg") +val pigNodeSvg: String = ClassPathResource("persona/animal/pig-node.svg") .getContentAsString(Charset.defaultCharset()) -val pigSwiftSvg: String = ClassPathResource("classpath:persona/animal/pig-swift.svg") +val pigSwiftSvg: String = ClassPathResource("persona/animal/pig-swift.svg") .getContentAsString(Charset.defaultCharset()) -val pigLinuxSvg: String = ClassPathResource("classpath:persona/animal/pig-linux.svg") +val pigLinuxSvg: String = ClassPathResource("persona/animal/pig-linux.svg") .getContentAsString(Charset.defaultCharset()) -val pigSpringSvg: String = ClassPathResource("classpath:persona/animal/pig-spring.svg") +val pigSpringSvg: String = ClassPathResource("persona/animal/pig-spring.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedSvg: String = ClassPathResource("classpath:persona/animal/slime-red.svg") +val slimeRedSvg: String = ClassPathResource("persona/animal/slime-red.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedKotlinSvg: String = ClassPathResource("classpath:persona/animal/slime-red-kotlin.svg") +val slimeRedKotlinSvg: String = ClassPathResource("persona/animal/slime-red-kotlin.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedJavaSvg: String = ClassPathResource("classpath:persona/animal/slime-red-java.svg") +val slimeRedJavaSvg: String = ClassPathResource("persona/animal/slime-red-java.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedJsSvg: String = ClassPathResource("classpath:persona/animal/slime-red-js.svg") +val slimeRedJsSvg: String = ClassPathResource("persona/animal/slime-red-js.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedNodeSvg: String = ClassPathResource("classpath:persona/animal/slime-red-node.svg") +val slimeRedNodeSvg: String = ClassPathResource("persona/animal/slime-red-node.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedSwiftSvg: String = ClassPathResource("classpath:persona/animal/slime-red-swift.svg") +val slimeRedSwiftSvg: String = ClassPathResource("persona/animal/slime-red-swift.svg") .getContentAsString(Charset.defaultCharset()) -val slimeRedLinuxSvg: String = ClassPathResource("classpath:persona/animal/slime-red-linux.svg") +val slimeRedLinuxSvg: String = ClassPathResource("persona/animal/slime-red-linux.svg") .getContentAsString(Charset.defaultCharset()) -val slimeBlueSvg: String = ClassPathResource("classpath:persona/animal/slime-blue.svg") +val slimeBlueSvg: String = ClassPathResource("persona/animal/slime-blue.svg") .getContentAsString(Charset.defaultCharset()) -val slimeGreenSvg: String = ClassPathResource("classpath:persona/animal/slime-green.svg") +val slimeGreenSvg: String = ClassPathResource("persona/animal/slime-green.svg") .getContentAsString(Charset.defaultCharset()) val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { - val path = "classpath:persona/text/large/$i.svg" + val path = "persona/text/large/$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } for (i in 'a'..'z') { - val path = "classpath:persona/text/large/_$i.svg" + val path = "persona/text/large/_$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } for (i in 0..9) { - val path = "classpath:persona/text/large/$i.svg" + val path = "persona/text/large/$i.svg" map[i.toString()] = ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) } - map["-"] = ClassPathResource("classpath:persona/text/large/hyphens.svg") + map["-"] = ClassPathResource("persona/text/large/hyphens.svg") .getContentAsString(Charset.defaultCharset()) map }.value @@ -169,7 +170,7 @@ val largeTextSvgs = lazy { val mediumNumberSvgs = lazy { val list = mutableListOf() for (i in 0..9) { - val path = "classpath:persona/text/medium/$i.svg" + val path = "persona/text/medium/$i.svg" list.add( ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) @@ -181,7 +182,7 @@ val mediumNumberSvgs = lazy { val numberSvgs = lazy { val list = mutableListOf() for (i in 0..9) { - val path = "classpath:persona/text/small/$i.svg" + val path = "persona/text/small/$i.svg" list.add( ClassPathResource(path) .getContentAsString(Charset.defaultCharset()) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 46fb537..38a0719 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -3,6 +3,7 @@ package org.gitanimals.render.domain import jakarta.persistence.* import org.gitanimals.render.core.AggregateRoot import org.gitanimals.render.domain.value.Contribution +import org.gitanimals.render.domain.value.Level import org.hibernate.annotations.BatchSize import java.time.Instant import java.time.ZoneId @@ -10,7 +11,6 @@ import java.time.ZonedDateTime import java.time.temporal.ChronoUnit import kotlin.math.max import kotlin.math.min -import kotlin.random.Random @AggregateRoot @Entity(name = "user") @@ -76,8 +76,13 @@ class User( private fun levelUpPersonas(newContribution: Int) { repeat(newContribution) { - val persona = personas[Random.nextInt(0, personas.size)] - persona.level.value++ + runCatching { + val persona = personas.random() + persona.level.value++ + }.onFailure { + it.printStackTrace() + throw it + } } } @@ -88,7 +93,8 @@ class User( if (personas.size >= MAX_PERSONA_COUNT) { return } - personas.add(Persona(PersonaType.random(), 0)) + val newPersona = Persona(type = PersonaType.random(), level = Level(0), user = this) + personas.add(newPersona) } fun increaseVisitCount() { diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 6bee8f2..5c9d155 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -25,7 +25,8 @@ class UserService( @Retryable(retryFor = [OptimisticLockingFailureException::class], maxAttempts = 10) @Transactional fun updateContributions(username: String, contribution: Int) { - getUserByName(username).updateContribution(contribution) + getUserByName(username) + .updateContribution(contribution) } fun isContributionUpdatedBeforeOneHour(name: String): Boolean = diff --git a/src/main/kotlin/org/gitanimals/render/domain/value/Contribution.kt b/src/main/kotlin/org/gitanimals/render/domain/value/Contribution.kt index 619fe8a..91480de 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/value/Contribution.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/value/Contribution.kt @@ -5,7 +5,7 @@ import jakarta.persistence.Embeddable import java.time.Instant @Embeddable -class Contribution( +data class Contribution( @Column(name = "year", nullable = false) val year: Int, @Column(name = "contribution", nullable = false) diff --git a/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt b/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt index 9c6d4f3..660b804 100644 --- a/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt +++ b/src/main/kotlin/org/gitanimals/render/infra/GithubContributionApi.kt @@ -120,11 +120,11 @@ class GithubContributionApi( private const val YEAR_FIX = "*{year}" private val contributionYearQuery: String = - ClassPathResource("classpath:github-graphql/contribution-year.graphql") + ClassPathResource("github-graphql/contribution-year.graphql") .getContentAsString(Charset.defaultCharset()) private val contributionCountByYearQuery = - ClassPathResource("classpath:github-graphql/contribution-count-by-year.graphql") + ClassPathResource("github-graphql/contribution-count-by-year.graphql") .getContentAsString(Charset.defaultCharset()) } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bb001ee..c24180b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ server.name=gitanimals-render server.port=8080 -spring.datasource.url= +spring.datasource.url=jdbc:mysql://localhost:3306/gitanimalsrender spring.datasource.username= spring.datasource.password= spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -11,8 +11,8 @@ spring.jpa.hibernate.ddl-auto=update spring.jpa.open-in-view=false netx.mode=redis -netx.host= -netx.port= +netx.host=localhost +netx.port=6379 netx.group=render netx.node-id=1 netx.node-name=render-1 From 7065cb9c09c6d5450d588291e8f8f74249399b61 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 21:05:16 +0900 Subject: [PATCH 022/161] =?UTF-8?q?refactor:=20=EC=9B=80=EC=A7=81=EC=9E=84?= =?UTF-8?q?=EC=9D=84=20=EC=9E=90=EC=97=B0=EC=8A=A4=EB=9F=BD=EA=B2=8C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 37 +++-- src/test/resources/persona/goose/test.svg | 157 +++++++----------- 2 files changed, 76 insertions(+), 118 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 84a6cbb..34c5864 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -955,18 +955,18 @@ enum class PersonaType(private val weight: Double) { ): StringBuilder { var currentY = Random.nextInt(10, 90) var currentX = Random.nextInt(10, 90) - val startAngle = (Random.nextDouble() * 10).toInt() + var currentAngle = (Random.nextDouble() * 10).toInt() var scale = Random.nextInt(0, 2) - 1 if (scale == 0) { scale++ } this.append("@keyframes move-$id {") .append("0% {") - .append("-webkit-transform:translate($currentY%, $currentX%) rotate(${startAngle}deg) scaleX($scale);") - .append("-ms-transform:translate($currentY%, $currentX%) rotate(${startAngle}deg) scaleX($scale);") - .append("-o-transform:translate($currentY%, $currentX%) rotate(${startAngle}deg) scaleX($scale);") - .append("-moz-transform:translate($currentY%, $currentX%) rotate(${startAngle}deg) scaleX($scale);") - .append("transform:translate($currentY%, $currentX%) rotate(${startAngle}deg) scaleX($scale);") + .append("-webkit-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-ms-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-o-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-moz-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") + .append("transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") .append("}") var animationPercentage = 0.0 while (animationPercentage < 100) { @@ -976,7 +976,7 @@ enum class PersonaType(private val weight: Double) { Random.nextInt(max(10, min(79, currentY - speed)), min(80, currentY + speed)) val nextX = Random.nextInt(max(10, min(79, currentX - speed)), min(80, currentX + speed)) - val angle = (atan2( + val nextAngle = (atan2( currentY.toDouble() - nextY.toDouble(), currentX.toDouble() - nextX.toDouble() )).toInt() @@ -984,22 +984,23 @@ enum class PersonaType(private val weight: Double) { true -> 1 false -> -1 } - this.append("${min(100.0, beforeAnimationPercentage + 0.0001)}% {") - .append("-webkit-transform: translate(${scale * (currentX + width)}, $currentY) scaleX($scale);") - .append("-ms-transform: translate(${scale * (currentX + width)}, $currentY) scaleX($scale);") - .append("-o-transform: translate(${scale * (currentX + width)}, $currentY) scaleX($scale);") - .append("-moz-transform: translate(${scale * (currentX + width)}, $currentY) scaleX($scale);") - .append("transform: translate(${scale * (currentX + width)}, $currentY) scaleX($scale);") + this.append("${min(100.0, beforeAnimationPercentage + 0.2)}% {") + .append("-webkit-transform: translate($currentX%, ${currentY}%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-ms-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-o-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-moz-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") + .append("transform: translate(${currentX}%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") .append("}") .append("${min(100.0, animationPercentage)}% {") - .append("-webkit-transform:translate($nextY%, $nextX%) rotate(${angle}deg) scaleX($scale);") - .append("-ms-transform:translate($nextY%, $nextX%) rotate(${angle}deg) scaleX($scale);") - .append("-o-transform:translate($nextY%, $nextX%) rotate(${angle}deg) scaleX($scale);") - .append("-moz-transform:translate($nextY%, $nextX%) rotate(${angle}deg) scaleX($scale);") - .append("transform:translate($nextY%, $nextX%) rotate(${angle}deg) scaleX($scale);") + .append("-webkit-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") + .append("-ms-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") + .append("-o-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") + .append("-moz-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") + .append("transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") .append("}") currentY = nextY currentX = nextX + currentAngle = nextAngle } this.append("}") .append("#$type-$id {") diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 44db000..a05b4a5 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,123 +1,80 @@ - + - - - - - - + + + + + + - + - - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + From 7145799eb4fb7db70f7c67d50de232bac6f79b2d Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 21:26:55 +0900 Subject: [PATCH 023/161] =?UTF-8?q?refactor:=20=EC=9B=80=EC=A7=81=EC=9E=84?= =?UTF-8?q?=EC=9D=84=20=EC=9E=90=EC=97=B0=EC=8A=A4=EB=9F=BD=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/app/AnimationFacade.kt | 8 +- .../render/controller/AnimationController.kt | 4 +- .../gitanimals/render/domain/AnimationMode.kt | 10 ++ .../gitanimals/render/domain/PersonaType.kt | 137 +++++++++--------- .../org/gitanimals/render/domain/User.kt | 6 +- .../gitanimals/render/domain/UserService.kt | 6 +- 6 files changed, 95 insertions(+), 76 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt diff --git a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt index 6079885..2945b41 100644 --- a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt @@ -1,6 +1,7 @@ package org.gitanimals.render.app import jakarta.annotation.PostConstruct +import org.gitanimals.render.domain.AnimationMode import org.gitanimals.render.domain.User import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.event.Visited @@ -17,10 +18,11 @@ class AnimationFacade( private lateinit var registerNewUserOrchestrator: Orchestrator - fun getSvgAnimationByUsername(username: String): String { + fun getSvgAnimation(username: String, mode: String): String { + val animationMode = AnimationMode.valueOf(mode.uppercase()) return when (userService.existsByName(username)) { true -> { - val svgAnimation = userService.getSvgAnimationByUsername(username) + val svgAnimation = userService.getSvgAnimationByUsername(username, animationMode) sagaManager.startSync(Visited(username)) svgAnimation } @@ -28,7 +30,7 @@ class AnimationFacade( false -> { registerNewUserOrchestrator.sagaSync(10000, username) - userService.getSvgAnimationByUsername(username) + userService.getSvgAnimationByUsername(username, animationMode) } } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index 56afc4e..72665bc 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -5,6 +5,7 @@ import org.gitanimals.render.app.AnimationFacade import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController @@ -16,10 +17,11 @@ class AnimationController( @GetMapping(value = ["/{username}"], produces = ["image/svg+xml"]) fun getSvgAnimation( @PathVariable("username") username: String, + @RequestParam(name = "mode", defaultValue = "FARM") mode: String, response: HttpServletResponse ): String { response.noCache() - return animationFacade.getSvgAnimationByUsername(username) + return animationFacade.getSvgAnimation(username, mode) } fun HttpServletResponse.noCache(): HttpServletResponse { diff --git a/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt b/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt new file mode 100644 index 0000000..8bd76b1 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt @@ -0,0 +1,10 @@ +package org.gitanimals.render.domain + +enum class AnimationMode( + private val func: (User) -> String, +) { + + FARM({ it.createFarmAnimation() }), + ; + fun createAnimation(user: User): String = func.invoke(user) +} diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 34c5864..6a881f4 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -25,7 +25,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 15) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -48,7 +48,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 15) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -71,7 +71,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 25) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -94,7 +94,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 25) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -117,7 +117,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 27) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -140,7 +140,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 28) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -163,7 +163,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 26) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -186,7 +186,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 25) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -209,7 +209,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 30) + .moveRandomly("goose", id, 20, "180s", 6) .toString() }, @@ -232,7 +232,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 10) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -255,7 +255,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 10) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -278,7 +278,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -301,7 +301,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -324,7 +324,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -347,7 +347,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -370,7 +370,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -393,7 +393,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 13) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -416,7 +416,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 17) + .moveRandomly("little-chick", id, 40, "180s", 2) .toString() }, @@ -435,7 +435,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 15) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 6) .toString() }, @@ -454,7 +454,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 15) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 6) .toString() }, @@ -473,7 +473,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -492,7 +492,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -511,7 +511,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -530,7 +530,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -549,7 +549,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -568,7 +568,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -587,7 +587,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 25) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) .toString() }, @@ -605,7 +605,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -623,7 +623,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -641,7 +641,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -659,7 +659,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -677,7 +677,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -695,7 +695,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -713,7 +713,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -731,7 +731,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -749,7 +749,7 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 15) + override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) .toString() }, @@ -767,7 +767,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -785,7 +785,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -803,7 +803,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -821,7 +821,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -839,7 +839,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -857,7 +857,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -875,7 +875,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -893,7 +893,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, @@ -911,7 +911,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 15) + StringBuilder().moveRandomly("slime", id, 15, "180s", 2) .toString() }, ; @@ -956,17 +956,17 @@ enum class PersonaType(private val weight: Double) { var currentY = Random.nextInt(10, 90) var currentX = Random.nextInt(10, 90) var currentAngle = (Random.nextDouble() * 10).toInt() - var scale = Random.nextInt(0, 2) - 1 - if (scale == 0) { - scale++ + var currentScale = Random.nextInt(0, 2) - 1 + if (currentScale == 0) { + currentScale++ } this.append("@keyframes move-$id {") .append("0% {") - .append("-webkit-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-ms-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-o-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-moz-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") - .append("transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($scale);") + .append("-webkit-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") + .append("-ms-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") + .append("-o-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") + .append("-moz-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") + .append("transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") .append("}") var animationPercentage = 0.0 while (animationPercentage < 100) { @@ -980,27 +980,30 @@ enum class PersonaType(private val weight: Double) { currentY.toDouble() - nextY.toDouble(), currentX.toDouble() - nextX.toDouble() )).toInt() - scale = when (nextX > currentX) { + val nextScale = when (nextX > currentX) { true -> 1 false -> -1 } - this.append("${min(100.0, beforeAnimationPercentage + 0.2)}% {") - .append("-webkit-transform: translate($currentX%, ${currentY}%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-ms-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-o-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") - .append("-moz-transform: translate($currentX%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") - .append("transform: translate(${currentX}%, $currentY%) rotate(${currentAngle}deg) scaleX($scale);") - .append("}") - .append("${min(100.0, animationPercentage)}% {") - .append("-webkit-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") - .append("-ms-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") - .append("-o-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") - .append("-moz-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") - .append("transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($scale);") + if (nextScale != currentScale) { + this.append("${min(100.0, beforeAnimationPercentage + 0.01)}% {") + .append("-webkit-transform: translate(${currentX - (width * nextScale)}%, ${currentY}%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-ms-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-o-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-moz-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("transform: translate(${{currentX - (width * nextScale)}}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("}") + } + this.append("${min(100.0, animationPercentage)}% {") + .append("-webkit-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") + .append("-ms-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") + .append("-o-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") + .append("-moz-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") + .append("transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") .append("}") currentY = nextY currentX = nextX currentAngle = nextAngle + currentScale = nextScale } this.append("}") .append("#$type-$id {") diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 38a0719..98f3d91 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -101,8 +101,8 @@ class User( visit += 1 } - fun createSvgAnimation(): String { - val builder = StringBuilder().openSvg() + fun createFarmAnimation(): String { + val builder = StringBuilder().openFarm() .append(field.fillBackground()) personas.asSequence() @@ -119,7 +119,7 @@ class User( return totalCount } - private fun StringBuilder.openSvg(): StringBuilder = + private fun StringBuilder.openFarm(): StringBuilder = this.append("") private fun StringBuilder.closeSvg(): String = this.append("").toString() diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 5c9d155..3a10793 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -13,8 +13,10 @@ class UserService( fun existsByName(name: String): Boolean = userRepository.existsByName(name) - fun getSvgAnimationByUsername(username: String): String = - getUserByName(username).createSvgAnimation() + fun getSvgAnimationByUsername(username: String, mode: AnimationMode): String { + val user = getUserByName(username) + return mode.createAnimation(user) + } @Retryable(retryFor = [OptimisticLockingFailureException::class], maxAttempts = 10) @Transactional From 94d6898538998120dc4f01465a05f04f62947225 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 21:30:30 +0900 Subject: [PATCH 024/161] =?UTF-8?q?refactor:=20=EC=98=A4=EB=A6=AC=EC=9D=98?= =?UTF-8?q?=20=EC=9B=80=EC=A7=81=EC=9E=84=EC=9D=84=20=EC=9E=90=EC=97=B0?= =?UTF-8?q?=EC=8A=A4=EB=9F=BD=EA=B2=8C=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 6a881f4..581ebf0 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -25,7 +25,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -48,7 +48,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -71,7 +71,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -94,7 +94,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -117,7 +117,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -140,7 +140,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -163,7 +163,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -186,7 +186,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -209,7 +209,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 6) + .moveRandomly("goose", id, 20, "180s", 7) .toString() }, @@ -767,7 +767,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -785,7 +785,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -803,7 +803,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -821,7 +821,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -839,7 +839,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -857,7 +857,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -875,7 +875,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -893,7 +893,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, @@ -911,7 +911,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 2) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, ; From 8b5db3a65ecda0b66f2bd8ab2f6f37f2196f22bf Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 22:10:33 +0900 Subject: [PATCH 025/161] =?UTF-8?q?feat:=20line=20mode=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/AnimationMode.kt | 1 + .../gitanimals/render/domain/PersonaType.kt | 16 +- .../org/gitanimals/render/domain/User.kt | 13 + .../resources/persona/animal/goose-java.svg | 8 +- .../resources/persona/animal/goose-js.svg | 6 +- .../resources/persona/animal/goose-kotlin.svg | 520 +++++++++--------- .../resources/persona/animal/goose-linux.svg | 8 +- .../resources/persona/animal/goose-node.svg | 8 +- .../resources/persona/animal/goose-spring.svg | 8 +- .../persona/animal/goose-sunglasses.svg | 7 +- .../resources/persona/animal/goose-swift.svg | 8 +- src/main/resources/persona/animal/goose.svg | 299 +++++----- .../persona/animal/little-chick-java.svg | 4 +- .../persona/animal/little-chick-js.svg | 4 +- .../persona/animal/little-chick-kotlin.svg | 4 +- .../persona/animal/little-chick-linux.svg | 4 +- .../persona/animal/little-chick-node.svg | 4 +- .../persona/animal/little-chick-spring.svg | 4 +- .../animal/little-chick-sunglasses.svg | 298 +++++----- .../persona/animal/little-chick-swift.svg | 4 +- .../resources/persona/animal/little-chick.svg | 4 +- .../resources/persona/animal/penguin-java.svg | 489 ++++++++-------- .../resources/persona/animal/penguin-js.svg | 8 +- .../persona/animal/penguin-kotlin.svg | 468 ++++++++-------- .../persona/animal/penguin-linux.svg | 410 +++++++------- .../resources/persona/animal/penguin-node.svg | 375 +++++++------ .../persona/animal/penguin-spring.svg | 442 ++++++++------- .../persona/animal/penguin-sunglasses.svg | 312 ++++++----- .../persona/animal/penguin-swift.svg | 419 +++++++------- src/main/resources/persona/animal/penguin.svg | 253 +++++---- .../resources/persona/animal/pig-java.svg | 518 +++++++++-------- src/main/resources/persona/animal/pig-js.svg | 311 ++++++----- .../resources/persona/animal/pig-kotlin.svg | 387 +++++++------ .../resources/persona/animal/pig-linux.svg | 380 +++++++------ .../resources/persona/animal/pig-node.svg | 345 ++++++------ .../resources/persona/animal/pig-spring.svg | 411 +++++++------- .../persona/animal/pig-sunglasses.svg | 308 ++++++----- .../resources/persona/animal/pig-swift.svg | 394 +++++++------ src/main/resources/persona/animal/pig.svg | 267 ++++----- .../resources/persona/animal/slime-blue.svg | 205 ++++--- .../resources/persona/animal/slime-green.svg | 205 ++++--- .../persona/animal/slime-red-java.svg | 388 +++++++------ .../resources/persona/animal/slime-red-js.svg | 241 ++++---- .../persona/animal/slime-red-kotlin.svg | 328 ++++++----- .../persona/animal/slime-red-linux.svg | 284 +++++----- .../persona/animal/slime-red-node.svg | 274 ++++----- .../persona/animal/slime-red-swift.svg | 319 ++++++----- .../resources/persona/animal/slime-red.svg | 205 ++++--- 48 files changed, 5278 insertions(+), 4900 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt b/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt index 8bd76b1..c2367e5 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt @@ -5,6 +5,7 @@ enum class AnimationMode( ) { FARM({ it.createFarmAnimation() }), + LINE({ it.createLineAnimation() }), ; fun createAnimation(user: User): String = func.invoke(user) } diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 581ebf0..f7d55bd 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -951,9 +951,9 @@ enum class PersonaType(private val weight: Double) { id: Long, speed: Int, duration: String, - width: Long, + personaWidth: Long, ): StringBuilder { - var currentY = Random.nextInt(10, 90) + var currentY = Random.nextInt(10, 70) var currentX = Random.nextInt(10, 90) var currentAngle = (Random.nextDouble() * 10).toInt() var currentScale = Random.nextInt(0, 2) - 1 @@ -973,7 +973,7 @@ enum class PersonaType(private val weight: Double) { val beforeAnimationPercentage = animationPercentage animationPercentage += Random.nextInt(2, 6) val nextY = - Random.nextInt(max(10, min(79, currentY - speed)), min(80, currentY + speed)) + Random.nextInt(max(0, min(79, currentY - speed)), min(70, currentY + speed)) val nextX = Random.nextInt(max(10, min(79, currentX - speed)), min(80, currentX + speed)) val nextAngle = (atan2( @@ -986,11 +986,11 @@ enum class PersonaType(private val weight: Double) { } if (nextScale != currentScale) { this.append("${min(100.0, beforeAnimationPercentage + 0.01)}% {") - .append("-webkit-transform: translate(${currentX - (width * nextScale)}%, ${currentY}%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-ms-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-o-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-moz-transform: translate(${currentX - (width * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("transform: translate(${{currentX - (width * nextScale)}}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-webkit-transform: translate(${currentX - (personaWidth * nextScale)}%, ${currentY}%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-ms-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-o-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("-moz-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("transform: translate(${{currentX - (personaWidth * nextScale)}}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") .append("}") } this.append("${min(100.0, animationPercentage)}% {") diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 98f3d91..0de2833 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -101,6 +101,19 @@ class User( visit += 1 } + fun createLineAnimation(): String { + val builder = StringBuilder().openLine() + + val persona = personas.first() + builder.append(persona.toSvg()) + + return builder.closeSvg() + } + + private fun StringBuilder.openLine(): StringBuilder { + return this.append("") + } + fun createFarmAnimation(): String { val builder = StringBuilder().openFarm() .append(field.fillBackground()) diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index 09ef687..99ef06e 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -1,6 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index 5448fbb..9f3adc3 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -1,5 +1,3 @@ - - + @@ -199,5 +197,5 @@ + - diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 4c9bca8..14fce5f 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -1,271 +1,269 @@ - - - + + + + + + + + + *{level} + - - - - - - - *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index a2fb959..d4f764d 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -1,6 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index 4b66529..87ca8d9 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -1,6 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index eb51b88..c624112 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -1,6 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 87a37cd..56d0856 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -1,5 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index 561d89f..b14a16e 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -1,6 +1,4 @@ - - diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index cc2c298..40a0f7d 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -1,159 +1,158 @@ - - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index 7e24019..aa14328 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index e0b9e7f..0a375bc 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index 2b83e92..07160e9 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index 84d626c..9dd4d23 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index bf05b24..edc72a8 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index bf545e9..9101ee6 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index ab8d6ac..fd762e5 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -1,156 +1,168 @@ - - - - - - - - - - - *{level} - - + + + + + + + + + *{level} + + - - - - - - + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index 7f4dc31..def84f0 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 59d5898..152fbd4 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -1,5 +1,4 @@ - - - diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index 542da42..92cad65 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -1,231 +1,288 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin-js.svg b/src/main/resources/persona/animal/penguin-js.svg index 8d7812c..b2741df 100644 --- a/src/main/resources/persona/animal/penguin-js.svg +++ b/src/main/resources/persona/animal/penguin-js.svg @@ -1,6 +1,4 @@ - - + diff --git a/src/main/resources/persona/animal/penguin-kotlin.svg b/src/main/resources/persona/animal/penguin-kotlin.svg index 4dd85c2..a6052cf 100644 --- a/src/main/resources/persona/animal/penguin-kotlin.svg +++ b/src/main/resources/persona/animal/penguin-kotlin.svg @@ -1,250 +1,248 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin-linux.svg b/src/main/resources/persona/animal/penguin-linux.svg index 08386f8..02bcdf2 100644 --- a/src/main/resources/persona/animal/penguin-linux.svg +++ b/src/main/resources/persona/animal/penguin-linux.svg @@ -1,221 +1,219 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin-node.svg b/src/main/resources/persona/animal/penguin-node.svg index 1ad6d1d..bb74399 100644 --- a/src/main/resources/persona/animal/penguin-node.svg +++ b/src/main/resources/persona/animal/penguin-node.svg @@ -1,193 +1,212 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin-spring.svg b/src/main/resources/persona/animal/penguin-spring.svg index 18a8c01..2495966 100644 --- a/src/main/resources/persona/animal/penguin-spring.svg +++ b/src/main/resources/persona/animal/penguin-spring.svg @@ -1,237 +1,235 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin-sunglasses.svg b/src/main/resources/persona/animal/penguin-sunglasses.svg index c41746b..60bea96 100644 --- a/src/main/resources/persona/animal/penguin-sunglasses.svg +++ b/src/main/resources/persona/animal/penguin-sunglasses.svg @@ -1,170 +1,168 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/penguin-swift.svg b/src/main/resources/persona/animal/penguin-swift.svg index d0e73ff..e4724e0 100644 --- a/src/main/resources/persona/animal/penguin-swift.svg +++ b/src/main/resources/persona/animal/penguin-swift.svg @@ -1,208 +1,241 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + diff --git a/src/main/resources/persona/animal/penguin.svg b/src/main/resources/persona/animal/penguin.svg index a7c32e6..48458ac 100644 --- a/src/main/resources/persona/animal/penguin.svg +++ b/src/main/resources/persona/animal/penguin.svg @@ -1,140 +1,137 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - + + + + + + + *{level} + - - - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-java.svg b/src/main/resources/persona/animal/pig-java.svg index 5da9bdf..9abe647 100644 --- a/src/main/resources/persona/animal/pig-java.svg +++ b/src/main/resources/persona/animal/pig-java.svg @@ -1,273 +1,271 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-js.svg b/src/main/resources/persona/animal/pig-js.svg index e4c2891..06a557b 100644 --- a/src/main/resources/persona/animal/pig-js.svg +++ b/src/main/resources/persona/animal/pig-js.svg @@ -1,165 +1,172 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-kotlin.svg b/src/main/resources/persona/animal/pig-kotlin.svg index 27ba214..493ba75 100644 --- a/src/main/resources/persona/animal/pig-kotlin.svg +++ b/src/main/resources/persona/animal/pig-kotlin.svg @@ -1,183 +1,230 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-linux.svg b/src/main/resources/persona/animal/pig-linux.svg index f3d6d8f..2abe1c6 100644 --- a/src/main/resources/persona/animal/pig-linux.svg +++ b/src/main/resources/persona/animal/pig-linux.svg @@ -1,204 +1,202 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-node.svg b/src/main/resources/persona/animal/pig-node.svg index dc93f92..0d90428 100644 --- a/src/main/resources/persona/animal/pig-node.svg +++ b/src/main/resources/persona/animal/pig-node.svg @@ -1,176 +1,195 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-spring.svg b/src/main/resources/persona/animal/pig-spring.svg index f8a9ccf..3e0ebf8 100644 --- a/src/main/resources/persona/animal/pig-spring.svg +++ b/src/main/resources/persona/animal/pig-spring.svg @@ -1,220 +1,217 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-sunglasses.svg b/src/main/resources/persona/animal/pig-sunglasses.svg index 82b4c31..638ce3b 100644 --- a/src/main/resources/persona/animal/pig-sunglasses.svg +++ b/src/main/resources/persona/animal/pig-sunglasses.svg @@ -1,168 +1,166 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - - *{level} - + + + + + + + *{level} + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig-swift.svg b/src/main/resources/persona/animal/pig-swift.svg index b33528d..9a31643 100644 --- a/src/main/resources/persona/animal/pig-swift.svg +++ b/src/main/resources/persona/animal/pig-swift.svg @@ -1,193 +1,227 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/pig.svg b/src/main/resources/persona/animal/pig.svg index 1ce4b37..5892324 100644 --- a/src/main/resources/persona/animal/pig.svg +++ b/src/main/resources/persona/animal/pig.svg @@ -1,141 +1,150 @@ - - - - - - - - - - - - - - - - - - - *{level} - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-blue.svg b/src/main/resources/persona/animal/slime-blue.svg index a8996f9..cfdd060 100644 --- a/src/main/resources/persona/animal/slime-blue.svg +++ b/src/main/resources/persona/animal/slime-blue.svg @@ -1,112 +1,111 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-green.svg b/src/main/resources/persona/animal/slime-green.svg index a3d097f..3eec3ef 100644 --- a/src/main/resources/persona/animal/slime-green.svg +++ b/src/main/resources/persona/animal/slime-green.svg @@ -1,112 +1,111 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-java.svg b/src/main/resources/persona/animal/slime-red-java.svg index e2f390c..f9ada6f 100644 --- a/src/main/resources/persona/animal/slime-red-java.svg +++ b/src/main/resources/persona/animal/slime-red-java.svg @@ -1,174 +1,232 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-js.svg b/src/main/resources/persona/animal/slime-red-js.svg index 68a212f..79ade6a 100644 --- a/src/main/resources/persona/animal/slime-red-js.svg +++ b/src/main/resources/persona/animal/slime-red-js.svg @@ -1,125 +1,134 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-kotlin.svg b/src/main/resources/persona/animal/slime-red-kotlin.svg index cf1fe36..1ef89cf 100644 --- a/src/main/resources/persona/animal/slime-red-kotlin.svg +++ b/src/main/resources/persona/animal/slime-red-kotlin.svg @@ -1,154 +1,192 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-linux.svg b/src/main/resources/persona/animal/slime-red-linux.svg index 969c33c..b4fd032 100644 --- a/src/main/resources/persona/animal/slime-red-linux.svg +++ b/src/main/resources/persona/animal/slime-red-linux.svg @@ -1,139 +1,163 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-node.svg b/src/main/resources/persona/animal/slime-red-node.svg index 71f3011..3da0e56 100644 --- a/src/main/resources/persona/animal/slime-red-node.svg +++ b/src/main/resources/persona/animal/slime-red-node.svg @@ -1,136 +1,156 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red-swift.svg b/src/main/resources/persona/animal/slime-red-swift.svg index f6db8b9..bd86607 100644 --- a/src/main/resources/persona/animal/slime-red-swift.svg +++ b/src/main/resources/persona/animal/slime-red-swift.svg @@ -1,151 +1,186 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-red.svg b/src/main/resources/persona/animal/slime-red.svg index 5bc25d5..8e6d6f2 100644 --- a/src/main/resources/persona/animal/slime-red.svg +++ b/src/main/resources/persona/animal/slime-red.svg @@ -1,112 +1,111 @@ - - - - - - - - - - *{level} - + + + + + + + + + *{level} + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + From 2021334d8b6d5a3a080ff5fd9d60e1a527e7b944 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 22:26:31 +0900 Subject: [PATCH 026/161] =?UTF-8?q?feat:=20line=20mode=EC=97=90=EC=84=9C?= =?UTF-8?q?=20width,=20height=EB=A5=BC=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=EA=B0=80=20=EC=A1=B0=EC=A0=88=ED=95=A0=20=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/User.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 0de2833..95500be 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -111,7 +111,7 @@ class User( } private fun StringBuilder.openLine(): StringBuilder { - return this.append("") + return this.append("") } fun createFarmAnimation(): String { From cf8e1ba1f3377a8ebeadf57548ef01abae971a22 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:34:52 +0900 Subject: [PATCH 027/161] =?UTF-8?q?docs:=20line=20mode=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5c30e1..070349c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ + + + + ##
@@ -26,7 +30,15 @@ ## λΉ λ₯΄κ²Œ μ‚¬μš©ν•˜κΈ° -μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 방식쀑 ν•˜λ‚˜λ₯Ό λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. +μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 쀑 ν•˜λ‚˜λ₯Ό κΉƒν—ˆλΈŒ Readme 에 λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. + +> [!IMPORTANT] +> {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. +> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. + +### farm mode + +farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) @@ -37,12 +49,21 @@ ``` - -> [!IMPORTANT] -> {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. -> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. +### line mode + +line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. +Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. + +```markdown +[![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) +``` +```html + + + +``` ## TIPS From d574e8f04e760706499b20142f2b4bdd03cfacd4 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:35:52 +0900 Subject: [PATCH 028/161] =?UTF-8?q?docs:=20=ED=8E=AB=EC=9D=98=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 070349c..54e5b3a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ +## -## -
β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️

Press star

From f5890707e10d64098ecc91b37f6f391d7c904eee Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:41:15 +0900 Subject: [PATCH 029/161] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 54e5b3a..bc6d1b7 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. +μ΄λ•Œ, img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”. Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. ```markdown @@ -60,7 +61,7 @@ Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. ```html - + ``` From 6f12a276e44ecb8535809b1be050d96231ebea34 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:44:42 +0900 Subject: [PATCH 030/161] =?UTF-8?q?docs:=20line=20mode=EC=9D=98=20?= =?UTF-8?q?=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=9E=90=EC=84=B8=ED=95=98?= =?UTF-8?q?=EA=B2=8C=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bc6d1b7..e4d3b97 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,12 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### line mode -line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. -μ΄λ•Œ, img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”. -Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. +line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. +펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. +> [!TIP] +> **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. +> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) From 4b9cc0ffb1a597c1a5d2300c916d9220c541aaff Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:34:52 +0900 Subject: [PATCH 031/161] =?UTF-8?q?docs:=20line=20mode=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5c30e1..070349c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ + + + + ##
@@ -26,7 +30,15 @@ ## λΉ λ₯΄κ²Œ μ‚¬μš©ν•˜κΈ° -μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 방식쀑 ν•˜λ‚˜λ₯Ό λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. +μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 쀑 ν•˜λ‚˜λ₯Ό κΉƒν—ˆλΈŒ Readme 에 λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. + +> [!IMPORTANT] +> {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. +> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. + +### farm mode + +farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) @@ -37,12 +49,21 @@ ``` - -> [!IMPORTANT] -> {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. -> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. +### line mode + +line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. +Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. + +```markdown +[![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) +``` +```html + + + +``` ## TIPS From acc7fcc19cc1fc31000ac43e04c586ef5bafb21f Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:35:52 +0900 Subject: [PATCH 032/161] =?UTF-8?q?docs:=20=ED=8E=AB=EC=9D=98=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 070349c..54e5b3a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ +## -## -
β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️

Press star

From 301d4576521e95f06f321217d03bb576e57bcdfc Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:41:15 +0900 Subject: [PATCH 033/161] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 54e5b3a..bc6d1b7 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. +μ΄λ•Œ, img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”. Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. ```markdown @@ -60,7 +61,7 @@ Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. ```html - + ``` From 2d78151ec0a6bb57f10b5b8b29db60f384df1d15 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:44:42 +0900 Subject: [PATCH 034/161] =?UTF-8?q?docs:=20line=20mode=EC=9D=98=20?= =?UTF-8?q?=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=9E=90=EC=84=B8=ED=95=98?= =?UTF-8?q?=EA=B2=8C=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bc6d1b7..e4d3b97 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,12 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### line mode -line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, 길게 μ›€μ§μ΄κ²Œ ν•΄μš”. -μ΄λ•Œ, img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”. -Readmeμ—μ„œ νŽ«μ„ λŒμ•„λ‹€λ‹ˆκ²Œ ν•˜λŠ”λ° μ‚¬μš©ν•  수 μžˆμ–΄μš”. +line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. +펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. +> [!TIP] +> **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. +> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) From 4805471c3816aeb5bc875b6e622072a89a934816 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 23:00:30 +0900 Subject: [PATCH 035/161] =?UTF-8?q?refactor:=20line=20mode=EC=9D=98=20url?= =?UTF-8?q?=20path=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/app/AnimationFacade.kt | 24 +++++++++++++++---- .../render/controller/AnimationController.kt | 19 ++++++++++----- .../gitanimals/render/domain/AnimationMode.kt | 11 --------- .../org/gitanimals/render/domain/User.kt | 5 ++-- .../gitanimals/render/domain/UserService.kt | 9 ++++--- 5 files changed, 41 insertions(+), 27 deletions(-) delete mode 100644 src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt diff --git a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt index 2945b41..41c737f 100644 --- a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt @@ -1,7 +1,6 @@ package org.gitanimals.render.app import jakarta.annotation.PostConstruct -import org.gitanimals.render.domain.AnimationMode import org.gitanimals.render.domain.User import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.event.Visited @@ -18,11 +17,10 @@ class AnimationFacade( private lateinit var registerNewUserOrchestrator: Orchestrator - fun getSvgAnimation(username: String, mode: String): String { - val animationMode = AnimationMode.valueOf(mode.uppercase()) + fun getFarmAnimation(username: String): String { return when (userService.existsByName(username)) { true -> { - val svgAnimation = userService.getSvgAnimationByUsername(username, animationMode) + val svgAnimation = userService.getFarmAnimationByUsername(username) sagaManager.startSync(Visited(username)) svgAnimation } @@ -30,7 +28,23 @@ class AnimationFacade( false -> { registerNewUserOrchestrator.sagaSync(10000, username) - userService.getSvgAnimationByUsername(username, animationMode) + userService.getFarmAnimationByUsername(username) + } + } + } + + fun getLineAnimation(username: String, personaId: Long): String { + return when(userService.existsByName(username)) { + true -> { + val svgAnimation = userService.getLineAnimationByUsername(username, personaId) + sagaManager.startSync(Visited(username)) + svgAnimation + } + + false -> { + registerNewUserOrchestrator.sagaSync(10000, username) + + userService.getLineAnimationByUsername(username ,personaId) } } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index 72665bc..f407adf 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -4,24 +4,31 @@ import jakarta.servlet.http.HttpServletResponse import org.gitanimals.render.app.AnimationFacade import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController -@RequestMapping("/farms") class AnimationController( private val animationFacade: AnimationFacade, ) { - @GetMapping(value = ["/{username}"], produces = ["image/svg+xml"]) - fun getSvgAnimation( + @GetMapping(value = ["/farms/{username}"], produces = ["image/svg+xml"]) + fun getFarmSvgAnimation( @PathVariable("username") username: String, - @RequestParam(name = "mode", defaultValue = "FARM") mode: String, response: HttpServletResponse ): String { response.noCache() - return animationFacade.getSvgAnimation(username, mode) + return animationFacade.getFarmAnimation(username) + } + + @GetMapping(value = ["/lines/{username}"], produces = ["image/svg+xml"]) + fun getLineSvgAnimation( + @PathVariable("username") username: String, + @RequestParam(name = "pet-id", defaultValue = "0") personaId: Long, + response: HttpServletResponse, + ): String { + response.noCache() + return animationFacade.getLineAnimation(username, personaId) } fun HttpServletResponse.noCache(): HttpServletResponse { diff --git a/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt b/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt deleted file mode 100644 index c2367e5..0000000 --- a/src/main/kotlin/org/gitanimals/render/domain/AnimationMode.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.gitanimals.render.domain - -enum class AnimationMode( - private val func: (User) -> String, -) { - - FARM({ it.createFarmAnimation() }), - LINE({ it.createLineAnimation() }), - ; - fun createAnimation(user: User): String = func.invoke(user) -} diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 95500be..8eae70e 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -101,10 +101,11 @@ class User( visit += 1 } - fun createLineAnimation(): String { + fun createLineAnimation(personaId: Long): String { val builder = StringBuilder().openLine() - val persona = personas.first() + val persona = personas.find { it.id!! >= personaId } + ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") builder.append(persona.toSvg()) return builder.closeSvg() diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 3a10793..9955a90 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -13,9 +13,12 @@ class UserService( fun existsByName(name: String): Boolean = userRepository.existsByName(name) - fun getSvgAnimationByUsername(username: String, mode: AnimationMode): String { - val user = getUserByName(username) - return mode.createAnimation(user) + fun getFarmAnimationByUsername(username: String): String { + return getUserByName(username).createFarmAnimation() + } + + fun getLineAnimationByUsername(username: String, personaId: Long): String { + return getUserByName(username).createLineAnimation(personaId) } @Retryable(retryFor = [OptimisticLockingFailureException::class], maxAttempts = 10) From 6dce1062907d3f0183114114c4d14a29b813d290 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 23:01:37 +0900 Subject: [PATCH 036/161] =?UTF-8?q?refactor:=20=EC=9B=80=EC=A7=81=EC=9D=B4?= =?UTF-8?q?=EB=8A=94=20y=EB=B2=94=EC=9C=84=EB=A5=BC=2070=20->=2090=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index f7d55bd..f4f42f5 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -953,7 +953,7 @@ enum class PersonaType(private val weight: Double) { duration: String, personaWidth: Long, ): StringBuilder { - var currentY = Random.nextInt(10, 70) + var currentY = Random.nextInt(10, 90) var currentX = Random.nextInt(10, 90) var currentAngle = (Random.nextDouble() * 10).toInt() var currentScale = Random.nextInt(0, 2) - 1 @@ -973,7 +973,7 @@ enum class PersonaType(private val weight: Double) { val beforeAnimationPercentage = animationPercentage animationPercentage += Random.nextInt(2, 6) val nextY = - Random.nextInt(max(0, min(79, currentY - speed)), min(70, currentY + speed)) + Random.nextInt(max(10, min(79, currentY - speed)), min(80, currentY + speed)) val nextX = Random.nextInt(max(10, min(79, currentX - speed)), min(80, currentX + speed)) val nextAngle = (atan2( From 061e96b704c86af80ebac870b17ae763a54f8344 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 23:13:07 +0900 Subject: [PATCH 037/161] =?UTF-8?q?feat:=20user=EC=9D=98=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=A5=BC=20=EC=A1=B0=ED=9A=8C=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20api=20endpoint=EB=A5=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/PersonaController.kt | 18 +++++++++++++++ .../controller/response/PersonaResponse.kt | 9 ++++++++ .../controller/response/UserResponse.kt | 22 +++++++++++++++++++ .../org/gitanimals/render/domain/Persona.kt | 2 ++ .../org/gitanimals/render/domain/User.kt | 2 +- 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt create mode 100644 src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt create mode 100644 src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt new file mode 100644 index 0000000..2439788 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -0,0 +1,18 @@ +package org.gitanimals.render.controller + +import org.gitanimals.render.controller.response.UserResponse +import org.gitanimals.render.domain.UserService +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RestController + +@RestController +class PersonaController( + private val userService: UserService +) { + + @GetMapping("/users/{username}") + fun getUserByName(@PathVariable("username") username: String): UserResponse { + return UserResponse.from(userService.getUserByName(username)) + } +} diff --git a/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt b/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt new file mode 100644 index 0000000..9c66209 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt @@ -0,0 +1,9 @@ +package org.gitanimals.render.controller.response + +import org.gitanimals.render.domain.PersonaType + +data class PersonaResponse( + val id: String, + val type: PersonaType, + val level: String, +) diff --git a/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt b/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt new file mode 100644 index 0000000..a6eac7e --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt @@ -0,0 +1,22 @@ +package org.gitanimals.render.controller.response + +import org.gitanimals.render.domain.User + +data class UserResponse( + val id: String, + val name: String, + private val personas: List, +) { + + companion object { + fun from(user: User): UserResponse { + return UserResponse( + user.id.toString(), + user.name, + user.personas.map { + PersonaResponse(it.id.toString(), it.type, it.level().toString()) + }.toList() + ) + } + } +} diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index f8f84e3..149ae13 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -32,4 +32,6 @@ class Persona( fun toSvg(): String = type.load(this) + + fun level(): Long = level.value } diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 8eae70e..32eafb2 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -25,7 +25,7 @@ class User( val name: String, @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = [CascadeType.ALL]) - private val personas: MutableList = mutableListOf(), + val personas: MutableList = mutableListOf(), @BatchSize(size = 20) @ElementCollection(fetch = FetchType.LAZY) From 16a7e2ec8efafaf95cab29ee4e4073ab1ceb64d3 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 12 Apr 2024 23:18:55 +0900 Subject: [PATCH 038/161] =?UTF-8?q?docs:=20Readme.md=EC=9D=98=20line-mode?= =?UTF-8?q?=EC=9D=98=20=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e4d3b97..b33ebc6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## - +
@@ -52,7 +52,8 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. -펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. +펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. +pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. > [!TIP] > **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. @@ -64,7 +65,17 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ wid ```html - + + +``` + +νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. +μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 을 url에 λΆ™μ—¬λ„£μœΌμ„Έμš”. +```html +μ˜ˆμ‹œ) + + + ``` From 0c3290b1ce6b4696dfcf4ca2cc51122a4384672e Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:24:15 +0900 Subject: [PATCH 039/161] =?UTF-8?q?docs:=20line-mode=EC=9D=98=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b33ebc6..c5af9c0 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ wid 펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. > [!TIP] -> **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. ```markdown -[![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) +[![gitanimals](https://render.gitanimals.org/lines/{username})](https://github.com/devxb/gitanimals) ``` ```html @@ -70,7 +70,7 @@ pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. ``` νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 을 url에 λΆ™μ—¬λ„£μœΌμ„Έμš”. +μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html μ˜ˆμ‹œ) From f4df795bc86c3f17938ac2179c1a2d459334eea1 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:49:08 +0900 Subject: [PATCH 040/161] =?UTF-8?q?docs:=20Readme=EB=A5=BC=20=EC=A2=80=20?= =?UTF-8?q?=EB=8D=94=20=EC=9D=BD=EA=B8=B0=20=EC=89=BD=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c5af9c0..0054a9b 100644 --- a/README.md +++ b/README.md @@ -36,48 +36,58 @@ > μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. ### farm mode - farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. + + + + +**markdown** ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) ``` +**html** ```html ``` - + ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. -펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. -pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ > [!TIP] -> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. + + + + +**markdown** ```markdown [![gitanimals](https://render.gitanimals.org/lines/{username})](https://github.com/devxb/gitanimals) ``` +**html** ```html -``` +``` + +### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. +λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html -μ˜ˆμ‹œ) - -``` +``` ## TIPS From 2a505b268273361518887db51a971eac4be723c7 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:57:39 +0900 Subject: [PATCH 041/161] =?UTF-8?q?docs:=20=EB=A7=A5=20=ED=95=9C=EA=B8=80?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0054a9b..fd665dd 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš” ### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. +λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html From 0452b89489d3ee664256d1b478ae43dbcb0f5e0f Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 13 Apr 2024 11:17:23 +0900 Subject: [PATCH 042/161] =?UTF-8?q?fix:=20noCache=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=EC=97=90=20PRAGMA:no-cache,=20EXPIRES:0=20=EC=9D=84?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/controller/AnimationController.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index f407adf..a0db3b4 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.controller import jakarta.servlet.http.HttpServletResponse import org.gitanimals.render.app.AnimationFacade +import org.springframework.http.HttpHeaders import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestParam @@ -32,7 +33,9 @@ class AnimationController( } fun HttpServletResponse.noCache(): HttpServletResponse { - this.setHeader("Cache-Control", "no-cache, no-store, must-revalidate") + this.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate") + this.setHeader(HttpHeaders.PRAGMA, "no-cache") + this.setHeader(HttpHeaders.EXPIRES, "0") return this } } From 5353b1dfcec867b9cc05e7fe5ae3ca2d48209c15 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:24:15 +0900 Subject: [PATCH 043/161] =?UTF-8?q?docs:=20line-mode=EC=9D=98=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b33ebc6..c5af9c0 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ wid 펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. > [!TIP] -> **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. ```markdown -[![gitanimals](https://render.gitanimals.org/farms/{username}?mode=line)](https://github.com/devxb/gitanimals) +[![gitanimals](https://render.gitanimals.org/lines/{username})](https://github.com/devxb/gitanimals) ``` ```html @@ -70,7 +70,7 @@ pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. ``` νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 을 url에 λΆ™μ—¬λ„£μœΌμ„Έμš”. +μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html μ˜ˆμ‹œ) From 0344738ac2f6c71a5af535bb1aa9178eb2f7d29e Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:49:08 +0900 Subject: [PATCH 044/161] =?UTF-8?q?docs:=20Readme=EB=A5=BC=20=EC=A2=80=20?= =?UTF-8?q?=EB=8D=94=20=EC=9D=BD=EA=B8=B0=20=EC=89=BD=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c5af9c0..0054a9b 100644 --- a/README.md +++ b/README.md @@ -36,48 +36,58 @@ > μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. ### farm mode - farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. + + + + +**markdown** ```markdown [![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) ``` +**html** ```html ``` - + ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. -펫이 Readmeμ—μ„œ 자유둭게 μ›€μ§μ΄λŠ”λͺ¨μŠ΅μ„ ν‘œν˜„ν•  수 μžˆμ–΄μš”. -pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”. +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ > [!TIP] -> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. + + + + +**markdown** ```markdown [![gitanimals](https://render.gitanimals.org/lines/{username})](https://github.com/devxb/gitanimals) ``` +**html** ```html -``` +``` + +### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -μ‚¬μš© κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. +λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html -μ˜ˆμ‹œ) - -``` +``` ## TIPS From 68a750858a50ae1b8227491a0eaa1b3d46a4b8f5 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:57:39 +0900 Subject: [PATCH 045/161] =?UTF-8?q?docs:=20=EB=A7=A5=20=ED=95=9C=EA=B8=80?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0054a9b..fd665dd 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš” ### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. +λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. ```html From 57f884dbca10d5be94cd60f6f75eca55cb83f8c6 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 13 Apr 2024 11:48:20 +0900 Subject: [PATCH 046/161] =?UTF-8?q?refactor:=20visit=EC=B9=B4=EC=9A=B4?= =?UTF-8?q?=ED=8A=B8=EB=A5=BC=20=EC=A0=9C=EA=B1=B0=ED=95=98=EA=B3=A0=20cac?= =?UTF-8?q?he=EB=A5=BC=201=EC=8B=9C=EA=B0=84=EC=9C=BC=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/AnimationController.kt | 12 +++++++----- .../kotlin/org/gitanimals/render/domain/FieldType.kt | 10 ++++------ src/main/kotlin/org/gitanimals/render/domain/User.kt | 2 +- src/main/resources/persona/field/snowy-field.svg | 7 +------ src/main/resources/persona/field/white-field.svg | 7 +------ 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index a0db3b4..dda6b81 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -18,7 +18,7 @@ class AnimationController( @PathVariable("username") username: String, response: HttpServletResponse ): String { - response.noCache() + response.cacheControl(3600) return animationFacade.getFarmAnimation(username) } @@ -28,14 +28,16 @@ class AnimationController( @RequestParam(name = "pet-id", defaultValue = "0") personaId: Long, response: HttpServletResponse, ): String { - response.noCache() + response.cacheControl(3600) return animationFacade.getLineAnimation(username, personaId) } - fun HttpServletResponse.noCache(): HttpServletResponse { - this.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate") + fun HttpServletResponse.cacheControl(maxAgeSeconds: Int): HttpServletResponse { + this.setHeader( + HttpHeaders.CACHE_CONTROL, + "no-cache, no-store, must-revalidate, max-age=$maxAgeSeconds" + ) this.setHeader(HttpHeaders.PRAGMA, "no-cache") - this.setHeader(HttpHeaders.EXPIRES, "0") return this } } diff --git a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt index e9f33f3..5331d42 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt @@ -3,10 +3,9 @@ package org.gitanimals.render.domain enum class FieldType { WHITE_FIELD { - override fun loadComponent(name: String, commit: Long, visit: Long): String { + override fun loadComponent(name: String, commit: Long): String { return whiteFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) .replace(COMMIT_FIX, commit.toSvg("commit", 85.0, 4.0)) - .replace(VISIT_FIX, visit.toSvg("visit", 70.0, 4.0)) } override fun fillBackground(): String = @@ -16,10 +15,9 @@ enum class FieldType { "" }, SNOWY_FIELD { - override fun loadComponent(name: String, commit: Long, visit: Long): String { + override fun loadComponent(name: String, commit: Long): String { return snowyFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) .replace(COMMIT_FIX, commit.toSvg("commit", 85.0, 4.0)) - .replace(VISIT_FIX, visit.toSvg("visit", 70.0, 4.0)) } override fun fillBackground(): String { @@ -43,7 +41,7 @@ enum class FieldType { }, ; - abstract fun loadComponent(name: String, commit: Long, visit: Long): String + abstract fun loadComponent(name: String, commit: Long): String abstract fun fillBackground(): String @@ -158,7 +156,7 @@ enum class FieldType { this.toString().forEach { char -> val index = char.digitToInt() val mediumNumberSvg = mediumNumberSvgs[index] - builder.append("") + builder.append("") .append(mediumNumberSvg) .append("") currentX += xIncrease + mediumNumberWidth[index] diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 32eafb2..5184afd 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -122,7 +122,7 @@ class User( personas.asSequence() .forEach { builder.append(it.toSvg()) } - return builder.append(field.loadComponent(name, contributions.totalCount(), visit)) + return builder.append(field.loadComponent(name, contributions.totalCount())) .append(field.drawBorder()) .closeSvg() } diff --git a/src/main/resources/persona/field/snowy-field.svg b/src/main/resources/persona/field/snowy-field.svg index 6ca6140..2e510ff 100644 --- a/src/main/resources/persona/field/snowy-field.svg +++ b/src/main/resources/persona/field/snowy-field.svg @@ -3,15 +3,10 @@ - + *{commit-count} - - -*{visit-count} - - diff --git a/src/main/resources/persona/field/white-field.svg b/src/main/resources/persona/field/white-field.svg index 6ca6140..2e510ff 100644 --- a/src/main/resources/persona/field/white-field.svg +++ b/src/main/resources/persona/field/white-field.svg @@ -3,15 +3,10 @@ - + *{commit-count} - - -*{visit-count} - - From ba228df40b8030aa6be6d880ff3c16b43e27a0d3 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sat, 13 Apr 2024 11:54:12 +0900 Subject: [PATCH 047/161] =?UTF-8?q?docs:=20total-contribtuions=EC=A7=91?= =?UTF-8?q?=EA=B3=84=20=EC=A1=B0=EA=B1=B4=EC=9D=84=20=EB=AA=85=EC=8B=9C?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index fd665dd..cebb9b3 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,11 @@ _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš” λ‹€λ₯Έ μœ μ €κ°€ νŒλ§€ν•˜λŠ” νŽ«μ„ μ»€λ°‹ν¬μΈνŠΈλ‘œ ꡬ맀할 수 μžˆμ–΄μš”. 컀밋 1νšŒλ‹Ή μΌμ •λŸ‰μ˜ ν¬μΈνŠΈκ°€ μ§€κΈ‰λ©λ‹ˆλ‹€. ν˜Ήμ€ μžμ‹ μ˜ νŽ«μ„ νŒλ§€ν•΄μ„œ μ»€λ°‹ν¬μΈνŠΈλ₯Ό μ–»μ„μˆ˜λ„ μžˆμ–΄μš”. +### Total contributions + +Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ λͺ¨λ“  Contribtuions 수λ₯Ό μ§‘κ³„ν•΄μ„œ λ³΄μ—¬μ€λ‹ˆλ‹€. +μ΄λ•Œ, μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€. + ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ docs/pets.svg From 2e1c37fbe2dd30384ca16804777a92fa3bc349cf Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 13 Apr 2024 23:34:16 +0900 Subject: [PATCH 048/161] =?UTF-8?q?refactor:=20=EB=A0=88=EB=B2=A8=EC=97=90?= =?UTF-8?q?=20=ED=9D=B0=EC=83=89=20=EB=B8=94=EB=9F=AC=ED=9A=A8=EA=B3=BC?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/domain/User.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 5184afd..072d7cc 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -136,7 +136,33 @@ class User( private fun StringBuilder.openFarm(): StringBuilder = this.append("") - private fun StringBuilder.closeSvg(): String = this.append("").toString() + private fun StringBuilder.closeSvg(): String = this.blackBlurOnLevel() + .append("") + .toString() + + private fun StringBuilder.blackBlurOnLevel(): StringBuilder = + this.append( + """ + + + + + + + + + + + + + + + """.trimIndent() + ) companion object { private const val MAX_PERSONA_COUNT = 30L From b31606add5d9d5dc587e645db1bc4c21ce7b8f59 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 13 Apr 2024 23:37:55 +0900 Subject: [PATCH 049/161] =?UTF-8?q?docs:=20line=20mode=EC=99=80=20farms?= =?UTF-8?q?=EB=AA=A8=EB=93=9C=EC=9D=98=20=EC=88=9C=EC=84=9C=EB=A5=BC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=ED=95=98=EA=B3=A0=20=EB=82=B4=EC=9A=A9?= =?UTF-8?q?=EC=9D=84=20=EC=83=81=EC=84=B8=ED=95=98=EA=B2=8C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index cebb9b3..7b65f35 100644 --- a/README.md +++ b/README.md @@ -29,49 +29,26 @@ ## λΉ λ₯΄κ²Œ μ‚¬μš©ν•˜κΈ° -μ•„λž˜μ˜ MARKDOWN ν˜Ήμ€ HTML 쀑 ν•˜λ‚˜λ₯Ό κΉƒν—ˆλΈŒ Readme 에 λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. +μ•„λž˜μ˜ 링크λ₯Ό κΉƒν—ˆλΈŒ Readme 에 λΆ™μ—¬λ„£κΈ° ν•˜λŠ”κ²ƒμœΌλ‘œ μ‰½κ²Œ μ μš©ν•  수 μžˆμ–΄μš”. > [!IMPORTANT] > {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. > μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. -### farm mode -farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. - - - - - -**markdown** -```markdown -[![gitanimals](https://render.gitanimals.org/farms/{username})](https://github.com/devxb/gitanimals) -``` - -**html** -```html - - - -``` - ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ + > [!TIP] > **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. -> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. +> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. -**markdown** -```markdown -[![gitanimals](https://render.gitanimals.org/lines/{username})](https://github.com/devxb/gitanimals) -``` - **html** ```html @@ -80,6 +57,21 @@ _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš” ``` +### farm mode +farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. + + + + + +**html** +```html + + + +``` + + ### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. From 57fceb4ee5ad278baf0f68330faa22ab3fc5f861 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 13 Apr 2024 23:42:29 +0900 Subject: [PATCH 050/161] =?UTF-8?q?docs:=20line=20mode=EC=97=90=EC=84=9C?= =?UTF-8?q?=20html=EC=9D=84=20=EA=B6=8C=EC=9E=A5=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EC=9D=B4=EC=9C=A0=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7b65f35..ff5f670 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. +line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 μ‚¬μš©ν•΄μ£Όμ„Έμš”. _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ > [!TIP] From dbf89f1be4a8004d788f600d9d5485d05ce16fcf Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 14 Apr 2024 17:03:43 +0900 Subject: [PATCH 051/161] =?UTF-8?q?fix:=20lastPersonaGivePoint=EA=B0=80=20?= =?UTF-8?q?30=EC=9D=B4=ED=95=98=EB=A9=B4=20=EC=83=88=EB=A1=9C=EC=9A=B4=20?= =?UTF-8?q?=ED=8E=AB=EC=9D=84=20=EC=A3=BC=EC=A7=80=20=EC=95=8A=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/User.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 072d7cc..908f997 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -87,9 +87,10 @@ class User( } private fun giveNewPersona() { - if (lastPersonaGivePoint >= FOR_NEW_PERSONA_COUNT) { - lastPersonaGivePoint %= FOR_NEW_PERSONA_COUNT.toInt() + if (lastPersonaGivePoint < FOR_NEW_PERSONA_COUNT) { + return } + lastPersonaGivePoint %= FOR_NEW_PERSONA_COUNT.toInt() if (personas.size >= MAX_PERSONA_COUNT) { return } From 6fec0c85ee5f71c070eda9ecc317c6f5e7a31a2e Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 14 Apr 2024 17:50:53 +0900 Subject: [PATCH 052/161] =?UTF-8?q?fix:=20OptimisticLocking..=20=EC=9D=84?= =?UTF-8?q?=20ObjectOptimisticLocking=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/UserService.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 9955a90..93b9c46 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -1,6 +1,6 @@ package org.gitanimals.render.domain -import org.springframework.dao.OptimisticLockingFailureException +import org.springframework.orm.ObjectOptimisticLockingFailureException import org.springframework.retry.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -21,13 +21,13 @@ class UserService( return getUserByName(username).createLineAnimation(personaId) } - @Retryable(retryFor = [OptimisticLockingFailureException::class], maxAttempts = 10) + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 10) @Transactional fun increaseVisit(username: String) { getUserByName(username).increaseVisitCount() } - @Retryable(retryFor = [OptimisticLockingFailureException::class], maxAttempts = 10) + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 10) @Transactional fun updateContributions(username: String, contribution: Int) { getUserByName(username) From 12751f078006496360807a038ab1eff64e62f129 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 14 Apr 2024 21:48:19 +0900 Subject: [PATCH 053/161] =?UTF-8?q?refactor:=2030=EA=B0=9C=EA=B0=80=20?= =?UTF-8?q?=EB=84=98=EB=8A=94=20persona=EA=B0=80=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A7=80=EC=A7=80=EB=8A=94=20=EC=95=8A=EC=A7=80=EB=A7=8C,=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/domain/Persona.kt | 13 ++++++-- .../org/gitanimals/render/domain/User.kt | 30 ++++++++++++++----- .../gitanimals/render/domain/UserService.kt | 5 ++-- .../org/gitanimals/render/domain/UserTest.kt | 12 ++++++++ 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 149ae13..4635a8b 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -19,6 +19,9 @@ class Persona( @Embedded val level: Level, + @Column(name = "visible", nullable = false) + val visible: Boolean, + @JsonIgnore @JoinColumn(name = "user_id") @ManyToOne(fetch = FetchType.LAZY, optional = false) @@ -28,10 +31,16 @@ class Persona( constructor( type: PersonaType, level: Long, - ) : this(type = type, level = Level(level)) + visible: Boolean + ) : this(type = type, level = Level(level), visible = visible) - fun toSvg(): String = type.load(this) + fun toSvg(): String { + if (!visible) { + return "" + } + return type.load(this) + } fun level(): Long = level.value } diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 908f997..c831a33 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -63,7 +63,12 @@ class User( fun updateContribution(contribution: Int) { val currentYear = ZonedDateTime.now(ZoneId.of("UTC")).year val currentYearContribution = - contributions.first { it.year == currentYear } + contributions.firstOrNull { it.year == currentYear } + ?: run { + val currentYearContribution = Contribution(currentYear, 0, Instant.now()) + contributions.add(currentYearContribution) + currentYearContribution + } val newContribution = contribution - currentYearContribution.contribution @@ -71,7 +76,6 @@ class User( lastPersonaGivePoint += newContribution currentYearContribution.lastUpdatedContribution = Instant.now() levelUpPersonas(newContribution) - giveNewPersona() } private fun levelUpPersonas(newContribution: Int) { @@ -86,15 +90,27 @@ class User( } } - private fun giveNewPersona() { + fun giveNewPersona() { if (lastPersonaGivePoint < FOR_NEW_PERSONA_COUNT) { return } lastPersonaGivePoint %= FOR_NEW_PERSONA_COUNT.toInt() - if (personas.size >= MAX_PERSONA_COUNT) { - return + + val newPersona = when (personas.size >= MAX_PERSONA_COUNT) { + true -> Persona( + type = PersonaType.random(), + level = Level(0), + visible = false, + user = this + ) + + false -> Persona( + type = PersonaType.random(), + level = Level(0), + visible = true, + user = this + ) } - val newPersona = Persona(type = PersonaType.random(), level = Level(0), user = this) personas.add(newPersona) } @@ -202,7 +218,7 @@ class User( max((totalContributionCount / FOR_INIT_PERSONA_COUNT), 1) ).toInt() ) { - personas.add(Persona(PersonaType.random(), 0)) + personas.add(Persona(PersonaType.random(), 0, true)) } return personas } diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 93b9c46..66df64e 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -30,8 +30,9 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 10) @Transactional fun updateContributions(username: String, contribution: Int) { - getUserByName(username) - .updateContribution(contribution) + val user = getUserByName(username) + user.updateContribution(contribution) + user.giveNewPersona() } fun isContributionUpdatedBeforeOneHour(name: String): Boolean = diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt b/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt index 40e40a3..81e32d0 100644 --- a/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt +++ b/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt @@ -63,6 +63,18 @@ internal class UserTest : DescribeSpec({ } } } + + describe("giveNewPersona λ©”μ†Œλ“œλŠ”") { + val user = User.newUser("new-user", mutableMapOf()) + context("펫이 30λ§ˆλ¦¬κ°€ λ„˜μ„κ²½μš°, visible false의 pet을 μƒμ„±ν•œλ‹€.") { + repeat(99) { + user.updateContribution(30 * (it + 1)) + user.giveNewPersona() + } + + user.personas.count { !it.visible } shouldBeEqual 70 + } + } }) { private companion object { private const val ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" From 089b49cc27653d5eba26a11eef7e99a18a4e0228 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sun, 14 Apr 2024 21:53:49 +0900 Subject: [PATCH 054/161] =?UTF-8?q?docs:=20=EB=B3=B4=EC=97=AC=EC=A7=80?= =?UTF-8?q?=EB=8A=94=20pet=EC=9D=84=20=EC=8A=AC=EB=9D=BC=EC=9E=84=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff5f670..35e3b73 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## - +
From 82240afe40d55d2262d7f2abbed3540312ff1bc1 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sun, 14 Apr 2024 21:55:04 +0900 Subject: [PATCH 055/161] =?UTF-8?q?docs:=20Slime=EC=9D=B4=20=EC=9B=80?= =?UTF-8?q?=EC=A7=81=EC=9D=B4=EB=8A=94=20=EC=98=81=EC=97=AD=EC=9D=98=20hei?= =?UTF-8?q?ght=EB=A5=BC=20100=EC=9C=BC=EB=A1=9C=20=EC=A6=9D=EA=B0=80?= =?UTF-8?q?=EC=8B=9C=ED=82=A8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35e3b73..2da561e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## - +
From 253a71718c0d6214ef5e8cd658380bb8382fad7c Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 10:26:58 +0900 Subject: [PATCH 056/161] =?UTF-8?q?feat:=20=EC=B2=98=EC=9D=8C=EA=B3=BC=20?= =?UTF-8?q?=EB=81=9D=EC=9D=98=20=EB=8C=80=EA=B4=84=ED=98=B8=EB=A5=BC=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=9C=BC=EB=A1=9C=20=EC=97=86=EC=95=A4?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/AnimationController.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index dda6b81..0fd4e2d 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -19,7 +19,7 @@ class AnimationController( response: HttpServletResponse ): String { response.cacheControl(3600) - return animationFacade.getFarmAnimation(username) + return animationFacade.getFarmAnimation(deleteBrackets(username)) } @GetMapping(value = ["/lines/{username}"], produces = ["image/svg+xml"]) @@ -29,7 +29,21 @@ class AnimationController( response: HttpServletResponse, ): String { response.cacheControl(3600) - return animationFacade.getLineAnimation(username, personaId) + return animationFacade.getLineAnimation(deleteBrackets(username), personaId) + } + + private fun deleteBrackets(username: String): String { + val start = when (username[0]) { + '{' -> 1 + else -> 0 + } + + val end = when (username.last()) { + '}' -> username.length - 1 + else -> username.length + } + + return username.substring(start, end) } fun HttpServletResponse.cacheControl(maxAgeSeconds: Int): HttpServletResponse { From 6c750121a41db82124decc8d91822c6ba9ddd294 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 16:50:09 +0900 Subject: [PATCH 057/161] =?UTF-8?q?build:=20Sentry=EB=A5=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- build.gradle | 9 +++++++++ gradle.properties | 3 +++ .../render/controller/SentryController.kt | 14 ++++++++++++++ src/main/resources/application.properties | 3 +++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/SentryController.kt diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4698121..63186c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,7 +34,7 @@ jobs: restore-keys: ${{ runner.os }}-gradle - name: build server - run: ./gradlew build -x test + run: ./gradlew build -x test -DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - name: docker arm64 build set up - qemu uses: docker/setup-qemu-action@v2 diff --git a/build.gradle b/build.gradle index cfc0994..62448ec 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { id 'org.jetbrains.kotlin.plugin.jpa' version "${jetbrainKotlinVersion}" id "org.springframework.boot" version "${springbootVersion}" id "io.spring.dependency-management" version "${springDependencyManagementVersion}" + id "io.sentry.jvm.gradle" version "${sentryVersion}" } group = "${group}" @@ -25,6 +26,14 @@ application { mainClassName = 'org.gitanimals.render.Application' } +sentry { + includeSourceContext = true + + org = "devxb" + projectName = "gitanimals-render" + authToken = System.getProperty("SENTRY_AUTH_TOKEN") +} + apply from: "gradle/db.gradle" apply from: "gradle/etc.gradle" apply from: "gradle/test.gradle" diff --git a/gradle.properties b/gradle.properties index bbbc976..91ef374 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,3 +25,6 @@ testContainerVersion=1.19.3 ### Netx ### netxVersion=0.4.2 + +### Sentry ### +sentryVersion=4.4.0 diff --git a/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt b/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt new file mode 100644 index 0000000..364bfd4 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt @@ -0,0 +1,14 @@ +package org.gitanimals.render.controller + +import io.sentry.Sentry +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +class SentryController { + + @GetMapping("/sentries") + fun sentryCall() { + Sentry.captureException(IllegalArgumentException("This is test.")) + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c24180b..a748159 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,3 +22,6 @@ netx.backpressure=40 netx.logging.level=info github.token= + +sentry.dsn=https://fe1aaf784ec135343909a4a0dfe4f0eb@o4505051656486912.ingest.us.sentry.io/4507088960684032 +sentry.traces-sample-rate=1.0 From 837689ae9cbb503987729950326375cddc18549c Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 16:57:13 +0900 Subject: [PATCH 058/161] =?UTF-8?q?refactor:=20Sentry=20test=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/SentryController.kt | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/main/kotlin/org/gitanimals/render/controller/SentryController.kt diff --git a/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt b/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt deleted file mode 100644 index 364bfd4..0000000 --- a/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.gitanimals.render.controller - -import io.sentry.Sentry -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RestController - -@RestController -class SentryController { - - @GetMapping("/sentries") - fun sentryCall() { - Sentry.captureException(IllegalArgumentException("This is test.")) - } -} From 6071e93337d0ab324770be26ea60cdd2311a8025 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 16:57:13 +0900 Subject: [PATCH 059/161] =?UTF-8?q?refactor:=20Sentry=20test=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/SentryController.kt | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/main/kotlin/org/gitanimals/render/controller/SentryController.kt diff --git a/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt b/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt deleted file mode 100644 index 364bfd4..0000000 --- a/src/main/kotlin/org/gitanimals/render/controller/SentryController.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.gitanimals.render.controller - -import io.sentry.Sentry -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RestController - -@RestController -class SentryController { - - @GetMapping("/sentries") - fun sentryCall() { - Sentry.captureException(IllegalArgumentException("This is test.")) - } -} From d110bcd592ad2040d098ced3ec0d1647593bed41 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 17:47:28 +0900 Subject: [PATCH 060/161] =?UTF-8?q?refactor:=20user=20create=EC=8B=9C,=20O?= =?UTF-8?q?rchestrator=EB=A5=BC=20=EC=A0=9C=EA=B1=B0=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/app/AnimationFacade.kt | 62 +++++-------------- .../org/gitanimals/render/domain/User.kt | 2 + 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt index 41c737f..fd5d15d 100644 --- a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt @@ -1,22 +1,19 @@ package org.gitanimals.render.app -import jakarta.annotation.PostConstruct import org.gitanimals.render.domain.User import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.event.Visited -import org.rooftop.netx.api.* +import org.rooftop.netx.api.SagaManager import org.springframework.stereotype.Service +import org.springframework.web.client.RestClientException @Service class AnimationFacade( private val userService: UserService, private val contributionApi: ContributionApi, - private val orchestratorFactory: OrchestratorFactory, private val sagaManager: SagaManager, ) { - private lateinit var registerNewUserOrchestrator: Orchestrator - fun getFarmAnimation(username: String): String { return when (userService.existsByName(username)) { true -> { @@ -26,15 +23,14 @@ class AnimationFacade( } false -> { - registerNewUserOrchestrator.sagaSync(10000, username) - - userService.getFarmAnimationByUsername(username) + val user = createNewUser(username) + userService.getFarmAnimationByUsername(user.name) } } } fun getLineAnimation(username: String, personaId: Long): String { - return when(userService.existsByName(username)) { + return when (userService.existsByName(username)) { true -> { val svgAnimation = userService.getLineAnimationByUsername(username, personaId) sagaManager.startSync(Visited(username)) @@ -42,45 +38,21 @@ class AnimationFacade( } false -> { - registerNewUserOrchestrator.sagaSync(10000, username) - - userService.getLineAnimationByUsername(username ,personaId) + val user = createNewUser(username) + userService.getLineAnimationByUsername(user.name, personaId) } } } - @PostConstruct - fun registerNewUserOrchestrator() { - registerNewUserOrchestrator = orchestratorFactory.create("register new user") - .startWithContext( - contextOrchestrate = { context, username -> - context.set("username", username) - contributionApi.getAllContributionYears(username) - } - ) - .joinWithContext( - contextOrchestrate = object : ContextOrchestrate, Map> { - override fun orchestrate(context: Context, request: List): Map { - val username = context.decodeContext("username", String::class) - return contributionApi.getContributionCount(username, request) - } - - override fun reified(): TypeReference> { - return object : TypeReference>() {} - } - } - ) - .commitWithContext( - contextOrchestrate = object : ContextOrchestrate, User> { - override fun orchestrate(context: Context, request: Map): User { - val username = context.decodeContext("username", String::class) - return userService.createNewUser(username, request) - } - - override fun reified(): TypeReference> { - return object : TypeReference>() {} - } - } - ) + fun createNewUser(username: String): User { + return runCatching { + val contributionYears = contributionApi.getAllContributionYears(username) + val contributionCountPerYear = + contributionApi.getContributionCount(username, contributionYears) + userService.createNewUser(username, contributionCountPerYear) + }.getOrElse { + require(it !is RestClientException) { "Cannot create new user from username \"$username\"" } + throw it + } } } diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index c831a33..8cad6f2 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.domain +import com.fasterxml.jackson.annotation.JsonIgnore import jakarta.persistence.* import org.gitanimals.render.core.AggregateRoot import org.gitanimals.render.domain.value.Contribution @@ -50,6 +51,7 @@ class User( personas.forEach { it.user = this } } + @JsonIgnore fun isContributionUpdatedBeforeOneHour(): Boolean { val currentYear = ZonedDateTime.now(ZoneId.of("UTC")).year val currentYearContribution = From 66499abf7796918d806b97dc41136f2a2ac12df9 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Mon, 15 Apr 2024 22:11:21 +0900 Subject: [PATCH 061/161] =?UTF-8?q?docs:=20=EB=B0=A9=EB=AC=B8=EC=9E=90=20?= =?UTF-8?q?=EC=88=98=20=EC=A7=91=EA=B3=84=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2da561e..551d344 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,6 @@ Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ λͺ¨λ“  Contribtuions 수λ₯Ό 집

μ•„μ΄λ””μ–΄λ‚˜ 발견 ν•œ 버그가 μžˆλ‹€λ©΄ 제보 ν•΄μ£Όμ„Έμš”. Contact : develxb@gmail.com

+ +
From d35f19b37f303bb97bf62ecd2729b90afce141a0 Mon Sep 17 00:00:00 2001 From: devxb Date: Tue, 16 Apr 2024 11:50:09 +0900 Subject: [PATCH 062/161] =?UTF-8?q?feat:=20flamingo=20persona=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 26 ++- .../org/gitanimals/render/domain/Svgs.kt | 3 + .../resources/persona/animal/flamingo.svg | 94 +++++++++ src/test/resources/persona/goose/test.html | 3 + src/test/resources/persona/goose/test.svg | 182 ++++++++++-------- 5 files changed, 232 insertions(+), 76 deletions(-) create mode 100644 src/main/resources/persona/animal/flamingo.svg create mode 100644 src/test/resources/persona/goose/test.html diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index f4f42f5..ea5ac10 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -914,6 +914,30 @@ enum class PersonaType(private val weight: Double) { StringBuilder().moveRandomly("slime", id, 15, "180s", 5) .toString() }, + + FLAMINGO(0.05) { + override fun load(persona: Persona): String { + check(persona.id != null) { "Save persona first before call load()" } + + return flamingoSvg.replace("*{position}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-1 * (persona.level.value.toString().length)).toString() + ) + } + + override fun act(id: Long): String { + val x = Random.nextInt(25, 75) + val y = Random.nextInt(0, 50) + val scale = when (Random.nextBoolean()) { + true -> 1 + false -> -1 + } + return "translate(${x}%, ${y}%) scaleX($scale)" + } + } ; init { @@ -990,7 +1014,7 @@ enum class PersonaType(private val weight: Double) { .append("-ms-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") .append("-o-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") .append("-moz-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("transform: translate(${{currentX - (personaWidth * nextScale)}}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") + .append("transform: translate(${{ currentX - (personaWidth * nextScale) }}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") .append("}") } this.append("${min(100.0, animationPercentage)}% {") diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index fd4ac5d..5c36ad6 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -145,6 +145,9 @@ val slimeBlueSvg: String = ClassPathResource("persona/animal/slime-blue.svg") val slimeGreenSvg: String = ClassPathResource("persona/animal/slime-green.svg") .getContentAsString(Charset.defaultCharset()) +val flamingoSvg: String = ClassPathResource("persona/animal/flamingo.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg new file mode 100644 index 0000000..60f0b67 --- /dev/null +++ b/src/main/resources/persona/animal/flamingo.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.html b/src/test/resources/persona/goose/test.html new file mode 100644 index 0000000..8b4f088 --- /dev/null +++ b/src/test/resources/persona/goose/test.html @@ -0,0 +1,3 @@ + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index a05b4a5..05b591f 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,81 +1,113 @@ - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + From 8fbba3d5d1a871739fceb5b58db14195c095798e Mon Sep 17 00:00:00 2001 From: devxb Date: Tue, 16 Apr 2024 12:03:32 +0900 Subject: [PATCH 063/161] =?UTF-8?q?docs:=20=EB=93=B1=EC=9E=A5=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=9C=20=ED=8E=AB=EB=93=A4=20=EB=B9=84=EC=9C=A8?= =?UTF-8?q?=ED=91=9C=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 92 +++++++++++++++++++++++++++++-------- docs/flamingo.svg | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+), 19 deletions(-) create mode 100644 docs/flamingo.svg diff --git a/README.md b/README.md index 551d344..50e9bc2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ - ## + @@ -33,13 +33,14 @@ > [!IMPORTANT] > {username} 은 μžμ‹ μ˜ κΉƒν—ˆλΈŒ λ‹‰λ„€μž„ (ex. devxb) 으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. -> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. +> μ΄λ•Œ, {username} 은 λ°˜λ“œμ‹œ μžμ‹ μ˜ κΉƒν—ˆλΈŒ 이름이 λ“€μ–΄κ°€μ•Ό ν•©λ‹ˆλ‹€. ### line mode line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. -line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 μ‚¬μš©ν•΄μ£Όμ„Έμš”. -_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ +line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 +μ‚¬μš©ν•΄μ£Όμ„Έμš”. +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ > [!TIP] > **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** @@ -51,34 +52,38 @@ _pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš” **html** + ```html - + ``` - - + ### farm mode + farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. -**html** +**html** + ```html - + ``` - - + ### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 + νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, μš”μ²­ν•΄λ³΄μ„Έμš”. +λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, +μš”μ²­ν•΄λ³΄μ„Έμš”. + ```html - + ``` @@ -89,26 +94,75 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. νŽ«μ€ λ‹€μŒ 두가지 λ°©λ²•μœΌλ‘œ νšλ“ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 1. **컀밋 30λ²ˆν•˜κΈ°** - 컀밋이 30번 λˆ„μ λ˜λ©΄ μƒˆλ‘œμš΄ 펫이 λ“±μž₯ν•΄μš”. μ΄λ•Œ, λͺ¨λ“  νŽ«λ“€μ€ λ“±μž₯ν•˜λŠ” ν™•λ₯ μ΄ λ‹€λ¦…λ‹ˆλ‹€. - μ΄λ•Œ, μ΅œλŒ€λ‘œ 얻을 수 μžˆλŠ” νŽ«μ€ 30개 μž…λ‹ˆλ‹€. 30κ°œκ°€ λ„˜λŠ” νŽ«μ€ μΈλ²€ν† λ¦¬λ‘œ λ“€μ–΄κ°€λ©°, μ–Έμ œλ“ μ§€ λ³΄μ—¬μ§€λŠ” 펫과 ꡐ체할 수 μžˆμ–΄μš”. **_<- κ°œλ°œμ€‘_** + 컀밋이 30번 λˆ„μ λ˜λ©΄ μƒˆλ‘œμš΄ 펫이 λ“±μž₯ν•΄μš”. μ΄λ•Œ, λͺ¨λ“  νŽ«λ“€μ€ λ“±μž₯ν•˜λŠ” ν™•λ₯ μ΄ λ‹€λ¦…λ‹ˆλ‹€. + μ΄λ•Œ, μ΅œλŒ€λ‘œ 얻을 수 μžˆλŠ” νŽ«μ€ 30개 μž…λ‹ˆλ‹€. 30κ°œκ°€ λ„˜λŠ” νŽ«μ€ μΈλ²€ν† λ¦¬λ‘œ λ“€μ–΄κ°€λ©°, μ–Έμ œλ“ μ§€ λ³΄μ—¬μ§€λŠ” 펫과 ꡐ체할 수 μžˆμ–΄μš”. **_<- κ°œλ°œμ€‘_** 2. **펫 κ΅¬λ§€ν•˜κΈ°** **_<- κ°œλ°œμ€‘_** - λ‹€λ₯Έ μœ μ €κ°€ νŒλ§€ν•˜λŠ” νŽ«μ„ μ»€λ°‹ν¬μΈνŠΈλ‘œ ꡬ맀할 수 μžˆμ–΄μš”. - 컀밋 1νšŒλ‹Ή μΌμ •λŸ‰μ˜ ν¬μΈνŠΈκ°€ μ§€κΈ‰λ©λ‹ˆλ‹€. ν˜Ήμ€ μžμ‹ μ˜ νŽ«μ„ νŒλ§€ν•΄μ„œ μ»€λ°‹ν¬μΈνŠΈλ₯Ό μ–»μ„μˆ˜λ„ μžˆμ–΄μš”. + λ‹€λ₯Έ μœ μ €κ°€ νŒλ§€ν•˜λŠ” νŽ«μ„ μ»€λ°‹ν¬μΈνŠΈλ‘œ ꡬ맀할 수 μžˆμ–΄μš”. + 컀밋 1νšŒλ‹Ή μΌμ •λŸ‰μ˜ ν¬μΈνŠΈκ°€ μ§€κΈ‰λ©λ‹ˆλ‹€. ν˜Ήμ€ μžμ‹ μ˜ νŽ«μ„ νŒλ§€ν•΄μ„œ μ»€λ°‹ν¬μΈνŠΈλ₯Ό μ–»μ„μˆ˜λ„ μžˆμ–΄μš”. ### Total contributions Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ λͺ¨λ“  Contribtuions 수λ₯Ό μ§‘κ³„ν•΄μ„œ λ³΄μ—¬μ€λ‹ˆλ‹€. -μ΄λ•Œ, μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€. +μ΄λ•Œ, μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€. ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ docs/pets.svg +| name | ratio | +|---------------------------------------------------------------------------------------|-------| +| goose | 1.0 | +| goose_sunglasses | 0.05 | +| goose_kotlin | 0.01 | +| goose_java | 0.01 | +| goose_js | 0.01 | +| goose_node | 0.01 | +| goose_swift | 0.01 | +| goose_linux | 0.01 | +| goose_spring | 0.01 | +| little_chick | 0.9 | +| little_chick_suglasses | 0.4 | +| little_chick_kotlin | 0.01 | +| little_chick_java | 0.01 | +| little_chick_js | 0.01 | +| little_chick_node | 0.01 | +| little_chick_swift | 0.01 | +| little_chick_linux | 0.01 | +| little_chick_spring | 0.01 | +| penguin | 0.5 | +| penguin_sunglasses | 0.2 | +| penguin_kotlin | 0.01 | +| penguin_java | 0.01 | +| penguin_js | 0.01 | +| penguin_node | 0.01 | +| penguin_swift | 0.01 | +| penguin_linux | 0.01 | +| penguin_spring | 0.01 | +| pig | 0.2 | +| pig_sunglasses | 0.08 | +| pig_kotlin | 0.01 | +| pig_java | 0.01 | +| pig_js | 0.01 | +| pig_node | 0.01 | +| pig_swift | 0.01 | +| pig_linux | 0.01 | +| pig_spring | 0.01 | +| slime_red | 0.1 | +| slime_red_kotlin | 0.001 | +| slime_red_java | 0.001 | +| slime_red_js | 0.001 | +| slime_red_node | 0.001 | +| slime_red_swift | 0.001 | +| slime_red_linux | 0.001 | +| slime_green | 0.1 | +| slime_blue | 0.1 | +| flamingo
| 0.08 | + ##

μ•„μ΄λ””μ–΄λ‚˜ 발견 ν•œ 버그가 μžˆλ‹€λ©΄ 제보 ν•΄μ£Όμ„Έμš”. Contact : develxb@gmail.com

- +
diff --git a/docs/flamingo.svg b/docs/flamingo.svg new file mode 100644 index 0000000..05b591f --- /dev/null +++ b/docs/flamingo.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fe14ebd700284668327cc47407663fc47a47aa97 Mon Sep 17 00:00:00 2001 From: devxb Date: Tue, 16 Apr 2024 12:03:49 +0900 Subject: [PATCH 064/161] =?UTF-8?q?docs:=20=EA=B8=B0=EC=A1=B4=EC=9D=98=20?= =?UTF-8?q?=EB=93=B1=EC=9E=A5=ED=8E=AB=20=EB=AA=A9=EB=A1=9D=20=EC=82=AC?= =?UTF-8?q?=EC=A7=84=EC=9D=84=20=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 50e9bc2..94b45e8 100644 --- a/README.md +++ b/README.md @@ -107,8 +107,6 @@ Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ λͺ¨λ“  Contribtuions 수λ₯Ό 집 ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -docs/pets.svg - | name | ratio | |---------------------------------------------------------------------------------------|-------| | goose | 1.0 | From 7311d35dd0fab22d41bbe0cab2c3042412e1a12d Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:55:32 +0900 Subject: [PATCH 065/161] =?UTF-8?q?=08docs:=20=EB=AC=B8=EC=84=9C=EC=97=90?= =?UTF-8?q?=20=EB=B3=B4=EC=97=AC=EC=A7=80=EB=8A=94=20=ED=8E=AB=EC=9D=84=20?= =?UTF-8?q?flamingo=EB=A1=9C=20=EA=B5=90=EC=B2=B4=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 94b45e8..c98e1b6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ ## - +
- + -
β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️

Press star

From 30084420eb7dfddca7a94d99ee53a83ff331e24f Mon Sep 17 00:00:00 2001 From: devxb Date: Tue, 16 Apr 2024 17:03:32 +0900 Subject: [PATCH 066/161] =?UTF-8?q?docs:=20line=EB=AA=A8=EB=93=9C=EC=9D=98?= =?UTF-8?q?=20=EC=A4=91=EB=B3=B5=20=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=ED=95=98=EA=B3=A0,=20=EC=9D=BD=EA=B8=B0=20=EC=89=BD?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index c98e1b6..be1a20d 100644 --- a/README.md +++ b/README.md @@ -39,17 +39,21 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 μ‚¬μš©ν•΄μ£Όμ„Έμš”. -_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ + +λ³€κ²½ κ°€λŠ₯ν•œ pet-idλŠ” `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„ APIλ₯Ό μš”μ²­ν•˜λ©΄ 확인할 수 μžˆμ–΄μš”. +API μ‘λ‹΅μ˜ `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 pet-id에 μž…λ ₯ν•˜λ©΄ λΌμš”. > [!TIP] -> **HTML을 λΆ™μ—¬λ„£κΈ° ν•  경우, Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** +> **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. -> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. +> λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. +> img의 heightλ₯Ό 펫의 μ„Έλ‘œ 길이보닀 μΆ©λΆ„νžˆ 크게 μ μš©ν•΄μ£Όμ„Έμš”. κ·ΈλŸ¬μ§€ μ•ŠμœΌλ©΄ 펫이 μˆ¨μ–΄λ²„λ €μš”. - + **html** ```html @@ -74,26 +78,14 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ``` -### νŽ«μ„ λ³€κ²½ν•˜λŠ” 방법 - -νŽ«μ€ λ‹€μŒ url을 웹에 μš”μ²­ ν›„, `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 url의 pet-id param에 μž…λ ₯ν•˜λ©΄μ„œ λ³€κ²½ν•  수 μžˆμ–΄μš”. -λ³€κ²½κ°€λŠ₯ν•œ νŽ«μ„ ν™•μΈν•˜λ €λ©΄, `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„, -μš”μ²­ν•΄λ³΄μ„Έμš”. - -```html - - - -``` - ## TIPS ### νŽ«μ„ νšλ“ν•˜λŠ” 방법 -νŽ«μ€ λ‹€μŒ 두가지 λ°©λ²•μœΌλ‘œ νšλ“ν•  수 μžˆμŠ΅λ‹ˆλ‹€. +νŽ«μ€ λ‹€μŒ 두가지 λ°©λ²•μœΌλ‘œ νšλ“ν•  수 μžˆμ–΄μš”. 1. **컀밋 30λ²ˆν•˜κΈ°** - 컀밋이 30번 λˆ„μ λ˜λ©΄ μƒˆλ‘œμš΄ 펫이 λ“±μž₯ν•΄μš”. μ΄λ•Œ, λͺ¨λ“  νŽ«λ“€μ€ λ“±μž₯ν•˜λŠ” ν™•λ₯ μ΄ λ‹€λ¦…λ‹ˆλ‹€. + 컀밋이 30번 λˆ„μ λ˜λ©΄ μƒˆλ‘œμš΄ 펫이 λ“±μž₯ν•΄μš”. μ΄λ•Œ, λͺ¨λ“  νŽ«λ“€μ€ λ“±μž₯ν•˜λŠ” ν™•λ₯ μ΄ λ‹¬λΌμš”. μ΄λ•Œ, μ΅œλŒ€λ‘œ 얻을 수 μžˆλŠ” νŽ«μ€ 30개 μž…λ‹ˆλ‹€. 30κ°œκ°€ λ„˜λŠ” νŽ«μ€ μΈλ²€ν† λ¦¬λ‘œ λ“€μ–΄κ°€λ©°, μ–Έμ œλ“ μ§€ λ³΄μ—¬μ§€λŠ” 펫과 ꡐ체할 수 μžˆμ–΄μš”. **_<- κ°œλ°œμ€‘_** 2. **펫 κ΅¬λ§€ν•˜κΈ°** **_<- κ°œλ°œμ€‘_** λ‹€λ₯Έ μœ μ €κ°€ νŒλ§€ν•˜λŠ” νŽ«μ„ μ»€λ°‹ν¬μΈνŠΈλ‘œ ꡬ맀할 수 μžˆμ–΄μš”. @@ -101,8 +93,8 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### Total contributions -Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ λͺ¨λ“  Contribtuions 수λ₯Ό μ§‘κ³„ν•΄μ„œ λ³΄μ—¬μ€λ‹ˆλ‹€. -μ΄λ•Œ, μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€. +Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ μ§‘κ³„λœ Contribtuions 의 총합 μ΄μ—μš”. +_μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ From c9d67bf063fb6f977cb652425ea734ddf26d4821 Mon Sep 17 00:00:00 2001 From: devxb Date: Tue, 16 Apr 2024 17:09:24 +0900 Subject: [PATCH 067/161] =?UTF-8?q?refactor:=20line=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=8A=94=20invisible=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EB=90=9C=20=ED=8E=AB=EB=8F=84=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A7=80=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/Persona.kt | 2 ++ src/main/kotlin/org/gitanimals/render/domain/User.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 4635a8b..7f90b2d 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -35,6 +35,8 @@ class Persona( ) : this(type = type, level = Level(level), visible = visible) + fun toSvgForce(): String = type.load(this) + fun toSvg(): String { if (!visible) { return "" diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 8cad6f2..fd48946 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -125,7 +125,7 @@ class User( val persona = personas.find { it.id!! >= personaId } ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") - builder.append(persona.toSvg()) + builder.append(persona.toSvgForce()) return builder.closeSvg() } From 90d73264867a9604aa48293ccacdcda201449463 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:29:41 +0900 Subject: [PATCH 068/161] =?UTF-8?q?docs:=20=EB=B3=B4=EC=97=AC=EC=A7=80?= =?UTF-8?q?=EB=8A=94=20=ED=8E=AB=EC=9D=84=20=EC=8A=AC=EB=9D=BC=EC=9E=84?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be1a20d..7e573bc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ##
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 032bd1b4c6784a9a496f5dadac09ed34ddafcc45 Mon Sep 17 00:00:00 2001 From: devxb Date: Wed, 17 Apr 2024 12:53:24 +0900 Subject: [PATCH 069/161] =?UTF-8?q?feat:=20GET=20/users/{username}=20api?= =?UTF-8?q?=EC=97=90=20cors=EB=A5=BC=20=EC=A0=81=EC=9A=A9=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 6 ++ gradle/db.gradle | 2 +- gradle/test.gradle | 3 + .../render/controller/filter/CorsFilter.kt | 41 ++++++++++++ .../org/gitanimals/render/controller/Api.kt | 15 +++++ .../controller/filter/CorsFilterTest.kt | 63 +++++++++++++++++++ .../gitanimals/render/domain/UserFixture.kt | 3 +- .../render/supports/RedisContainer.kt | 27 ++++++++ src/test/resources/application.properties | 28 +++++++++ 9 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt create mode 100644 src/test/kotlin/org/gitanimals/render/controller/Api.kt create mode 100644 src/test/kotlin/org/gitanimals/render/controller/filter/CorsFilterTest.kt create mode 100644 src/test/kotlin/org/gitanimals/render/supports/RedisContainer.kt create mode 100644 src/test/resources/application.properties diff --git a/gradle.properties b/gradle.properties index 91ef374..3370ffa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,3 +28,9 @@ netxVersion=0.4.2 ### Sentry ### sentryVersion=4.4.0 + +### RestAssured ### +restAssuredVersion=5.4.0 + +### H2version ### +h2Version=1.4.200 diff --git a/gradle/db.gradle b/gradle/db.gradle index 7d7afdc..61d4ab8 100644 --- a/gradle/db.gradle +++ b/gradle/db.gradle @@ -1,5 +1,5 @@ dependencies { implementation "mysql:mysql-connector-java:${mysqlConnectorVersion}" - testRuntimeOnly "com.h2database:h2" + testRuntimeOnly "com.h2database:h2:${h2Version}" } diff --git a/gradle/test.gradle b/gradle/test.gradle index 60b80e1..bf9f2e1 100644 --- a/gradle/test.gradle +++ b/gradle/test.gradle @@ -8,4 +8,7 @@ dependencies { testImplementation "io.kotest.extensions:kotest-extensions-spring:${kotestExtensionSpringVersion}" testImplementation "org.testcontainers:testcontainers:${testContainerVersion}" + + testImplementation "io.rest-assured:rest-assured:${restAssuredVersion}" + } diff --git a/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt b/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt new file mode 100644 index 0000000..4165d18 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt @@ -0,0 +1,41 @@ +package org.gitanimals.render.controller.filter + +import jakarta.servlet.Filter +import jakarta.servlet.FilterChain +import jakarta.servlet.ServletRequest +import jakarta.servlet.ServletResponse +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import org.springframework.http.HttpHeaders +import org.springframework.stereotype.Component + +@Component +class CorsFilter : Filter { + + override fun doFilter( + request: ServletRequest, + response: ServletResponse, + chain: FilterChain + ) { + (request as HttpServletRequest) + if (regexMatcher.matches(request.requestURI)) { + (response as HttpServletResponse).allowCors() + } + chain.doFilter(request, response) + } + + private fun HttpServletResponse.allowCors(): ServletResponse { + this.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*") + this.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "*") + this.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "3600") + this.addHeader( + HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, + "Origin, X-Requested-With, Content-Type, Accept, Authorization" + ) + return this + } + + private companion object { + private val regexMatcher = Regex("/users/.*") + } +} diff --git a/src/test/kotlin/org/gitanimals/render/controller/Api.kt b/src/test/kotlin/org/gitanimals/render/controller/Api.kt new file mode 100644 index 0000000..3f9cf2a --- /dev/null +++ b/src/test/kotlin/org/gitanimals/render/controller/Api.kt @@ -0,0 +1,15 @@ +package org.gitanimals.render.controller + +import io.restassured.RestAssured +import io.restassured.http.ContentType +import io.restassured.response.ExtractableResponse +import io.restassured.response.Response + +fun users(username: String): ExtractableResponse = + RestAssured.given().log().all() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .`when`().log().all() + .get("/users/$username") + .then().log().all() + .extract() diff --git a/src/test/kotlin/org/gitanimals/render/controller/filter/CorsFilterTest.kt b/src/test/kotlin/org/gitanimals/render/controller/filter/CorsFilterTest.kt new file mode 100644 index 0000000..e3ca0f5 --- /dev/null +++ b/src/test/kotlin/org/gitanimals/render/controller/filter/CorsFilterTest.kt @@ -0,0 +1,63 @@ +package org.gitanimals.render.controller.filter + +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.collections.shouldExistInOrder +import io.restassured.RestAssured +import io.restassured.http.Header +import org.gitanimals.render.controller.users +import org.gitanimals.render.domain.User +import org.gitanimals.render.domain.UserRepository +import org.gitanimals.render.supports.RedisContainer +import org.junit.jupiter.api.DisplayName +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.boot.test.web.server.LocalServerPort +import org.springframework.test.context.ContextConfiguration + +@ContextConfiguration( + classes = [ + RedisContainer::class + ] +) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@DisplayName("Cors 적용 ν…ŒμŠ€νŠΈμ˜") +internal class CorsFilterTest( + @LocalServerPort private val port: Int, + private val userRepository: UserRepository, +) : DescribeSpec({ + + beforeSpec { + RestAssured.port = port + } + + afterEach { userRepository.deleteAll() } + + describe("/users/{username} apiλŠ”") { + context("호좜되면, ") { + it("cors ν—ˆμš© header듀을 μΆ”κ°€ν•΄μ„œ λ°˜ν™˜ν•œλ‹€.") { + val user = userRepository.saveAndFlush(user) + + val response = users(user.name) + + response.headers().shouldExistInOrder( + listOf( + { it == Header("Access-Control-Allow-Origin", "*") }, + { it == Header("Access-Control-Allow-Methods", "*") }, + { it == Header("Access-Control-Max-Age", "3600") }, + { + it == Header( + "Access-Control-Allow-Headers", + "Origin, X-Requested-With, Content-Type, Accept, Authorization" + ) + } + ) + ) + } + } + } + +}) { + + private companion object { + private val user = User.newUser("devxb", mutableMapOf(2024 to 1000)) + } +} diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt b/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt index 2aec862..1438a3a 100644 --- a/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt +++ b/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt @@ -1,9 +1,10 @@ package org.gitanimals.render.domain import org.gitanimals.render.domain.value.Contribution +import kotlin.random.Random fun user( - id: Long = 0L, + id: Long = Random.nextLong(), name: String = "devxb", personas: MutableList = mutableListOf(), contributions: MutableList = mutableListOf(), diff --git a/src/test/kotlin/org/gitanimals/render/supports/RedisContainer.kt b/src/test/kotlin/org/gitanimals/render/supports/RedisContainer.kt new file mode 100644 index 0000000..fda4dbd --- /dev/null +++ b/src/test/kotlin/org/gitanimals/render/supports/RedisContainer.kt @@ -0,0 +1,27 @@ +package org.gitanimals.render.supports + + +import org.springframework.boot.test.context.TestConfiguration +import org.testcontainers.containers.GenericContainer +import org.testcontainers.utility.DockerImageName + +@TestConfiguration +internal class RedisContainer { + init { + val redis: GenericContainer<*> = GenericContainer(DockerImageName.parse("redis:7.2.3")) + .withExposedPorts(6379) + + runCatching { + redis.start() + }.onFailure { + if (it is com.github.dockerjava.api.exception.InternalServerErrorException) { + redis.start() + } + } + + System.setProperty( + "netx.port", + redis.getMappedPort(6379).toString() + ) + } +} diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties new file mode 100644 index 0000000..f509631 --- /dev/null +++ b/src/test/resources/application.properties @@ -0,0 +1,28 @@ +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.url=jdbc:h2:mem:test;MODE=MySQL +spring.jpa.hibernated.ddl-auto=create +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +spring.datasource.hikari.maximum-pool-size=4 +spring.datasource.hikari.pool-name=H2_TEST_POOL + +### FOR DEBUGGING ### +logging.level.org.hibernate.SQL=debug +logging.level.org.hibernate.type.descriptor.sql=trace +spring.jpa.properties.hibernate.format_sql=true +spring.jpa.properties.hibernate.highlight_sql=true +spring.jpa.properties.hibernate.use_sql_comments=true + +### NETX ### +netx.mode=redis +netx.host=localhost +netx.port= +netx.group=render +netx.node-id=1 +netx.node-name=render-1 +netx.recovery-milli=1000 +netx.orphan-milli=60000 +netx.backpressure=40 +netx.logging.level=info + +### GITHUB ### +github.token=1234 From 8d54512e67c4dd5235a85eab4350d2d4b400bce1 Mon Sep 17 00:00:00 2001 From: devxb Date: Wed, 17 Apr 2024 17:56:03 +0900 Subject: [PATCH 070/161] =?UTF-8?q?feat:=20lines=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20total=20contributions=EB=A5=BC=20=EB=B3=B4?= =?UTF-8?q?=EC=97=AC=EC=A3=BC=EB=8F=84=EB=A1=9D=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/app/AnimationFacade.kt | 7 +- .../render/controller/AnimationController.kt | 10 +- .../org/gitanimals/render/domain/Mode.kt | 8 + .../org/gitanimals/render/domain/Persona.kt | 6 +- .../gitanimals/render/domain/PersonaType.kt | 124 +++-- .../org/gitanimals/render/domain/User.kt | 8 +- .../gitanimals/render/domain/UserService.kt | 4 +- .../resources/persona/animal/flamingo.svg | 11 + .../resources/persona/animal/goose-java.svg | 11 + .../resources/persona/animal/goose-js.svg | 11 + .../resources/persona/animal/goose-kotlin.svg | 11 + .../resources/persona/animal/goose-linux.svg | 11 + .../resources/persona/animal/goose-node.svg | 11 + .../resources/persona/animal/goose-spring.svg | 11 + .../persona/animal/goose-sunglasses.svg | 11 + .../resources/persona/animal/goose-swift.svg | 11 + src/main/resources/persona/animal/goose.svg | 11 + .../persona/animal/little-chick-java.svg | 11 + .../persona/animal/little-chick-js.svg | 11 + .../persona/animal/little-chick-kotlin.svg | 12 + .../persona/animal/little-chick-linux.svg | 12 + .../persona/animal/little-chick-node.svg | 12 + .../persona/animal/little-chick-spring.svg | 12 + .../animal/little-chick-sunglasses.svg | 12 + .../persona/animal/little-chick-swift.svg | 12 + .../resources/persona/animal/little-chick.svg | 11 + .../resources/persona/animal/penguin-java.svg | 11 + .../resources/persona/animal/penguin-js.svg | 11 + .../persona/animal/penguin-kotlin.svg | 11 + .../persona/animal/penguin-linux.svg | 11 + .../resources/persona/animal/penguin-node.svg | 11 + .../persona/animal/penguin-spring.svg | 11 + .../persona/animal/penguin-sunglasses.svg | 11 + .../persona/animal/penguin-swift.svg | 11 + src/main/resources/persona/animal/penguin.svg | 11 + .../resources/persona/animal/pig-java.svg | 11 + src/main/resources/persona/animal/pig-js.svg | 11 + .../resources/persona/animal/pig-kotlin.svg | 11 + .../resources/persona/animal/pig-linux.svg | 11 + .../resources/persona/animal/pig-node.svg | 11 + .../resources/persona/animal/pig-spring.svg | 11 + .../persona/animal/pig-sunglasses.svg | 11 + .../resources/persona/animal/pig-swift.svg | 11 + src/main/resources/persona/animal/pig.svg | 11 + .../resources/persona/animal/slime-blue.svg | 11 + .../resources/persona/animal/slime-green.svg | 11 + .../persona/animal/slime-red-java.svg | 11 + .../resources/persona/animal/slime-red-js.svg | 11 + .../persona/animal/slime-red-kotlin.svg | 11 + .../persona/animal/slime-red-linux.svg | 11 + .../persona/animal/slime-red-node.svg | 11 + .../persona/animal/slime-red-swift.svg | 11 + .../resources/persona/animal/slime-red.svg | 11 + src/test/resources/persona/goose/test.svg | 439 ++++++++++++++---- 54 files changed, 975 insertions(+), 143 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/domain/Mode.kt diff --git a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt index fd5d15d..3af8dae 100644 --- a/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.app +import org.gitanimals.render.domain.Mode import org.gitanimals.render.domain.User import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.event.Visited @@ -29,17 +30,17 @@ class AnimationFacade( } } - fun getLineAnimation(username: String, personaId: Long): String { + fun getLineAnimation(username: String, personaId: Long, mode: Mode): String { return when (userService.existsByName(username)) { true -> { - val svgAnimation = userService.getLineAnimationByUsername(username, personaId) + val svgAnimation = userService.getLineAnimationByUsername(username, personaId, mode) sagaManager.startSync(Visited(username)) svgAnimation } false -> { val user = createNewUser(username) - userService.getLineAnimationByUsername(user.name, personaId) + userService.getLineAnimationByUsername(user.name, personaId, mode) } } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index 0fd4e2d..4b3cd59 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.controller import jakarta.servlet.http.HttpServletResponse import org.gitanimals.render.app.AnimationFacade +import org.gitanimals.render.domain.Mode import org.springframework.http.HttpHeaders import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable @@ -26,10 +27,17 @@ class AnimationController( fun getLineSvgAnimation( @PathVariable("username") username: String, @RequestParam(name = "pet-id", defaultValue = "0") personaId: Long, + @RequestParam(name = "contribution-view", defaultValue = "true") contributionView: Boolean, response: HttpServletResponse, ): String { response.cacheControl(3600) - return animationFacade.getLineAnimation(deleteBrackets(username), personaId) + + val mode = when (contributionView) { + true -> Mode.LINE + false -> Mode.LINE_NO_CONTRIBUTION + } + + return animationFacade.getLineAnimation(deleteBrackets(username), personaId, mode) } private fun deleteBrackets(username: String): String { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Mode.kt b/src/main/kotlin/org/gitanimals/render/domain/Mode.kt new file mode 100644 index 0000000..4c08dfe --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/Mode.kt @@ -0,0 +1,8 @@ +package org.gitanimals.render.domain + +enum class Mode { + FARM, + LINE, + LINE_NO_CONTRIBUTION, + ; +} diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 7f90b2d..5ddad62 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -35,13 +35,13 @@ class Persona( ) : this(type = type, level = Level(level), visible = visible) - fun toSvgForce(): String = type.load(this) + fun toSvgForce(mode: Mode): String = type.load(user!!, this, mode) - fun toSvg(): String { + fun toSvg(mode: Mode): String { if (!visible) { return "" } - return type.load(this) + return type.load(user!!, this, mode) } fun level(): Long = level.value diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index ea5ac10..f88adb6 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -7,7 +7,7 @@ import kotlin.random.Random enum class PersonaType(private val weight: Double) { GOOSE(1.0) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseSvg.replace("*{act}", act(persona.id)) @@ -30,7 +30,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_SUNGLASSES(0.05) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseSunglassesSvg.replace("*{act}", act(persona.id)) @@ -53,7 +53,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_KOTLIN(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseKotlinSvg.replace("*{act}", act(persona.id)) @@ -76,7 +76,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_JAVA(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseJavaSvg.replace("*{act}", act(persona.id)) @@ -99,7 +99,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_JS(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseJsSvg.replace("*{act}", act(persona.id)) @@ -122,7 +122,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_NODE(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseNodeSvg.replace("*{act}", act(persona.id)) @@ -145,7 +145,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_SWIFT(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseSwiftSvg.replace("*{act}", act(persona.id)) @@ -168,7 +168,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_LINUX(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseLinuxSvg.replace("*{act}", act(persona.id)) @@ -191,7 +191,7 @@ enum class PersonaType(private val weight: Double) { }, GOOSE_SPRING(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val goose = gooseSpringSvg.replace("*{act}", act(persona.id)) @@ -214,7 +214,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK(0.9) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickSvg.replace("*{act}", act(persona.id)) @@ -237,7 +237,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_SUNGLASSES(0.4) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickSunglassesSvg.replace("*{act}", act(persona.id)) @@ -260,7 +260,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_KOTLIN(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickKotlinSvg.replace("*{act}", act(persona.id)) @@ -283,7 +283,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_JAVA(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickJavaSvg.replace("*{act}", act(persona.id)) @@ -306,7 +306,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_JS(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickJsSvg.replace("*{act}", act(persona.id)) @@ -329,7 +329,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_NODE(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickNodeSvg.replace("*{act}", act(persona.id)) @@ -352,7 +352,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_SWIFT(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickSwiftSvg.replace("*{act}", act(persona.id)) @@ -375,7 +375,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_LINUX(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickLinuxSvg.replace("*{act}", act(persona.id)) @@ -398,7 +398,7 @@ enum class PersonaType(private val weight: Double) { }, LITTLE_CHICK_SPRING(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } val littleChick = littleChickSpringSvg.replace("*{act}", act(persona.id)) @@ -421,7 +421,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN(0.5) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinSvg.replace("*{act}", act(persona.id)) @@ -440,7 +440,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_SUNGLASSES(0.2) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinSunglassesSvg.replace("*{act}", act(persona.id)) @@ -459,7 +459,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_KOTLIN(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinKotlinSvg.replace("*{act}", act(persona.id)) @@ -478,7 +478,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_JAVA(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinJavaSvg.replace("*{act}", act(persona.id)) @@ -497,7 +497,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_JS(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinJsSvg.replace("*{act}", act(persona.id)) @@ -516,7 +516,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_NODE(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinNodeSvg.replace("*{act}", act(persona.id)) @@ -535,7 +535,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_SWIFT(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinSwiftSvg.replace("*{act}", act(persona.id)) @@ -554,7 +554,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_LINUX(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinLinuxSvg.replace("*{act}", act(persona.id)) @@ -573,7 +573,7 @@ enum class PersonaType(private val weight: Double) { }, PENGUIN_SPRING(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return penguinSpringSvg.replace("*{act}", act(persona.id)) @@ -592,7 +592,7 @@ enum class PersonaType(private val weight: Double) { }, PIG(0.2) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigSvg.replace("*{act}", act(persona.id)) @@ -610,7 +610,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_SUNGLASSES(0.08) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigSunglassesSvg.replace("*{act}", act(persona.id)) @@ -628,7 +628,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_KOTLIN(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigKotlinSvg.replace("*{act}", act(persona.id)) @@ -646,7 +646,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_JAVA(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigJavaSvg.replace("*{act}", act(persona.id)) @@ -664,7 +664,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_JS(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigJsSvg.replace("*{act}", act(persona.id)) @@ -682,7 +682,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_NODE(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigNodeSvg.replace("*{act}", act(persona.id)) @@ -700,7 +700,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_SWIFT(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigSwiftSvg.replace("*{act}", act(persona.id)) @@ -718,7 +718,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_LINUX(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigLinuxSvg.replace("*{act}", act(persona.id)) @@ -736,7 +736,7 @@ enum class PersonaType(private val weight: Double) { }, PIG_SPRING(0.01) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return pigSpringSvg.replace("*{act}", act(persona.id)) @@ -754,7 +754,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED(0.1) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedSvg.replace("*{act}", act(persona.id)) @@ -772,7 +772,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_KOTLIN(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedKotlinSvg.replace("*{act}", act(persona.id)) @@ -790,7 +790,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_JAVA(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedJavaSvg.replace("*{act}", act(persona.id)) @@ -808,7 +808,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_JS(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedJsSvg.replace("*{act}", act(persona.id)) @@ -826,7 +826,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_NODE(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedNodeSvg.replace("*{act}", act(persona.id)) @@ -844,7 +844,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_SWIFT(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedSwiftSvg.replace("*{act}", act(persona.id)) @@ -862,7 +862,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_RED_LINUX(0.001) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeRedLinuxSvg.replace("*{act}", act(persona.id)) @@ -880,7 +880,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_BLUE(0.1) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeBlueSvg.replace("*{act}", act(persona.id)) @@ -898,7 +898,7 @@ enum class PersonaType(private val weight: Double) { }, SLIME_GREEN(0.1) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return slimeGreenSvg.replace("*{act}", act(persona.id)) @@ -916,7 +916,7 @@ enum class PersonaType(private val weight: Double) { }, FLAMINGO(0.05) { - override fun load(persona: Persona): String { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } return flamingoSvg.replace("*{position}", act(persona.id)) @@ -944,10 +944,32 @@ enum class PersonaType(private val weight: Double) { require(weight in 0.001..1.0) { "PersonaType's weight should be between 0.01 to 1.0" } } - abstract fun load(persona: Persona): String + fun load(user: User, persona: Persona, mode: Mode): String = + loadSvg(user, persona, mode) + .drawContribution(mode, user) + + abstract fun loadSvg(user: User, persona: Persona, mode: Mode): String protected abstract fun act(id: Long): String + protected fun String.drawContribution( + mode: Mode, + user: User + ): String { + return if (mode == Mode.LINE) { + this.replace( + "*{contributionx}", + (12 + (-1 * (user.contributionCount().toString().length))).toString() + ) + .replace( + "*{contribution}", + user.contributionCount().toSvg(0.0, 2.0) + ).replace("*{contribution-display}", "default") + } else { + this.replace("*{contribution-display}", "none") + } + } + companion object { private val maxWeight = lazy { @@ -1040,15 +1062,19 @@ enum class PersonaType(private val weight: Double) { } private fun Long.toSvg(levelStartX: Double, xIncrease: Double): String { + return this.toSvgWithY(-1.0, levelStartX, xIncrease) + } + + private fun Long.toSvgWithY(startY: Double, startX: Double, xIncrease: Double): String { val level = this.toString() - var currentX = levelStartX + var currentX = startX val builder = StringBuilder() level.withIndex().forEach { val index = it.index val number = it.value.digitToInt() val numberSvg = numberSvgs[number] - builder.append("") + builder.append("") .append(numberSvg) .append("") diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index fd48946..ec87260 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -120,12 +120,12 @@ class User( visit += 1 } - fun createLineAnimation(personaId: Long): String { + fun createLineAnimation(personaId: Long, mode: Mode): String { val builder = StringBuilder().openLine() val persona = personas.find { it.id!! >= personaId } ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") - builder.append(persona.toSvgForce()) + builder.append(persona.toSvgForce(mode)) return builder.closeSvg() } @@ -139,13 +139,15 @@ class User( .append(field.fillBackground()) personas.asSequence() - .forEach { builder.append(it.toSvg()) } + .forEach { builder.append(it.toSvg(Mode.FARM)) } return builder.append(field.loadComponent(name, contributions.totalCount())) .append(field.drawBorder()) .closeSvg() } + fun contributionCount(): Long = contributions.totalCount() + private fun List.totalCount(): Long { var totalCount = 0L this.forEach { totalCount += it.contribution } diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 66df64e..006c315 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -17,8 +17,8 @@ class UserService( return getUserByName(username).createFarmAnimation() } - fun getLineAnimationByUsername(username: String, personaId: Long): String { - return getUserByName(username).createLineAnimation(personaId) + fun getLineAnimationByUsername(username: String, personaId: Long, mode: Mode): String { + return getUserByName(username).createLineAnimation(personaId, mode) } @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 10) diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg index 60f0b67..1a22fe8 100644 --- a/src/main/resources/persona/animal/flamingo.svg +++ b/src/main/resources/persona/animal/flamingo.svg @@ -23,6 +23,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index 99ef06e..a4cf2c0 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index 9f3adc3..96d3f8a 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 14fce5f..538a3a3 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index d4f764d..41c90d4 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index 87ca8d9..8ac1622 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index c624112..b1e04a0 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 56d0856..45d642c 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -64,6 +64,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index b14a16e..b108cc4 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index 40a0f7d..68d9530 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -64,6 +64,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index aa14328..8653fbc 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -95,6 +95,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index 0a375bc..f1224e8 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -95,6 +95,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index 07160e9..e904a3c 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -95,6 +95,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index 9dd4d23..549158a 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -95,6 +95,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index edc72a8..2a2aff3 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -95,6 +95,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index 9101ee6..82c0442 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -95,6 +95,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index fd762e5..dd48a1e 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -65,6 +65,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index def84f0..5f2abe9 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -95,6 +95,18 @@ + + + + + *{contribution} + + + + diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 152fbd4..8db00e9 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -65,6 +65,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index 92cad65..fee78e2 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -94,6 +94,17 @@ + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-green.svg b/src/main/resources/persona/animal/slime-green.svg index 3eec3ef..4072ca3 100644 --- a/src/main/resources/persona/animal/slime-green.svg +++ b/src/main/resources/persona/animal/slime-green.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-java.svg b/src/main/resources/persona/animal/slime-red-java.svg index f9ada6f..10bd180 100644 --- a/src/main/resources/persona/animal/slime-red-java.svg +++ b/src/main/resources/persona/animal/slime-red-java.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-js.svg b/src/main/resources/persona/animal/slime-red-js.svg index 79ade6a..b991584 100644 --- a/src/main/resources/persona/animal/slime-red-js.svg +++ b/src/main/resources/persona/animal/slime-red-js.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-kotlin.svg b/src/main/resources/persona/animal/slime-red-kotlin.svg index 1ef89cf..aa82035 100644 --- a/src/main/resources/persona/animal/slime-red-kotlin.svg +++ b/src/main/resources/persona/animal/slime-red-kotlin.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-linux.svg b/src/main/resources/persona/animal/slime-red-linux.svg index b4fd032..472c0b2 100644 --- a/src/main/resources/persona/animal/slime-red-linux.svg +++ b/src/main/resources/persona/animal/slime-red-linux.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-node.svg b/src/main/resources/persona/animal/slime-red-node.svg index 3da0e56..69e5bc5 100644 --- a/src/main/resources/persona/animal/slime-red-node.svg +++ b/src/main/resources/persona/animal/slime-red-node.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red-swift.svg b/src/main/resources/persona/animal/slime-red-swift.svg index bd86607..94b5f33 100644 --- a/src/main/resources/persona/animal/slime-red-swift.svg +++ b/src/main/resources/persona/animal/slime-red-swift.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/main/resources/persona/animal/slime-red.svg b/src/main/resources/persona/animal/slime-red.svg index 8e6d6f2..8699746 100644 --- a/src/main/resources/persona/animal/slime-red.svg +++ b/src/main/resources/persona/animal/slime-red.svg @@ -63,6 +63,17 @@ + + + + + *{contribution} + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 05b591f..763d1db 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,95 +1,367 @@ - + + + + + *{contribution} + + + + - + + - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100,9 +372,11 @@ - + - + @@ -110,4 +384,5 @@ - + + From 769e9a9f679a3656b791dc3a1618ee950ef14e87 Mon Sep 17 00:00:00 2001 From: devxb Date: Wed, 17 Apr 2024 18:09:01 +0900 Subject: [PATCH 071/161] =?UTF-8?q?docs:=20lines=20=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=20contribution-view=20=EC=BF=BC=EB=A6=AC=ED=8C=8C?= =?UTF-8?q?=EB=9E=8C=20=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7e573bc..ce7872b 100644 --- a/README.md +++ b/README.md @@ -39,29 +39,31 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 μ‚¬μš©ν•΄μ£Όμ„Έμš”. -_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ - -λ³€κ²½ κ°€λŠ₯ν•œ pet-idλŠ” `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„ APIλ₯Ό μš”μ²­ν•˜λ©΄ 확인할 수 μžˆμ–΄μš”. -API μ‘λ‹΅μ˜ `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 pet-id에 μž…λ ₯ν•˜λ©΄ λΌμš”. > [!TIP] > **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. -> img의 heightλ₯Ό 펫의 μ„Έλ‘œ 길이보닀 μΆ©λΆ„νžˆ 크게 μ μš©ν•΄μ£Όμ„Έμš”. κ·ΈλŸ¬μ§€ μ•ŠμœΌλ©΄ 펫이 μˆ¨μ–΄λ²„λ €μš”. +> λ§Œμ•½, 펫이 보이지 μ•ŠλŠ”λ‹€λ©΄, img의 heightλ₯Ό 펫의 μ„Έλ‘œ 길이보닀 μΆ©λΆ„νžˆ 크게 μ μš©ν•΄μ£Όμ„Έμš”. + -**html** - ```html ``` +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ + +λ³€κ²½ κ°€λŠ₯ν•œ pet-idλŠ” `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„ APIλ₯Ό μš”μ²­ν•˜λ©΄ 확인할 수 μžˆμ–΄μš”. +API μ‘λ‹΅μ˜ `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 pet-id에 μž…λ ₯ν•˜λ©΄ λΌμš”. + +linesλͺ¨λ“œμ—μ„œλŠ” 펫 레벨 μœ„μ— 총 contributions수λ₯Ό λ³΄μ—¬μ€˜μš”. μ›ν•˜μ§€ μ•Šμ„κ²½μš°, 쿼리 νŒŒλΌλ―Έν„°λ‘œ `contribution-view=false`λ₯Ό λ‹΄μ•„ μš”μ²­ν•˜μ„Έμš”. + ### farm mode farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. From bfd805d44cc2af38fa5c0c077fe6c1f756c84b91 Mon Sep 17 00:00:00 2001 From: devxb Date: Wed, 17 Apr 2024 18:46:49 +0900 Subject: [PATCH 072/161] =?UTF-8?q?refactor:=20contribution=20=EA=B8=80?= =?UTF-8?q?=EC=9E=90=EA=B0=80=20=EA=B2=80=EC=9D=80=EB=B0=B0=EA=B2=BD?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=8F=84=20=EC=9E=98=20=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/domain/User.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index ec87260..3f42d21 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -157,10 +157,36 @@ class User( private fun StringBuilder.openFarm(): StringBuilder = this.append("") - private fun StringBuilder.closeSvg(): String = this.blackBlurOnLevel() + private fun StringBuilder.closeSvg(): String = this + .blackBlureOnContributions() + .blackBlurOnLevel() .append("") .toString() + private fun StringBuilder.blackBlureOnContributions(): StringBuilder = + this.append( + """ + + + + + + + + + + + + + + + """.trimIndent() + ) + private fun StringBuilder.blackBlurOnLevel(): StringBuilder = this.append( """ From 12457922e08daaab86ed68a5308bad6e3072b08a Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 18 Apr 2024 19:18:21 +0900 Subject: [PATCH 073/161] =?UTF-8?q?feat:=2010=EB=B6=84=EB=A7=8C=20?= =?UTF-8?q?=EC=BA=90=EB=A6=AD=ED=84=B0=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 114 ++-- docs/tenmm.svg | 208 +++++++ .../gitanimals/render/domain/PersonaType.kt | 22 +- .../org/gitanimals/render/domain/Svgs.kt | 4 +- src/main/resources/persona/animal/tenmm.svg | 196 +++++++ src/test/resources/persona/goose/test.svg | 518 ++++++------------ 6 files changed, 650 insertions(+), 412 deletions(-) create mode 100644 docs/tenmm.svg create mode 100644 src/main/resources/persona/animal/tenmm.svg diff --git a/README.md b/README.md index ce7872b..7d0d312 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## +
@@ -38,31 +39,32 @@ line modeλŠ” μžμ‹ μ΄ κ°–κ³ μžˆλŠ” νŽ«μ€‘ ν•˜λ‚˜λ₯Ό μ§€μ •ν•΄μ„œ, μ§€μ •ν•œ width, heightλ²”μœ„μ—μ„œ μ›€μ§μ΄κ²Œ ν•΄μš”. line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, width, heightλ₯Ό μ„€μ •ν•  수 μ—†μ–΄μ„œ 펫이 보이지 μ•Šμ„ 수 μžˆμœΌλ‹ˆ, HTMl방식을 -μ‚¬μš©ν•΄μ£Όμ„Έμš”. +μ‚¬μš©ν•΄μ£Όμ„Έμš”. > [!TIP] > **Img의 width와 heightλ₯Ό μ‘°μ ˆν•΄μ„œ 펫의 μ΄λ™μ˜μ—­μ„ μ‘°μ ˆν•  수 μžˆμ–΄μš”.** > widthλ₯Ό 길게 heightλ₯Ό μž‘κ²Œν•˜λ©΄ (width = 1000, height = 60) κ°€λ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ°˜λŒ€λ‘œ, widthλ₯Ό μž‘κ²Œ heightλ₯Ό κΈΈκ²Œν•˜λ©΄ (width = 60, height = 1000) μ„Έλ‘œλ‘œ 길게 μ›€μ§μ΄κ²Œ ν•  수 μžˆμ–΄μš”. > λ§Œμ•½, 펫이 보이지 μ•ŠλŠ”λ‹€λ©΄, img의 heightλ₯Ό 펫의 μ„Έλ‘œ 길이보닀 μΆ©λΆ„νžˆ 크게 μ μš©ν•΄μ£Όμ„Έμš”. - + - + ```html ``` -_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ - -λ³€κ²½ κ°€λŠ₯ν•œ pet-idλŠ” `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„ APIλ₯Ό μš”μ²­ν•˜λ©΄ 확인할 수 μžˆμ–΄μš”. +_pet-id에 아무값도 μž…λ ₯ν•˜μ§€ μ•ŠμœΌλ©΄, 첫번째 펫이 κ°€μ Έμ™€μ Έμš”._ + +λ³€κ²½ κ°€λŠ₯ν•œ pet-idλŠ” `https://render.gitanimals.org/users/{username}` 의 {username}을 μžμ‹ μ˜ κΉƒν—ˆλΈŒ μ•„μ΄λ””λ‘œ λ³€κ²½ ν›„ APIλ₯Ό +μš”μ²­ν•˜λ©΄ 확인할 수 μžˆμ–΄μš”. API μ‘λ‹΅μ˜ `$.personas.[].id` 에 ν•΄λ‹Ήν•˜λŠ” 값을 pet-id에 μž…λ ₯ν•˜λ©΄ λΌμš”. -linesλͺ¨λ“œμ—μ„œλŠ” 펫 레벨 μœ„μ— 총 contributions수λ₯Ό λ³΄μ—¬μ€˜μš”. μ›ν•˜μ§€ μ•Šμ„κ²½μš°, 쿼리 νŒŒλΌλ―Έν„°λ‘œ `contribution-view=false`λ₯Ό λ‹΄μ•„ μš”μ²­ν•˜μ„Έμš”. +linesλͺ¨λ“œμ—μ„œλŠ” 펫 레벨 μœ„μ— 총 contributions수λ₯Ό λ³΄μ—¬μ€˜μš”. μ›ν•˜μ§€ μ•Šμ„κ²½μš°, 쿼리 νŒŒλΌλ―Έν„°λ‘œ `contribution-view=false`λ₯Ό λ‹΄μ•„ μš”μ²­ν•˜μ„Έμš”. ### farm mode @@ -100,54 +102,56 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | -|---------------------------------------------------------------------------------------|-------| -| goose | 1.0 | -| goose_sunglasses | 0.05 | -| goose_kotlin | 0.01 | -| goose_java | 0.01 | -| goose_js | 0.01 | -| goose_node | 0.01 | -| goose_swift | 0.01 | -| goose_linux | 0.01 | -| goose_spring | 0.01 | -| little_chick | 0.9 | -| little_chick_suglasses | 0.4 | -| little_chick_kotlin | 0.01 | -| little_chick_java | 0.01 | -| little_chick_js | 0.01 | -| little_chick_node | 0.01 | -| little_chick_swift | 0.01 | -| little_chick_linux | 0.01 | -| little_chick_spring | 0.01 | -| penguin | 0.5 | -| penguin_sunglasses | 0.2 | -| penguin_kotlin | 0.01 | -| penguin_java | 0.01 | -| penguin_js | 0.01 | -| penguin_node | 0.01 | -| penguin_swift | 0.01 | -| penguin_linux | 0.01 | -| penguin_spring | 0.01 | -| pig | 0.2 | -| pig_sunglasses | 0.08 | -| pig_kotlin | 0.01 | -| pig_java | 0.01 | -| pig_js | 0.01 | -| pig_node | 0.01 | -| pig_swift | 0.01 | -| pig_linux | 0.01 | -| pig_spring | 0.01 | -| slime_red | 0.1 | -| slime_red_kotlin | 0.001 | -| slime_red_java | 0.001 | -| slime_red_js | 0.001 | -| slime_red_node | 0.001 | -| slime_red_swift | 0.001 | -| slime_red_linux | 0.001 | -| slime_green | 0.1 | -| slime_blue | 0.1 | -| flamingo
| 0.08 | +| name | ratio | Description | +|------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created with `10MM` donations
Only buy in shop
10MM | ## diff --git a/docs/tenmm.svg b/docs/tenmm.svg new file mode 100644 index 0000000..0fec26b --- /dev/null +++ b/docs/tenmm.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index f88adb6..e7730d4 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -937,11 +937,29 @@ enum class PersonaType(private val weight: Double) { } return "translate(${x}%, ${y}%) scaleX($scale)" } - } + }, + + TEN_MM(0.000) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return tenmmSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-2 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("tenmm", id, 15, "180s", 5) + .toString() + }, ; init { - require(weight in 0.001..1.0) { "PersonaType's weight should be between 0.01 to 1.0" } + require(weight in 0.000..1.0) { "PersonaType's weight should be between 0.000 to 1.0" } } fun load(user: User, persona: Persona, mode: Mode): String = diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 5c36ad6..4db4360 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -1,7 +1,6 @@ package org.gitanimals.render.domain import org.springframework.core.io.ClassPathResource -import org.springframework.util.ClassUtils import java.nio.charset.Charset val whiteFieldSvg: String = ClassPathResource("persona/field/white-field.svg") @@ -148,6 +147,9 @@ val slimeGreenSvg: String = ClassPathResource("persona/animal/slime-green.svg") val flamingoSvg: String = ClassPathResource("persona/animal/flamingo.svg") .getContentAsString(Charset.defaultCharset()) +val tenmmSvg: String = ClassPathResource("persona/animal/tenmm.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/tenmm.svg b/src/main/resources/persona/animal/tenmm.svg new file mode 100644 index 0000000..be86fdd --- /dev/null +++ b/src/main/resources/persona/animal/tenmm.svg @@ -0,0 +1,196 @@ + + + + + + + + *{contribution} + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 763d1db..98d6b28 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,382 +1,193 @@ - - - - - - *{contribution} + + + + + + + + + + + + - - - + + - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -384,5 +195,4 @@ - - + From ba7d6978a1396dd1e2513cea10c602cb9d89a58d Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 18 Apr 2024 20:38:53 +0900 Subject: [PATCH 074/161] =?UTF-8?q?docs:=20=EC=98=81=EC=96=B4=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 105 +++++++++++++++++----------------- 2 files changed, 216 insertions(+), 50 deletions(-) create mode 100644 ENGLISH.md diff --git a/ENGLISH.md b/ENGLISH.md new file mode 100644 index 0000000..72bd46d --- /dev/null +++ b/ENGLISH.md @@ -0,0 +1,161 @@ + +
+ + + +## + +
+ + + + +⭐️ Please press the star! It greatly helps development! ⭐️
+

Press star

+
+ +
+

Grow your pets through GitHub activities!

+

You can acquire and grow pets through GitHub activities. +
When you commit 30 times, you can adopt an additional pet. +
Each contribution increases a random pet's level by 1. +
You can trade the pets with others. +
+
+Choose from over 40 different pets and raise them. +

+
+ + docs/sample.svg + +
+ +## Getting Start + +You can easily apply by copying the following link to your GitHub Readme. + +> [!IMPORTANT] +> Please replace {username} with your GitHub nickname (ex. devxb). +> {username} must be your GitHub username. + +### Line Mode + +Line mode allows you to specify one of your pets to move within the specified width and height range. +When using line mode, if you request the image in markdown, you cannot set width and height, so please use HTML format instead. + +> [!TIP] +> **Adjust the width and height of the Img to adjust the pet's movement area.** +> If you make the width long and the height short (width = 1000, height = 60), the pet will move horizontally for a long distance. +> Conversely, if you make the width short and the height long (width = 60, height = 1000), the pet will move vertically for a long distance. +> If the pet is not visible, please make the height of the img larger than the vertical length of the pet. + + + + + +```html + + + +``` + +If you don't enter any value for pet-id, the first pet will be responsed. + +You can check the available pet-ids in https://render.gitanimals.org/users/{username} to your GitHub username and requesting the API. +Enter the value corresponding to $.personas.[].id in the API response into pet-id. + +In line mode, the total number of contributions is displayed above the pet's level. If you don't want this, include contribution-view=false as a query parameter in your request. + +### Farm Mode + +Farm mode shows all your animals and additional information. + + + + + +```html + + + +``` + +## Tips + +### How to Acquire Pets + +Pets can be acquired in two ways: + +1. **Contributions 30 times** + When you accumulate 30 commits, a new pet will appear. At this point, all pets have different probabilities of appearing. + The maximum number of pets you can have is 30. If you have more than 30 pets, they will go into your inventory, and you can swap them with the pets displayed at any time. <- Under development +2. **Purchase Pets <- Under development** +You can buy pets sold by other users with commit points. +A certain amount of points will be given per commit. Alternatively, you can sell your own pets to earn commit points. + +### Total Contributions +Total contributions represent the sum of contributions accumulated after joining GitHub. +_New contributions may take up to 1 hour to be reflected._ + +### Available Pets + + +| name | ratio | Description | +|------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | + +## + +
+

If you have any ideas or discover a bug, please report it. +Contact : develxb@gmail.com

+ diff --git a/README.md b/README.md index 7d0d312..0d1806c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + +
+ ## @@ -102,56 +107,56 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created with `10MM` donations
Only buy in shop
10MM | +| name | ratio | Description | +|------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | ## From 2999ca6351f221e58f99f2376cb366132060885e Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 18 Apr 2024 20:40:50 +0900 Subject: [PATCH 075/161] =?UTF-8?q?docs:=20linemode=EC=9D=98=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=20height=EB=A5=BC=20120=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index 72bd46d..d219cb8 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -52,12 +52,12 @@ When using line mode, if you request the image in markdown, you cannot set width > If the pet is not visible, please make the height of the img larger than the vertical length of the pet. - + ```html - + ``` diff --git a/README.md b/README.md index 0d1806c..10f844c 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,12 @@ line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, widt - + ```html - + ``` From 7127b8078ea404700af6570aba46fe429eaa1181 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 19 Apr 2024 12:59:45 +0900 Subject: [PATCH 076/161] =?UTF-8?q?refactor:=20farms=20=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=20powered=20by=20...=20=EB=A5=BC=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/domain/FieldType.kt | 4 ++-- src/main/resources/persona/field/snowy-field.svg | 10 ++++------ src/main/resources/persona/field/white-field.svg | 10 ++++------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt index 5331d42..9962b5f 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt @@ -5,7 +5,7 @@ enum class FieldType { WHITE_FIELD { override fun loadComponent(name: String, commit: Long): String { return whiteFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) - .replace(COMMIT_FIX, commit.toSvg("commit", 85.0, 4.0)) + .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) } override fun fillBackground(): String = @@ -17,7 +17,7 @@ enum class FieldType { SNOWY_FIELD { override fun loadComponent(name: String, commit: Long): String { return snowyFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) - .replace(COMMIT_FIX, commit.toSvg("commit", 85.0, 4.0)) + .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) } override fun fillBackground(): String { diff --git a/src/main/resources/persona/field/snowy-field.svg b/src/main/resources/persona/field/snowy-field.svg index 2e510ff..4cf5285 100644 --- a/src/main/resources/persona/field/snowy-field.svg +++ b/src/main/resources/persona/field/snowy-field.svg @@ -2,11 +2,9 @@ *{username} - - -*{commit-count} + + + + *{commit-count} - - - diff --git a/src/main/resources/persona/field/white-field.svg b/src/main/resources/persona/field/white-field.svg index 2e510ff..4cf5285 100644 --- a/src/main/resources/persona/field/white-field.svg +++ b/src/main/resources/persona/field/white-field.svg @@ -2,11 +2,9 @@ *{username} - - -*{commit-count} + + + + *{commit-count} - - - From 55d60beb6ca927f53993327722a9275cf142864d Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 19 Apr 2024 13:11:51 +0900 Subject: [PATCH 077/161] =?UTF-8?q?fix:=20=EC=9C=A0=EC=A0=80=EC=9D=98=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=EC=97=90=20=EC=86=8C=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=EB=A5=BC=20=ED=8F=AC=ED=95=A8=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/FieldType.kt | 4 ++-- src/main/resources/persona/text/large/_a.svg | 4 ++-- src/main/resources/persona/text/large/_c.svg | 4 ++-- src/main/resources/persona/text/large/_e.svg | 4 ++-- src/main/resources/persona/text/large/_g.svg | 4 ++-- src/main/resources/persona/text/large/_m.svg | 4 ++-- src/main/resources/persona/text/large/_n.svg | 4 ++-- src/main/resources/persona/text/large/_o.svg | 4 ++-- src/main/resources/persona/text/large/_p.svg | 4 ++-- src/main/resources/persona/text/large/_q.svg | 4 ++-- src/main/resources/persona/text/large/_r.svg | 4 ++-- src/main/resources/persona/text/large/_s.svg | 4 ++-- src/main/resources/persona/text/large/_u.svg | 4 ++-- src/main/resources/persona/text/large/_v.svg | 4 ++-- src/main/resources/persona/text/large/_w.svg | 4 ++-- src/main/resources/persona/text/large/_x.svg | 4 ++-- src/main/resources/persona/text/large/_y.svg | 4 ++-- src/main/resources/persona/text/large/_z.svg | 4 ++-- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt index 9962b5f..34ea133 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt @@ -4,7 +4,7 @@ enum class FieldType { WHITE_FIELD { override fun loadComponent(name: String, commit: Long): String { - return whiteFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) + return whiteFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) } @@ -16,7 +16,7 @@ enum class FieldType { }, SNOWY_FIELD { override fun loadComponent(name: String, commit: Long): String { - return snowyFieldSvg.replace(NAME_FIX, name.uppercase().toSvg(0.0, 3.0)) + return snowyFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) } diff --git a/src/main/resources/persona/text/large/_a.svg b/src/main/resources/persona/text/large/_a.svg index 25e7bf1..f986e4f 100644 --- a/src/main/resources/persona/text/large/_a.svg +++ b/src/main/resources/persona/text/large/_a.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_c.svg b/src/main/resources/persona/text/large/_c.svg index b5b2d14..091e336 100644 --- a/src/main/resources/persona/text/large/_c.svg +++ b/src/main/resources/persona/text/large/_c.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_e.svg b/src/main/resources/persona/text/large/_e.svg index db9857e..ecc3f95 100644 --- a/src/main/resources/persona/text/large/_e.svg +++ b/src/main/resources/persona/text/large/_e.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_g.svg b/src/main/resources/persona/text/large/_g.svg index ba4fd41..1340cbe 100644 --- a/src/main/resources/persona/text/large/_g.svg +++ b/src/main/resources/persona/text/large/_g.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_m.svg b/src/main/resources/persona/text/large/_m.svg index 76d9299..aa44377 100644 --- a/src/main/resources/persona/text/large/_m.svg +++ b/src/main/resources/persona/text/large/_m.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_n.svg b/src/main/resources/persona/text/large/_n.svg index 0a97cc9..8ba5822 100644 --- a/src/main/resources/persona/text/large/_n.svg +++ b/src/main/resources/persona/text/large/_n.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_o.svg b/src/main/resources/persona/text/large/_o.svg index 7137daf..c280a1c 100644 --- a/src/main/resources/persona/text/large/_o.svg +++ b/src/main/resources/persona/text/large/_o.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_p.svg b/src/main/resources/persona/text/large/_p.svg index 32fbbd1..d0264cd 100644 --- a/src/main/resources/persona/text/large/_p.svg +++ b/src/main/resources/persona/text/large/_p.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_q.svg b/src/main/resources/persona/text/large/_q.svg index 0244334..1b2a381 100644 --- a/src/main/resources/persona/text/large/_q.svg +++ b/src/main/resources/persona/text/large/_q.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_r.svg b/src/main/resources/persona/text/large/_r.svg index cfd7922..037934e 100644 --- a/src/main/resources/persona/text/large/_r.svg +++ b/src/main/resources/persona/text/large/_r.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_s.svg b/src/main/resources/persona/text/large/_s.svg index 9a87de8..79d0bdf 100644 --- a/src/main/resources/persona/text/large/_s.svg +++ b/src/main/resources/persona/text/large/_s.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_u.svg b/src/main/resources/persona/text/large/_u.svg index 54d2991..041968d 100644 --- a/src/main/resources/persona/text/large/_u.svg +++ b/src/main/resources/persona/text/large/_u.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_v.svg b/src/main/resources/persona/text/large/_v.svg index 0a76a84..89095c3 100644 --- a/src/main/resources/persona/text/large/_v.svg +++ b/src/main/resources/persona/text/large/_v.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_w.svg b/src/main/resources/persona/text/large/_w.svg index 66be62e..52b9a2a 100644 --- a/src/main/resources/persona/text/large/_w.svg +++ b/src/main/resources/persona/text/large/_w.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_x.svg b/src/main/resources/persona/text/large/_x.svg index bb669d5..1e85f66 100644 --- a/src/main/resources/persona/text/large/_x.svg +++ b/src/main/resources/persona/text/large/_x.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_y.svg b/src/main/resources/persona/text/large/_y.svg index fcabaaf..5e0b0de 100644 --- a/src/main/resources/persona/text/large/_y.svg +++ b/src/main/resources/persona/text/large/_y.svg @@ -1,3 +1,3 @@ - + - + diff --git a/src/main/resources/persona/text/large/_z.svg b/src/main/resources/persona/text/large/_z.svg index ac607d9..7833aef 100644 --- a/src/main/resources/persona/text/large/_z.svg +++ b/src/main/resources/persona/text/large/_z.svg @@ -1,3 +1,3 @@ - + - + From baf029ca0adbb3ed7d0f70fd3605c2721dda5f4e Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 19 Apr 2024 13:27:36 +0900 Subject: [PATCH 078/161] =?UTF-8?q?refactor:=20=EC=BA=90=EB=A6=AD=ED=84=B0?= =?UTF-8?q?=EC=9D=98=20=EC=B5=9C=EB=8C=80=20=EB=86=92=EC=9D=B4=EB=A5=BC=20?= =?UTF-8?q?=EC=A4=84=EC=9D=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index e7730d4..fd9ef75 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1017,7 +1017,7 @@ enum class PersonaType(private val weight: Double) { duration: String, personaWidth: Long, ): StringBuilder { - var currentY = Random.nextInt(10, 90) + var currentY = Random.nextInt(30, 80) var currentX = Random.nextInt(10, 90) var currentAngle = (Random.nextDouble() * 10).toInt() var currentScale = Random.nextInt(0, 2) - 1 @@ -1037,7 +1037,7 @@ enum class PersonaType(private val weight: Double) { val beforeAnimationPercentage = animationPercentage animationPercentage += Random.nextInt(2, 6) val nextY = - Random.nextInt(max(10, min(79, currentY - speed)), min(80, currentY + speed)) + Random.nextInt(max(20, min(79, currentY - speed)), min(80, currentY + speed)) val nextX = Random.nextInt(max(10, min(79, currentX - speed)), min(80, currentX + speed)) val nextAngle = (atan2( From 6a02cf86fe8ac73cbbc9fa00b1ef3e89ebd8b2af Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 19 Apr 2024 18:32:38 +0900 Subject: [PATCH 079/161] =?UTF-8?q?refactor:=20i=20=EB=A5=BC=20-3=20?= =?UTF-8?q?=EC=9C=84=EB=A1=9C=20=EC=98=AC=EB=A6=B0=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/text/large/_i.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/persona/text/large/_i.svg b/src/main/resources/persona/text/large/_i.svg index 03a627a..9fcd33d 100644 --- a/src/main/resources/persona/text/large/_i.svg +++ b/src/main/resources/persona/text/large/_i.svg @@ -1,3 +1,3 @@ - + - + From 24042a52c2c50133f32334e4c3a6f7d633be714e Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 14:24:56 +0900 Subject: [PATCH 080/161] =?UTF-8?q?feat:=20gobling=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 ++ .../org/gitanimals/render/domain/Svgs.kt | 3 + src/main/resources/persona/animal/goblin.svg | 136 ++++++++ src/test/resources/persona/goose/test.svg | 293 +++++++----------- 4 files changed, 273 insertions(+), 177 deletions(-) create mode 100644 src/main/resources/persona/animal/goblin.svg diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index fd9ef75..d88c275 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -956,6 +956,24 @@ enum class PersonaType(private val weight: Double) { StringBuilder().moveRandomly("tenmm", id, 15, "180s", 5) .toString() }, + + GOBLIN(0.06) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return goblinSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6.5 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("goblin", id, 15, "180s", 5) + .toString() + } ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 4db4360..02b0a82 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -150,6 +150,9 @@ val flamingoSvg: String = ClassPathResource("persona/animal/flamingo.svg") val tenmmSvg: String = ClassPathResource("persona/animal/tenmm.svg") .getContentAsString(Charset.defaultCharset()) +val goblinSvg: String = ClassPathResource("persona/animal/goblin.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg new file mode 100644 index 0000000..c59f5c4 --- /dev/null +++ b/src/main/resources/persona/animal/goblin.svg @@ -0,0 +1,136 @@ + + + + + + + *{contribution} + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 98d6b28..fda8515 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,198 +1,137 @@ - + + + + + + *{contribution} - - + + - - - + *{level} + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + From 4eac4d05d268bbe18f8c4494cd945e42fde22526 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 14:27:46 +0900 Subject: [PATCH 081/161] =?UTF-8?q?docs:=20=EB=AC=B8=EC=84=9C=EC=97=90=20?= =?UTF-8?q?=EA=B3=A0=EB=B8=94=EB=A6=B0=20=EC=BA=90=EB=A6=AD=ED=84=B0?= =?UTF-8?q?=EC=9D=98=20=EB=93=B1=EC=9E=A5=20ratio=EB=A5=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +- docs/goblin.svg | 169 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 docs/goblin.svg diff --git a/README.md b/README.md index 10f844c..9985069 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,8 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. | slime_green | 0.1 | | | slime_blue | 0.1 | | | flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | ## diff --git a/docs/goblin.svg b/docs/goblin.svg new file mode 100644 index 0000000..fa78ca6 --- /dev/null +++ b/docs/goblin.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 59edfa0471d8148a146bbc39b2d83344c5f885a5 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sat, 20 Apr 2024 14:31:06 +0900 Subject: [PATCH 082/161] =?UTF-8?q?docs:=20lines=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=20pet-id=20=EC=98=88=EC=8B=9C=EB=A5=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9985069..ac37db2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ line modeλ₯Ό μ‚¬μš©ν• λ•Œ, markdown λ°©μ‹μœΌλ‘œ 이미지λ₯Ό μš”μ²­ν•˜λ©΄, widt ```html - + ``` From 2baf850324a84d5601a9a5fbf39edacaa9c8a3d2 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 14:37:32 +0900 Subject: [PATCH 083/161] =?UTF-8?q?refactor:=20goblin=EC=9D=98=20=ED=81=AC?= =?UTF-8?q?=EA=B8=B0=EB=A5=BC=20=EC=A4=84=EC=9D=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/animal/goblin.svg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index c59f5c4..1911f32 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -59,7 +59,7 @@ } - - + @@ -81,7 +81,7 @@ *{level} - + @@ -89,15 +89,15 @@ - + - + - + @@ -112,7 +112,7 @@ fill-opacity="0.1"/> - + From c3c179e80ea17c34b0fa4390017439d564fa770f Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 14:44:28 +0900 Subject: [PATCH 084/161] =?UTF-8?q?refactor:=20goblin=EC=9D=98=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20=EC=9E=AC=EC=A1=B0=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/animal/goblin.svg | 20 ++++++++++---------- src/test/resources/persona/goose/test.html | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index 1911f32..1f5525c 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -3,37 +3,37 @@ @keyframes goblin-*{id}-head-move { 0% { - transform: translate(0px, 4px); + transform: translate(0px, -6px); } 50% { - transform: translate(0px, 5px); + transform: translate(0px, -5px); } 100% { - transform: translate(0px, 4px); + transform: translate(0px, -6px); } } @keyframes goblin-*{id}-leg-1-move { 0% { - transform: translate(1px, 15px); + transform: translate(1px, 5px); } 50% { - transform: translate(1px, 14.5px); + transform: translate(1px, 4.5px); } 100% { - transform: translate(1px, 15px); + transform: translate(1px, 5px); } } @keyframes goblin-*{id}-leg-2-move { 0% { - transform: translate(4px, 14.5px); + transform: translate(4px, 4.5px); } 50% { - transform: translate(4px, 15px); + transform: translate(4px, 5px); } 100% { - transform: translate(4px, 14.5px); + transform: translate(4px, 4.5px); } } @@ -59,7 +59,7 @@ } - - + From 29f92fa03e1f7aecae1bb3c2ca1f03cd5d3c8d5e Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sat, 20 Apr 2024 14:48:41 +0900 Subject: [PATCH 085/161] =?UTF-8?q?docs:=20=EB=AC=B8=EC=84=9C=EC=9D=98=20?= =?UTF-8?q?=EB=A1=9C=EA=B3=A0=20=EB=8C=80=ED=91=9C=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20=EA=B3=A0=EB=B8=94=EB=A6=B0=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac37db2..9db1363 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 841848957d8b557bce63bf3e28b17d9ded908993 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 14:52:07 +0900 Subject: [PATCH 086/161] =?UTF-8?q?docs:=20ENGLISH=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=99=80=20=ED=95=9C=EA=B5=AD=EC=96=B4=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=9D=98=20=EC=8B=B1=ED=81=AC=EB=A5=BC=20=EB=A7=9E=EC=B6=98?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index d219cb8..05910ae 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -1,5 +1,5 @@
@@ -9,7 +9,7 @@
- + ⭐️ Please press the star! It greatly helps development! ⭐️
@@ -152,6 +152,7 @@ _New contributions may take up to 1 hour to be reflected._ | slime_blue | 0.1 | | | flamingo
| 0.08 | | | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | ## From 9f94868348e5d32ffdbe8a66cce10bd94a6413cf Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 19:52:41 +0900 Subject: [PATCH 087/161] =?UTF-8?q?feat:=20goblin=20bag=20=ED=8E=AB?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 20 ++- .../org/gitanimals/render/domain/Svgs.kt | 3 + .../resources/persona/animal/goblin-bag.svg | 153 ++++++++++++++++++ 3 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/persona/animal/goblin-bag.svg diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index d88c275..57e64e5 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -973,7 +973,25 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String = StringBuilder().moveRandomly("goblin", id, 15, "180s", 5) .toString() - } + }, + + GOBLIN_BAG(0.03) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return goblinBagSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6.5 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("goblin-bag", id, 15, "180s", 5) + .toString() + }, ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 02b0a82..d7118b0 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -153,6 +153,9 @@ val tenmmSvg: String = ClassPathResource("persona/animal/tenmm.svg") val goblinSvg: String = ClassPathResource("persona/animal/goblin.svg") .getContentAsString(Charset.defaultCharset()) +val goblinBagSvg: String = ClassPathResource("persona/animal/goblin-bag.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg new file mode 100644 index 0000000..26ae461 --- /dev/null +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -0,0 +1,153 @@ + + + + + + + *{contribution} + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cb816a967848c278c61b12373e29d64b4d9a9e2a Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 19:56:12 +0900 Subject: [PATCH 088/161] =?UTF-8?q?refactor:=20gobling-bag=20=EC=BA=90?= =?UTF-8?q?=EB=A6=AD=ED=84=B0=EA=B0=80=20=EC=9B=80=EC=A7=81=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=B2=84=EA=B7=B8=EB=A5=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/goblin-bag.svg | 186 ++++++++++++++++++ .../resources/persona/animal/goblin-bag.svg | 16 +- 2 files changed, 194 insertions(+), 8 deletions(-) create mode 100644 docs/goblin-bag.svg diff --git a/docs/goblin-bag.svg b/docs/goblin-bag.svg new file mode 100644 index 0000000..2ef822e --- /dev/null +++ b/docs/goblin-bag.svg @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg index 26ae461..b252f04 100644 --- a/src/main/resources/persona/animal/goblin-bag.svg +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -37,28 +37,28 @@ } } - #goblin-*{id}-head { + #goblin-bag-*{id}-head { animation-name:goblin-*{id}-head-move; animation-duration:1s; animation-iteration-count:infinite; animation-timing-function: ease-in-out; } - #goblin-*{id}-leg-1 { + #goblin-bag-*{id}-leg-1 { animation-name:goblin-*{id}-leg-1-move; animation-duration:1s; animation-iteration-count:infinite; animation-timing-function: ease-in-out; } - #goblin-*{id}-leg-2 { + #goblin-bag-*{id}-leg-2 { animation-name:goblin-*{id}-leg-2-move; animation-duration:1s; animation-iteration-count:infinite; animation-timing-function: ease-in-out; } - + - + - + - + @@ -129,7 +129,7 @@ fill-opacity="0.1"/> - + From 6a91293e52ebf92c9f0b1f50f83ca54c1a5efd27 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 19:58:28 +0900 Subject: [PATCH 089/161] =?UTF-8?q?docs:=20goblin-bag=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 139 ++++++++++++++++++++++++-------------------- README.md | 103 ++++++++++++++++---------------- docs/goblin-bag.svg | 2 +- 3 files changed, 128 insertions(+), 116 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index 05910ae..341d5e6 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -42,14 +42,19 @@ You can easily apply by copying the following link to your GitHub Readme. ### Line Mode -Line mode allows you to specify one of your pets to move within the specified width and height range. -When using line mode, if you request the image in markdown, you cannot set width and height, so please use HTML format instead. +Line mode allows you to specify one of your pets to move within the specified width and height +range. +When using line mode, if you request the image in markdown, you cannot set width and height, so +please use HTML format instead. > [!TIP] > **Adjust the width and height of the Img to adjust the pet's movement area.** -> If you make the width long and the height short (width = 1000, height = 60), the pet will move horizontally for a long distance. -> Conversely, if you make the width short and the height long (width = 60, height = 1000), the pet will move vertically for a long distance. -> If the pet is not visible, please make the height of the img larger than the vertical length of the pet. +> If you make the width long and the height short (width = 1000, height = 60), the pet will move +> horizontally for a long distance. +> Conversely, if you make the width short and the height long (width = 60, height = 1000), the pet +> will move vertically for a long distance. +> If the pet is not visible, please make the height of the img larger than the vertical length of +> the pet. @@ -63,10 +68,12 @@ When using line mode, if you request the image in markdown, you cannot set width If you don't enter any value for pet-id, the first pet will be responsed. -You can check the available pet-ids in https://render.gitanimals.org/users/{username} to your GitHub username and requesting the API. +You can check the available pet-ids in https://render.gitanimals.org/users/{username} to your GitHub +username and requesting the API. Enter the value corresponding to $.personas.[].id in the API response into pet-id. -In line mode, the total number of contributions is displayed above the pet's level. If you don't want this, include contribution-view=false as a query parameter in your request. +In line mode, the total number of contributions is displayed above the pet's level. If you don't +want this, include contribution-view=false as a query parameter in your request. ### Farm Mode @@ -89,70 +96,74 @@ Farm mode shows all your animals and additional information. Pets can be acquired in two ways: 1. **Contributions 30 times** - When you accumulate 30 commits, a new pet will appear. At this point, all pets have different probabilities of appearing. - The maximum number of pets you can have is 30. If you have more than 30 pets, they will go into your inventory, and you can swap them with the pets displayed at any time. <- Under development + When you accumulate 30 commits, a new pet will appear. At this point, all pets have different + probabilities of appearing. + The maximum number of pets you can have is 30. If you have more than 30 pets, they will go into + your inventory, and you can swap them with the pets displayed at any time. <- Under development 2. **Purchase Pets <- Under development** -You can buy pets sold by other users with commit points. -A certain amount of points will be given per commit. Alternatively, you can sell your own pets to earn commit points. + You can buy pets sold by other users with commit points. + A certain amount of points will be given per commit. Alternatively, you can sell your own pets to + earn commit points. ### Total Contributions + Total contributions represent the sum of contributions accumulated after joining GitHub. -_New contributions may take up to 1 hour to be reflected._ +_New contributions may take up to 1 hour to be reflected._ ### Available Pets - -| name | ratio | Description | -|------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | +| name | ratio | Description | +|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | ## diff --git a/README.md b/README.md index 9db1363..238248f 100644 --- a/README.md +++ b/README.md @@ -107,57 +107,58 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | +| name | ratio | Description | +|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | ## diff --git a/docs/goblin-bag.svg b/docs/goblin-bag.svg index 2ef822e..1084d3c 100644 --- a/docs/goblin-bag.svg +++ b/docs/goblin-bag.svg @@ -56,7 +56,7 @@ animation-timing-function: ease-in-out; } - + From 321c90afd412a554119d5127ad5ada39ec137ec0 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sat, 20 Apr 2024 20:03:43 +0900 Subject: [PATCH 090/161] =?UTF-8?q?docs:=20=EB=8C=80=ED=91=9C=20=EC=BA=90?= =?UTF-8?q?=EB=A6=AD=ED=84=B0=EB=A5=BC=20goblin-bag=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 238248f..6adbcb6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 0d67058e19b4b720897902b749bee70bda3b6d6a Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 23:31:49 +0900 Subject: [PATCH 091/161] =?UTF-8?q?feat:=20BBIBBI=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 105 ++--- docs/bbibbi.svg | 302 ++++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 18 + .../org/gitanimals/render/domain/Svgs.kt | 4 + src/main/resources/persona/animal/bbibbi.svg | 268 ++++++++++++ src/test/resources/persona/goose/test.svg | 385 +++++++++++++----- 6 files changed, 921 insertions(+), 161 deletions(-) create mode 100644 docs/bbibbi.svg create mode 100644 src/main/resources/persona/animal/bbibbi.svg diff --git a/README.md b/README.md index 6adbcb6..bd8ad06 100644 --- a/README.md +++ b/README.md @@ -107,58 +107,59 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | +| name | ratio | Description | +|------------------------------------------------------------------------------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bbibbi
| 0.00 | Character created by `BBIBBI` donations
Only buy in shop
BBIBBI | ## diff --git a/docs/bbibbi.svg b/docs/bbibbi.svg new file mode 100644 index 0000000..578544c --- /dev/null +++ b/docs/bbibbi.svg @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 57e64e5..7225366 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -992,6 +992,24 @@ enum class PersonaType(private val weight: Double) { StringBuilder().moveRandomly("goblin-bag", id, 15, "180s", 5) .toString() }, + + BBIBBI(0.000) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return bbibbiSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-1.5 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("bbibbi", id, 15, "180s", 5) + .toString() + } ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index d7118b0..790570b 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -156,6 +156,10 @@ val goblinSvg: String = ClassPathResource("persona/animal/goblin.svg") val goblinBagSvg: String = ClassPathResource("persona/animal/goblin-bag.svg") .getContentAsString(Charset.defaultCharset()) +val bbibbiSvg: String = ClassPathResource("persona/animal/bbibbi.svg") + .getContentAsString(Charset.defaultCharset()) + + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/bbibbi.svg b/src/main/resources/persona/animal/bbibbi.svg new file mode 100644 index 0000000..f3d9dee --- /dev/null +++ b/src/main/resources/persona/animal/bbibbi.svg @@ -0,0 +1,268 @@ + + + + + + + *{contribution} + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index fda8515..93c7b06 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,137 +1,304 @@ - - + + + + + + + + + + - + - *{level} + + - - - - - - + + + + + + - - + + + + + + + - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + From fe87b064b28ab9a3069cb9c8690511516f31904a Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 23:32:34 +0900 Subject: [PATCH 092/161] =?UTF-8?q?docs:=20ENGLISH=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=97=90=20BBIBBI=20=EC=BA=90=EB=A6=AD=ED=84=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ENGLISH.md b/ENGLISH.md index 341d5e6..2d5881b 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -164,6 +164,7 @@ _New contributions may take up to 1 hour to be reflected._ | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | | goblin-bag
| 0.03 | | +| bbibbi
| 0.00 | Character created by `BBIBBI` donations
Only buy in shop
BBIBBI | ## From ecf5e93e7f7d3137a2318929b3997aa0b281474d Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 20 Apr 2024 23:44:13 +0900 Subject: [PATCH 093/161] =?UTF-8?q?refactor:=20BBIBBI=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=EA=B0=80=20=EC=9B=80=EC=A7=81=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=EC=98=81=EC=97=AD=EC=9D=84=20=EC=9C=84=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=EC=8B=9C=ED=82=A8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/animal/bbibbi.svg | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/resources/persona/animal/bbibbi.svg b/src/main/resources/persona/animal/bbibbi.svg index f3d9dee..fdb20eb 100644 --- a/src/main/resources/persona/animal/bbibbi.svg +++ b/src/main/resources/persona/animal/bbibbi.svg @@ -3,37 +3,37 @@ @keyframes bbibbi-*{id}-body-move { 0% { - transform: translate(0px, 0px); + transform: translate(0px, -10px); } 50% { - transform: translate(0.4px, 0px); + transform: translate(0.4px, -10px); } 100% { - transform: translate(0px, 0px); + transform: translate(0px, -10px); } } @keyframes bbibbi-*{id}-leg-move-1 { 0% { - transform: translate(5px, 15px); + transform: translate(5px, 5px); } 50% { - transform: translate(5px, 14px) rotate(10deg); + transform: translate(5px, 4px) rotate(10deg); } 100% { - transform: translate(5px, 15px); + transform: translate(5px, 5px); } } @keyframes bbibbi-*{id}-leg-move-2 { 0% { - transform: translate(10px, 15px); + transform: translate(10px, 5px); } 50% { - transform: translate(10px, 15px) rotate(-10deg); + transform: translate(10px, 5px) rotate(-10deg); } 100% { - transform: translate(10px, 15px); + transform: translate(10px, 5px); } } @@ -59,7 +59,7 @@ } - - + @@ -81,7 +81,7 @@ *{level} - + @@ -89,7 +89,7 @@ - + @@ -98,7 +98,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -251,7 +251,7 @@ - + From 43c95d8087c1316fcaeb341a18bb1b69267955c0 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Sat, 20 Apr 2024 23:58:19 +0900 Subject: [PATCH 094/161] =?UTF-8?q?docs:=20=EC=82=90=EC=82=90=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd8ad06..8c62000 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ _μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”. | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | | goblin-bag
| 0.03 | | -| bbibbi
| 0.00 | Character created by `BBIBBI` donations
Only buy in shop
BBIBBI | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | ## From 66d80c70a035c7144ac344bcb421d00321a10b01 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 21 Apr 2024 00:30:18 +0900 Subject: [PATCH 095/161] =?UTF-8?q?docs:=20=EC=98=A4=ED=83=80=EB=A5=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c62000..bb1b61f 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ farm modeλŠ” κ°–κ³ μžˆλŠ” λͺ¨λ“  동물과 좔가적인 정보λ₯Ό λ³΄μ—¬μ€˜μš”. ### Total contributions Total contribtuions λŠ” κΉƒν—ˆλΈŒμ— κ°€μž… ν›„ μ§‘κ³„λœ Contribtuions 의 총합 μ΄μ—μš”. -_μƒˆλ‘œμš΄ contribtuion은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ +_μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ From 709fde72cf0884a70e1792502172ea8b6a0a4899 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 21 Apr 2024 14:51:59 +0900 Subject: [PATCH 096/161] =?UTF-8?q?refactor:=20SagaHandler=EB=A5=BC=20saga?= =?UTF-8?q?=20=EB=A0=88=EC=9D=B4=EC=96=B4=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=EC=8B=9C=ED=82=A8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{app/SagaHandlers.kt => saga/VisitedSagaHandlers.kt} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename src/main/kotlin/org/gitanimals/render/{app/SagaHandlers.kt => saga/VisitedSagaHandlers.kt} (92%) diff --git a/src/main/kotlin/org/gitanimals/render/app/SagaHandlers.kt b/src/main/kotlin/org/gitanimals/render/saga/VisitedSagaHandlers.kt similarity index 92% rename from src/main/kotlin/org/gitanimals/render/app/SagaHandlers.kt rename to src/main/kotlin/org/gitanimals/render/saga/VisitedSagaHandlers.kt index 9d1abe3..4b78c15 100644 --- a/src/main/kotlin/org/gitanimals/render/app/SagaHandlers.kt +++ b/src/main/kotlin/org/gitanimals/render/saga/VisitedSagaHandlers.kt @@ -1,5 +1,6 @@ -package org.gitanimals.render.app +package org.gitanimals.render.saga +import org.gitanimals.render.app.ContributionApi import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.event.Visited import org.rooftop.netx.api.* @@ -8,7 +9,7 @@ import java.time.ZoneId import java.time.ZonedDateTime @SagaHandler -class SagaHandlers( +class VisitedSagaHandlers( private val userService: UserService, private val contributionApi: ContributionApi, ) { From ba3c8860f8ec31ba3e3840a4d54f5782aa7ca3f6 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 21 Apr 2024 15:19:12 +0900 Subject: [PATCH 097/161] =?UTF-8?q?feat:=20Coupon=20Handler=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/Idempotency.kt | 14 ++++++ .../render/domain/IdempotencyRepository.kt | 5 ++ .../org/gitanimals/render/domain/User.kt | 48 +++++++++++++------ .../gitanimals/render/domain/UserService.kt | 17 +++++++ .../render/saga/UsedCouponSagaHandlers.kt | 21 ++++++++ .../render/saga/event/CouponUsed.kt | 7 +++ .../org/gitanimals/render/domain/UserTest.kt | 40 +++++++++++++--- src/test/resources/application.properties | 25 +++++----- 8 files changed, 146 insertions(+), 31 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/domain/Idempotency.kt create mode 100644 src/main/kotlin/org/gitanimals/render/domain/IdempotencyRepository.kt create mode 100644 src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt create mode 100644 src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt diff --git a/src/main/kotlin/org/gitanimals/render/domain/Idempotency.kt b/src/main/kotlin/org/gitanimals/render/domain/Idempotency.kt new file mode 100644 index 0000000..d3e23d6 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/Idempotency.kt @@ -0,0 +1,14 @@ +package org.gitanimals.render.domain + +import jakarta.persistence.Column +import jakarta.persistence.Entity +import jakarta.persistence.Id +import jakarta.persistence.Table + +@Entity(name="idempotency") +@Table(name="idempotency") +class Idempotency( + @Id + @Column(name="id") + val id: String +) diff --git a/src/main/kotlin/org/gitanimals/render/domain/IdempotencyRepository.kt b/src/main/kotlin/org/gitanimals/render/domain/IdempotencyRepository.kt new file mode 100644 index 0000000..dd4ac00 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/IdempotencyRepository.kt @@ -0,0 +1,5 @@ +package org.gitanimals.render.domain + +import org.springframework.data.jpa.repository.JpaRepository + +interface IdempotencyRepository : JpaRepository diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 3f42d21..962e316 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -98,22 +98,37 @@ class User( } lastPersonaGivePoint %= FOR_NEW_PERSONA_COUNT.toInt() - val newPersona = when (personas.size >= MAX_PERSONA_COUNT) { - true -> Persona( - type = PersonaType.random(), - level = Level(0), - visible = false, - user = this - ) + val newPersona = getRandomPersona() + personas.add(newPersona) + } - false -> Persona( - type = PersonaType.random(), - level = Level(0), - visible = true, - user = this - ) + fun giveBonusPersona(persona: String) { + val personaType = PersonaType.valueOf(persona.uppercase()) + + require(bonusPersonas.contains(personaType)) { + "Cannot select as a bonus persona." } - personas.add(newPersona) + + val persona = getPersona(personaType) + personas.add(persona) + } + + private fun getRandomPersona() = getPersona(PersonaType.random()) + + private fun getPersona(personaType: PersonaType) = when (personas.size >= MAX_PERSONA_COUNT) { + true -> Persona( + type = personaType, + level = Level(0), + visible = false, + user = this + ) + + false -> Persona( + type = personaType, + level = Level(0), + visible = true, + user = this + ) } fun increaseVisitCount() { @@ -218,6 +233,11 @@ class User( private const val FOR_INIT_PERSONA_COUNT = 100L private val nameConvention = Regex("[^a-zA-Z0-9-]") + private val bonusPersonas = listOf( + PersonaType.PENGUIN, PersonaType.GOOSE, PersonaType.LITTLE_CHICK, + PersonaType.SLIME_RED, PersonaType.SLIME_BLUE, PersonaType.SLIME_GREEN, + PersonaType.PIG, + ) fun newUser(name: String, contributions: Map): User { require(!nameConvention.containsMatchIn(name)) { diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 006c315..effa3a6 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.domain +import org.springframework.data.repository.findByIdOrNull import org.springframework.orm.ObjectOptimisticLockingFailureException import org.springframework.retry.annotation.Retryable import org.springframework.stereotype.Service @@ -9,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional @Transactional(readOnly = true) class UserService( private val userRepository: UserRepository, + private val idempotencyRepository: IdempotencyRepository, ) { fun existsByName(name: String): Boolean = userRepository.existsByName(name) @@ -44,4 +46,19 @@ class UserService( @Transactional fun createNewUser(name: String, contributions: Map): User = userRepository.save(User.newUser(name, contributions)) + + @Transactional + fun giveBonusPersona(id: Long, persona: String) { + val idempotencyId = "$id:bonus" + val idempotency = idempotencyRepository.findByIdOrNull(idempotencyId) + + require(idempotency == null) { "Got bonus pet already." } + + val user = userRepository.findByIdOrNull(id) + ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"") + + user.giveBonusPersona(persona) + + idempotencyRepository.save(Idempotency(idempotencyId)) + } } diff --git a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt new file mode 100644 index 0000000..fb91e16 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt @@ -0,0 +1,21 @@ +package org.gitanimals.render.saga + +import org.gitanimals.render.domain.UserService +import org.gitanimals.render.saga.event.CouponUsed +import org.rooftop.netx.api.SagaCommitEvent +import org.rooftop.netx.api.SagaCommitListener +import org.rooftop.netx.meta.SagaHandler + +@SagaHandler +class UsedCouponSagaHandlers( + private val userService: UserService, +) { + + @SagaCommitListener(event = CouponUsed::class) + fun handleCouponUsedCommitEvent(sagaCommitEvent: SagaCommitEvent) { + val couponUsed = sagaCommitEvent.decodeEvent(CouponUsed::class) + sagaCommitEvent.setNextEvent(couponUsed) + + userService.giveBonusPersona(couponUsed.userId, couponUsed.dynamic) + } +} diff --git a/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt b/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt new file mode 100644 index 0000000..377dfa4 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt @@ -0,0 +1,7 @@ +package org.gitanimals.render.saga.event + +data class CouponUsed( + val userId: Long, + val code: String, + val dynamic: String, +) diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt b/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt index 81e32d0..373743f 100644 --- a/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt +++ b/src/test/kotlin/org/gitanimals/render/domain/UserTest.kt @@ -5,6 +5,7 @@ import io.kotest.assertions.throwables.shouldThrowWithMessage import io.kotest.core.annotation.DisplayName import io.kotest.core.spec.style.DescribeSpec import io.kotest.matchers.equals.shouldBeEqual +import io.kotest.matchers.nulls.shouldNotBeNull import org.gitanimals.render.domain.value.Contribution import java.time.Instant import java.time.temporal.ChronoUnit @@ -65,14 +66,41 @@ internal class UserTest : DescribeSpec({ } describe("giveNewPersona λ©”μ†Œλ“œλŠ”") { - val user = User.newUser("new-user", mutableMapOf()) - context("펫이 30λ§ˆλ¦¬κ°€ λ„˜μ„κ²½μš°, visible false의 pet을 μƒμ„±ν•œλ‹€.") { - repeat(99) { - user.updateContribution(30 * (it + 1)) - user.giveNewPersona() + context("펫이 30λ§ˆλ¦¬κ°€ λ„˜μ„κ²½μš°,") { + val user = User.newUser("new-user", mutableMapOf()) + + it("visible false의 pet을 μƒμ„±ν•œλ‹€.") { + repeat(99) { + user.updateContribution(30 * (it + 1)) + user.giveNewPersona() + } + + user.personas.count { !it.visible } shouldBeEqual 70 } + } + } + + describe("giveBonusPersona λ©”μ†Œλ“œλŠ”") { + context("Bonus pet λͺ©λ‘μ— λ“±λ‘λœ pet의 이름이 μ£Όμ–΄μ§ˆ 경우,") { + val user = User.newUser("new-user", mutableMapOf()) + val persona = "PENGUIN" + + it("μƒˆλ‘œμš΄ νŽ«μ„ μ§€κΈ‰ν•œλ‹€.") { + user.giveBonusPersona(persona) - user.personas.count { !it.visible } shouldBeEqual 70 + user.personas.find { it.type == PersonaType.PENGUIN }.shouldNotBeNull() + } + } + + context("Bonus pet λͺ©λ‘μ— λ“±λ‘λ˜μ§€ μ•Šμ€ pet의 이름이 μ£Όμ–΄μ§ˆ 경우,") { + val user = User.newUser("new-user", mutableMapOf()) + val persona = "GOBLIN_BAG" + + it("μ˜ˆμ™Έλ₯Ό λ˜μ§„λ‹€.") { + shouldThrowWithMessage("Cannot select as a bonus persona.") { + user.giveBonusPersona(persona) + } + } } } }) { diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index f509631..ee33bc9 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,16 +1,19 @@ -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.url=jdbc:h2:mem:test;MODE=MySQL -spring.jpa.hibernated.ddl-auto=create -spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect -spring.datasource.hikari.maximum-pool-size=4 -spring.datasource.hikari.pool-name=H2_TEST_POOL +spring.datasource.driver-class-name = org.h2.Driver +spring.datasource.url = jdbc:h2:mem:test;MODE=MySQL;DATABASE_TO_LOWER=TRUE + +spring.jpa.hibernated.ddl-auto = create-drop +spring.jpa.database-platform = org.hibernate.dialect.H2Dialect + +spring.datasource.hikari.maximum-pool-size = 4 +spring.datasource.hikari.pool-name = H2_TEST_POOL ### FOR DEBUGGING ### -logging.level.org.hibernate.SQL=debug -logging.level.org.hibernate.type.descriptor.sql=trace -spring.jpa.properties.hibernate.format_sql=true -spring.jpa.properties.hibernate.highlight_sql=true -spring.jpa.properties.hibernate.use_sql_comments=true +logging.level.org.hibernate.SQL = debug +logging.level.org.hibernate.type.descriptor.sql = trace + +spring.jpa.properties.hibernate.format_sql = true +spring.jpa.properties.hibernate.highlight_sql = true +spring.jpa.properties.hibernate.use_sql_comments = true ### NETX ### netx.mode=redis From f4ae6314387d34ef5500d3a6a626fd6d089eaf7a Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 21 Apr 2024 15:20:49 +0900 Subject: [PATCH 098/161] =?UTF-8?q?fix:=20Coupon=20SagaHandler=EA=B0=80=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EC=B2=98=EB=A6=AC=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20code=EB=A5=BC=20=EB=B0=9B=EC=9C=BC?= =?UTF-8?q?=EB=A9=B4,=20=EC=A1=B0=EC=9A=A9=ED=9E=88=20=EC=A2=85=EB=A3=8C?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/saga/UsedCouponSagaHandlers.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt index fb91e16..1c5eafd 100644 --- a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt +++ b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt @@ -14,6 +14,9 @@ class UsedCouponSagaHandlers( @SagaCommitListener(event = CouponUsed::class) fun handleCouponUsedCommitEvent(sagaCommitEvent: SagaCommitEvent) { val couponUsed = sagaCommitEvent.decodeEvent(CouponUsed::class) + if (couponUsed.code != "NEW_USER_BONUS_PET") { + return + } sagaCommitEvent.setNextEvent(couponUsed) userService.giveBonusPersona(couponUsed.userId, couponUsed.dynamic) From 26ee3e647dd96169ad55895dc0e55a7707d12f52 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 21 Apr 2024 22:34:28 +0900 Subject: [PATCH 099/161] =?UTF-8?q?feat:=20Persona=EC=9D=98=20visible?= =?UTF-8?q?=EC=83=81=ED=83=9C=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8A=94=20=EA=B8=B0=EB=8A=A5=EC=9D=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/app/IdentityApi.kt | 13 +++++++++++ .../org/gitanimals/render/app/UserFacade.kt | 18 +++++++++++++++ .../render/controller/PersonaController.kt | 18 +++++++++++---- .../org/gitanimals/render/domain/Persona.kt | 2 +- .../org/gitanimals/render/domain/User.kt | 13 +++++++++++ .../gitanimals/render/domain/UserService.kt | 17 ++++++++++++-- .../domain/request/PersonaChangeRequest.kt | 6 +++++ .../render/infra/RestIdentityApi.kt | 22 +++++++++++++++++++ 8 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/app/IdentityApi.kt create mode 100644 src/main/kotlin/org/gitanimals/render/app/UserFacade.kt create mode 100644 src/main/kotlin/org/gitanimals/render/domain/request/PersonaChangeRequest.kt create mode 100644 src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt diff --git a/src/main/kotlin/org/gitanimals/render/app/IdentityApi.kt b/src/main/kotlin/org/gitanimals/render/app/IdentityApi.kt new file mode 100644 index 0000000..d6fa94a --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/app/IdentityApi.kt @@ -0,0 +1,13 @@ +package org.gitanimals.render.app + +fun interface IdentityApi { + + fun getUserByToken(token: String): UserResponse + + data class UserResponse( + val id: String, + val username: String, + val points: String, + val profileImage: String, + ) +} diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt new file mode 100644 index 0000000..c12b82e --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -0,0 +1,18 @@ +package org.gitanimals.render.app + +import org.gitanimals.render.domain.UserService +import org.gitanimals.render.domain.request.PersonaChangeRequest +import org.springframework.stereotype.Service + +@Service +class UserFacade( + private val userService: UserService, + private val identityApi: IdentityApi, +) { + + fun changePersona(token: String, personChangeRequest: PersonaChangeRequest) { + val user = identityApi.getUserByToken(token) + + userService.changePersona(user.id.toLong(), personChangeRequest) + } +} diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 2439788..ef297f2 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -1,18 +1,28 @@ package org.gitanimals.render.controller +import org.gitanimals.render.app.UserFacade import org.gitanimals.render.controller.response.UserResponse import org.gitanimals.render.domain.UserService -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RestController +import org.gitanimals.render.domain.request.PersonaChangeRequest +import org.springframework.http.HttpHeaders +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.* @RestController class PersonaController( - private val userService: UserService + private val userService: UserService, + private val userFacade: UserFacade, ) { @GetMapping("/users/{username}") fun getUserByName(@PathVariable("username") username: String): UserResponse { return UserResponse.from(userService.getUserByName(username)) } + + @PatchMapping("/personas") + @ResponseStatus(HttpStatus.OK) + fun changePersona( + @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, + @RequestBody personaChangeRequest: PersonaChangeRequest, + ) = userFacade.changePersona(token, personaChangeRequest) } diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 5ddad62..294f294 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -20,7 +20,7 @@ class Persona( val level: Level, @Column(name = "visible", nullable = false) - val visible: Boolean, + var visible: Boolean, @JsonIgnore @JoinColumn(name = "user_id") diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 962e316..d05a87b 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -62,6 +62,19 @@ class User( ) } + fun changePersonaVisible(personaId: Long, visible: Boolean) { + val persona = personas.find { it.id == personaId } + ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") + + val visiblePersonas = personas.filter { it.visible } + + require(visiblePersonas.size < MAX_PERSONA_COUNT) { + "Persona count must be under \"$MAX_PERSONA_COUNT\" but, current persona count is \"${visiblePersonas.size}\"" + } + + persona.visible = visible + } + fun updateContribution(contribution: Int) { val currentYear = ZonedDateTime.now(ZoneId.of("UTC")).year val currentYearContribution = diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index effa3a6..55b89b2 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.domain +import org.gitanimals.render.domain.request.PersonaChangeRequest import org.springframework.data.repository.findByIdOrNull import org.springframework.orm.ObjectOptimisticLockingFailureException import org.springframework.retry.annotation.Retryable @@ -54,11 +55,23 @@ class UserService( require(idempotency == null) { "Got bonus pet already." } - val user = userRepository.findByIdOrNull(id) - ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"") + val user = getUserById(id) user.giveBonusPersona(persona) idempotencyRepository.save(Idempotency(idempotencyId)) } + + @Transactional + fun changePersona(id: Long, personChangeRequest: PersonaChangeRequest) { + val user = getUserById(id) + + user.changePersonaVisible( + personChangeRequest.personaId.toLong(), + personChangeRequest.visible + ) + } + + private fun getUserById(id: Long) = (userRepository.findByIdOrNull(id) + ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"")) } diff --git a/src/main/kotlin/org/gitanimals/render/domain/request/PersonaChangeRequest.kt b/src/main/kotlin/org/gitanimals/render/domain/request/PersonaChangeRequest.kt new file mode 100644 index 0000000..3863afc --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/request/PersonaChangeRequest.kt @@ -0,0 +1,6 @@ +package org.gitanimals.render.domain.request + +data class PersonaChangeRequest( + val personaId: String, + val visible: Boolean, +) diff --git a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt new file mode 100644 index 0000000..512bc1d --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt @@ -0,0 +1,22 @@ +package org.gitanimals.render.infra + +import org.gitanimals.render.app.IdentityApi +import org.springframework.http.HttpHeaders +import org.springframework.stereotype.Component +import org.springframework.web.client.RestClient + +@Component +class RestIdentityApi : IdentityApi { + + private val restClient = RestClient.create("https://api.gitanimals.org") + + override fun getUserByToken(token: String): IdentityApi.UserResponse { + return restClient.get() + .uri("/users") + .header(HttpHeaders.AUTHORIZATION, token) + .exchange { _, response -> + response.bodyTo(IdentityApi.UserResponse::class.java) + ?: throw IllegalArgumentException("Unauthorized user") + } + } +} From 7322447cd7bf5d119206ffb8d09b88cec1b3d4b5 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 22 Apr 2024 01:19:24 +0900 Subject: [PATCH 100/161] =?UTF-8?q?refactor:=20=EB=8B=A4=ED=81=AC=EB=AA=A8?= =?UTF-8?q?=EB=93=9C=EC=97=90=EC=84=9C=20contribution=EA=B3=BC=20level?= =?UTF-8?q?=EC=9D=84=20=ED=83=9C=EA=B7=B8=EB=B0=A9=EC=8B=9D=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=B4=EC=97=AC=EC=A4=80=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 5 + .../org/gitanimals/render/domain/User.kt | 50 -- src/main/resources/persona/animal/bbibbi.svg | 10 + .../resources/persona/animal/flamingo.svg | 10 + .../resources/persona/animal/goblin-bag.svg | 12 +- src/main/resources/persona/animal/goblin.svg | 12 +- .../resources/persona/animal/goose-java.svg | 12 +- .../resources/persona/animal/goose-js.svg | 12 +- .../resources/persona/animal/goose-kotlin.svg | 12 +- .../resources/persona/animal/goose-linux.svg | 12 +- .../resources/persona/animal/goose-node.svg | 12 +- .../resources/persona/animal/goose-spring.svg | 12 +- .../persona/animal/goose-sunglasses.svg | 12 +- .../resources/persona/animal/goose-swift.svg | 12 +- src/main/resources/persona/animal/goose.svg | 12 +- .../persona/animal/little-chick-java.svg | 10 + .../persona/animal/little-chick-js.svg | 10 + .../persona/animal/little-chick-kotlin.svg | 11 +- .../persona/animal/little-chick-linux.svg | 11 +- .../persona/animal/little-chick-node.svg | 11 +- .../persona/animal/little-chick-spring.svg | 11 +- .../animal/little-chick-sunglasses.svg | 11 +- .../persona/animal/little-chick-swift.svg | 11 +- .../resources/persona/animal/little-chick.svg | 10 + .../resources/persona/animal/penguin-java.svg | 10 + .../resources/persona/animal/penguin-js.svg | 10 + .../persona/animal/penguin-kotlin.svg | 10 + .../persona/animal/penguin-linux.svg | 10 + .../resources/persona/animal/penguin-node.svg | 10 + .../persona/animal/penguin-spring.svg | 10 + .../persona/animal/penguin-sunglasses.svg | 10 + .../persona/animal/penguin-swift.svg | 10 + src/main/resources/persona/animal/penguin.svg | 11 + .../resources/persona/animal/pig-java.svg | 10 + src/main/resources/persona/animal/pig-js.svg | 10 + .../resources/persona/animal/pig-kotlin.svg | 10 + .../resources/persona/animal/pig-linux.svg | 10 + .../resources/persona/animal/pig-node.svg | 10 + .../resources/persona/animal/pig-spring.svg | 10 + .../persona/animal/pig-sunglasses.svg | 10 + .../resources/persona/animal/pig-swift.svg | 10 + src/main/resources/persona/animal/pig.svg | 10 + .../resources/persona/animal/slime-blue.svg | 10 + .../resources/persona/animal/slime-green.svg | 10 + .../persona/animal/slime-red-java.svg | 10 + .../resources/persona/animal/slime-red-js.svg | 10 + .../persona/animal/slime-red-kotlin.svg | 10 + .../persona/animal/slime-red-linux.svg | 10 + .../persona/animal/slime-red-node.svg | 10 + .../persona/animal/slime-red-swift.svg | 10 + .../resources/persona/animal/slime-red.svg | 10 + src/main/resources/persona/animal/tenmm.svg | 12 +- src/test/resources/persona/goose/test.svg | 440 +++++++----------- 53 files changed, 688 insertions(+), 338 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 7225366..ac5162f 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1037,8 +1037,13 @@ enum class PersonaType(private val weight: Double) { "*{contribution}", user.contributionCount().toSvg(0.0, 2.0) ).replace("*{contribution-display}", "default") + .replace("*{level-tag-display}", "default") + } else if (mode == Mode.LINE_NO_CONTRIBUTION) { + this.replace("*{contribution-display}", "none") + .replace("*{level-tag-display}", "default") } else { this.replace("*{contribution-display}", "none") + .replace("*{level-tag-display}", "none") } } diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index d05a87b..8bb7222 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -186,59 +186,9 @@ class User( this.append("") private fun StringBuilder.closeSvg(): String = this - .blackBlureOnContributions() - .blackBlurOnLevel() .append("") .toString() - private fun StringBuilder.blackBlureOnContributions(): StringBuilder = - this.append( - """ - - - - - - - - - - - - - - - """.trimIndent() - ) - - private fun StringBuilder.blackBlurOnLevel(): StringBuilder = - this.append( - """ - - - - - - - - - - - - - - - """.trimIndent() - ) - companion object { private const val MAX_PERSONA_COUNT = 30L private const val MAX_INIT_PERSONA_COUNT = 10L diff --git a/src/main/resources/persona/animal/bbibbi.svg b/src/main/resources/persona/animal/bbibbi.svg index fdb20eb..5981ded 100644 --- a/src/main/resources/persona/animal/bbibbi.svg +++ b/src/main/resources/persona/animal/bbibbi.svg @@ -61,6 +61,11 @@ + + + + + @@ -71,6 +76,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg index 1a22fe8..cabc45a 100644 --- a/src/main/resources/persona/animal/flamingo.svg +++ b/src/main/resources/persona/animal/flamingo.svg @@ -24,6 +24,11 @@ + + + + + @@ -34,6 +39,11 @@
+ + + + + diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg index b252f04..7d29a18 100644 --- a/src/main/resources/persona/animal/goblin-bag.svg +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -61,6 +61,11 @@ + + + + + @@ -71,8 +76,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index 1f5525c..ed78824 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -61,6 +61,11 @@ + + + + + @@ -71,8 +76,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index a4cf2c0..dec3670 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index 96d3f8a..f35c8d6 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 538a3a3..6c06ebb 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index 41c90d4..5d70e0c 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index 8ac1622..7d69a2e 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index b1e04a0..1b0e585 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 45d642c..6316d1b 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -65,6 +65,11 @@ + + + + + @@ -75,8 +80,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index b108cc4..a551df6 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,8 +110,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index 68d9530..fba7e74 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -65,6 +65,11 @@ + + + + + @@ -75,8 +80,13 @@ + + + + + - + diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index 8653fbc..ec4a15d 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -96,6 +96,11 @@ + + + + + @@ -105,6 +110,11 @@ *{contribution} + + + + + diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index f1224e8..60995df 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -96,6 +96,11 @@ + + + + + @@ -105,6 +110,11 @@ *{contribution} + + + + + diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index e904a3c..f8d35c0 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -96,6 +96,11 @@ + + + + + @@ -106,7 +111,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index 549158a..a6cfd79 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -96,6 +96,11 @@ + + + + + @@ -106,7 +111,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index 2a2aff3..64ab35a 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -96,6 +96,11 @@ + + + + + @@ -106,7 +111,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index 82c0442..c994efb 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -96,6 +96,11 @@ + + + + + @@ -106,7 +111,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index dd48a1e..b284865 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -66,6 +66,11 @@ + + + + + @@ -76,7 +81,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index 5f2abe9..90e6ac7 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -96,6 +96,11 @@ + + + + + @@ -106,7 +111,11 @@ - + + + + + diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 8db00e9..3f38676 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -66,6 +66,11 @@ + + + + + @@ -76,6 +81,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index fee78e2..b1d752c 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -95,6 +95,11 @@ + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -105,6 +110,11 @@ + + + + + + + + + + @@ -75,6 +80,12 @@ + + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -75,6 +80,11 @@ + + + + + + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-green.svg b/src/main/resources/persona/animal/slime-green.svg index 4072ca3..6212bc8 100644 --- a/src/main/resources/persona/animal/slime-green.svg +++ b/src/main/resources/persona/animal/slime-green.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-java.svg b/src/main/resources/persona/animal/slime-red-java.svg index 10bd180..983ddc4 100644 --- a/src/main/resources/persona/animal/slime-red-java.svg +++ b/src/main/resources/persona/animal/slime-red-java.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-js.svg b/src/main/resources/persona/animal/slime-red-js.svg index b991584..8a3767e 100644 --- a/src/main/resources/persona/animal/slime-red-js.svg +++ b/src/main/resources/persona/animal/slime-red-js.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-kotlin.svg b/src/main/resources/persona/animal/slime-red-kotlin.svg index aa82035..ec9dae5 100644 --- a/src/main/resources/persona/animal/slime-red-kotlin.svg +++ b/src/main/resources/persona/animal/slime-red-kotlin.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-linux.svg b/src/main/resources/persona/animal/slime-red-linux.svg index 472c0b2..faf1e51 100644 --- a/src/main/resources/persona/animal/slime-red-linux.svg +++ b/src/main/resources/persona/animal/slime-red-linux.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-node.svg b/src/main/resources/persona/animal/slime-red-node.svg index 69e5bc5..4fd4271 100644 --- a/src/main/resources/persona/animal/slime-red-node.svg +++ b/src/main/resources/persona/animal/slime-red-node.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red-swift.svg b/src/main/resources/persona/animal/slime-red-swift.svg index 94b5f33..185d6a6 100644 --- a/src/main/resources/persona/animal/slime-red-swift.svg +++ b/src/main/resources/persona/animal/slime-red-swift.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/slime-red.svg b/src/main/resources/persona/animal/slime-red.svg index 8699746..18ce7e5 100644 --- a/src/main/resources/persona/animal/slime-red.svg +++ b/src/main/resources/persona/animal/slime-red.svg @@ -64,6 +64,11 @@ + + + + + @@ -74,6 +79,11 @@ + + + + + diff --git a/src/main/resources/persona/animal/tenmm.svg b/src/main/resources/persona/animal/tenmm.svg index be86fdd..78746c0 100644 --- a/src/main/resources/persona/animal/tenmm.svg +++ b/src/main/resources/persona/animal/tenmm.svg @@ -66,6 +66,11 @@ + + + + + @@ -76,9 +81,14 @@ + + + + + - + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 93c7b06..64cf449 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,304 +1,204 @@ - + From 4a87d9525548dc502053009cd968df8b1305d768 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 22 Apr 2024 01:22:16 +0900 Subject: [PATCH 101/161] =?UTF-8?q?docs:=20=ED=99=95=EB=A5=A0=ED=91=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20contribution=EA=B3=BC=20level=EC=9D=84=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/bbibbi.svg | 22 ---------------------- docs/flamingo.svg | 9 --------- docs/goblin-bag.svg | 21 --------------------- docs/goblin.svg | 21 --------------------- docs/tenmm.svg | 24 ------------------------ 5 files changed, 97 deletions(-) diff --git a/docs/bbibbi.svg b/docs/bbibbi.svg index 578544c..80fdb69 100644 --- a/docs/bbibbi.svg +++ b/docs/bbibbi.svg @@ -57,29 +57,7 @@ } - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/flamingo.svg b/docs/flamingo.svg index 05b591f..214e6ad 100644 --- a/docs/flamingo.svg +++ b/docs/flamingo.svg @@ -24,15 +24,6 @@ - - - - - - - - - diff --git a/docs/goblin-bag.svg b/docs/goblin-bag.svg index 1084d3c..23f8333 100644 --- a/docs/goblin-bag.svg +++ b/docs/goblin-bag.svg @@ -57,28 +57,7 @@ } - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/goblin.svg b/docs/goblin.svg index fa78ca6..c946871 100644 --- a/docs/goblin.svg +++ b/docs/goblin.svg @@ -57,28 +57,7 @@ } - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/tenmm.svg b/docs/tenmm.svg index 0fec26b..d6cd4f8 100644 --- a/docs/tenmm.svg +++ b/docs/tenmm.svg @@ -63,31 +63,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - From 47fe50f36a33a1210330d0bf7f71a367f297d1ec Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Wed, 24 Apr 2024 19:47:38 +0900 Subject: [PATCH 102/161] =?UTF-8?q?docs:=20=EB=A9=94=EC=9D=B8=20=EC=BA=90?= =?UTF-8?q?=EB=A6=AD=ED=84=B0=EB=A5=BC=20sunglasses=20little=20chick?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb1b61f..001e4d9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 409e4ec357c103d309a503d3c7510f672ce0a389 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 19:42:51 +0900 Subject: [PATCH 103/161] =?UTF-8?q?feat:=20Cat=20persona=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 + .../org/gitanimals/render/domain/Svgs.kt | 2 + src/main/resources/persona/animal/cat.svg | 186 ++++++++++ src/test/resources/persona/goose/test.svg | 349 ++++++++---------- 4 files changed, 368 insertions(+), 187 deletions(-) create mode 100644 src/main/resources/persona/animal/cat.svg diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index ac5162f..0daaecf 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1009,6 +1009,24 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String = StringBuilder().moveRandomly("bbibbi", id, 15, "180s", 5) .toString() + }, + + CAT(0.3) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return catSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("cat", id, 15, "180s", 5) + .toString() } ; diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 790570b..c46d86e 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -159,6 +159,8 @@ val goblinBagSvg: String = ClassPathResource("persona/animal/goblin-bag.svg") val bbibbiSvg: String = ClassPathResource("persona/animal/bbibbi.svg") .getContentAsString(Charset.defaultCharset()) +val catSvg: String = ClassPathResource("persona/animal/cat.svg") + .getContentAsString(Charset.defaultCharset()) val largeTextSvgs = lazy { val map = mutableMapOf() diff --git a/src/main/resources/persona/animal/cat.svg b/src/main/resources/persona/animal/cat.svg new file mode 100644 index 0000000..bc0d2a2 --- /dev/null +++ b/src/main/resources/persona/animal/cat.svg @@ -0,0 +1,186 @@ + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 64cf449..21bda03 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,204 +1,179 @@ + + + + + + + + + + + + + *{contribution} + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + *{level} + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - From 94f44810301eeeaac78f1a3732d0d5bb8a57f528 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 21:33:01 +0900 Subject: [PATCH 104/161] =?UTF-8?q?feat:=20cheese=5Fcat=20persona=EB=A5=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 20 +- .../org/gitanimals/render/domain/Svgs.kt | 3 + .../resources/persona/animal/cheese-cat.svg | 342 ++++++++++++++++++ 3 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/persona/animal/cheese-cat.svg diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 0daaecf..acf35aa 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1011,7 +1011,7 @@ enum class PersonaType(private val weight: Double) { .toString() }, - CAT(0.3) { + CAT(0.2) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } @@ -1024,6 +1024,24 @@ enum class PersonaType(private val weight: Double) { ) } + override fun act(id: Long): String = + StringBuilder().moveRandomly("cat", id, 15, "180s", 5) + .toString() + }, + + CHEESE_CAT(0.08) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return cheeseCatSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + override fun act(id: Long): String = StringBuilder().moveRandomly("cat", id, 15, "180s", 5) .toString() diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index c46d86e..6bb5f3f 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -162,6 +162,9 @@ val bbibbiSvg: String = ClassPathResource("persona/animal/bbibbi.svg") val catSvg: String = ClassPathResource("persona/animal/cat.svg") .getContentAsString(Charset.defaultCharset()) +val cheeseCatSvg: String = ClassPathResource("persona/animal/cheese-cat.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/cheese-cat.svg b/src/main/resources/persona/animal/cheese-cat.svg new file mode 100644 index 0000000..1a02613 --- /dev/null +++ b/src/main/resources/persona/animal/cheese-cat.svg @@ -0,0 +1,342 @@ + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a42590e01f131eb4305431dc98d2728206a5c55d Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 21:40:48 +0900 Subject: [PATCH 105/161] =?UTF-8?q?refactor:=20CAT=EC=9D=98=20=EB=93=B1?= =?UTF-8?q?=EC=9E=A5=ED=99=95=EB=A5=A0=EC=9D=84=200.1=EB=A1=9C=20=EB=82=B4?= =?UTF-8?q?=EB=A6=B0=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index acf35aa..da6b29f 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1011,7 +1011,7 @@ enum class PersonaType(private val weight: Double) { .toString() }, - CAT(0.2) { + CAT(0.1) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } From 88559112bfe959561867ea80534c755a4fcafc5f Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 21:41:03 +0900 Subject: [PATCH 106/161] =?UTF-8?q?docs:=20Cat=EA=B3=BC=20Cheese=5Fcat?= =?UTF-8?q?=EC=9D=98=20=EB=93=B1=EC=9E=A5=ED=99=95=EB=A5=A0=ED=91=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 106 +++++++++--------- README.md | 108 +++++++++--------- docs/cat.svg | 153 +++++++++++++++++++++++++ docs/cheese-cat.svg | 264 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 526 insertions(+), 105 deletions(-) create mode 100644 docs/cat.svg create mode 100644 docs/cheese-cat.svg diff --git a/ENGLISH.md b/ENGLISH.md index 2d5881b..e56e483 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -112,59 +112,61 @@ _New contributions may take up to 1 hour to be reflected._ ### Available Pets -| name | ratio | Description | -|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | +| name | ratio | Description | +|------------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | | bbibbi
| 0.00 | Character created by `BBIBBI` donations
Only buy in shop
BBIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.08 | | ## diff --git a/README.md b/README.md index 001e4d9..32d4a1a 100644 --- a/README.md +++ b/README.md @@ -107,59 +107,61 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|------------------------------------------------------------------------------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| | | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| name | ratio | Description | +|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| goose | 1.0 | | +| goose_sunglasses | 0.05 | | +| | | | +| goose_kotlin | 0.01 | | +| goose_java | 0.01 | | +| goose_js | 0.01 | | +| goose_node | 0.01 | | +| goose_swift | 0.01 | | +| goose_linux | 0.01 | | +| goose_spring | 0.01 | | +| little_chick | 0.9 | | +| little_chick_suglasses | 0.4 | | +| little_chick_kotlin | 0.01 | | +| little_chick_java | 0.01 | | +| little_chick_js | 0.01 | | +| little_chick_node | 0.01 | | +| little_chick_swift | 0.01 | | +| little_chick_linux | 0.01 | | +| little_chick_spring | 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.08 | | ## diff --git a/docs/cat.svg b/docs/cat.svg new file mode 100644 index 0000000..130d290 --- /dev/null +++ b/docs/cat.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/cheese-cat.svg b/docs/cheese-cat.svg new file mode 100644 index 0000000..ce0753e --- /dev/null +++ b/docs/cheese-cat.svg @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fab3310b91a34857b8228846f1b540b8ac030d33 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 21:49:45 +0900 Subject: [PATCH 107/161] =?UTF-8?q?docs:=20=EB=8C=80=ED=91=9C=ED=8E=AB?= =?UTF-8?q?=EC=9D=84=20CHEESE=5FCAT=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index e56e483..817e6ff 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -9,7 +9,7 @@
- + ⭐️ Please press the star! It greatly helps development! ⭐️
diff --git a/README.md b/README.md index 32d4a1a..4d1f2ea 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 5135945b75973a249be3eccfedf3c1fc2f313265 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 26 Apr 2024 22:50:20 +0900 Subject: [PATCH 108/161] =?UTF-8?q?refactor:=20cat=20persona=EB=93=A4?= =?UTF-8?q?=EC=9D=98=20=EC=88=98=EC=97=BC=EC=83=89=EA=B9=94=EC=9D=84=20bla?= =?UTF-8?q?ck=20->=20#2d2d2d=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/cat.svg | 8 ++++---- docs/cheese-cat.svg | 8 ++++---- src/main/resources/persona/animal/cat.svg | 8 ++++---- src/main/resources/persona/animal/cheese-cat.svg | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/cat.svg b/docs/cat.svg index 130d290..6e71aef 100644 --- a/docs/cat.svg +++ b/docs/cat.svg @@ -108,10 +108,10 @@ - - - - + + + + diff --git a/docs/cheese-cat.svg b/docs/cheese-cat.svg index ce0753e..e89ccdd 100644 --- a/docs/cheese-cat.svg +++ b/docs/cheese-cat.svg @@ -148,10 +148,10 @@ - - - - + + + + diff --git a/src/main/resources/persona/animal/cat.svg b/src/main/resources/persona/animal/cat.svg index bc0d2a2..dddc37b 100644 --- a/src/main/resources/persona/animal/cat.svg +++ b/src/main/resources/persona/animal/cat.svg @@ -142,10 +142,10 @@ - - - - + + + + diff --git a/src/main/resources/persona/animal/cheese-cat.svg b/src/main/resources/persona/animal/cheese-cat.svg index 1a02613..cf72961 100644 --- a/src/main/resources/persona/animal/cheese-cat.svg +++ b/src/main/resources/persona/animal/cheese-cat.svg @@ -182,10 +182,10 @@ - - - - + + + + Date: Fri, 26 Apr 2024 23:10:27 +0900 Subject: [PATCH 109/161] =?UTF-8?q?feat:=20white-cat=EA=B3=BC=20galchi-cat?= =?UTF-8?q?=20=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 17 +- README.md | 17 +- docs/galchi-cat.svg | 242 ++++++++++++++ docs/white-cat.svg | 256 +++++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 40 ++- .../org/gitanimals/render/domain/Svgs.kt | 6 + .../resources/persona/animal/galchi-cat.svg | 242 ++++++++++++++ .../resources/persona/animal/white-cat.svg | 307 ++++++++++++++++++ 8 files changed, 1109 insertions(+), 18 deletions(-) create mode 100644 docs/galchi-cat.svg create mode 100644 docs/white-cat.svg create mode 100644 src/main/resources/persona/animal/galchi-cat.svg create mode 100644 src/main/resources/persona/animal/white-cat.svg diff --git a/ENGLISH.md b/ENGLISH.md index 817e6ff..6170c71 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -114,9 +114,17 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |------------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | | goose | 1.0 | | | goose_sunglasses | 0.05 | | -| | | | | goose_kotlin | 0.01 | | | goose_java | 0.01 | | | goose_js | 0.01 | | @@ -160,13 +168,6 @@ _New contributions may take up to 1 hour to be reflected._ | slime_red_linux | 0.001 | | | slime_green | 0.1 | | | slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bbibbi
| 0.00 | Character created by `BBIBBI` donations
Only buy in shop
BBIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.08 | | ## diff --git a/README.md b/README.md index 4d1f2ea..c9e5151 100644 --- a/README.md +++ b/README.md @@ -109,9 +109,17 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | name | ratio | Description | |------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | | goose | 1.0 | | | goose_sunglasses | 0.05 | | -| | | | | goose_kotlin | 0.01 | | | goose_java | 0.01 | | | goose_js | 0.01 | | @@ -155,13 +163,6 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | slime_red_linux | 0.001 | | | slime_green | 0.1 | | | slime_blue | 0.1 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.08 | | ## diff --git a/docs/galchi-cat.svg b/docs/galchi-cat.svg new file mode 100644 index 0000000..6062e65 --- /dev/null +++ b/docs/galchi-cat.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/white-cat.svg b/docs/white-cat.svg new file mode 100644 index 0000000..5476199 --- /dev/null +++ b/docs/white-cat.svg @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index da6b29f..fea27ab 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1029,7 +1029,7 @@ enum class PersonaType(private val weight: Double) { .toString() }, - CHEESE_CAT(0.08) { + CHEESE_CAT(0.04) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { check(persona.id != null) { "Save persona first before call load()" } @@ -1045,7 +1045,43 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String = StringBuilder().moveRandomly("cat", id, 15, "180s", 5) .toString() - } + }, + + GALCHI_CAT(0.06) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return galchiCatSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("cat", id, 15, "180s", 5) + .toString() + }, + + WHITE_CAT(0.04) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + check(persona.id != null) { "Save persona first before call load()" } + + return whiteCatSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("cat", id, 15, "180s", 5) + .toString() + }, ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 6bb5f3f..41fd5af 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -165,6 +165,12 @@ val catSvg: String = ClassPathResource("persona/animal/cat.svg") val cheeseCatSvg: String = ClassPathResource("persona/animal/cheese-cat.svg") .getContentAsString(Charset.defaultCharset()) +val galchiCatSvg: String = ClassPathResource("persona/animal/galchi-cat.svg") + .getContentAsString(Charset.defaultCharset()) + +val whiteCatSvg: String = ClassPathResource("persona/animal/white-cat.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/galchi-cat.svg b/src/main/resources/persona/animal/galchi-cat.svg new file mode 100644 index 0000000..6dfcb60 --- /dev/null +++ b/src/main/resources/persona/animal/galchi-cat.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/white-cat.svg b/src/main/resources/persona/animal/white-cat.svg new file mode 100644 index 0000000..2a17e6d --- /dev/null +++ b/src/main/resources/persona/animal/white-cat.svg @@ -0,0 +1,307 @@ + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ec4a207c0d253b3f54c29204071d7d62d426535a Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 28 Apr 2024 12:26:13 +0900 Subject: [PATCH 110/161] =?UTF-8?q?feat:=20Persona=20add,=20Persona=20dele?= =?UTF-8?q?te=20=EB=A1=9C=EC=A7=81=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 3 ++ gradle/db.gradle | 1 + .../org/gitanimals/render/app/UserFacade.kt | 13 +++++ .../render/controller/PersonaController.kt | 23 ++++++++ .../controller/request/AddPersonaRequest.kt | 5 ++ .../org/gitanimals/render/core/IdGenerator.kt | 10 ++++ .../org/gitanimals/render/domain/Persona.kt | 19 +++++-- .../org/gitanimals/render/domain/User.kt | 52 +++++++++++------- .../render/domain/UserRepository.kt | 5 +- .../gitanimals/render/domain/UserService.kt | 34 +++++++++--- .../render/domain/response/PersonaResponse.kt | 16 ++++++ .../gitanimals/render/domain/UserFixture.kt | 4 +- .../render/domain/UserServiceTest.kt | 53 +++++++++++++++++++ 13 files changed, 204 insertions(+), 34 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt create mode 100644 src/main/kotlin/org/gitanimals/render/core/IdGenerator.kt create mode 100644 src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt create mode 100644 src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt diff --git a/gradle.properties b/gradle.properties index 3370ffa..e7ca5ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,3 +34,6 @@ restAssuredVersion=5.4.0 ### H2version ### h2Version=1.4.200 + +### Snowflake ### +snowflakeVersion=5.2.5 diff --git a/gradle/db.gradle b/gradle/db.gradle index 61d4ab8..1750eef 100644 --- a/gradle/db.gradle +++ b/gradle/db.gradle @@ -1,5 +1,6 @@ dependencies { implementation "mysql:mysql-connector-java:${mysqlConnectorVersion}" + implementation "com.github.f4b6a3:tsid-creator:${snowflakeVersion}" testRuntimeOnly "com.h2database:h2:${h2Version}" } diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt index c12b82e..2c0e289 100644 --- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.app import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.request.PersonaChangeRequest +import org.gitanimals.render.domain.response.PersonaResponse import org.springframework.stereotype.Service @Service @@ -15,4 +16,16 @@ class UserFacade( userService.changePersona(user.id.toLong(), personChangeRequest) } + + fun addPersona(token: String, idempotencyKey: String, personaType: String): PersonaResponse { + val user = identityApi.getUserByToken(token) + + return userService.addPersona(user.id.toLong(), personaType, idempotencyKey) + } + + fun deletePersona(token: String, personaId: Long): PersonaResponse { + val user = identityApi.getUserByToken(token) + + return userService.deletePersona(user.id.toLong(), personaId) + } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index ef297f2..0babd28 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -1,6 +1,8 @@ package org.gitanimals.render.controller import org.gitanimals.render.app.UserFacade +import org.gitanimals.render.controller.request.AddPersonaRequest +import org.gitanimals.render.controller.response.PersonaResponse import org.gitanimals.render.controller.response.UserResponse import org.gitanimals.render.domain.UserService import org.gitanimals.render.domain.request.PersonaChangeRequest @@ -25,4 +27,25 @@ class PersonaController( @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, @RequestBody personaChangeRequest: PersonaChangeRequest, ) = userFacade.changePersona(token, personaChangeRequest) + + @PostMapping("/internals/personas") + fun addPersona( + @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, + @RequestParam("idempotency-key") idempotencyKey: String, + @RequestBody addPersonaRequest: AddPersonaRequest, + ): PersonaResponse { + val persona = userFacade.addPersona(token, idempotencyKey, addPersonaRequest.name) + + return PersonaResponse(persona.id, persona.type, persona.level) + } + + @DeleteMapping("/internals/personas") + fun deletePersona( + @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, + @RequestParam("persona-id") personaId: Long, + ): PersonaResponse { + val persona = userFacade.deletePersona(token, personaId) + + return PersonaResponse(persona.id, persona.type, persona.level) + } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt b/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt new file mode 100644 index 0000000..5065e81 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt @@ -0,0 +1,5 @@ +package org.gitanimals.render.controller.request + +data class AddPersonaRequest( + val name: String, +) diff --git a/src/main/kotlin/org/gitanimals/render/core/IdGenerator.kt b/src/main/kotlin/org/gitanimals/render/core/IdGenerator.kt new file mode 100644 index 0000000..2b2942f --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/core/IdGenerator.kt @@ -0,0 +1,10 @@ +package org.gitanimals.render.core + +import com.github.f4b6a3.tsid.TsidFactory + +object IdGenerator { + + private val tsidFactory = TsidFactory.newInstance256() + + fun generate(): Long = tsidFactory.create().toLong() +} diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index 294f294..e22ccb3 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.domain import com.fasterxml.jackson.annotation.JsonIgnore import jakarta.persistence.* +import org.gitanimals.render.core.IdGenerator import org.gitanimals.render.domain.value.Level @Table(name = "persona") @@ -9,8 +10,7 @@ import org.gitanimals.render.domain.value.Level class Persona( @Id @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long? = null, + val id: Long, @Column(name = "type", nullable = false, columnDefinition = "TEXT") @Enumerated(EnumType.STRING) @@ -32,7 +32,20 @@ class Persona( type: PersonaType, level: Long, visible: Boolean - ) : this(type = type, level = Level(level), visible = visible) + ) : this(id = IdGenerator.generate(), type = type, level = Level(level), visible = visible) + + constructor( + type: PersonaType, + level: Long, + visible: Boolean, + user: User, + ) : this( + id = IdGenerator.generate(), + type = type, + level = Level(level), + visible = visible, + user = user + ) fun toSvgForce(mode: Mode): String = type.load(user!!, this, mode) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 8bb7222..304565b 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -3,8 +3,9 @@ package org.gitanimals.render.domain import com.fasterxml.jackson.annotation.JsonIgnore import jakarta.persistence.* import org.gitanimals.render.core.AggregateRoot +import org.gitanimals.render.core.IdGenerator +import org.gitanimals.render.domain.response.PersonaResponse import org.gitanimals.render.domain.value.Contribution -import org.gitanimals.render.domain.value.Level import org.hibernate.annotations.BatchSize import java.time.Instant import java.time.ZoneId @@ -19,13 +20,17 @@ import kotlin.math.min class User( @Id @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long? = null, + val id: Long, @Column(name = "name", unique = true, nullable = false) val name: String, - @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = [CascadeType.ALL]) + @OneToMany( + mappedBy = "user", + fetch = FetchType.EAGER, + cascade = [CascadeType.ALL], + orphanRemoval = true + ) val personas: MutableList = mutableListOf(), @BatchSize(size = 20) @@ -46,11 +51,27 @@ class User( @Column(name = "version", nullable = false) val version: Long, ) : AbstractTime() { - init { personas.forEach { it.user = this } } + fun addPersona(personaType: PersonaType): PersonaResponse { + val persona = Persona(personaType, 0L, personas.size < 30, this) + + this.personas.add(persona) + + return PersonaResponse.from(persona) + } + + fun deletePersona(personaId: Long): PersonaResponse { + val persona = this.personas.find { it.id == personaId } + ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") + + this.personas.remove(persona) + + return PersonaResponse.from(persona) + } + @JsonIgnore fun isContributionUpdatedBeforeOneHour(): Boolean { val currentYear = ZonedDateTime.now(ZoneId.of("UTC")).year @@ -122,25 +143,17 @@ class User( "Cannot select as a bonus persona." } - val persona = getPersona(personaType) - personas.add(persona) + personas.add(getPersona(personaType)) } private fun getRandomPersona() = getPersona(PersonaType.random()) - private fun getPersona(personaType: PersonaType) = when (personas.size >= MAX_PERSONA_COUNT) { - true -> Persona( - type = personaType, - level = Level(0), - visible = false, - user = this - ) - - false -> Persona( + private fun getPersona(personaType: PersonaType): Persona { + return Persona( type = personaType, - level = Level(0), - visible = true, - user = this + level = 0, + visible = personas.size < MAX_PERSONA_COUNT, + user = this, ) } @@ -208,6 +221,7 @@ class User( } return User( + id = IdGenerator.generate(), name = name, personas = createPersonas(contributions), field = FieldType.WHITE_FIELD, diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserRepository.kt b/src/main/kotlin/org/gitanimals/render/domain/UserRepository.kt index bf41f54..bc8dc18 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserRepository.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserRepository.kt @@ -1,13 +1,10 @@ package org.gitanimals.render.domain import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.data.jpa.repository.Query -import org.springframework.data.repository.query.Param interface UserRepository : JpaRepository { - @Query("select u from user as u join fetch u.personas where u.name = :name") - fun findByName(@Param("name") name: String): User? + fun findByName(name: String): User? fun existsByName(name: String): Boolean } diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 55b89b2..f82d584 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -1,6 +1,7 @@ package org.gitanimals.render.domain import org.gitanimals.render.domain.request.PersonaChangeRequest +import org.gitanimals.render.domain.response.PersonaResponse import org.springframework.data.repository.findByIdOrNull import org.springframework.orm.ObjectOptimisticLockingFailureException import org.springframework.retry.annotation.Retryable @@ -50,16 +51,11 @@ class UserService( @Transactional fun giveBonusPersona(id: Long, persona: String) { - val idempotencyId = "$id:bonus" - val idempotency = idempotencyRepository.findByIdOrNull(idempotencyId) - - require(idempotency == null) { "Got bonus pet already." } + requireIdempotency("$id:bonus") val user = getUserById(id) user.giveBonusPersona(persona) - - idempotencyRepository.save(Idempotency(idempotencyId)) } @Transactional @@ -72,6 +68,32 @@ class UserService( ) } + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) + @Transactional + fun addPersona(id: Long, personaType: String, idempotencyKey: String): PersonaResponse { + requireIdempotency("addPersona:$idempotencyKey") + + val user = getUserById(id) + + return user.addPersona(PersonaType.valueOf(personaType.uppercase())) + } + + private fun requireIdempotency(idempotencyKey: String) { + val idempotency = idempotencyRepository.findByIdOrNull(idempotencyKey) + + require(idempotency == null) { "Duplicated request" } + + idempotencyRepository.save(Idempotency(idempotencyKey)) + } + + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) + @Transactional + fun deletePersona(id: Long, personaId: Long): PersonaResponse { + val user = getUserById(id) + + return user.deletePersona(personaId) + } + private fun getUserById(id: Long) = (userRepository.findByIdOrNull(id) ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"")) } diff --git a/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt new file mode 100644 index 0000000..281004a --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt @@ -0,0 +1,16 @@ +package org.gitanimals.render.domain.response + +import org.gitanimals.render.domain.Persona +import org.gitanimals.render.domain.PersonaType + +data class PersonaResponse( + val id: String, + val type: PersonaType, + val level: String, +) { + companion object { + fun from(persona: Persona): PersonaResponse { + return PersonaResponse(persona.id.toString(), persona.type, persona.level.toString()) + } + } +} diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt b/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt index 1438a3a..b177326 100644 --- a/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt +++ b/src/test/kotlin/org/gitanimals/render/domain/UserFixture.kt @@ -1,10 +1,10 @@ package org.gitanimals.render.domain +import org.gitanimals.render.core.IdGenerator import org.gitanimals.render.domain.value.Contribution -import kotlin.random.Random fun user( - id: Long = Random.nextLong(), + id: Long = IdGenerator.generate(), name: String = "devxb", personas: MutableList = mutableListOf(), contributions: MutableList = mutableListOf(), diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt b/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt new file mode 100644 index 0000000..561d4e2 --- /dev/null +++ b/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt @@ -0,0 +1,53 @@ +package org.gitanimals.render.domain + +import io.kotest.core.annotation.DisplayName +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.nulls.shouldBeNull +import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest +import org.springframework.data.jpa.repository.config.EnableJpaRepositories +import org.springframework.test.context.ContextConfiguration + +@DataJpaTest +@DisplayName("UserService 클래슀의") +@ContextConfiguration( + classes = [ + UserService::class, + ] +) +@EntityScan(basePackages = ["org.gitanimals.render.domain"]) +@EnableJpaRepositories(basePackages = ["org.gitanimals.render.domain"]) +internal class UserServiceTest( + private val userService: UserService, + private val userRepository: UserRepository, +) : DescribeSpec({ + + beforeEach { + userRepository.save(user) + } + + afterEach { + userRepository.deleteAll() + } + + describe("deletePersona λ©”μ†Œλ“œλŠ”") { + context("userId와 personaIdλ₯Ό λ°›μœΌλ©΄,") { + val personaId = user.personas[0].id + val userId = user.id + + it("personaλ₯Ό μ‚­μ œν•œλ‹€.") { + val response = userService.deletePersona(userId, personaId) + val user = userService.getUserByName(user.name) + + user.personas + .find { it.id == response.id.toLong() } + .shouldBeNull() + } + } + } +}) { + + private companion object { + val user = User.newUser("devxb", mapOf()) + } +} From 8df2e5e5f7f6d2ef76d5cc17bf81ba449fafb147 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 28 Apr 2024 12:30:45 +0900 Subject: [PATCH 111/161] =?UTF-8?q?feat:=20InternalApi=20interceptor?= =?UTF-8?q?=EB=A5=BC=20=EC=A0=95=EC=9D=98=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interceptor/InterceptorConfigurer.kt | 22 +++++++++ .../interceptor/InternalApiInterceptor.kt | 45 +++++++++++++++++++ src/main/resources/application.properties | 2 + 3 files changed, 69 insertions(+) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt create mode 100644 src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt diff --git a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt new file mode 100644 index 0000000..a265490 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt @@ -0,0 +1,22 @@ +package org.gitanimals.render.controller.interceptor + +import org.springframework.beans.factory.annotation.Value +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.web.servlet.config.annotation.InterceptorRegistry +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer + +@Configuration +class InterceptorConfigurer( + @Value("\${white.ip}") private val whiteIps: List +) : WebMvcConfigurer { + + override fun addInterceptors(registry: InterceptorRegistry) { + registry.addInterceptor(internalApiInterceptor()) + .addPathPatterns("/internals/**") + .excludePathPatterns() + } + + @Bean + fun internalApiInterceptor(): InternalApiInterceptor = InternalApiInterceptor(whiteIps) +} diff --git a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt new file mode 100644 index 0000000..8efddff --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt @@ -0,0 +1,45 @@ +package org.gitanimals.render.controller.interceptor + +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import org.springframework.web.servlet.HandlerInterceptor + +class InternalApiInterceptor( + private val whiteIps: List, +) : HandlerInterceptor { + + override fun preHandle( + request: HttpServletRequest, + response: HttpServletResponse, + handler: Any, + ): Boolean { + val ip = extractIp(request) + return whiteIps.contains(ip) + } + + private fun extractIp(request: HttpServletRequest): String { + val headers = arrayOf( + "Proxy-Client-IP", + "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", + "X-Real-IP", "X-RealIP", "REMOTE_ADDR" + ) + + var ip: String = request.getHeader("X-Forwarded-For") + + for (header in headers) { + if (ip.isEmpty() || "unknown".equals(ip, ignoreCase = true)) { + ip = request.getHeader(header) + } + } + + if (ip.isEmpty() || "unknown".equals(ip, ignoreCase = true)) { + ip = request.remoteAddr + } + + if (ip == "0:0:0:0:0:0:0:1") { + ip = "127.0.0.1" + } + + return ip + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a748159..a48e684 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -25,3 +25,5 @@ github.token= sentry.dsn=https://fe1aaf784ec135343909a4a0dfe4f0eb@o4505051656486912.ingest.us.sentry.io/4507088960684032 sentry.traces-sample-rate=1.0 + +white.ip=127.0.0.1,192.168.35.190,192.168.35.139,39.120.67.208 From 1607cb457b2c2b9e1c505fc3ea75f9d0932d91b7 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 28 Apr 2024 12:56:53 +0900 Subject: [PATCH 112/161] =?UTF-8?q?fix:=20internal=20api=20interceptor?= =?UTF-8?q?=EA=B0=80=20X-Forwarded-For=EC=9D=B4=20=EC=97=86=EC=96=B4?= =?UTF-8?q?=EB=8F=84=20=EC=88=98=ED=96=89=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/controller/PersonaController.kt | 5 +++++ .../controller/interceptor/InternalApiInterceptor.kt | 11 +++++------ .../render/controller/response/ErrorResponse.kt | 11 +++++++++++ .../org/gitanimals/render/infra/RestIdentityApi.kt | 7 +++++-- 4 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/render/controller/response/ErrorResponse.kt diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 0babd28..bcd4f0e 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.controller import org.gitanimals.render.app.UserFacade import org.gitanimals.render.controller.request.AddPersonaRequest +import org.gitanimals.render.controller.response.ErrorResponse import org.gitanimals.render.controller.response.PersonaResponse import org.gitanimals.render.controller.response.UserResponse import org.gitanimals.render.domain.UserService @@ -48,4 +49,8 @@ class PersonaController( return PersonaResponse(persona.id, persona.type, persona.level) } + + @ExceptionHandler(IllegalArgumentException::class) + fun handleIllegalArgumentException(exception: IllegalArgumentException): ErrorResponse = + ErrorResponse.from(exception) } diff --git a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt index 8efddff..8441dc2 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt @@ -13,8 +13,7 @@ class InternalApiInterceptor( response: HttpServletResponse, handler: Any, ): Boolean { - val ip = extractIp(request) - return whiteIps.contains(ip) + return whiteIps.contains(extractIp(request)) } private fun extractIp(request: HttpServletRequest): String { @@ -24,15 +23,15 @@ class InternalApiInterceptor( "X-Real-IP", "X-RealIP", "REMOTE_ADDR" ) - var ip: String = request.getHeader("X-Forwarded-For") + var ip: String? = request.getHeader("X-Forwarded-For") for (header in headers) { - if (ip.isEmpty() || "unknown".equals(ip, ignoreCase = true)) { + if (ip.isNullOrEmpty() || "unknown".equals(ip, ignoreCase = true)) { ip = request.getHeader(header) } } - if (ip.isEmpty() || "unknown".equals(ip, ignoreCase = true)) { + if (ip.isNullOrEmpty() || "unknown".equals(ip, ignoreCase = true)) { ip = request.remoteAddr } @@ -40,6 +39,6 @@ class InternalApiInterceptor( ip = "127.0.0.1" } - return ip + return ip ?: throw IllegalStateException("Cannot extract ip") } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/response/ErrorResponse.kt b/src/main/kotlin/org/gitanimals/render/controller/response/ErrorResponse.kt new file mode 100644 index 0000000..01f4a5b --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/controller/response/ErrorResponse.kt @@ -0,0 +1,11 @@ +package org.gitanimals.render.controller.response + +data class ErrorResponse( + val message: String, +) { + + companion object { + fun from(exception: Exception): ErrorResponse = + ErrorResponse(exception.message ?: exception.localizedMessage) + } +} diff --git a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt index 512bc1d..9b394c5 100644 --- a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt +++ b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt @@ -15,8 +15,11 @@ class RestIdentityApi : IdentityApi { .uri("/users") .header(HttpHeaders.AUTHORIZATION, token) .exchange { _, response -> - response.bodyTo(IdentityApi.UserResponse::class.java) - ?: throw IllegalArgumentException("Unauthorized user") + runCatching { + response.bodyTo(IdentityApi.UserResponse::class.java) + }.getOrElse { + throw IllegalArgumentException("Unauthorized user") + } } } } From 0d581f9abe7e4e3f813fe1fb196d6287c6335345 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 29 Apr 2024 21:52:12 +0900 Subject: [PATCH 113/161] =?UTF-8?q?feat:=20persona-id=EB=A5=BC=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=EC=9C=BC=EB=A1=9C=20=EC=A1=B0=ED=9A=8C=ED=95=98?= =?UTF-8?q?=EB=8A=94=20API=EB=A5=BC=20=EA=B0=9C=EB=B0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/app/UserFacade.kt | 6 ++++++ .../gitanimals/render/controller/PersonaController.kt | 10 ++++++++++ .../kotlin/org/gitanimals/render/domain/UserService.kt | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt index 2c0e289..5f2eb21 100644 --- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -28,4 +28,10 @@ class UserFacade( return userService.deletePersona(user.id.toLong(), personaId) } + + fun getPersona(token: String, personaId: Long): PersonaResponse { + val user = identityApi.getUserByToken(token) + + return userService.getPersona(user.id.toLong(), personaId) + } } diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index bcd4f0e..5ad8e10 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -22,6 +22,16 @@ class PersonaController( return UserResponse.from(userService.getUserByName(username)) } + @GetMapping("/personas/{persona-id}") + fun getPersonaById( + @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, + @PathVariable("persona-id") personaId: Long, + ): PersonaResponse { + val persona = userFacade.getPersona(token, personaId) + + return PersonaResponse(persona.id, persona.type, persona.level) + } + @PatchMapping("/personas") @ResponseStatus(HttpStatus.OK) fun changePersona( diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index f82d584..f55ee71 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -94,6 +94,13 @@ class UserService( return user.deletePersona(personaId) } + fun getPersona(id: Long, personaId: Long): PersonaResponse { + return getUserById(id).personas + .find { it.id == personaId } + ?.let { PersonaResponse.from(it) } + ?: throw IllegalArgumentException("Cannot find matched persona \"$personaId\" by user \"$id\"") + } + private fun getUserById(id: Long) = (userRepository.findByIdOrNull(id) ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"")) } From 874ead0c5bef4016d2bd7d070685fcce5fef0123 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 29 Apr 2024 22:19:43 +0900 Subject: [PATCH 114/161] =?UTF-8?q?docs:=20goose=EC=99=80=20little-chick?= =?UTF-8?q?=20=EA=B3=84=EC=97=B4=EC=9D=98=20=ED=99=95=EB=A5=A0=ED=91=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 112 +++++++-------- docs/goose-java.svg | 226 +++++++++++++++++++++++++++++++ docs/goose-js.svg | 177 ++++++++++++++++++++++++ docs/goose-kotlin.svg | 206 ++++++++++++++++++++++++++++ docs/goose-linux.svg | 191 ++++++++++++++++++++++++++ docs/goose-node.svg | 188 +++++++++++++++++++++++++ docs/goose-spring.svg | 199 +++++++++++++++++++++++++++ docs/goose-sunglasses.svg | 151 +++++++++++++++++++++ docs/goose-swift.svg | 203 +++++++++++++++++++++++++++ docs/goose.svg | 134 ++++++++++++++++++ docs/little-chick-java.svg | 208 ++++++++++++++++++++++++++++ docs/little-chick-js.svg | 159 ++++++++++++++++++++++ docs/little-chick-kotlin.svg | 188 +++++++++++++++++++++++++ docs/little-chick-linux.svg | 207 ++++++++++++++++++++++++++++ docs/little-chick-node.svg | 199 +++++++++++++++++++++++++++ docs/little-chick-spring.svg | 181 +++++++++++++++++++++++++ docs/little-chick-sunglasses.svg | 133 ++++++++++++++++++ docs/little-chick-swift.svg | 185 +++++++++++++++++++++++++ docs/little-chick.svg | 116 ++++++++++++++++ 19 files changed, 3307 insertions(+), 56 deletions(-) create mode 100644 docs/goose-java.svg create mode 100644 docs/goose-js.svg create mode 100644 docs/goose-kotlin.svg create mode 100644 docs/goose-linux.svg create mode 100644 docs/goose-node.svg create mode 100644 docs/goose-spring.svg create mode 100644 docs/goose-sunglasses.svg create mode 100644 docs/goose-swift.svg create mode 100644 docs/goose.svg create mode 100644 docs/little-chick-java.svg create mode 100644 docs/little-chick-js.svg create mode 100644 docs/little-chick-kotlin.svg create mode 100644 docs/little-chick-linux.svg create mode 100644 docs/little-chick-node.svg create mode 100644 docs/little-chick-spring.svg create mode 100644 docs/little-chick-sunglasses.svg create mode 100644 docs/little-chick-swift.svg create mode 100644 docs/little-chick.svg diff --git a/README.md b/README.md index c9e5151..a3541eb 100644 --- a/README.md +++ b/README.md @@ -107,62 +107,62 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.04 | | -| galchi-cat
| 0.06 | | -| white-cat
| 0.04 | | -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | +| name | ratio | Description | +|-----------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | +| goose
| 1.0 | | +| goose_sunglasses
| 0.05 | | +| goose_kotlin
| 0.01 | | +| goose_java
| 0.01 | | +| goose_js
| 0.01 | | +| goose_node
| 0.01 | | +| goose_swift
| 0.01 | | +| goose_linux
| 0.01 | | +| goose_spring
| 0.01 | | +| little_chick
| 0.9 | | +| little_chick_suglasses
| 0.4 | | +| little_chick_kotlin
| 0.01 | | +| little_chick_java
| 0.01 | | +| little_chick_js
| 0.01 | | +| little_chick_node
| 0.01 | | +| little_chick_swift
| 0.01 | | +| little_chick_linux
| 0.01 | | +| little_chick_spring
| 0.01 | | +| penguin | 0.5 | | +| penguin_sunglasses | 0.2 | | +| penguin_kotlin | 0.01 | | +| penguin_java | 0.01 | | +| penguin_js | 0.01 | | +| penguin_node | 0.01 | | +| penguin_swift | 0.01 | | +| penguin_linux | 0.01 | | +| penguin_spring | 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | ## diff --git a/docs/goose-java.svg b/docs/goose-java.svg new file mode 100644 index 0000000..d4d4c16 --- /dev/null +++ b/docs/goose-java.svg @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-js.svg b/docs/goose-js.svg new file mode 100644 index 0000000..ee98f21 --- /dev/null +++ b/docs/goose-js.svg @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-kotlin.svg b/docs/goose-kotlin.svg new file mode 100644 index 0000000..f0e8b69 --- /dev/null +++ b/docs/goose-kotlin.svg @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-linux.svg b/docs/goose-linux.svg new file mode 100644 index 0000000..6a72492 --- /dev/null +++ b/docs/goose-linux.svg @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-node.svg b/docs/goose-node.svg new file mode 100644 index 0000000..18fe20a --- /dev/null +++ b/docs/goose-node.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-spring.svg b/docs/goose-spring.svg new file mode 100644 index 0000000..e3d9a6a --- /dev/null +++ b/docs/goose-spring.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-sunglasses.svg b/docs/goose-sunglasses.svg new file mode 100644 index 0000000..79e73b3 --- /dev/null +++ b/docs/goose-sunglasses.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose-swift.svg b/docs/goose-swift.svg new file mode 100644 index 0000000..3db02af --- /dev/null +++ b/docs/goose-swift.svg @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/goose.svg b/docs/goose.svg new file mode 100644 index 0000000..bf87dc6 --- /dev/null +++ b/docs/goose.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-java.svg b/docs/little-chick-java.svg new file mode 100644 index 0000000..cf487ff --- /dev/null +++ b/docs/little-chick-java.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-js.svg b/docs/little-chick-js.svg new file mode 100644 index 0000000..bc91f69 --- /dev/null +++ b/docs/little-chick-js.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-kotlin.svg b/docs/little-chick-kotlin.svg new file mode 100644 index 0000000..ddf06bf --- /dev/null +++ b/docs/little-chick-kotlin.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-linux.svg b/docs/little-chick-linux.svg new file mode 100644 index 0000000..7006599 --- /dev/null +++ b/docs/little-chick-linux.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-node.svg b/docs/little-chick-node.svg new file mode 100644 index 0000000..06c93be --- /dev/null +++ b/docs/little-chick-node.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-spring.svg b/docs/little-chick-spring.svg new file mode 100644 index 0000000..7fa6c27 --- /dev/null +++ b/docs/little-chick-spring.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-sunglasses.svg b/docs/little-chick-sunglasses.svg new file mode 100644 index 0000000..bb4c599 --- /dev/null +++ b/docs/little-chick-sunglasses.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick-swift.svg b/docs/little-chick-swift.svg new file mode 100644 index 0000000..86912b0 --- /dev/null +++ b/docs/little-chick-swift.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/little-chick.svg b/docs/little-chick.svg new file mode 100644 index 0000000..d89d677 --- /dev/null +++ b/docs/little-chick.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ea247e58b504ff28723158594c158dba3abdf617 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 29 Apr 2024 22:28:56 +0900 Subject: [PATCH 115/161] =?UTF-8?q?docs:=20=ED=99=95=EB=A5=A0=ED=91=9C?= =?UTF-8?q?=EC=97=90=20Penguin=20=EA=B3=84=EC=97=B4=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EB=AA=A8=EB=91=90=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 110 ++++++++++---------- docs/penguin-java.svg | 201 ++++++++++++++++++++++++++++++++++++ docs/penguin-js.svg | 152 +++++++++++++++++++++++++++ docs/penguin-kotlin.svg | 181 ++++++++++++++++++++++++++++++++ docs/penguin-linux.svg | 166 +++++++++++++++++++++++++++++ docs/penguin-node.svg | 163 +++++++++++++++++++++++++++++ docs/penguin-spring.svg | 174 +++++++++++++++++++++++++++++++ docs/penguin-sunglasses.svg | 126 ++++++++++++++++++++++ docs/penguin-swift.svg | 178 +++++++++++++++++++++++++++++++ docs/penguin.svg | 109 +++++++++++++++++++ 10 files changed, 1505 insertions(+), 55 deletions(-) create mode 100644 docs/penguin-java.svg create mode 100644 docs/penguin-js.svg create mode 100644 docs/penguin-kotlin.svg create mode 100644 docs/penguin-linux.svg create mode 100644 docs/penguin-node.svg create mode 100644 docs/penguin-spring.svg create mode 100644 docs/penguin-sunglasses.svg create mode 100644 docs/penguin-swift.svg create mode 100644 docs/penguin.svg diff --git a/README.md b/README.md index a3541eb..8bf956e 100644 --- a/README.md +++ b/README.md @@ -107,62 +107,62 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ ### λ“±μž₯ κ°€λŠ₯ν•œ νŽ«λ“€ -| name | ratio | Description | -|-----------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.04 | | -| galchi-cat
| 0.06 | | -| white-cat
| 0.04 | | -| goose
| 1.0 | | -| goose_sunglasses
| 0.05 | | -| goose_kotlin
| 0.01 | | -| goose_java
| 0.01 | | -| goose_js
| 0.01 | | -| goose_node
| 0.01 | | -| goose_swift
| 0.01 | | -| goose_linux
| 0.01 | | -| goose_spring
| 0.01 | | -| little_chick
| 0.9 | | +| name | ratio | Description | +|------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | +| goose
| 1.0 | | +| goose_sunglasses
| 0.05 | | +| goose_kotlin
| 0.01 | | +| goose_java
| 0.01 | | +| goose_js
| 0.01 | | +| goose_node
| 0.01 | | +| goose_swift
| 0.01 | | +| goose_linux
| 0.01 | | +| goose_spring
| 0.01 | | +| little_chick
| 0.9 | | | little_chick_suglasses
| 0.4 | | -| little_chick_kotlin
| 0.01 | | -| little_chick_java
| 0.01 | | -| little_chick_js
| 0.01 | | -| little_chick_node
| 0.01 | | -| little_chick_swift
| 0.01 | | -| little_chick_linux
| 0.01 | | -| little_chick_spring
| 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | +| little_chick_kotlin
| 0.01 | | +| little_chick_java
| 0.01 | | +| little_chick_js
| 0.01 | | +| little_chick_node
| 0.01 | | +| little_chick_swift
| 0.01 | | +| little_chick_linux
| 0.01 | | +| little_chick_spring
| 0.01 | | +| penguin
| 0.5 | | +| penguin_sunglasses
| 0.2 | | +| penguin_kotlin
| 0.01 | | +| penguin_java
| 0.01 | | +| penguin_js
| 0.01 | | +| penguin_node
| 0.01 | | +| penguin_swift
| 0.01 | | +| penguin_linux
| 0.01 | | +| penguin_spring
| 0.01 | | +| pig | 0.2 | | +| pig_sunglasses | 0.08 | | +| pig_kotlin | 0.01 | | +| pig_java | 0.01 | | +| pig_js | 0.01 | | +| pig_node | 0.01 | | +| pig_swift | 0.01 | | +| pig_linux | 0.01 | | +| pig_spring | 0.01 | | +| slime_red | 0.1 | | +| slime_red_kotlin | 0.001 | | +| slime_red_java | 0.001 | | +| slime_red_js | 0.001 | | +| slime_red_node | 0.001 | | +| slime_red_swift | 0.001 | | +| slime_red_linux | 0.001 | | +| slime_green | 0.1 | | +| slime_blue | 0.1 | | ## diff --git a/docs/penguin-java.svg b/docs/penguin-java.svg new file mode 100644 index 0000000..fead90c --- /dev/null +++ b/docs/penguin-java.svg @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-js.svg b/docs/penguin-js.svg new file mode 100644 index 0000000..be9220b --- /dev/null +++ b/docs/penguin-js.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-kotlin.svg b/docs/penguin-kotlin.svg new file mode 100644 index 0000000..09f526d --- /dev/null +++ b/docs/penguin-kotlin.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-linux.svg b/docs/penguin-linux.svg new file mode 100644 index 0000000..17e936b --- /dev/null +++ b/docs/penguin-linux.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-node.svg b/docs/penguin-node.svg new file mode 100644 index 0000000..cbd9185 --- /dev/null +++ b/docs/penguin-node.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-spring.svg b/docs/penguin-spring.svg new file mode 100644 index 0000000..387e2e1 --- /dev/null +++ b/docs/penguin-spring.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-sunglasses.svg b/docs/penguin-sunglasses.svg new file mode 100644 index 0000000..56cbdc1 --- /dev/null +++ b/docs/penguin-sunglasses.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin-swift.svg b/docs/penguin-swift.svg new file mode 100644 index 0000000..ef3fafe --- /dev/null +++ b/docs/penguin-swift.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/penguin.svg b/docs/penguin.svg new file mode 100644 index 0000000..196220f --- /dev/null +++ b/docs/penguin.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 190eb2b17b1b653bc773f8eed06cc1d7b2748527 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 29 Apr 2024 22:38:42 +0900 Subject: [PATCH 116/161] =?UTF-8?q?docs:=20=ED=8E=AB=20=EB=93=B1=EC=9E=A5?= =?UTF-8?q?=20=ED=99=95=EB=A5=A0=ED=91=9C=EC=97=90=20fig=20=EA=B3=84?= =?UTF-8?q?=EC=97=B4=EC=9D=98=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++-- docs/pig-java.svg | 191 ++++++++++++++++++++++++++++++++++++++++ docs/pig-js.svg | 142 +++++++++++++++++++++++++++++ docs/pig-kotlin.svg | 171 +++++++++++++++++++++++++++++++++++ docs/pig-linux.svg | 156 ++++++++++++++++++++++++++++++++ docs/pig-node.svg | 153 ++++++++++++++++++++++++++++++++ docs/pig-spring.svg | 163 ++++++++++++++++++++++++++++++++++ docs/pig-sunglasses.svg | 145 ++++++++++++++++++++++++++++++ docs/pig-swift.svg | 169 +++++++++++++++++++++++++++++++++++ docs/pig.svg | 129 +++++++++++++++++++++++++++ 10 files changed, 1428 insertions(+), 9 deletions(-) create mode 100644 docs/pig-java.svg create mode 100644 docs/pig-js.svg create mode 100644 docs/pig-kotlin.svg create mode 100644 docs/pig-linux.svg create mode 100644 docs/pig-node.svg create mode 100644 docs/pig-spring.svg create mode 100644 docs/pig-sunglasses.svg create mode 100644 docs/pig-swift.svg create mode 100644 docs/pig.svg diff --git a/README.md b/README.md index 8bf956e..3164962 100644 --- a/README.md +++ b/README.md @@ -145,15 +145,15 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | penguin_swift
| 0.01 | | | penguin_linux
| 0.01 | | | penguin_spring
| 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | +| pig
| 0.2 | | +| pig_sunglasses
| 0.08 | | +| pig_kotlin
| 0.01 | | +| pig_java
| 0.01 | | +| pig_js
| 0.01 | | +| pig_node
| 0.01 | | +| pig_swift
| 0.01 | | +| pig_linux
| 0.01 | | +| pig_spring
| 0.01 | | | slime_red | 0.1 | | | slime_red_kotlin | 0.001 | | | slime_red_java | 0.001 | | diff --git a/docs/pig-java.svg b/docs/pig-java.svg new file mode 100644 index 0000000..c1584d3 --- /dev/null +++ b/docs/pig-java.svg @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-js.svg b/docs/pig-js.svg new file mode 100644 index 0000000..5259181 --- /dev/null +++ b/docs/pig-js.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-kotlin.svg b/docs/pig-kotlin.svg new file mode 100644 index 0000000..39cef7f --- /dev/null +++ b/docs/pig-kotlin.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-linux.svg b/docs/pig-linux.svg new file mode 100644 index 0000000..d1b9f10 --- /dev/null +++ b/docs/pig-linux.svg @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-node.svg b/docs/pig-node.svg new file mode 100644 index 0000000..253837a --- /dev/null +++ b/docs/pig-node.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-spring.svg b/docs/pig-spring.svg new file mode 100644 index 0000000..d218750 --- /dev/null +++ b/docs/pig-spring.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-sunglasses.svg b/docs/pig-sunglasses.svg new file mode 100644 index 0000000..69c908b --- /dev/null +++ b/docs/pig-sunglasses.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig-swift.svg b/docs/pig-swift.svg new file mode 100644 index 0000000..b12a30f --- /dev/null +++ b/docs/pig-swift.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pig.svg b/docs/pig.svg new file mode 100644 index 0000000..99c1b7d --- /dev/null +++ b/docs/pig.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 8a9c988ec32bbb8d1389a2206a75193f71e9568e Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 29 Apr 2024 22:45:07 +0900 Subject: [PATCH 117/161] =?UTF-8?q?docs:=20Slime=20=EA=B3=84=EC=97=B4?= =?UTF-8?q?=EC=9D=98=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=ED=99=95?= =?UTF-8?q?=EB=A5=A0=ED=91=9C=EC=97=90=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EA=B3=A0,=20=EC=98=81=EC=96=B4=20=EB=AC=B8=EC=84=9C=EB=A5=BC?= =?UTF-8?q?=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 112 +++++++++---------- README.md | 18 +-- docs/slime-blue.svg | 102 +++++++++++++++++ docs/slime-green.svg | 91 +++++++++++++++ docs/slime-red-java.svg | 227 ++++++++++++++++++++++++++++++++++++++ docs/slime-red-js.svg | 127 +++++++++++++++++++++ docs/slime-red-kotlin.svg | 133 ++++++++++++++++++++++ docs/slime-red-linux.svg | 157 ++++++++++++++++++++++++++ docs/slime-red-node.svg | 115 +++++++++++++++++++ docs/slime-red-swift.svg | 130 ++++++++++++++++++++++ docs/slime-red.svg | 102 +++++++++++++++++ 11 files changed, 1249 insertions(+), 65 deletions(-) create mode 100644 docs/slime-blue.svg create mode 100644 docs/slime-green.svg create mode 100644 docs/slime-red-java.svg create mode 100644 docs/slime-red-js.svg create mode 100644 docs/slime-red-kotlin.svg create mode 100644 docs/slime-red-linux.svg create mode 100644 docs/slime-red-node.svg create mode 100644 docs/slime-red-swift.svg create mode 100644 docs/slime-red.svg diff --git a/ENGLISH.md b/ENGLISH.md index 6170c71..e07473a 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -112,62 +112,62 @@ _New contributions may take up to 1 hour to be reflected._ ### Available Pets -| name | ratio | Description | -|------------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.04 | | -| galchi-cat
| 0.06 | | -| white-cat
| 0.04 | | -| goose | 1.0 | | -| goose_sunglasses | 0.05 | | -| goose_kotlin | 0.01 | | -| goose_java | 0.01 | | -| goose_js | 0.01 | | -| goose_node | 0.01 | | -| goose_swift | 0.01 | | -| goose_linux | 0.01 | | -| goose_spring | 0.01 | | -| little_chick | 0.9 | | -| little_chick_suglasses | 0.4 | | -| little_chick_kotlin | 0.01 | | -| little_chick_java | 0.01 | | -| little_chick_js | 0.01 | | -| little_chick_node | 0.01 | | -| little_chick_swift | 0.01 | | -| little_chick_linux | 0.01 | | -| little_chick_spring | 0.01 | | -| penguin | 0.5 | | -| penguin_sunglasses | 0.2 | | -| penguin_kotlin | 0.01 | | -| penguin_java | 0.01 | | -| penguin_js | 0.01 | | -| penguin_node | 0.01 | | -| penguin_swift | 0.01 | | -| penguin_linux | 0.01 | | -| penguin_spring | 0.01 | | -| pig | 0.2 | | -| pig_sunglasses | 0.08 | | -| pig_kotlin | 0.01 | | -| pig_java | 0.01 | | -| pig_js | 0.01 | | -| pig_node | 0.01 | | -| pig_swift | 0.01 | | -| pig_linux | 0.01 | | -| pig_spring | 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | +| name | ratio | Description | +|------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | +| goose
| 1.0 | | +| goose_sunglasses
| 0.05 | | +| goose_kotlin
| 0.01 | | +| goose_java
| 0.01 | | +| goose_js
| 0.01 | | +| goose_node
| 0.01 | | +| goose_swift
| 0.01 | | +| goose_linux
| 0.01 | | +| goose_spring
| 0.01 | | +| little_chick
| 0.9 | | +| little_chick_suglasses
| 0.4 | | +| little_chick_kotlin
| 0.01 | | +| little_chick_java
| 0.01 | | +| little_chick_js
| 0.01 | | +| little_chick_node
| 0.01 | | +| little_chick_swift
| 0.01 | | +| little_chick_linux
| 0.01 | | +| little_chick_spring
| 0.01 | | +| penguin
| 0.5 | | +| penguin_sunglasses
| 0.2 | | +| penguin_kotlin
| 0.01 | | +| penguin_java
| 0.01 | | +| penguin_js
| 0.01 | | +| penguin_node
| 0.01 | | +| penguin_swift
| 0.01 | | +| penguin_linux
| 0.01 | | +| penguin_spring
| 0.01 | | +| pig
| 0.2 | | +| pig_sunglasses
| 0.08 | | +| pig_kotlin
| 0.01 | | +| pig_java
| 0.01 | | +| pig_js
| 0.01 | | +| pig_node
| 0.01 | | +| pig_swift
| 0.01 | | +| pig_linux
| 0.01 | | +| pig_spring
| 0.01 | | +| slime_red
| 0.1 | | +| slime_red_kotlin
| 0.001 | | +| slime_red_java
| 0.001 | | +| slime_red_js
| 0.001 | | +| slime_red_node
| 0.001 | | +| slime_red_swift
| 0.001 | | +| slime_red_linux
| 0.001 | | +| slime_green
| 0.1 | | +| slime_blue
| 0.1 | | ## diff --git a/README.md b/README.md index 3164962..9169e48 100644 --- a/README.md +++ b/README.md @@ -154,15 +154,15 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | pig_swift
| 0.01 | | | pig_linux
| 0.01 | | | pig_spring
| 0.01 | | -| slime_red | 0.1 | | -| slime_red_kotlin | 0.001 | | -| slime_red_java | 0.001 | | -| slime_red_js | 0.001 | | -| slime_red_node | 0.001 | | -| slime_red_swift | 0.001 | | -| slime_red_linux | 0.001 | | -| slime_green | 0.1 | | -| slime_blue | 0.1 | | +| slime_red
| 0.1 | | +| slime_red_kotlin
| 0.001 | | +| slime_red_java
| 0.001 | | +| slime_red_js
| 0.001 | | +| slime_red_node
| 0.001 | | +| slime_red_swift
| 0.001 | | +| slime_red_linux
| 0.001 | | +| slime_green
| 0.1 | | +| slime_blue
| 0.1 | | ## diff --git a/docs/slime-blue.svg b/docs/slime-blue.svg new file mode 100644 index 0000000..5d7467e --- /dev/null +++ b/docs/slime-blue.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-green.svg b/docs/slime-green.svg new file mode 100644 index 0000000..a270d47 --- /dev/null +++ b/docs/slime-green.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-java.svg b/docs/slime-red-java.svg new file mode 100644 index 0000000..c434d38 --- /dev/null +++ b/docs/slime-red-java.svg @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-js.svg b/docs/slime-red-js.svg new file mode 100644 index 0000000..963958d --- /dev/null +++ b/docs/slime-red-js.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-kotlin.svg b/docs/slime-red-kotlin.svg new file mode 100644 index 0000000..b57f990 --- /dev/null +++ b/docs/slime-red-kotlin.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-linux.svg b/docs/slime-red-linux.svg new file mode 100644 index 0000000..6dd6086 --- /dev/null +++ b/docs/slime-red-linux.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-node.svg b/docs/slime-red-node.svg new file mode 100644 index 0000000..db1579b --- /dev/null +++ b/docs/slime-red-node.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red-swift.svg b/docs/slime-red-swift.svg new file mode 100644 index 0000000..7c71456 --- /dev/null +++ b/docs/slime-red-swift.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-red.svg b/docs/slime-red.svg new file mode 100644 index 0000000..f5ea44d --- /dev/null +++ b/docs/slime-red.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 075fd7caf99044bb324fe060a1fc186f64045376 Mon Sep 17 00:00:00 2001 From: devxb Date: Wed, 1 May 2024 15:00:04 +0900 Subject: [PATCH 118/161] =?UTF-8?q?build:=20actuactor,=20prometheus=20?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 +++-- gradle/monitor.gradle | 3 +++ gradle/spring.gradle | 1 + src/main/resources/application.properties | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 gradle/monitor.gradle diff --git a/build.gradle b/build.gradle index 62448ec..baf8cb5 100644 --- a/build.gradle +++ b/build.gradle @@ -14,8 +14,8 @@ version = "${version}" repositories { mavenCentral() maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots"} - maven { url "https://s01.oss.sonatype.org/content/groups/staging/"} + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://s01.oss.sonatype.org/content/groups/staging/" } } test { @@ -38,4 +38,5 @@ apply from: "gradle/db.gradle" apply from: "gradle/etc.gradle" apply from: "gradle/test.gradle" apply from: "gradle/spring.gradle" +apply from: "gradle/monitor.gradle" apply from: "gradle/jetbrains.gradle" diff --git a/gradle/monitor.gradle b/gradle/monitor.gradle new file mode 100644 index 0000000..94060b0 --- /dev/null +++ b/gradle/monitor.gradle @@ -0,0 +1,3 @@ +dependencies { + runtimeOnly 'io.micrometer:micrometer-registry-prometheus' +} diff --git a/gradle/spring.gradle b/gradle/spring.gradle index 3ec8764..7b8d2bb 100644 --- a/gradle/spring.gradle +++ b/gradle/spring.gradle @@ -6,6 +6,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter" implementation "org.springframework.boot:spring-boot-starter-web" implementation "org.springframework.boot:spring-boot-starter-data-jpa" + implementation "org.springframework.boot:spring-boot-starter-actuator" implementation 'org.springframework.retry:spring-retry' testImplementation "org.springframework.boot:spring-boot-starter-test" diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a48e684..7ad3871 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -27,3 +27,7 @@ sentry.dsn=https://fe1aaf784ec135343909a4a0dfe4f0eb@o4505051656486912.ingest.us. sentry.traces-sample-rate=1.0 white.ip=127.0.0.1,192.168.35.190,192.168.35.139,39.120.67.208 + +spring.application.name=render.gitanimals +management.endpoints.web.exposure.include=prometheus +management.metrics.tags.application=${spring.application.name} From a4b754374fe91733e4aaa90cceb91ce0de4babd4 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 4 May 2024 14:34:42 +0900 Subject: [PATCH 119/161] =?UTF-8?q?refactor:=20Lv=20=ED=8F=B0=ED=8A=B8?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/animal/bbibbi.svg | 8 +++----- src/main/resources/persona/animal/cat.svg | 8 +++----- src/main/resources/persona/animal/cheese-cat.svg | 8 +++----- src/main/resources/persona/animal/flamingo.svg | 8 +++----- src/main/resources/persona/animal/galchi-cat.svg | 8 +++----- src/main/resources/persona/animal/goblin-bag.svg | 8 +++----- src/main/resources/persona/animal/goblin.svg | 8 +++----- src/main/resources/persona/animal/goose-java.svg | 10 ++++------ src/main/resources/persona/animal/goose-js.svg | 10 ++++------ src/main/resources/persona/animal/goose-kotlin.svg | 10 ++++------ src/main/resources/persona/animal/goose-linux.svg | 10 ++++------ src/main/resources/persona/animal/goose-node.svg | 10 ++++------ src/main/resources/persona/animal/goose-spring.svg | 10 ++++------ src/main/resources/persona/animal/goose-sunglasses.svg | 10 ++++------ src/main/resources/persona/animal/goose-swift.svg | 10 ++++------ src/main/resources/persona/animal/goose.svg | 10 ++++------ .../resources/persona/animal/little-chick-java.svg | 8 +++----- src/main/resources/persona/animal/little-chick-js.svg | 8 +++----- .../resources/persona/animal/little-chick-kotlin.svg | 8 +++----- .../resources/persona/animal/little-chick-linux.svg | 8 +++----- .../resources/persona/animal/little-chick-node.svg | 8 +++----- .../resources/persona/animal/little-chick-spring.svg | 8 +++----- .../persona/animal/little-chick-sunglasses.svg | 8 +++----- .../resources/persona/animal/little-chick-swift.svg | 8 +++----- src/main/resources/persona/animal/little-chick.svg | 8 +++----- src/main/resources/persona/animal/penguin-java.svg | 8 +++----- src/main/resources/persona/animal/penguin-js.svg | 8 +++----- src/main/resources/persona/animal/penguin-kotlin.svg | 8 +++----- src/main/resources/persona/animal/penguin-linux.svg | 8 +++----- src/main/resources/persona/animal/penguin-node.svg | 8 +++----- src/main/resources/persona/animal/penguin-spring.svg | 8 +++----- .../resources/persona/animal/penguin-sunglasses.svg | 8 +++----- src/main/resources/persona/animal/penguin-swift.svg | 8 +++----- src/main/resources/persona/animal/penguin.svg | 8 +++----- src/main/resources/persona/animal/pig-java.svg | 8 +++----- src/main/resources/persona/animal/pig-js.svg | 8 +++----- src/main/resources/persona/animal/pig-kotlin.svg | 8 +++----- src/main/resources/persona/animal/pig-linux.svg | 8 +++----- src/main/resources/persona/animal/pig-node.svg | 8 +++----- src/main/resources/persona/animal/pig-spring.svg | 8 +++----- src/main/resources/persona/animal/pig-sunglasses.svg | 8 +++----- src/main/resources/persona/animal/pig-swift.svg | 8 +++----- src/main/resources/persona/animal/pig.svg | 8 +++----- src/main/resources/persona/animal/slime-blue.svg | 8 +++----- src/main/resources/persona/animal/slime-green.svg | 8 +++----- src/main/resources/persona/animal/slime-red-java.svg | 8 +++----- src/main/resources/persona/animal/slime-red-js.svg | 8 +++----- src/main/resources/persona/animal/slime-red-kotlin.svg | 8 +++----- src/main/resources/persona/animal/slime-red-linux.svg | 8 +++----- src/main/resources/persona/animal/slime-red-node.svg | 8 +++----- src/main/resources/persona/animal/slime-red-swift.svg | 8 +++----- src/main/resources/persona/animal/slime-red.svg | 8 +++----- src/main/resources/persona/animal/tenmm.svg | 8 +++----- src/main/resources/persona/animal/white-cat.svg | 8 +++----- 54 files changed, 171 insertions(+), 279 deletions(-) diff --git a/src/main/resources/persona/animal/bbibbi.svg b/src/main/resources/persona/animal/bbibbi.svg index 5981ded..3888646 100644 --- a/src/main/resources/persona/animal/bbibbi.svg +++ b/src/main/resources/persona/animal/bbibbi.svg @@ -83,11 +83,9 @@
- - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/cat.svg b/src/main/resources/persona/animal/cat.svg index dddc37b..de00d94 100644 --- a/src/main/resources/persona/animal/cat.svg +++ b/src/main/resources/persona/animal/cat.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/cheese-cat.svg b/src/main/resources/persona/animal/cheese-cat.svg index cf72961..d0b3efa 100644 --- a/src/main/resources/persona/animal/cheese-cat.svg +++ b/src/main/resources/persona/animal/cheese-cat.svg @@ -130,11 +130,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg index cabc45a..ce2829c 100644 --- a/src/main/resources/persona/animal/flamingo.svg +++ b/src/main/resources/persona/animal/flamingo.svg @@ -46,11 +46,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/galchi-cat.svg b/src/main/resources/persona/animal/galchi-cat.svg index 6dfcb60..91c90cf 100644 --- a/src/main/resources/persona/animal/galchi-cat.svg +++ b/src/main/resources/persona/animal/galchi-cat.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg index 7d29a18..c83f4ed 100644 --- a/src/main/resources/persona/animal/goblin-bag.svg +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -83,11 +83,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index ed78824..0584d57 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -83,11 +83,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index dec3670..2a0fdb2 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index f35c8d6..9f43514 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 6c06ebb..5935157 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index 5d70e0c..0d837b7 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index 7d69a2e..c7237e3 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index 1b0e585..898633d 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 6316d1b..710a921 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -86,12 +86,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index a551df6..26108b0 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -116,12 +116,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index fba7e74..5c1c41c 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -86,12 +86,10 @@ - - - - - - + + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index ec4a15d..78475fe 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index 60995df..238a71a 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index f8d35c0..cf4c144 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index a6cfd79..7ec726b 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index 64ab35a..b357e47 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index c994efb..c7e87fa 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index b284865..a3e4b1a 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -89,11 +89,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index 90e6ac7..03f332e 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -119,11 +119,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 3f38676..43a8cf0 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -89,11 +89,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index b1d752c..b6002ba 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-js.svg b/src/main/resources/persona/animal/penguin-js.svg index a8f092a..45523b6 100644 --- a/src/main/resources/persona/animal/penguin-js.svg +++ b/src/main/resources/persona/animal/penguin-js.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-kotlin.svg b/src/main/resources/persona/animal/penguin-kotlin.svg index 25ac321..2fba761 100644 --- a/src/main/resources/persona/animal/penguin-kotlin.svg +++ b/src/main/resources/persona/animal/penguin-kotlin.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-linux.svg b/src/main/resources/persona/animal/penguin-linux.svg index 527e08e..5228d40 100644 --- a/src/main/resources/persona/animal/penguin-linux.svg +++ b/src/main/resources/persona/animal/penguin-linux.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-node.svg b/src/main/resources/persona/animal/penguin-node.svg index e61bc58..fbe46ca 100644 --- a/src/main/resources/persona/animal/penguin-node.svg +++ b/src/main/resources/persona/animal/penguin-node.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-spring.svg b/src/main/resources/persona/animal/penguin-spring.svg index fbc24ec..c3cec2d 100644 --- a/src/main/resources/persona/animal/penguin-spring.svg +++ b/src/main/resources/persona/animal/penguin-spring.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-sunglasses.svg b/src/main/resources/persona/animal/penguin-sunglasses.svg index 9ccb1ea..48bec04 100644 --- a/src/main/resources/persona/animal/penguin-sunglasses.svg +++ b/src/main/resources/persona/animal/penguin-sunglasses.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin-swift.svg b/src/main/resources/persona/animal/penguin-swift.svg index dc34417..4936353 100644 --- a/src/main/resources/persona/animal/penguin-swift.svg +++ b/src/main/resources/persona/animal/penguin-swift.svg @@ -135,11 +135,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/penguin.svg b/src/main/resources/persona/animal/penguin.svg index a4e7f90..7306651 100644 --- a/src/main/resources/persona/animal/penguin.svg +++ b/src/main/resources/persona/animal/penguin.svg @@ -106,11 +106,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-java.svg b/src/main/resources/persona/animal/pig-java.svg index efde512..992094a 100644 --- a/src/main/resources/persona/animal/pig-java.svg +++ b/src/main/resources/persona/animal/pig-java.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-js.svg b/src/main/resources/persona/animal/pig-js.svg index 7aef597..dcb6643 100644 --- a/src/main/resources/persona/animal/pig-js.svg +++ b/src/main/resources/persona/animal/pig-js.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-kotlin.svg b/src/main/resources/persona/animal/pig-kotlin.svg index 117aeca..037857f 100644 --- a/src/main/resources/persona/animal/pig-kotlin.svg +++ b/src/main/resources/persona/animal/pig-kotlin.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-linux.svg b/src/main/resources/persona/animal/pig-linux.svg index fb1fa7a..48c20d8 100644 --- a/src/main/resources/persona/animal/pig-linux.svg +++ b/src/main/resources/persona/animal/pig-linux.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-node.svg b/src/main/resources/persona/animal/pig-node.svg index 928c7b2..533847e 100644 --- a/src/main/resources/persona/animal/pig-node.svg +++ b/src/main/resources/persona/animal/pig-node.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-spring.svg b/src/main/resources/persona/animal/pig-spring.svg index 62e3140..d05d100 100644 --- a/src/main/resources/persona/animal/pig-spring.svg +++ b/src/main/resources/persona/animal/pig-spring.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-sunglasses.svg b/src/main/resources/persona/animal/pig-sunglasses.svg index cf9c004..985d260 100644 --- a/src/main/resources/persona/animal/pig-sunglasses.svg +++ b/src/main/resources/persona/animal/pig-sunglasses.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig-swift.svg b/src/main/resources/persona/animal/pig-swift.svg index 8501a5d..14d0b03 100644 --- a/src/main/resources/persona/animal/pig-swift.svg +++ b/src/main/resources/persona/animal/pig-swift.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/pig.svg b/src/main/resources/persona/animal/pig.svg index f69c763..cd1e463 100644 --- a/src/main/resources/persona/animal/pig.svg +++ b/src/main/resources/persona/animal/pig.svg @@ -105,11 +105,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-blue.svg b/src/main/resources/persona/animal/slime-blue.svg index c82e0bd..73e000a 100644 --- a/src/main/resources/persona/animal/slime-blue.svg +++ b/src/main/resources/persona/animal/slime-blue.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-green.svg b/src/main/resources/persona/animal/slime-green.svg index 6212bc8..0019ab6 100644 --- a/src/main/resources/persona/animal/slime-green.svg +++ b/src/main/resources/persona/animal/slime-green.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-java.svg b/src/main/resources/persona/animal/slime-red-java.svg index 983ddc4..7b61b3d 100644 --- a/src/main/resources/persona/animal/slime-red-java.svg +++ b/src/main/resources/persona/animal/slime-red-java.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-js.svg b/src/main/resources/persona/animal/slime-red-js.svg index 8a3767e..6085518 100644 --- a/src/main/resources/persona/animal/slime-red-js.svg +++ b/src/main/resources/persona/animal/slime-red-js.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-kotlin.svg b/src/main/resources/persona/animal/slime-red-kotlin.svg index ec9dae5..dd4a1f0 100644 --- a/src/main/resources/persona/animal/slime-red-kotlin.svg +++ b/src/main/resources/persona/animal/slime-red-kotlin.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-linux.svg b/src/main/resources/persona/animal/slime-red-linux.svg index faf1e51..e55cceb 100644 --- a/src/main/resources/persona/animal/slime-red-linux.svg +++ b/src/main/resources/persona/animal/slime-red-linux.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-node.svg b/src/main/resources/persona/animal/slime-red-node.svg index 4fd4271..e1ebc1b 100644 --- a/src/main/resources/persona/animal/slime-red-node.svg +++ b/src/main/resources/persona/animal/slime-red-node.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red-swift.svg b/src/main/resources/persona/animal/slime-red-swift.svg index 185d6a6..965dde6 100644 --- a/src/main/resources/persona/animal/slime-red-swift.svg +++ b/src/main/resources/persona/animal/slime-red-swift.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/slime-red.svg b/src/main/resources/persona/animal/slime-red.svg index 18ce7e5..3af8514 100644 --- a/src/main/resources/persona/animal/slime-red.svg +++ b/src/main/resources/persona/animal/slime-red.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/tenmm.svg b/src/main/resources/persona/animal/tenmm.svg index 78746c0..722d5a9 100644 --- a/src/main/resources/persona/animal/tenmm.svg +++ b/src/main/resources/persona/animal/tenmm.svg @@ -89,11 +89,9 @@ - - - - - + + + *{level} diff --git a/src/main/resources/persona/animal/white-cat.svg b/src/main/resources/persona/animal/white-cat.svg index 2a17e6d..06907a7 100644 --- a/src/main/resources/persona/animal/white-cat.svg +++ b/src/main/resources/persona/animal/white-cat.svg @@ -86,11 +86,9 @@ - - - - - + + + *{level} From 542f5b0dda55e534b4387618641373693ea2c489 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 16:52:09 +0900 Subject: [PATCH 120/161] =?UTF-8?q?fix:=20cat-type=EC=9D=98=20lv,=20contri?= =?UTF-8?q?butions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 253 +++--- src/main/resources/persona/animal/cat.svg | 350 +++++---- .../resources/persona/animal/cheese-cat.svg | 67 +- .../resources/persona/animal/galchi-cat.svg | 166 ++-- src/test/resources/persona/goose/test.svg | 741 +++++++++++++++--- 5 files changed, 1063 insertions(+), 514 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index fea27ab..a0e3052 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -8,8 +8,6 @@ import kotlin.random.Random enum class PersonaType(private val weight: Double) { GOOSE(1.0) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -31,8 +29,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_SUNGLASSES(0.05) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseSunglassesSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -54,8 +50,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_KOTLIN(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseKotlinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -77,8 +71,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_JAVA(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseJavaSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -100,8 +92,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_JS(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseJsSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -123,8 +113,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_NODE(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseNodeSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -146,8 +134,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_SWIFT(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseSwiftSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -169,8 +155,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_LINUX(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseLinuxSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -192,8 +176,6 @@ enum class PersonaType(private val weight: Double) { GOOSE_SPRING(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val goose = gooseSpringSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -215,8 +197,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK(0.9) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -238,8 +218,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_SUNGLASSES(0.4) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickSunglassesSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -261,8 +239,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_KOTLIN(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickKotlinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -284,8 +260,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_JAVA(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickJavaSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -307,8 +281,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_JS(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickJsSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -330,8 +302,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_NODE(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickNodeSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -353,8 +323,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_SWIFT(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickSwiftSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -376,8 +344,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_LINUX(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickLinuxSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -399,8 +365,6 @@ enum class PersonaType(private val weight: Double) { LITTLE_CHICK_SPRING(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - val littleChick = littleChickSpringSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -422,8 +386,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN(0.5) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -441,8 +403,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_SUNGLASSES(0.2) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinSunglassesSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -460,8 +420,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_KOTLIN(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinKotlinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -479,8 +437,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_JAVA(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinJavaSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -498,8 +454,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_JS(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinJsSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -517,8 +471,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_NODE(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinNodeSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -536,8 +488,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_SWIFT(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinSwiftSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -555,8 +505,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_LINUX(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinLinuxSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -574,8 +522,6 @@ enum class PersonaType(private val weight: Double) { PENGUIN_SPRING(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return penguinSpringSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -593,8 +539,6 @@ enum class PersonaType(private val weight: Double) { PIG(0.2) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -611,8 +555,6 @@ enum class PersonaType(private val weight: Double) { PIG_SUNGLASSES(0.08) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigSunglassesSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -629,8 +571,6 @@ enum class PersonaType(private val weight: Double) { PIG_KOTLIN(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigKotlinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -647,8 +587,6 @@ enum class PersonaType(private val weight: Double) { PIG_JAVA(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigJavaSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -665,8 +603,6 @@ enum class PersonaType(private val weight: Double) { PIG_JS(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigJsSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -683,8 +619,6 @@ enum class PersonaType(private val weight: Double) { PIG_NODE(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigNodeSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -701,8 +635,6 @@ enum class PersonaType(private val weight: Double) { PIG_SWIFT(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigSwiftSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -719,8 +651,6 @@ enum class PersonaType(private val weight: Double) { PIG_LINUX(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigLinuxSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -737,8 +667,6 @@ enum class PersonaType(private val weight: Double) { PIG_SPRING(0.01) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return pigSpringSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{leg-iteration-count}", "360") @@ -755,8 +683,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED(0.1) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -773,8 +699,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_KOTLIN(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedKotlinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -791,8 +715,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_JAVA(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedJavaSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -809,8 +731,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_JS(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedJsSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -827,8 +747,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_NODE(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedNodeSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -845,8 +763,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_SWIFT(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedSwiftSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -863,8 +779,6 @@ enum class PersonaType(private val weight: Double) { SLIME_RED_LINUX(0.001) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeRedLinuxSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -881,8 +795,6 @@ enum class PersonaType(private val weight: Double) { SLIME_BLUE(0.1) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeBlueSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -899,8 +811,6 @@ enum class PersonaType(private val weight: Double) { SLIME_GREEN(0.1) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return slimeGreenSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -917,8 +827,6 @@ enum class PersonaType(private val weight: Double) { FLAMINGO(0.05) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return flamingoSvg.replace("*{position}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -941,8 +849,6 @@ enum class PersonaType(private val weight: Double) { TEN_MM(0.000) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return tenmmSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -959,8 +865,6 @@ enum class PersonaType(private val weight: Double) { GOBLIN(0.06) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return goblinSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -977,8 +881,6 @@ enum class PersonaType(private val weight: Double) { GOBLIN_BAG(0.03) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return goblinBagSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -995,8 +897,6 @@ enum class PersonaType(private val weight: Double) { BBIBBI(0.000) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return bbibbiSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -1013,8 +913,6 @@ enum class PersonaType(private val weight: Double) { CAT(0.1) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return catSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -1031,8 +929,6 @@ enum class PersonaType(private val weight: Double) { CHEESE_CAT(0.04) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return cheeseCatSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -1049,8 +945,6 @@ enum class PersonaType(private val weight: Double) { GALCHI_CAT(0.06) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return galchiCatSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -1067,8 +961,6 @@ enum class PersonaType(private val weight: Double) { WHITE_CAT(0.04) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { - check(persona.id != null) { "Save persona first before call load()" } - return whiteCatSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) @@ -1148,25 +1040,96 @@ enum class PersonaType(private val weight: Double) { duration: String, personaWidth: Long, ): StringBuilder { + val movingPoints = getMovingPoints(speed) + + makeMove(movingPoints, personaWidth, id, type, duration) + reverseFlipped(movingPoints, duration) + + return this + } + + private fun StringBuilder.makeMove( + movingPoints: List, + personaWidth: Long, + id: Long, + type: String, + duration: String + ) { + this.append("@keyframes move-$id {") + + var beforeMovingPoint = movingPoints.first() + movingPoints.forEach { movingPoint -> + if (beforeMovingPoint.scale != movingPoint.scale) { + this.append("${min(100.0, beforeMovingPoint.percentage + 0.01)}% {") + .append("transform:translate(${beforeMovingPoint.x - (personaWidth * movingPoint.scale)}%, ${beforeMovingPoint.y}%) rotate(${beforeMovingPoint.angle}deg) scaleX(${movingPoint.scale});") + .append("}") + } + this.append("${movingPoint.percentage}% {") + .append("transform:translate(${movingPoint.x}%, ${movingPoint.y}%) rotate(${movingPoint.angle}deg) scaleX(${movingPoint.scale});") + .append("}") + beforeMovingPoint = movingPoint + } + this.append("}") + .append("#$type-$id {") + .append("animation-name: move-$id;") + .append("animation-duration: $duration;") + .append("animation-iteration-count: 1;") + .append("animation-fill-mode: forwards;") + .append("}") + } + + private fun StringBuilder.reverseFlipped( + movingPoints: List, + duration: String + ) { + this.append("@keyframes reverse-flip {") + var beforeMovingPoint = movingPoints.first() + movingPoints.forEach { movingPoint -> + if (beforeMovingPoint.scale != movingPoint.scale) { + this.append("${min(100.0, beforeMovingPoint.percentage + 0.01)}% {") + .append("transform-origin: 17.75px 0px;") + .append("transform: scaleX(${movingPoint.scale});") + .append("}") + } + this.append("${movingPoint.percentage}% {") + .append("transform-origin: 17.75px 0px;") + .append("transform: scaleX(${movingPoint.scale});") + .append("}") + beforeMovingPoint = movingPoint + } + this.append("}") + .append("#contributions-wrap, #level-tag-wrap, #level-wrap {") + .append("animation-name: reverse-flip;") + .append("animation-duration: $duration;") + .append("animation-iteration-count: 1;") + .append("animation-fill-mode: forwards;") + .append("}") + } + + private fun getMovingPoints(speed: Int): List { + val movingPoints = mutableListOf() var currentY = Random.nextInt(30, 80) var currentX = Random.nextInt(10, 90) - var currentAngle = (Random.nextDouble() * 10).toInt() - var currentScale = Random.nextInt(0, 2) - 1 - if (currentScale == 0) { - currentScale++ + val startAngle = (Random.nextDouble() * 10).toInt() + val startScale = when (Random.nextInt(0, 2) - 1) { + 0 -> 1 + else -> -1 } - this.append("@keyframes move-$id {") - .append("0% {") - .append("-webkit-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") - .append("-ms-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") - .append("-o-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") - .append("-moz-transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") - .append("transform:translate($currentY%, $currentX%) rotate(${currentAngle}deg) scaleX($currentScale);") - .append("}") var animationPercentage = 0.0 - while (animationPercentage < 100) { - val beforeAnimationPercentage = animationPercentage + + movingPoints.add( + MovingPoint( + animationPercentage, + currentY, + currentX, + startAngle, + startScale + ) + ) + + while (animationPercentage < 100.0) { animationPercentage += Random.nextInt(2, 6) + animationPercentage = min(100.0, animationPercentage) val nextY = Random.nextInt(max(20, min(79, currentY - speed)), min(80, currentY + speed)) val nextX = @@ -1179,35 +1142,21 @@ enum class PersonaType(private val weight: Double) { true -> 1 false -> -1 } - if (nextScale != currentScale) { - this.append("${min(100.0, beforeAnimationPercentage + 0.01)}% {") - .append("-webkit-transform: translate(${currentX - (personaWidth * nextScale)}%, ${currentY}%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-ms-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-o-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("-moz-transform: translate(${currentX - (personaWidth * nextScale)}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("transform: translate(${{ currentX - (personaWidth * nextScale) }}%, $currentY%) rotate(${currentAngle}deg) scaleX($nextScale);") - .append("}") - } - this.append("${min(100.0, animationPercentage)}% {") - .append("-webkit-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") - .append("-ms-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") - .append("-o-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") - .append("-moz-transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") - .append("transform:translate($nextX%, $nextY%) rotate(${nextAngle}deg) scaleX($nextScale);") - .append("}") + + movingPoints.add( + MovingPoint( + animationPercentage, + nextY, + nextX, + nextAngle, + nextScale + ) + ) + currentY = nextY currentX = nextX - currentAngle = nextAngle - currentScale = nextScale } - this.append("}") - .append("#$type-$id {") - .append("animation-name: move-$id;") - .append("animation-duration: $duration;") - .append("animation-iteration-count: 1;") - .append("animation-fill-mode: forwards;") - .append("}") - return this + return movingPoints } private fun Long.toSvg(levelStartX: Double, xIncrease: Double): String { @@ -1232,4 +1181,12 @@ enum class PersonaType(private val weight: Double) { return builder.toString() } } + + private data class MovingPoint( + val percentage: Double, + val y: Int, + val x: Int, + val angle: Int, + val scale: Int, + ) } diff --git a/src/main/resources/persona/animal/cat.svg b/src/main/resources/persona/animal/cat.svg index de00d94..bda837b 100644 --- a/src/main/resources/persona/animal/cat.svg +++ b/src/main/resources/persona/animal/cat.svg @@ -1,184 +1,196 @@ - - - - - - - - - - - *{contribution} - - - - - - - - + + + + + + + + - - - - - - *{level} + + + + *{contribution} + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + *{level} + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/cheese-cat.svg b/src/main/resources/persona/animal/cheese-cat.svg index d0b3efa..fb23511 100644 --- a/src/main/resources/persona/animal/cheese-cat.svg +++ b/src/main/resources/persona/animal/cheese-cat.svg @@ -105,36 +105,49 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + + *{level} - - - - - - - - - - *{level} - @@ -295,8 +308,10 @@ fill="black" fill-opacity="0.1"/> - - + + diff --git a/src/main/resources/persona/animal/galchi-cat.svg b/src/main/resources/persona/animal/galchi-cat.svg index 91c90cf..4370f57 100644 --- a/src/main/resources/persona/animal/galchi-cat.svg +++ b/src/main/resources/persona/animal/galchi-cat.svg @@ -61,37 +61,48 @@ - - - - - - - - - - *{contribution} + + + + + + - + + + + *{contribution} + + + - - - - + + + + + + - - - - + + + + + + + + *{level} - *{level} - + + + @@ -141,59 +152,94 @@ - - + + - + - - - - + + + + - + - - - - - - - + + + + + + + - - + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 21bda03..5eec1ea 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,68 +1,391 @@ - - - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + *{level} - - - - - - - - - - *{level} - @@ -132,131 +143,231 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - + + + - + - - - + + + - - - - - - - + + + + + + + - - - + + + - - - + + + - + - - - - + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - + + + - - - - - - + + + + + + - - - - - - - + + + + + + + From 101f80e0b43cd3238d621944a02e73216faff695 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:10:18 +0900 Subject: [PATCH 122/161] =?UTF-8?q?fix:=20FLAMINGO=20=EC=9D=98=20lv,=20con?= =?UTF-8?q?tributions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 5 +- .../resources/persona/animal/flamingo.svg | 171 ++++++++++-------- 2 files changed, 92 insertions(+), 84 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index dc30ae1..820c9aa 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -839,10 +839,7 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String { val x = Random.nextInt(25, 75) val y = Random.nextInt(0, 50) - val scale = when (Random.nextBoolean()) { - true -> 1 - false -> -1 - } + val scale = 1 return "translate(${x}%, ${y}%) scaleX($scale)" } }, diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg index ce2829c..40c0142 100644 --- a/src/main/resources/persona/animal/flamingo.svg +++ b/src/main/resources/persona/animal/flamingo.svg @@ -1,28 +1,29 @@ - - + + @@ -39,75 +40,85 @@ + + + + + - + *{level} - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + From 0932fceb978b861c2a461432feb9786e8b9bff0c Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:15:21 +0900 Subject: [PATCH 123/161] =?UTF-8?q?fix:=20GOBLIN=20=EC=9D=98=20lv,=20contr?= =?UTF-8?q?ibutions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 4 +- .../resources/persona/animal/goblin-bag.svg | 59 +++++++++++-------- src/main/resources/persona/animal/goblin.svg | 59 +++++++++++-------- 3 files changed, 70 insertions(+), 52 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 820c9aa..133b0b3 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -872,7 +872,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("goblin", id, 15, "180s", 5) + StringBuilder().moveRandomly("goblin", id, 15, "180s", 5, 14.5) .toString() }, @@ -888,7 +888,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("goblin-bag", id, 15, "180s", 5) + StringBuilder().moveRandomly("goblin-bag", id, 15, "180s", 5, 14.5) .toString() }, diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg index c83f4ed..bf14275 100644 --- a/src/main/resources/persona/animal/goblin-bag.svg +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -59,36 +59,45 @@ } - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + - - - - *{contribution} + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index 0584d57..61c2d72 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -59,36 +59,45 @@ } - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + - - - - *{contribution} + + + + + + + + *{level} - - - - - - - - - - *{level} - - From 41e96e14e2eb314d91d2df15b676672dfab97325 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:18:37 +0900 Subject: [PATCH 124/161] =?UTF-8?q?fix:=20TEN=5FMM=20=EC=9D=98=20lv,=20con?= =?UTF-8?q?tributions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 2 +- src/main/resources/persona/animal/tenmm.svg | 57 ++++++++++++------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 133b0b3..ee5e200 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -856,7 +856,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("tenmm", id, 15, "180s", 5) + StringBuilder().moveRandomly("tenmm", id, 15, "180s", 5, 28.5) .toString() }, diff --git a/src/main/resources/persona/animal/tenmm.svg b/src/main/resources/persona/animal/tenmm.svg index 722d5a9..48f5db4 100644 --- a/src/main/resources/persona/animal/tenmm.svg +++ b/src/main/resources/persona/animal/tenmm.svg @@ -65,36 +65,49 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - + + + - - *{contribution} + + + + + *{level} - - - - - + - - - - - *{level} - - From 14a87d3217eacc7a3be510993d19a07168b201e7 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:19:34 +0900 Subject: [PATCH 125/161] =?UTF-8?q?fix:=20WHITE=5FCAT=20=EC=9D=98=20lv,=20?= =?UTF-8?q?contributions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/persona/animal/white-cat.svg | 62 +++++++++++-------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/src/main/resources/persona/animal/white-cat.svg b/src/main/resources/persona/animal/white-cat.svg index 06907a7..b89b5ef 100644 --- a/src/main/resources/persona/animal/white-cat.svg +++ b/src/main/resources/persona/animal/white-cat.svg @@ -61,37 +61,47 @@ - - - - - - - - - - *{contribution} + + + + + + - + + + + *{contribution} + + + - - - - - - - - - - - *{level} + + + + + + + + + + + + + *{level} + + + + From 7c7e265e2a89ead83c93194fa4b548cb10f92de6 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:28:42 +0900 Subject: [PATCH 126/161] =?UTF-8?q?fix:=20GOOSE=20=EC=9D=98=20lv,=20contri?= =?UTF-8?q?butions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 +- .../resources/persona/animal/goose-java.svg | 533 ++++++++++-------- .../resources/persona/animal/goose-js.svg | 385 +++++++------ .../resources/persona/animal/goose-kotlin.svg | 373 ++++++------ .../resources/persona/animal/goose-linux.svg | 454 +++++++-------- .../resources/persona/animal/goose-node.svg | 416 +++++++------- .../resources/persona/animal/goose-spring.svg | 483 ++++++++-------- .../persona/animal/goose-sunglasses.svg | 342 +++++------ .../resources/persona/animal/goose-swift.svg | 461 ++++++++------- src/main/resources/persona/animal/goose.svg | 59 +- 10 files changed, 1876 insertions(+), 1648 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index ee5e200..e51b815 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -23,7 +23,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -44,7 +44,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -65,7 +65,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -86,7 +86,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -107,7 +107,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -128,7 +128,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -149,7 +149,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -170,7 +170,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, @@ -191,7 +191,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("goose", id, 20, "180s", 7) + .moveRandomly("goose", id, 20, "180s", 7, 33.0) .toString() }, diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index 2a0fdb2..d2d7699 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -1,99 +1,100 @@ - - + + @@ -110,160 +111,228 @@ + + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index 9f43514..b49ddee 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -1,99 +1,100 @@ - - + + @@ -110,111 +111,131 @@ + + + + + + - + *{level} + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 5935157..17878c7 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -94,195 +94,204 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + - - - - *{contribution} + + + + + + + + *{level} - - - - - - - - + + + + + + + + - *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index 0d837b7..2cc74c2 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -1,99 +1,100 @@ - - + + @@ -110,150 +111,159 @@ + + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index c7237e3..257dade 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -1,99 +1,100 @@ + #node-*{id}-logo { + animation-name:move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -110,122 +111,151 @@ + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index 898633d..414792d 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -1,99 +1,100 @@ + #spring-*{id}-logo { + animation-name:move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -110,166 +111,174 @@ + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 710a921..3225073 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -1,69 +1,70 @@ - - + + @@ -80,115 +81,138 @@ + + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index 26108b0..a73141b 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -1,99 +1,100 @@ + #swift-*{id}-logo { + animation-name:move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -110,137 +111,181 @@ + + + + + - + *{level} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index 5c1c41c..8752cf2 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -64,35 +64,46 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - Date: Mon, 6 May 2024 17:40:08 +0900 Subject: [PATCH 127/161] =?UTF-8?q?fix:=20LITTLE=5FCHICK=20=EC=9D=98=20lv,?= =?UTF-8?q?=20contributions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 +- .../persona/animal/little-chick-java.svg | 490 ++++++++++-------- .../persona/animal/little-chick-js.svg | 343 ++++++------ .../persona/animal/little-chick-kotlin.svg | 431 ++++++++------- .../persona/animal/little-chick-linux.svg | 412 ++++++++------- .../persona/animal/little-chick-node.svg | 377 +++++++------- .../persona/animal/little-chick-spring.svg | 444 ++++++++-------- .../animal/little-chick-sunglasses.svg | 58 ++- .../persona/animal/little-chick-swift.svg | 421 ++++++++------- .../resources/persona/animal/little-chick.svg | 285 +++++----- 10 files changed, 1765 insertions(+), 1514 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index e51b815..087ca1c 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -212,7 +212,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -233,7 +233,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -254,7 +254,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -275,7 +275,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -296,7 +296,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2 ,16.0) .toString() }, @@ -317,7 +317,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -338,7 +338,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -359,7 +359,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -380,7 +380,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index 78475fe..50b1993 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -1,100 +1,101 @@ + #java-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,138 +112,205 @@ + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index 238a71a..703ec48 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -1,100 +1,101 @@ + #js-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,89 +112,107 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index cf4c144..d4a36ee 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -1,100 +1,101 @@ + #kotlin-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,118 +112,166 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index 7ec726b..38f5690 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -1,100 +1,101 @@ + #linux-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,128 +112,137 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index b357e47..8a54c9d 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -1,100 +1,101 @@ + #node-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,100 +112,130 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index c7e87fa..9d168d3 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -1,100 +1,101 @@ + #spring-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,144 +112,153 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index a3e4b1a..b79ac2a 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -65,36 +65,46 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - + + + - - *{contribution} + + + + + *{level} - - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index 03f332e..a1335df 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -1,100 +1,101 @@ + #swift-*{id}-logo { + animation-name: move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -111,115 +112,159 @@ + + + - - - - - - *{level} - - + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 43a8cf0..4c54ddd 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -1,156 +1,165 @@ + #little-chick-leg { + animation-name:little-chick-move-leg; + animation-duration:0.5s; + animation-iteration-count:*{leg-iteration-count}; + animation-timing-function: ease-in; + } + - - - - - - - - - - - *{contribution} - - - - - - - + + + + + + + + - - - - - *{level} + + *{contribution} + + + + + + + + + - - - - - + + + + + + *{level} + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5d7de7f72c84a17cbe751b0d7a2b8e0339471a10 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 17:57:39 +0900 Subject: [PATCH 128/161] =?UTF-8?q?fix:=20PENGUIN=20=EC=9D=98=20lv,=20cont?= =?UTF-8?q?ributions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 +- .../resources/persona/animal/penguin-java.svg | 59 +-- .../resources/persona/animal/penguin-js.svg | 336 ++++++++++-------- .../persona/animal/penguin-kotlin.svg | 59 +-- .../persona/animal/penguin-linux.svg | 59 +-- .../resources/persona/animal/penguin-node.svg | 59 +-- .../persona/animal/penguin-spring.svg | 60 ++-- .../persona/animal/penguin-sunglasses.svg | 59 +-- .../persona/animal/penguin-swift.svg | 60 ++-- src/main/resources/persona/animal/penguin.svg | 60 ++-- 10 files changed, 468 insertions(+), 361 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 087ca1c..07950cc 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -397,7 +397,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 6) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 6, 22.5) .toString() }, @@ -414,7 +414,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 6) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 6, 22.5) .toString() }, @@ -431,7 +431,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -448,7 +448,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -465,7 +465,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -482,7 +482,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -499,7 +499,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -516,7 +516,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, @@ -533,7 +533,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("penguin", id, 10, "180s", 10) + StringBuilder().moveRandomly("penguin", id, 10, "180s", 10, 22.5) .toString() }, diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index b6002ba..35fc5a0 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -94,27 +94,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-js.svg b/src/main/resources/persona/animal/penguin-js.svg index 45523b6..16dc9c9 100644 --- a/src/main/resources/persona/animal/penguin-js.svg +++ b/src/main/resources/persona/animal/penguin-js.svg @@ -1,99 +1,100 @@ + #js-*{id}-logo { + animation-name:move-*{id}-logo; + animation-duration:1s; + animation-iteration-count:infinite; + } + - + + @@ -110,90 +111,109 @@ + + + - - - - - - - - + + + - + *{level} + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + + diff --git a/src/main/resources/persona/animal/penguin-kotlin.svg b/src/main/resources/persona/animal/penguin-kotlin.svg index 2fba761..37839ae 100644 --- a/src/main/resources/persona/animal/penguin-kotlin.svg +++ b/src/main/resources/persona/animal/penguin-kotlin.svg @@ -94,27 +94,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-linux.svg b/src/main/resources/persona/animal/penguin-linux.svg index 5228d40..5b1518a 100644 --- a/src/main/resources/persona/animal/penguin-linux.svg +++ b/src/main/resources/persona/animal/penguin-linux.svg @@ -94,27 +94,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-node.svg b/src/main/resources/persona/animal/penguin-node.svg index fbe46ca..1b6d361 100644 --- a/src/main/resources/persona/animal/penguin-node.svg +++ b/src/main/resources/persona/animal/penguin-node.svg @@ -94,27 +94,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-spring.svg b/src/main/resources/persona/animal/penguin-spring.svg index c3cec2d..3f35559 100644 --- a/src/main/resources/persona/animal/penguin-spring.svg +++ b/src/main/resources/persona/animal/penguin-spring.svg @@ -94,27 +94,46 @@ - - - - - + + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-sunglasses.svg b/src/main/resources/persona/animal/penguin-sunglasses.svg index 48bec04..fd74efe 100644 --- a/src/main/resources/persona/animal/penguin-sunglasses.svg +++ b/src/main/resources/persona/animal/penguin-sunglasses.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin-swift.svg b/src/main/resources/persona/animal/penguin-swift.svg index 4936353..55b8960 100644 --- a/src/main/resources/persona/animal/penguin-swift.svg +++ b/src/main/resources/persona/animal/penguin-swift.svg @@ -94,27 +94,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/penguin.svg b/src/main/resources/persona/animal/penguin.svg index 7306651..dc84706 100644 --- a/src/main/resources/persona/animal/penguin.svg +++ b/src/main/resources/persona/animal/penguin.svg @@ -64,28 +64,45 @@ - - - - - - - - - - *{contribution} + + + + + + - + + + + *{contribution} + + + - - - - + + + + + + + + + + + + + + *{level} + + + - - - - - *{level} - - From 1c07ef9ee4878d58f4ca1ca2224e1d5b79575948 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 18:02:54 +0900 Subject: [PATCH 129/161] =?UTF-8?q?fix:=20PIG=20=EC=9D=98=20lv,=20contribu?= =?UTF-8?q?tions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 47 +++++++++------ .../resources/persona/animal/pig-java.svg | 59 ++++++++++-------- src/main/resources/persona/animal/pig-js.svg | 60 +++++++++++-------- .../resources/persona/animal/pig-kotlin.svg | 59 ++++++++++-------- .../resources/persona/animal/pig-linux.svg | 59 ++++++++++-------- .../resources/persona/animal/pig-node.svg | 59 ++++++++++-------- .../resources/persona/animal/pig-spring.svg | 60 +++++++++++-------- .../persona/animal/pig-sunglasses.svg | 59 ++++++++++-------- .../resources/persona/animal/pig-swift.svg | 59 ++++++++++-------- src/main/resources/persona/animal/pig.svg | 59 ++++++++++-------- 10 files changed, 345 insertions(+), 235 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 07950cc..c7d3fd4 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -296,7 +296,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = StringBuilder() - .moveRandomly("little-chick", id, 40, "180s", 2 ,16.0) + .moveRandomly("little-chick", id, 40, "180s", 2, 16.0) .toString() }, @@ -549,8 +549,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_SUNGLASSES(0.08) { @@ -565,8 +566,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_KOTLIN(0.01) { @@ -581,8 +583,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_JAVA(0.01) { @@ -597,8 +600,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_JS(0.01) { @@ -613,8 +617,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_NODE(0.01) { @@ -629,8 +634,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_SWIFT(0.01) { @@ -645,8 +651,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_LINUX(0.01) { @@ -661,8 +668,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, PIG_SPRING(0.01) { @@ -677,8 +685,9 @@ enum class PersonaType(private val weight: Double) { ) } - override fun act(id: Long): String = StringBuilder().moveRandomly("fig", id, 5, "180s", 10) - .toString() + override fun act(id: Long): String = + StringBuilder().moveRandomly("fig", id, 5, "180s", 10, 60.5) + .toString() }, SLIME_RED(0.1) { diff --git a/src/main/resources/persona/animal/pig-java.svg b/src/main/resources/persona/animal/pig-java.svg index 992094a..8369e48 100644 --- a/src/main/resources/persona/animal/pig-java.svg +++ b/src/main/resources/persona/animal/pig-java.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-js.svg b/src/main/resources/persona/animal/pig-js.svg index dcb6643..aab9809 100644 --- a/src/main/resources/persona/animal/pig-js.svg +++ b/src/main/resources/persona/animal/pig-js.svg @@ -64,27 +64,46 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - + - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-kotlin.svg b/src/main/resources/persona/animal/pig-kotlin.svg index 037857f..644ea2f 100644 --- a/src/main/resources/persona/animal/pig-kotlin.svg +++ b/src/main/resources/persona/animal/pig-kotlin.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-linux.svg b/src/main/resources/persona/animal/pig-linux.svg index 48c20d8..a93e8ca 100644 --- a/src/main/resources/persona/animal/pig-linux.svg +++ b/src/main/resources/persona/animal/pig-linux.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-node.svg b/src/main/resources/persona/animal/pig-node.svg index 533847e..32a4a1e 100644 --- a/src/main/resources/persona/animal/pig-node.svg +++ b/src/main/resources/persona/animal/pig-node.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-spring.svg b/src/main/resources/persona/animal/pig-spring.svg index d05d100..0b4c18f 100644 --- a/src/main/resources/persona/animal/pig-spring.svg +++ b/src/main/resources/persona/animal/pig-spring.svg @@ -64,27 +64,46 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - + - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-sunglasses.svg b/src/main/resources/persona/animal/pig-sunglasses.svg index 985d260..4157155 100644 --- a/src/main/resources/persona/animal/pig-sunglasses.svg +++ b/src/main/resources/persona/animal/pig-sunglasses.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig-swift.svg b/src/main/resources/persona/animal/pig-swift.svg index 14d0b03..e870814 100644 --- a/src/main/resources/persona/animal/pig-swift.svg +++ b/src/main/resources/persona/animal/pig-swift.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - diff --git a/src/main/resources/persona/animal/pig.svg b/src/main/resources/persona/animal/pig.svg index cd1e463..162778a 100644 --- a/src/main/resources/persona/animal/pig.svg +++ b/src/main/resources/persona/animal/pig.svg @@ -64,27 +64,45 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - From 8f88176c3769618974aacab85e45375864f13d83 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 18:08:15 +0900 Subject: [PATCH 130/161] =?UTF-8?q?fix:=20SLIME=20=EC=9D=98=20lv,=20contri?= =?UTF-8?q?butions=20=EC=A2=8C=EC=9A=B0=20=EB=B0=98=EC=A0=84=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 18 +++--- .../resources/persona/animal/slime-blue.svg | 59 +++++++++++-------- .../resources/persona/animal/slime-green.svg | 58 ++++++++++-------- .../persona/animal/slime-red-java.svg | 59 +++++++++++-------- .../resources/persona/animal/slime-red-js.svg | 59 +++++++++++-------- .../persona/animal/slime-red-kotlin.svg | 59 +++++++++++-------- .../persona/animal/slime-red-linux.svg | 59 +++++++++++-------- .../persona/animal/slime-red-node.svg | 59 +++++++++++-------- .../persona/animal/slime-red-swift.svg | 59 +++++++++++-------- .../resources/persona/animal/slime-red.svg | 59 +++++++++++-------- 10 files changed, 324 insertions(+), 224 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index c7d3fd4..74d81b1 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -702,7 +702,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -718,7 +718,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -734,7 +734,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -750,7 +750,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -766,7 +766,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -782,7 +782,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -798,7 +798,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -814,7 +814,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, @@ -830,7 +830,7 @@ enum class PersonaType(private val weight: Double) { } override fun act(id: Long): String = - StringBuilder().moveRandomly("slime", id, 15, "180s", 5) + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) .toString() }, diff --git a/src/main/resources/persona/animal/slime-blue.svg b/src/main/resources/persona/animal/slime-blue.svg index 73e000a..58cc6c9 100644 --- a/src/main/resources/persona/animal/slime-blue.svg +++ b/src/main/resources/persona/animal/slime-blue.svg @@ -63,35 +63,46 @@ - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + + + + + + + + + - - - - *{contribution} + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - - - - - - + + + + + + + + + + + *{contribution} + + - - - - *{contribution} + + + + + + + + + + + + + + + + + *{level} - - - - - - - - - - *{level} - - Date: Mon, 6 May 2024 18:15:50 +0900 Subject: [PATCH 131/161] =?UTF-8?q?refactor:=20flippedWidth=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=EA=B0=92=EC=9D=84=20=EC=82=AD=EC=A0=9C=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 74d81b1..4577f17 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1051,7 +1051,7 @@ enum class PersonaType(private val weight: Double) { speed: Int, duration: String, personaWidth: Long, - flippedWidth: Double = 17.5, + flippedWidth: Double, ): StringBuilder { val movingPoints = getMovingPoints(speed) From 9def75128612012ebc0d1a867055dcfe296ef60d Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 6 May 2024 18:44:38 +0900 Subject: [PATCH 132/161] =?UTF-8?q?fix:=20=EB=AA=A8=EB=93=A0=20persona?= =?UTF-8?q?=EB=93=A4=EC=9D=B4=20=EC=84=9C=EB=A1=9C=20=EB=8B=A4=EB=A5=B8=20?= =?UTF-8?q?flip=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/PersonaType.kt | 9 +- src/main/resources/persona/animal/bbibbi.svg | 6 +- src/main/resources/persona/animal/cat.svg | 6 +- .../resources/persona/animal/cheese-cat.svg | 6 +- .../resources/persona/animal/flamingo.svg | 6 +- .../resources/persona/animal/galchi-cat.svg | 6 +- .../resources/persona/animal/goblin-bag.svg | 6 +- src/main/resources/persona/animal/goblin.svg | 6 +- .../resources/persona/animal/goose-java.svg | 6 +- .../resources/persona/animal/goose-js.svg | 6 +- .../resources/persona/animal/goose-kotlin.svg | 6 +- .../resources/persona/animal/goose-linux.svg | 6 +- .../resources/persona/animal/goose-node.svg | 6 +- .../resources/persona/animal/goose-spring.svg | 6 +- .../persona/animal/goose-sunglasses.svg | 6 +- .../resources/persona/animal/goose-swift.svg | 6 +- src/main/resources/persona/animal/goose.svg | 6 +- .../persona/animal/little-chick-java.svg | 6 +- .../persona/animal/little-chick-js.svg | 6 +- .../persona/animal/little-chick-kotlin.svg | 6 +- .../persona/animal/little-chick-linux.svg | 6 +- .../persona/animal/little-chick-node.svg | 6 +- .../persona/animal/little-chick-spring.svg | 6 +- .../animal/little-chick-sunglasses.svg | 6 +- .../persona/animal/little-chick-swift.svg | 6 +- .../resources/persona/animal/little-chick.svg | 6 +- .../resources/persona/animal/penguin-java.svg | 6 +- .../resources/persona/animal/penguin-js.svg | 6 +- .../persona/animal/penguin-kotlin.svg | 6 +- .../persona/animal/penguin-linux.svg | 6 +- .../resources/persona/animal/penguin-node.svg | 6 +- .../persona/animal/penguin-spring.svg | 6 +- .../persona/animal/penguin-sunglasses.svg | 6 +- .../persona/animal/penguin-swift.svg | 6 +- src/main/resources/persona/animal/penguin.svg | 6 +- .../resources/persona/animal/pig-java.svg | 6 +- src/main/resources/persona/animal/pig-js.svg | 6 +- .../resources/persona/animal/pig-kotlin.svg | 6 +- .../resources/persona/animal/pig-linux.svg | 6 +- .../resources/persona/animal/pig-node.svg | 6 +- .../resources/persona/animal/pig-spring.svg | 6 +- .../persona/animal/pig-sunglasses.svg | 6 +- .../resources/persona/animal/pig-swift.svg | 6 +- src/main/resources/persona/animal/pig.svg | 6 +- .../resources/persona/animal/slime-blue.svg | 6 +- .../resources/persona/animal/slime-green.svg | 6 +- .../persona/animal/slime-red-java.svg | 6 +- .../resources/persona/animal/slime-red-js.svg | 6 +- .../persona/animal/slime-red-kotlin.svg | 6 +- .../persona/animal/slime-red-linux.svg | 6 +- .../persona/animal/slime-red-node.svg | 6 +- .../persona/animal/slime-red-swift.svg | 6 +- .../resources/persona/animal/slime-red.svg | 6 +- src/main/resources/persona/animal/tenmm.svg | 6 +- .../resources/persona/animal/white-cat.svg | 6 +- src/test/resources/persona/goose/test.svg | 417 +++++++++--------- 56 files changed, 386 insertions(+), 364 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 4577f17..4e72f80 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1056,7 +1056,7 @@ enum class PersonaType(private val weight: Double) { val movingPoints = getMovingPoints(speed) makeMove(movingPoints, personaWidth, id, type, duration) - reverseFlipped(movingPoints, flippedWidth, duration) + reverseFlipped(id, movingPoints, flippedWidth, duration) return this } @@ -1092,11 +1092,12 @@ enum class PersonaType(private val weight: Double) { } private fun StringBuilder.reverseFlipped( + id: Long, movingPoints: List, flippedWith: Double, duration: String ) { - this.append("@keyframes reverse-flip {") + this.append("@keyframes reverse-flip-$id {") var beforeMovingPoint = movingPoints.first() movingPoints.forEach { movingPoint -> if (beforeMovingPoint.scale != movingPoint.scale) { @@ -1112,8 +1113,8 @@ enum class PersonaType(private val weight: Double) { beforeMovingPoint = movingPoint } this.append("}") - .append("#contributions-wrap, #level-tag-wrap, #level-wrap {") - .append("animation-name: reverse-flip;") + .append("#contributions-wrap-$id, #level-tag-wrap-$id, #level-wrap-$id {") + .append("animation-name: reverse-flip-$id;") .append("animation-duration: $duration;") .append("animation-iteration-count: 1;") .append("animation-fill-mode: forwards;") diff --git a/src/main/resources/persona/animal/bbibbi.svg b/src/main/resources/persona/animal/bbibbi.svg index 6e25548..2038c72 100644 --- a/src/main/resources/persona/animal/bbibbi.svg +++ b/src/main/resources/persona/animal/bbibbi.svg @@ -59,7 +59,7 @@ } - + @@ -79,14 +79,14 @@ - + - + diff --git a/src/main/resources/persona/animal/cat.svg b/src/main/resources/persona/animal/cat.svg index bda837b..99681bd 100644 --- a/src/main/resources/persona/animal/cat.svg +++ b/src/main/resources/persona/animal/cat.svg @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/src/main/resources/persona/animal/cheese-cat.svg b/src/main/resources/persona/animal/cheese-cat.svg index fb23511..89dea51 100644 --- a/src/main/resources/persona/animal/cheese-cat.svg +++ b/src/main/resources/persona/animal/cheese-cat.svg @@ -105,7 +105,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -133,7 +133,7 @@ - + diff --git a/src/main/resources/persona/animal/flamingo.svg b/src/main/resources/persona/animal/flamingo.svg index 40c0142..ef1a29a 100644 --- a/src/main/resources/persona/animal/flamingo.svg +++ b/src/main/resources/persona/animal/flamingo.svg @@ -23,7 +23,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/src/main/resources/persona/animal/galchi-cat.svg b/src/main/resources/persona/animal/galchi-cat.svg index 4370f57..26caccb 100644 --- a/src/main/resources/persona/animal/galchi-cat.svg +++ b/src/main/resources/persona/animal/galchi-cat.svg @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/src/main/resources/persona/animal/goblin-bag.svg b/src/main/resources/persona/animal/goblin-bag.svg index bf14275..f6ec0c9 100644 --- a/src/main/resources/persona/animal/goblin-bag.svg +++ b/src/main/resources/persona/animal/goblin-bag.svg @@ -59,7 +59,7 @@ } - + @@ -78,14 +78,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goblin.svg b/src/main/resources/persona/animal/goblin.svg index 61c2d72..f8cecf2 100644 --- a/src/main/resources/persona/animal/goblin.svg +++ b/src/main/resources/persona/animal/goblin.svg @@ -59,7 +59,7 @@ } - + @@ -78,14 +78,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goose-java.svg b/src/main/resources/persona/animal/goose-java.svg index d2d7699..f93306c 100644 --- a/src/main/resources/persona/animal/goose-java.svg +++ b/src/main/resources/persona/animal/goose-java.svg @@ -94,7 +94,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + diff --git a/src/main/resources/persona/animal/goose-js.svg b/src/main/resources/persona/animal/goose-js.svg index b49ddee..570b2ed 100644 --- a/src/main/resources/persona/animal/goose-js.svg +++ b/src/main/resources/persona/animal/goose-js.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/goose-kotlin.svg b/src/main/resources/persona/animal/goose-kotlin.svg index 17878c7..2770f0c 100644 --- a/src/main/resources/persona/animal/goose-kotlin.svg +++ b/src/main/resources/persona/animal/goose-kotlin.svg @@ -94,7 +94,7 @@ - + @@ -112,14 +112,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goose-linux.svg b/src/main/resources/persona/animal/goose-linux.svg index 2cc74c2..8fe495f 100644 --- a/src/main/resources/persona/animal/goose-linux.svg +++ b/src/main/resources/persona/animal/goose-linux.svg @@ -94,7 +94,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + diff --git a/src/main/resources/persona/animal/goose-node.svg b/src/main/resources/persona/animal/goose-node.svg index 257dade..fe3b60e 100644 --- a/src/main/resources/persona/animal/goose-node.svg +++ b/src/main/resources/persona/animal/goose-node.svg @@ -94,7 +94,7 @@ - + @@ -112,14 +112,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goose-spring.svg b/src/main/resources/persona/animal/goose-spring.svg index 414792d..4c793ec 100644 --- a/src/main/resources/persona/animal/goose-spring.svg +++ b/src/main/resources/persona/animal/goose-spring.svg @@ -94,7 +94,7 @@ - + @@ -112,14 +112,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goose-sunglasses.svg b/src/main/resources/persona/animal/goose-sunglasses.svg index 3225073..24fd132 100644 --- a/src/main/resources/persona/animal/goose-sunglasses.svg +++ b/src/main/resources/persona/animal/goose-sunglasses.svg @@ -64,7 +64,7 @@ - + @@ -83,14 +83,14 @@ - + - + diff --git a/src/main/resources/persona/animal/goose-swift.svg b/src/main/resources/persona/animal/goose-swift.svg index a73141b..a2fa684 100644 --- a/src/main/resources/persona/animal/goose-swift.svg +++ b/src/main/resources/persona/animal/goose-swift.svg @@ -94,7 +94,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + diff --git a/src/main/resources/persona/animal/goose.svg b/src/main/resources/persona/animal/goose.svg index 8752cf2..35a6e41 100644 --- a/src/main/resources/persona/animal/goose.svg +++ b/src/main/resources/persona/animal/goose.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-java.svg b/src/main/resources/persona/animal/little-chick-java.svg index 50b1993..c73c3cf 100644 --- a/src/main/resources/persona/animal/little-chick-java.svg +++ b/src/main/resources/persona/animal/little-chick-java.svg @@ -95,7 +95,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-js.svg b/src/main/resources/persona/animal/little-chick-js.svg index 703ec48..1173931 100644 --- a/src/main/resources/persona/animal/little-chick-js.svg +++ b/src/main/resources/persona/animal/little-chick-js.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-kotlin.svg b/src/main/resources/persona/animal/little-chick-kotlin.svg index d4a36ee..53517a4 100644 --- a/src/main/resources/persona/animal/little-chick-kotlin.svg +++ b/src/main/resources/persona/animal/little-chick-kotlin.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-linux.svg b/src/main/resources/persona/animal/little-chick-linux.svg index 38f5690..504a1ae 100644 --- a/src/main/resources/persona/animal/little-chick-linux.svg +++ b/src/main/resources/persona/animal/little-chick-linux.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-node.svg b/src/main/resources/persona/animal/little-chick-node.svg index 8a54c9d..9f87e70 100644 --- a/src/main/resources/persona/animal/little-chick-node.svg +++ b/src/main/resources/persona/animal/little-chick-node.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-spring.svg b/src/main/resources/persona/animal/little-chick-spring.svg index 9d168d3..d09f3ba 100644 --- a/src/main/resources/persona/animal/little-chick-spring.svg +++ b/src/main/resources/persona/animal/little-chick-spring.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-sunglasses.svg b/src/main/resources/persona/animal/little-chick-sunglasses.svg index b79ac2a..d8fad66 100644 --- a/src/main/resources/persona/animal/little-chick-sunglasses.svg +++ b/src/main/resources/persona/animal/little-chick-sunglasses.svg @@ -65,7 +65,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -92,7 +92,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick-swift.svg b/src/main/resources/persona/animal/little-chick-swift.svg index a1335df..5ee8d78 100644 --- a/src/main/resources/persona/animal/little-chick-swift.svg +++ b/src/main/resources/persona/animal/little-chick-swift.svg @@ -95,7 +95,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/little-chick.svg b/src/main/resources/persona/animal/little-chick.svg index 4c54ddd..52cd8bb 100644 --- a/src/main/resources/persona/animal/little-chick.svg +++ b/src/main/resources/persona/animal/little-chick.svg @@ -65,7 +65,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-java.svg b/src/main/resources/persona/animal/penguin-java.svg index 35fc5a0..a63da87 100644 --- a/src/main/resources/persona/animal/penguin-java.svg +++ b/src/main/resources/persona/animal/penguin-java.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-js.svg b/src/main/resources/persona/animal/penguin-js.svg index 16dc9c9..526b6c1 100644 --- a/src/main/resources/persona/animal/penguin-js.svg +++ b/src/main/resources/persona/animal/penguin-js.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-kotlin.svg b/src/main/resources/persona/animal/penguin-kotlin.svg index 37839ae..1ae9887 100644 --- a/src/main/resources/persona/animal/penguin-kotlin.svg +++ b/src/main/resources/persona/animal/penguin-kotlin.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-linux.svg b/src/main/resources/persona/animal/penguin-linux.svg index 5b1518a..76cdd5e 100644 --- a/src/main/resources/persona/animal/penguin-linux.svg +++ b/src/main/resources/persona/animal/penguin-linux.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-node.svg b/src/main/resources/persona/animal/penguin-node.svg index 1b6d361..e8a7549 100644 --- a/src/main/resources/persona/animal/penguin-node.svg +++ b/src/main/resources/persona/animal/penguin-node.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-spring.svg b/src/main/resources/persona/animal/penguin-spring.svg index 3f35559..b80c38e 100644 --- a/src/main/resources/persona/animal/penguin-spring.svg +++ b/src/main/resources/persona/animal/penguin-spring.svg @@ -94,7 +94,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,7 +122,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-sunglasses.svg b/src/main/resources/persona/animal/penguin-sunglasses.svg index fd74efe..7276c67 100644 --- a/src/main/resources/persona/animal/penguin-sunglasses.svg +++ b/src/main/resources/persona/animal/penguin-sunglasses.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin-swift.svg b/src/main/resources/persona/animal/penguin-swift.svg index 55b8960..6cc0280 100644 --- a/src/main/resources/persona/animal/penguin-swift.svg +++ b/src/main/resources/persona/animal/penguin-swift.svg @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/main/resources/persona/animal/penguin.svg b/src/main/resources/persona/animal/penguin.svg index dc84706..7a8332d 100644 --- a/src/main/resources/persona/animal/penguin.svg +++ b/src/main/resources/persona/animal/penguin.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-java.svg b/src/main/resources/persona/animal/pig-java.svg index 8369e48..d9e3793 100644 --- a/src/main/resources/persona/animal/pig-java.svg +++ b/src/main/resources/persona/animal/pig-java.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-js.svg b/src/main/resources/persona/animal/pig-js.svg index aab9809..3c90967 100644 --- a/src/main/resources/persona/animal/pig-js.svg +++ b/src/main/resources/persona/animal/pig-js.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-kotlin.svg b/src/main/resources/persona/animal/pig-kotlin.svg index 644ea2f..62fd803 100644 --- a/src/main/resources/persona/animal/pig-kotlin.svg +++ b/src/main/resources/persona/animal/pig-kotlin.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-linux.svg b/src/main/resources/persona/animal/pig-linux.svg index a93e8ca..4350d92 100644 --- a/src/main/resources/persona/animal/pig-linux.svg +++ b/src/main/resources/persona/animal/pig-linux.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-node.svg b/src/main/resources/persona/animal/pig-node.svg index 32a4a1e..7ba5713 100644 --- a/src/main/resources/persona/animal/pig-node.svg +++ b/src/main/resources/persona/animal/pig-node.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-spring.svg b/src/main/resources/persona/animal/pig-spring.svg index 0b4c18f..43846a7 100644 --- a/src/main/resources/persona/animal/pig-spring.svg +++ b/src/main/resources/persona/animal/pig-spring.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-sunglasses.svg b/src/main/resources/persona/animal/pig-sunglasses.svg index 4157155..000e6b2 100644 --- a/src/main/resources/persona/animal/pig-sunglasses.svg +++ b/src/main/resources/persona/animal/pig-sunglasses.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig-swift.svg b/src/main/resources/persona/animal/pig-swift.svg index e870814..cd081be 100644 --- a/src/main/resources/persona/animal/pig-swift.svg +++ b/src/main/resources/persona/animal/pig-swift.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/pig.svg b/src/main/resources/persona/animal/pig.svg index 162778a..f3758ea 100644 --- a/src/main/resources/persona/animal/pig.svg +++ b/src/main/resources/persona/animal/pig.svg @@ -64,7 +64,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-blue.svg b/src/main/resources/persona/animal/slime-blue.svg index 58cc6c9..740d93f 100644 --- a/src/main/resources/persona/animal/slime-blue.svg +++ b/src/main/resources/persona/animal/slime-blue.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-green.svg b/src/main/resources/persona/animal/slime-green.svg index 51412a4..64b4afe 100644 --- a/src/main/resources/persona/animal/slime-green.svg +++ b/src/main/resources/persona/animal/slime-green.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-java.svg b/src/main/resources/persona/animal/slime-red-java.svg index 29eacdc..5d3f9a6 100644 --- a/src/main/resources/persona/animal/slime-red-java.svg +++ b/src/main/resources/persona/animal/slime-red-java.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-js.svg b/src/main/resources/persona/animal/slime-red-js.svg index e21b874..4a1614e 100644 --- a/src/main/resources/persona/animal/slime-red-js.svg +++ b/src/main/resources/persona/animal/slime-red-js.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-kotlin.svg b/src/main/resources/persona/animal/slime-red-kotlin.svg index 7b48ab4..d44a388 100644 --- a/src/main/resources/persona/animal/slime-red-kotlin.svg +++ b/src/main/resources/persona/animal/slime-red-kotlin.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-linux.svg b/src/main/resources/persona/animal/slime-red-linux.svg index 8ad9744..8905ed5 100644 --- a/src/main/resources/persona/animal/slime-red-linux.svg +++ b/src/main/resources/persona/animal/slime-red-linux.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-node.svg b/src/main/resources/persona/animal/slime-red-node.svg index f47bf82..6efc3fe 100644 --- a/src/main/resources/persona/animal/slime-red-node.svg +++ b/src/main/resources/persona/animal/slime-red-node.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red-swift.svg b/src/main/resources/persona/animal/slime-red-swift.svg index 70c443a..46dd4a2 100644 --- a/src/main/resources/persona/animal/slime-red-swift.svg +++ b/src/main/resources/persona/animal/slime-red-swift.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/slime-red.svg b/src/main/resources/persona/animal/slime-red.svg index 45f4d39..a97e99e 100644 --- a/src/main/resources/persona/animal/slime-red.svg +++ b/src/main/resources/persona/animal/slime-red.svg @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/main/resources/persona/animal/tenmm.svg b/src/main/resources/persona/animal/tenmm.svg index 48f5db4..3e300dd 100644 --- a/src/main/resources/persona/animal/tenmm.svg +++ b/src/main/resources/persona/animal/tenmm.svg @@ -65,7 +65,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -92,7 +92,7 @@ - + diff --git a/src/main/resources/persona/animal/white-cat.svg b/src/main/resources/persona/animal/white-cat.svg index b89b5ef..114c0b3 100644 --- a/src/main/resources/persona/animal/white-cat.svg +++ b/src/main/resources/persona/animal/white-cat.svg @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 5eec1ea..c3fc860 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,142 +1,127 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - Date: Thu, 9 May 2024 23:52:00 +0900 Subject: [PATCH 133/161] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=93=A0=20url?= =?UTF-8?q?=EC=97=90=20CORS=EC=84=A4=EC=A0=95=EC=9D=84=20=ED=91=BC?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/controller/filter/CorsFilter.kt | 10 +--------- src/test/resources/application.properties | 2 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt b/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt index 4165d18..ee08188 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/filter/CorsFilter.kt @@ -4,7 +4,6 @@ import jakarta.servlet.Filter import jakarta.servlet.FilterChain import jakarta.servlet.ServletRequest import jakarta.servlet.ServletResponse -import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import org.springframework.http.HttpHeaders import org.springframework.stereotype.Component @@ -17,10 +16,7 @@ class CorsFilter : Filter { response: ServletResponse, chain: FilterChain ) { - (request as HttpServletRequest) - if (regexMatcher.matches(request.requestURI)) { - (response as HttpServletResponse).allowCors() - } + (response as HttpServletResponse).allowCors() chain.doFilter(request, response) } @@ -34,8 +30,4 @@ class CorsFilter : Filter { ) return this } - - private companion object { - private val regexMatcher = Regex("/users/.*") - } } diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index ee33bc9..83d5efb 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -29,3 +29,5 @@ netx.logging.level=info ### GITHUB ### github.token=1234 + +white.ip=127.0.0.1 From 1e552a1dafc893ce77b2c1ace9b4a0f73f8d0f48 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 14:36:24 +0900 Subject: [PATCH 134/161] =?UTF-8?q?feat:=20=EB=82=99=EA=B4=80=EC=A0=81?= =?UTF-8?q?=EB=9D=BD=20retry=20=EB=A1=9C=EC=A7=81=EC=9D=B4=20=EB=B9=A0?= =?UTF-8?q?=EC=A7=84=EB=B6=80=EB=B6=84=EC=97=90=20retry=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/UserService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index f55ee71..0264459 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -49,6 +49,7 @@ class UserService( fun createNewUser(name: String, contributions: Map): User = userRepository.save(User.newUser(name, contributions)) + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional fun giveBonusPersona(id: Long, persona: String) { requireIdempotency("$id:bonus") @@ -58,6 +59,7 @@ class UserService( user.giveBonusPersona(persona) } + @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional fun changePersona(id: Long, personChangeRequest: PersonaChangeRequest) { val user = getUserById(id) From c5037c293975ce03dc7c086a1bde6e0d7e6c9de0 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 15:03:57 +0900 Subject: [PATCH 135/161] =?UTF-8?q?fix:=20modifiedAt=EC=9D=B4=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/domain/AbstractTime.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/AbstractTime.kt b/src/main/kotlin/org/gitanimals/render/domain/AbstractTime.kt index 0b86180..85f6ec8 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/AbstractTime.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/AbstractTime.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.domain import jakarta.persistence.Column import jakarta.persistence.MappedSuperclass +import jakarta.persistence.PrePersist import org.springframework.data.annotation.CreatedDate import org.springframework.data.annotation.LastModifiedDate import java.time.Instant @@ -14,5 +15,14 @@ abstract class AbstractTime( @LastModifiedDate @Column(name = "modified_at") - val modifiedAt: Instant = createdAt, -) + var modifiedAt: Instant? = null, +) { + + @PrePersist + fun prePersist() { + modifiedAt = when (modifiedAt == null) { + true -> createdAt + false -> return + } + } +} From 54ed65ed30d3969ecc766da74961000097b904c6 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 15:05:48 +0900 Subject: [PATCH 136/161] =?UTF-8?q?refactor:=20persona=EC=97=90=20version?= =?UTF-8?q?=20=ED=95=84=EB=93=9C=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EB=82=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/Persona.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt index e22ccb3..da8f6a1 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Persona.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Persona.kt @@ -26,6 +26,10 @@ class Persona( @JoinColumn(name = "user_id") @ManyToOne(fetch = FetchType.LAZY, optional = false) var user: User? = null, + + @Version + @Column(name = "version", nullable = false) + var version: Long? = null, ) : AbstractTime() { constructor( From e18133a1426aec5f9e6d592be36633b47497251c Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 16:07:16 +0900 Subject: [PATCH 137/161] =?UTF-8?q?build:=20Netx=20=EB=B2=84=EC=A0=84?= =?UTF-8?q?=EC=9D=84=200.4.3=EC=9C=BC=EB=A1=9C=20=EC=98=AC=EB=A6=B0?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e7ca5ce..9651458 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ kotestExtensionSpringVersion=1.1.3 testContainerVersion=1.19.3 ### Netx ### -netxVersion=0.4.2 +netxVersion=0.4.3 ### Sentry ### sentryVersion=4.4.0 From 965d24f500f13f41d22ca78dc75148bbfad11871 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 16:07:36 +0900 Subject: [PATCH 138/161] =?UTF-8?q?test:=20UsedCouponSagaHandlerTest=20?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/saga/UsedCouponSagaHandlerTest.kt | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt diff --git a/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt b/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt new file mode 100644 index 0000000..f6cdbbf --- /dev/null +++ b/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt @@ -0,0 +1,65 @@ +package org.gitanimals.render.saga + +import io.kotest.assertions.nondeterministic.eventually +import io.kotest.core.annotation.DisplayName +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.collections.shouldHaveSize +import io.kotest.matchers.equals.shouldBeEqual +import io.kotest.matchers.should +import org.gitanimals.render.domain.PersonaType +import org.gitanimals.render.domain.UserRepository +import org.gitanimals.render.domain.user +import org.gitanimals.render.saga.event.CouponUsed +import org.gitanimals.render.supports.RedisContainer +import org.rooftop.netx.api.SagaManager +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.data.repository.findByIdOrNull +import kotlin.time.Duration.Companion.seconds + +@SpringBootTest( + classes = [ + RedisContainer::class, + ] +) +@DisplayName("UsedCouponSagaHandler 클래슀의") +internal class UsedCouponSagaHandlerTest( + private val sagaManager: SagaManager, + private val userRepository: UserRepository, +) : DescribeSpec({ + + beforeTest { + userRepository.deleteAll() + userRepository.saveAndFlush(user) + } + + describe("handleCouponUsedCommitEvent λ©”μ†Œλ“œλŠ”") { + context("CouponUsed commit eventλ₯Ό λ°›μœΌλ©΄") { + val sagaId = sagaManager.startSync() + + val couponUsed = CouponUsed( + userId = user.id, + code = "NEW_USER_BONUS_PET", + dynamic = "GOOSE", + ) + + it("coupon을 μ‚¬μš©ν•œλ‹€.") { + sagaManager.commitSync(sagaId, couponUsed) + + Thread.sleep(1.seconds.inWholeMilliseconds) + + eventually(5.seconds) { + val user = userRepository.findByIdOrNull(user.id)!! + + user.personas.shouldHaveSize(1) + .should { + it.first().type shouldBeEqual PersonaType.GOOSE + } + } + } + } + } +}) { + companion object { + private var user = user() + } +} From 0c612fbfbf1479389556770dfcb3832a80d7e303 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 16:15:41 +0900 Subject: [PATCH 139/161] =?UTF-8?q?refactor:=20coupon=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EB=8C=80=EC=83=81=20=EC=8B=9D=EB=B3=84=EC=9D=84=20userId?= =?UTF-8?q?=EC=97=90=EC=84=9C=20username=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/UserService.kt | 6 +++--- .../org/gitanimals/render/saga/UsedCouponSagaHandlers.kt | 2 +- .../kotlin/org/gitanimals/render/saga/event/CouponUsed.kt | 1 + .../org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 0264459..d0670ae 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -51,10 +51,10 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun giveBonusPersona(id: Long, persona: String) { - requireIdempotency("$id:bonus") + fun giveBonusPersona(name: String, persona: String) { + requireIdempotency("$name:bonus") - val user = getUserById(id) + val user = getUserByName(name) user.giveBonusPersona(persona) } diff --git a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt index 1c5eafd..3f3e407 100644 --- a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt +++ b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt @@ -19,6 +19,6 @@ class UsedCouponSagaHandlers( } sagaCommitEvent.setNextEvent(couponUsed) - userService.giveBonusPersona(couponUsed.userId, couponUsed.dynamic) + userService.giveBonusPersona(couponUsed.username, couponUsed.dynamic) } } diff --git a/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt b/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt index 377dfa4..3c2a6e7 100644 --- a/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt +++ b/src/main/kotlin/org/gitanimals/render/saga/event/CouponUsed.kt @@ -2,6 +2,7 @@ package org.gitanimals.render.saga.event data class CouponUsed( val userId: Long, + val username: String, val code: String, val dynamic: String, ) diff --git a/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt b/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt index f6cdbbf..5bcede6 100644 --- a/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt +++ b/src/test/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlerTest.kt @@ -38,6 +38,7 @@ internal class UsedCouponSagaHandlerTest( val couponUsed = CouponUsed( userId = user.id, + username = user.name, code = "NEW_USER_BONUS_PET", dynamic = "GOOSE", ) From 4dce8eb7e87ce2e74d165c3b24110f7124176505 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 11 May 2024 16:48:02 +0900 Subject: [PATCH 140/161] =?UTF-8?q?refactor:=20user-api=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EC=9D=98=20user=EC=99=80=20username=20=EC=8B=9D=EB=B3=84?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/app/UserFacade.kt | 8 +++---- .../gitanimals/render/domain/UserService.kt | 21 ++++++++----------- .../render/domain/UserServiceTest.kt | 3 +-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt index 5f2eb21..9806c2e 100644 --- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -14,24 +14,24 @@ class UserFacade( fun changePersona(token: String, personChangeRequest: PersonaChangeRequest) { val user = identityApi.getUserByToken(token) - userService.changePersona(user.id.toLong(), personChangeRequest) + userService.changePersona(user.username, personChangeRequest) } fun addPersona(token: String, idempotencyKey: String, personaType: String): PersonaResponse { val user = identityApi.getUserByToken(token) - return userService.addPersona(user.id.toLong(), personaType, idempotencyKey) + return userService.addPersona(user.username, personaType, idempotencyKey) } fun deletePersona(token: String, personaId: Long): PersonaResponse { val user = identityApi.getUserByToken(token) - return userService.deletePersona(user.id.toLong(), personaId) + return userService.deletePersona(user.username, personaId) } fun getPersona(token: String, personaId: Long): PersonaResponse { val user = identityApi.getUserByToken(token) - return userService.getPersona(user.id.toLong(), personaId) + return userService.getPersona(user.username, personaId) } } diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index d0670ae..3ca466c 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -61,8 +61,8 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun changePersona(id: Long, personChangeRequest: PersonaChangeRequest) { - val user = getUserById(id) + fun changePersona(name: String, personChangeRequest: PersonaChangeRequest) { + val user = getUserByName(name) user.changePersonaVisible( personChangeRequest.personaId.toLong(), @@ -72,10 +72,10 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun addPersona(id: Long, personaType: String, idempotencyKey: String): PersonaResponse { + fun addPersona(name: String, personaType: String, idempotencyKey: String): PersonaResponse { requireIdempotency("addPersona:$idempotencyKey") - val user = getUserById(id) + val user = getUserByName(name) return user.addPersona(PersonaType.valueOf(personaType.uppercase())) } @@ -90,19 +90,16 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun deletePersona(id: Long, personaId: Long): PersonaResponse { - val user = getUserById(id) + fun deletePersona(name: String, personaId: Long): PersonaResponse { + val user = getUserByName(name) return user.deletePersona(personaId) } - fun getPersona(id: Long, personaId: Long): PersonaResponse { - return getUserById(id).personas + fun getPersona(name: String, personaId: Long): PersonaResponse { + return getUserByName(name).personas .find { it.id == personaId } ?.let { PersonaResponse.from(it) } - ?: throw IllegalArgumentException("Cannot find matched persona \"$personaId\" by user \"$id\"") + ?: throw IllegalArgumentException("Cannot find matched persona \"$personaId\" by user name \"$name\"") } - - private fun getUserById(id: Long) = (userRepository.findByIdOrNull(id) - ?: throw IllegalArgumentException("Cannot find exists user by id \"$id\"")) } diff --git a/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt b/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt index 561d4e2..15ff978 100644 --- a/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt +++ b/src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt @@ -33,10 +33,9 @@ internal class UserServiceTest( describe("deletePersona λ©”μ†Œλ“œλŠ”") { context("userId와 personaIdλ₯Ό λ°›μœΌλ©΄,") { val personaId = user.personas[0].id - val userId = user.id it("personaλ₯Ό μ‚­μ œν•œλ‹€.") { - val response = userService.deletePersona(userId, personaId) + val response = userService.deletePersona(user.name, personaId) val user = userService.getUserByName(user.name) user.personas From 58e1ecf75a375d92f44688edbb95b32ef4a68508 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 14:19:59 +0900 Subject: [PATCH 141/161] =?UTF-8?q?feat:=20FISH=5FMAN=20Persona=EB=A5=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 1 + README.md | 1 + docs/fishman.svg | 266 +++++ .../gitanimals/render/domain/PersonaType.kt | 16 + .../org/gitanimals/render/domain/Svgs.kt | 8 +- src/main/resources/persona/animal/fishman.svg | 381 +++++++ src/test/resources/persona/goose/test.svg | 991 ++++++------------ 7 files changed, 972 insertions(+), 692 deletions(-) create mode 100644 docs/fishman.svg create mode 100644 src/main/resources/persona/animal/fishman.svg diff --git a/ENGLISH.md b/ENGLISH.md index e07473a..0ff1f14 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -114,6 +114,7 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| FISH_MAN
| 0.001 | | | flamingo
| 0.08 | | | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | diff --git a/README.md b/README.md index 9169e48..fee9ac6 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| FISH_MAN
| 0.001 | | | flamingo
| 0.08 | | | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | diff --git a/docs/fishman.svg b/docs/fishman.svg new file mode 100644 index 0000000..e17a7ec --- /dev/null +++ b/docs/fishman.svg @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 4e72f80..60ae789 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -980,6 +980,22 @@ enum class PersonaType(private val weight: Double) { StringBuilder().moveRandomly("cat", id, 15, "180s", 5, 17.5) .toString() }, + + FISH_MAN(0.001) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return fishManSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("fishman", id, 15, "180s", 5, 16.5) + .toString() + } ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 41fd5af..c320634 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -39,8 +39,9 @@ val gooseSpringSvg: String = ClassPathResource("persona/animal/goose-spring.svg" val littleChickSvg: String = ClassPathResource("persona/animal/little-chick.svg") .getContentAsString(Charset.defaultCharset()) -val littleChickSunglassesSvg: String = ClassPathResource("persona/animal/little-chick-sunglasses.svg") - .getContentAsString(Charset.defaultCharset()) +val littleChickSunglassesSvg: String = + ClassPathResource("persona/animal/little-chick-sunglasses.svg") + .getContentAsString(Charset.defaultCharset()) val littleChickKotlinSvg: String = ClassPathResource("persona/animal/little-chick-kotlin.svg") .getContentAsString(Charset.defaultCharset()) @@ -171,6 +172,9 @@ val galchiCatSvg: String = ClassPathResource("persona/animal/galchi-cat.svg") val whiteCatSvg: String = ClassPathResource("persona/animal/white-cat.svg") .getContentAsString(Charset.defaultCharset()) +val fishManSvg: String = ClassPathResource("persona/animal/fishman.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/fishman.svg b/src/main/resources/persona/animal/fishman.svg new file mode 100644 index 0000000..63f6ff5 --- /dev/null +++ b/src/main/resources/persona/animal/fishman.svg @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index c3fc860..54046b8 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,719 +1,330 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + - - + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + From 43fd077b27061d7315962ce06afda8bb0c4bdd9d Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 14:49:09 +0900 Subject: [PATCH 142/161] =?UTF-8?q?refactor:=20FISH=5FMAN=EC=9D=98=20?= =?UTF-8?q?=ED=94=BD=EC=85=80=20=ED=80=84=EB=A6=AC=ED=8B=B0=EB=A5=BC=20?= =?UTF-8?q?=EC=A6=9D=EA=B0=80=EC=8B=9C=ED=82=A8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/persona/animal/fishman.svg | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/src/main/resources/persona/animal/fishman.svg b/src/main/resources/persona/animal/fishman.svg index 63f6ff5..eed8981 100644 --- a/src/main/resources/persona/animal/fishman.svg +++ b/src/main/resources/persona/animal/fishman.svg @@ -4,37 +4,37 @@ @keyframes fishman-*{id}-hand-move { 0% { - transform: translate(2px, 8px) rotate(-10deg); + transform: translate(2px, 3px) rotate(-10deg); } 50% { - transform: translate(2px, 8px) rotate(10deg); + transform: translate(2px, 3px) rotate(10deg); } 100% { - transform: translate(2px, 8px) rotate(-10deg); + transform: translate(2px, 3px) rotate(-10deg); } } @keyframes fishman-*{id}-leg-left-move { 0% { - transform: translate(3px, 18px); + transform: translate(3px, 13px); } 50% { - transform: translate(3px, 18px) rotate(10deg); + transform: translate(3px, 13px) rotate(10deg); } 100% { - transform: translate(3px, 18px); + transform: translate(3px, 13px); } } @keyframes fishman-*{id}-leg-right-move { 0% { - transform: translate(6px, 18px); + transform: translate(6px, 13px); } 50% { - transform: translate(6px, 18px) rotate(-10deg); + transform: translate(6px, 13px) rotate(-10deg); } 100% { - transform: translate(6px, 18px); + transform: translate(6px, 13px); } } @@ -100,7 +100,7 @@ - @@ -120,7 +120,7 @@ - + @@ -130,7 +130,7 @@ - + - + @@ -153,7 +153,7 @@ fill-opacity="0.1"/> - + @@ -163,7 +163,7 @@ fill-opacity="0.1"/> - + @@ -173,25 +173,25 @@ fill-opacity="0.1"/> - + - + - - + + - - - - + + + + - + @@ -217,25 +217,19 @@ - - - - - + + + + + - + - + @@ -250,7 +244,7 @@ - + Date: Sun, 12 May 2024 14:49:59 +0900 Subject: [PATCH 143/161] =?UTF-8?q?docs:=20Default=20persona=EB=A5=BC=20FI?= =?UTF-8?q?SH=5FMAN=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index 0ff1f14..970b78a 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -9,7 +9,7 @@
- + ⭐️ Please press the star! It greatly helps development! ⭐️
diff --git a/README.md b/README.md index fee9ac6..8681a2a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From aa2275d3f243b2e0d689d8db124b03fb846f4387 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 15:24:42 +0900 Subject: [PATCH 144/161] =?UTF-8?q?refactor:=20/users/{username}=20api?= =?UTF-8?q?=EA=B0=80=20=ED=8E=AB=EC=9D=98=20visible=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EB=A5=BC=20=ED=95=A8=EA=BB=98=20=EB=B0=98=ED=99=98=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/controller/response/PersonaResponse.kt | 1 + .../org/gitanimals/render/controller/response/UserResponse.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt b/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt index 9c66209..304133d 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/response/PersonaResponse.kt @@ -6,4 +6,5 @@ data class PersonaResponse( val id: String, val type: PersonaType, val level: String, + val visible: Boolean, ) diff --git a/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt b/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt index a6eac7e..9725545 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/response/UserResponse.kt @@ -14,7 +14,7 @@ data class UserResponse( user.id.toString(), user.name, user.personas.map { - PersonaResponse(it.id.toString(), it.type, it.level().toString()) + PersonaResponse(it.id.toString(), it.type, it.level().toString(), it.visible) }.toList() ) } From 6ab132ab7990fad0ec1a11dfbad7feabd235a362 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 15:29:32 +0900 Subject: [PATCH 145/161] =?UTF-8?q?fix:=20=EB=B9=A0=EC=A7=84=20persona=20v?= =?UTF-8?q?isible=20=EC=84=B8=ED=8C=85=EC=9D=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/render/controller/PersonaController.kt | 6 +++--- .../gitanimals/render/domain/response/PersonaResponse.kt | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 5ad8e10..76c019a 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -29,7 +29,7 @@ class PersonaController( ): PersonaResponse { val persona = userFacade.getPersona(token, personaId) - return PersonaResponse(persona.id, persona.type, persona.level) + return PersonaResponse(persona.id, persona.type, persona.level, persona.visible) } @PatchMapping("/personas") @@ -47,7 +47,7 @@ class PersonaController( ): PersonaResponse { val persona = userFacade.addPersona(token, idempotencyKey, addPersonaRequest.name) - return PersonaResponse(persona.id, persona.type, persona.level) + return PersonaResponse(persona.id, persona.type, persona.level, persona.visible) } @DeleteMapping("/internals/personas") @@ -57,7 +57,7 @@ class PersonaController( ): PersonaResponse { val persona = userFacade.deletePersona(token, personaId) - return PersonaResponse(persona.id, persona.type, persona.level) + return PersonaResponse(persona.id, persona.type, persona.level, persona.visible) } @ExceptionHandler(IllegalArgumentException::class) diff --git a/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt index 281004a..e11a208 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt @@ -7,10 +7,11 @@ data class PersonaResponse( val id: String, val type: PersonaType, val level: String, + val visible: Boolean, ) { companion object { fun from(persona: Persona): PersonaResponse { - return PersonaResponse(persona.id.toString(), persona.type, persona.level.toString()) + return PersonaResponse(persona.id.toString(), persona.type, persona.level.toString(), persona.visible) } } } From a0fd49f4016adeae675254a86559dd78584d2411 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 15:42:03 +0900 Subject: [PATCH 146/161] =?UTF-8?q?refactor:=20=ED=8E=AB=EC=9D=98=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EA=B0=80=20=EB=B3=80=EA=B2=BD=EB=90=98?= =?UTF-8?q?=EC=97=88=EC=9D=84=EB=95=8C,=20pet=EC=9D=98=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=A5=BC=20=EC=9D=91=EB=8B=B5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/app/UserFacade.kt | 4 ++-- .../gitanimals/render/controller/PersonaController.kt | 11 ++++++++++- src/main/kotlin/org/gitanimals/render/domain/User.kt | 3 ++- .../org/gitanimals/render/domain/UserService.kt | 6 ++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt index 9806c2e..5100b3c 100644 --- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -11,10 +11,10 @@ class UserFacade( private val identityApi: IdentityApi, ) { - fun changePersona(token: String, personChangeRequest: PersonaChangeRequest) { + fun changePersona(token: String, personChangeRequest: PersonaChangeRequest): PersonaResponse { val user = identityApi.getUserByToken(token) - userService.changePersona(user.username, personChangeRequest) + return userService.changePersona(user.username, personChangeRequest) } fun addPersona(token: String, idempotencyKey: String, personaType: String): PersonaResponse { diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 76c019a..c79f139 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -37,7 +37,16 @@ class PersonaController( fun changePersona( @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, @RequestBody personaChangeRequest: PersonaChangeRequest, - ) = userFacade.changePersona(token, personaChangeRequest) + ): PersonaResponse { + val changedPersona = userFacade.changePersona(token, personaChangeRequest) + + return PersonaResponse( + changedPersona.id, + changedPersona.type, + changedPersona.level, + changedPersona.visible, + ) + } @PostMapping("/internals/personas") fun addPersona( diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 304565b..1c031cf 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -83,7 +83,7 @@ class User( ) } - fun changePersonaVisible(personaId: Long, visible: Boolean) { + fun changePersonaVisible(personaId: Long, visible: Boolean): Persona { val persona = personas.find { it.id == personaId } ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") @@ -94,6 +94,7 @@ class User( } persona.visible = visible + return persona } fun updateContribution(contribution: Int) { diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 3ca466c..a62404b 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -61,13 +61,15 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun changePersona(name: String, personChangeRequest: PersonaChangeRequest) { + fun changePersona(name: String, personChangeRequest: PersonaChangeRequest): PersonaResponse { val user = getUserByName(name) - user.changePersonaVisible( + val changedPersona = user.changePersonaVisible( personChangeRequest.personaId.toLong(), personChangeRequest.visible ) + + return PersonaResponse.from(changedPersona) } @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) From 48dfb2d82c126d0d8aba049489a997219f20d975 Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 17:21:09 +0900 Subject: [PATCH 147/161] =?UTF-8?q?refactor:=20PersonaResponse=EC=9D=98=20?= =?UTF-8?q?level=EC=9D=B4=20Value=20class=EB=A1=9C=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/render/domain/response/PersonaResponse.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt index e11a208..6e42cf4 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/response/PersonaResponse.kt @@ -11,7 +11,12 @@ data class PersonaResponse( ) { companion object { fun from(persona: Persona): PersonaResponse { - return PersonaResponse(persona.id.toString(), persona.type, persona.level.toString(), persona.visible) + return PersonaResponse( + persona.id.toString(), + persona.type, + persona.level.value.toString(), + persona.visible + ) } } } From 97647410efe10a313edfb3be79e32df3925f1bfd Mon Sep 17 00:00:00 2001 From: devxb Date: Sun, 12 May 2024 17:50:03 +0900 Subject: [PATCH 148/161] =?UTF-8?q?feat:=20FISH=5FMAN=5FGLASSES=20persona?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 1 + README.md | 1 + docs/fishman-glasses.svg | 377 +++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 17 +- .../org/gitanimals/render/domain/Svgs.kt | 3 + .../persona/animal/fishman-glasses.svg | 524 ++++++++++++++++++ 6 files changed, 922 insertions(+), 1 deletion(-) create mode 100644 docs/fishman-glasses.svg create mode 100644 src/main/resources/persona/animal/fishman-glasses.svg diff --git a/ENGLISH.md b/ENGLISH.md index 970b78a..d62184f 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -115,6 +115,7 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | FISH_MAN
| 0.001 | | +| FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | | | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | diff --git a/README.md b/README.md index 8681a2a..74fcb0b 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | FISH_MAN
| 0.001 | | +| FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | | | TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | | goblin
| 0.06 | | diff --git a/docs/fishman-glasses.svg b/docs/fishman-glasses.svg new file mode 100644 index 0000000..5b819a0 --- /dev/null +++ b/docs/fishman-glasses.svg @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 60ae789..9f1c7d6 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -981,7 +981,7 @@ enum class PersonaType(private val weight: Double) { .toString() }, - FISH_MAN(0.001) { + FISH_MAN(0.002) { override fun loadSvg(user: User, persona: Persona, mode: Mode): String { return fishManSvg.replace("*{act}", act(persona.id)) .replace("*{id}", persona.id.toString()) @@ -992,6 +992,21 @@ enum class PersonaType(private val weight: Double) { ) } + override fun act(id: Long): String = + StringBuilder().moveRandomly("fishman", id, 15, "180s", 5, 16.5) + .toString() + }, + FISH_MAN_GLASSES(0.001) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return fishManGlassesSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + override fun act(id: Long): String = StringBuilder().moveRandomly("fishman", id, 15, "180s", 5, 16.5) .toString() diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index c320634..3884ade 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -175,6 +175,9 @@ val whiteCatSvg: String = ClassPathResource("persona/animal/white-cat.svg") val fishManSvg: String = ClassPathResource("persona/animal/fishman.svg") .getContentAsString(Charset.defaultCharset()) +val fishManGlassesSvg: String = ClassPathResource("persona/animal/fishman-glasses.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/fishman-glasses.svg b/src/main/resources/persona/animal/fishman-glasses.svg new file mode 100644 index 0000000..fc87114 --- /dev/null +++ b/src/main/resources/persona/animal/fishman-glasses.svg @@ -0,0 +1,524 @@ + + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 319211e75d8e331f9d5d6694ac9b5afcebaf7155 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 13 May 2024 00:50:57 +0900 Subject: [PATCH 149/161] =?UTF-8?q?refactor:=20=EB=82=B4=EB=B6=80=20api?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=EB=B0=A9=EC=8B=9D=EC=9D=84=20secret-key=20?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 +++-- .../interceptor/InterceptorConfigurer.kt | 4 +-- .../interceptor/InternalApiInterceptor.kt | 31 ++++--------------- src/main/resources/application.properties | 2 +- src/test/resources/application.properties | 2 +- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index a116c04..e53a500 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ARG DB_PASSWORD ARG GITHUB_TOKEN ARG REDIS_HOST ARG REDIS_PORT +ARG INTERNAL_SECRET ARG JAR_FILE=./build/libs/*.jar COPY ${JAR_FILE} gitanimals-render.jar @@ -15,7 +16,8 @@ ENV db_url=${DB_URL} \ db_password=${DB_PASSWORD} \ github_token=${GITHUB_TOKEN} \ redis_host=${REDIS_HOST} \ - redis_port=${REDIS_PORT} + redis_port=${REDIS_PORT} \ + internal_secret=${INTERNAL_SECRET} ENTRYPOINT java -jar gitanimals-render.jar \ --spring.datasource.url=${db_url} \ @@ -23,4 +25,5 @@ ENTRYPOINT java -jar gitanimals-render.jar \ --spring.datasource.password=${db_password} \ --netx.host=${redis_host} \ --netx.port=${redis_port} \ - --github.token=${github_token} + --github.token=${github_token} \ + --internal.secret=${internal_secret} diff --git a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt index a265490..afc089a 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InterceptorConfigurer.kt @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer @Configuration class InterceptorConfigurer( - @Value("\${white.ip}") private val whiteIps: List + @Value("\${internal.secret}") private val internalSecret: String, ) : WebMvcConfigurer { override fun addInterceptors(registry: InterceptorRegistry) { @@ -18,5 +18,5 @@ class InterceptorConfigurer( } @Bean - fun internalApiInterceptor(): InternalApiInterceptor = InternalApiInterceptor(whiteIps) + fun internalApiInterceptor(): InternalApiInterceptor = InternalApiInterceptor(internalSecret) } diff --git a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt index 8441dc2..5d6b157 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/interceptor/InternalApiInterceptor.kt @@ -5,7 +5,7 @@ import jakarta.servlet.http.HttpServletResponse import org.springframework.web.servlet.HandlerInterceptor class InternalApiInterceptor( - private val whiteIps: List, + private val internalSecret: String, ) : HandlerInterceptor { override fun preHandle( @@ -13,32 +13,13 @@ class InternalApiInterceptor( response: HttpServletResponse, handler: Any, ): Boolean { - return whiteIps.contains(extractIp(request)) - } - - private fun extractIp(request: HttpServletRequest): String { - val headers = arrayOf( - "Proxy-Client-IP", - "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", - "X-Real-IP", "X-RealIP", "REMOTE_ADDR" - ) - - var ip: String? = request.getHeader("X-Forwarded-For") - - for (header in headers) { - if (ip.isNullOrEmpty() || "unknown".equals(ip, ignoreCase = true)) { - ip = request.getHeader(header) - } - } - - if (ip.isNullOrEmpty() || "unknown".equals(ip, ignoreCase = true)) { - ip = request.remoteAddr - } + val requestSecret = request.getHeader("Internal-Secret") - if (ip == "0:0:0:0:0:0:0:1") { - ip = "127.0.0.1" + if (requestSecret == internalSecret) { + return true } - return ip ?: throw IllegalStateException("Cannot extract ip") + response.sendError(403, "Cannot call internal API") + return false } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 7ad3871..a5779ba 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -26,7 +26,7 @@ github.token= sentry.dsn=https://fe1aaf784ec135343909a4a0dfe4f0eb@o4505051656486912.ingest.us.sentry.io/4507088960684032 sentry.traces-sample-rate=1.0 -white.ip=127.0.0.1,192.168.35.190,192.168.35.139,39.120.67.208 +internal.secret= spring.application.name=render.gitanimals management.endpoints.web.exposure.include=prometheus diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 83d5efb..5c27886 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -30,4 +30,4 @@ netx.logging.level=info ### GITHUB ### github.token=1234 -white.ip=127.0.0.1 +internal.secret=foo From 8d38a27a12a27c04f72a5eb6f2a80062f9c3f0d1 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 13 May 2024 00:51:52 +0900 Subject: [PATCH 150/161] =?UTF-8?q?ci:=20deploy=EC=97=90=20INTERNAL=5FSECR?= =?UTF-8?q?ET=20=EB=B3=80=EC=88=98=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 63186c4..a741b06 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -68,6 +68,7 @@ jobs: "GITHUB_TOKEN=${{ secrets.GH_TOKEN }}" "REDIS_HOST=${{ secrets.REDIS_HOST }}" "REDIS_PORT=${{ secrets.REDIS_PORT }}" + "INTERNAL_SECRET=${{ secrets.INTERNAL_SECRET }}" deploy: needs: build From 668d3bd3691e60babaac5a90443c10bf9b0483f8 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 13 May 2024 08:41:37 +0900 Subject: [PATCH 151/161] =?UTF-8?q?refactor:=20POST=20/internals/personas?= =?UTF-8?q?=20api=EA=B0=80=20level,=20id=20=EB=A5=BC=20=ED=95=A8=EA=BB=98?= =?UTF-8?q?=20=EB=B0=9B=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/app/UserFacade.kt | 10 ++++++++-- .../gitanimals/render/controller/PersonaController.kt | 8 +++++++- .../render/controller/request/AddPersonaRequest.kt | 2 ++ src/main/kotlin/org/gitanimals/render/domain/User.kt | 5 +++-- .../kotlin/org/gitanimals/render/domain/UserService.kt | 8 +++++++- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt index 5100b3c..91d82f1 100644 --- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt +++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt @@ -17,10 +17,16 @@ class UserFacade( return userService.changePersona(user.username, personChangeRequest) } - fun addPersona(token: String, idempotencyKey: String, personaType: String): PersonaResponse { + fun addPersona( + token: String, + idempotencyKey: String, + id: Long, + personaType: String, + level: Int, + ): PersonaResponse { val user = identityApi.getUserByToken(token) - return userService.addPersona(user.username, personaType, idempotencyKey) + return userService.addPersona(user.username, id, personaType, level, idempotencyKey) } fun deletePersona(token: String, personaId: Long): PersonaResponse { diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index c79f139..99dc52b 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -54,7 +54,13 @@ class PersonaController( @RequestParam("idempotency-key") idempotencyKey: String, @RequestBody addPersonaRequest: AddPersonaRequest, ): PersonaResponse { - val persona = userFacade.addPersona(token, idempotencyKey, addPersonaRequest.name) + val persona = userFacade.addPersona( + token, + idempotencyKey, + addPersonaRequest.id, + addPersonaRequest.name, + addPersonaRequest.level, + ) return PersonaResponse(persona.id, persona.type, persona.level, persona.visible) } diff --git a/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt b/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt index 5065e81..5355ddd 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/request/AddPersonaRequest.kt @@ -1,5 +1,7 @@ package org.gitanimals.render.controller.request data class AddPersonaRequest( + val id: Long, val name: String, + val level: Int, ) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index 1c031cf..d5a2ac6 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -6,6 +6,7 @@ import org.gitanimals.render.core.AggregateRoot import org.gitanimals.render.core.IdGenerator import org.gitanimals.render.domain.response.PersonaResponse import org.gitanimals.render.domain.value.Contribution +import org.gitanimals.render.domain.value.Level import org.hibernate.annotations.BatchSize import java.time.Instant import java.time.ZoneId @@ -55,8 +56,8 @@ class User( personas.forEach { it.user = this } } - fun addPersona(personaType: PersonaType): PersonaResponse { - val persona = Persona(personaType, 0L, personas.size < 30, this) + fun addPersona(id: Long, personaType: PersonaType, level: Int): PersonaResponse { + val persona = Persona(id, personaType, Level(level.toLong()), personas.size < 30, this) this.personas.add(persona) diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index a62404b..fff2428 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -74,7 +74,13 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun addPersona(name: String, personaType: String, idempotencyKey: String): PersonaResponse { + fun addPersona( + name: String, + id: Long, + personaType: String, + level: Int, + idempotencyKey: String + ): PersonaResponse { requireIdempotency("addPersona:$idempotencyKey") val user = getUserByName(name) From d98c573e49fc74f648bc51e446a742a17400e1f5 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 13 May 2024 08:45:47 +0900 Subject: [PATCH 152/161] =?UTF-8?q?fix:=20UserService=EC=9D=98=20addPerson?= =?UTF-8?q?a=20=EB=A9=94=EC=86=8C=EB=93=9C=EA=B0=80=20id=20=EC=99=80=20lev?= =?UTF-8?q?el=EC=9D=84=20=ED=95=A8=EA=BB=98=20=EC=A0=84=EB=8B=AC=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/UserService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index fff2428..6e4b7fa 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -85,7 +85,7 @@ class UserService( val user = getUserByName(name) - return user.addPersona(PersonaType.valueOf(personaType.uppercase())) + return user.addPersona(id, PersonaType.valueOf(personaType.uppercase()), level) } private fun requireIdempotency(idempotencyKey: String) { From 790b3a1c4283c198c4fca29aef899ff8371d78d2 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 17 May 2024 23:08:20 +0900 Subject: [PATCH 153/161] =?UTF-8?q?refactor:=20=ED=8E=AB=EC=9D=B4=2030?= =?UTF-8?q?=EB=A7=88=EB=A6=AC=20=EC=9D=BC=EB=95=8C=20visible=EC=9D=B4=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/User.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index d5a2ac6..338a1a8 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -88,13 +88,14 @@ class User( val persona = personas.find { it.id == personaId } ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") + persona.visible = visible + val visiblePersonas = personas.filter { it.visible } require(visiblePersonas.size < MAX_PERSONA_COUNT) { "Persona count must be under \"$MAX_PERSONA_COUNT\" but, current persona count is \"${visiblePersonas.size}\"" } - persona.visible = visible return persona } From 3c49ed16780137fbfd85152f6d279e6d82c358bc Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 17 May 2024 23:08:35 +0900 Subject: [PATCH 154/161] =?UTF-8?q?refactor:=20IllegalArgumentException=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=EC=8B=9C=20400=20=EC=98=88=EC=99=B8=EB=A5=BC?= =?UTF-8?q?=20=EB=8D=98=EC=A7=84=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/controller/PersonaController.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 99dc52b..41a9c30 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -76,6 +76,7 @@ class PersonaController( } @ExceptionHandler(IllegalArgumentException::class) + @ResponseStatus(HttpStatus.BAD_REQUEST) fun handleIllegalArgumentException(exception: IllegalArgumentException): ErrorResponse = ErrorResponse.from(exception) } From 17b164e2499f42af64342c24c42d1447ebcec857 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 17 May 2024 23:14:36 +0900 Subject: [PATCH 155/161] =?UTF-8?q?refactor:=20=EB=A9=94=EC=9D=B8=EC=BA=90?= =?UTF-8?q?=EB=A6=AD=ED=84=B0=EB=A5=BC=20LITTLE=5FCHICK=5FSPRING=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index d62184f..20f1401 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -9,7 +9,7 @@
- + ⭐️ Please press the star! It greatly helps development! ⭐️
diff --git a/README.md b/README.md index 74fcb0b..a2b99cd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 5276fc57c7440608a9910788ddada44384fd2129 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 01:30:29 +0900 Subject: [PATCH 156/161] =?UTF-8?q?refactor:=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=EC=8B=9C=20403=EC=98=88=EC=99=B8=EB=A5=BC=20?= =?UTF-8?q?=EB=8D=98=EC=A7=80=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/app/Exception.kt | 6 ++++++ .../org/gitanimals/render/controller/PersonaController.kt | 6 ++++++ .../kotlin/org/gitanimals/render/infra/RestIdentityApi.kt | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/org/gitanimals/render/app/Exception.kt diff --git a/src/main/kotlin/org/gitanimals/render/app/Exception.kt b/src/main/kotlin/org/gitanimals/render/app/Exception.kt new file mode 100644 index 0000000..d0eae82 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/render/app/Exception.kt @@ -0,0 +1,6 @@ +package org.gitanimals.render.app + + +class AuthorizationException(message: String) : IllegalArgumentException(message) + +val AUTHORIZATION_EXCEPTION = AuthorizationException("Authorization fail") diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 41a9c30..5a24e7b 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.controller +import org.gitanimals.render.app.AuthorizationException import org.gitanimals.render.app.UserFacade import org.gitanimals.render.controller.request.AddPersonaRequest import org.gitanimals.render.controller.response.ErrorResponse @@ -79,4 +80,9 @@ class PersonaController( @ResponseStatus(HttpStatus.BAD_REQUEST) fun handleIllegalArgumentException(exception: IllegalArgumentException): ErrorResponse = ErrorResponse.from(exception) + + @ExceptionHandler(AuthorizationException::class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) + fun handleAuthorizationException(exception: AuthorizationException): ErrorResponse = + ErrorResponse.from(exception) } diff --git a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt index 9b394c5..6ee94a9 100644 --- a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt +++ b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.infra +import org.gitanimals.render.app.AUTHORIZATION_EXCEPTION import org.gitanimals.render.app.IdentityApi import org.springframework.http.HttpHeaders import org.springframework.stereotype.Component @@ -18,7 +19,7 @@ class RestIdentityApi : IdentityApi { runCatching { response.bodyTo(IdentityApi.UserResponse::class.java) }.getOrElse { - throw IllegalArgumentException("Unauthorized user") + throw AUTHORIZATION_EXCEPTION } } } From d17f0f5a4e02c8ea94da52381f3ba57ea876c498 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 01:41:17 +0900 Subject: [PATCH 157/161] =?UTF-8?q?docs:=20=EB=A9=94=EC=9D=B8=ED=8E=AB?= =?UTF-8?q?=EC=9D=84=203=EB=A7=88=EB=A6=AC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ENGLISH.md b/ENGLISH.md index 20f1401..c30f10d 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -9,7 +9,7 @@
- + ⭐️ Please press the star! It greatly helps development! ⭐️
diff --git a/README.md b/README.md index a2b99cd..2bcc1ff 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
- + β­μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš” κ°œλ°œμ— 큰 도움이 λ©λ‹ˆλ‹€!⭐️
From 6c280ab808412e1c07cf6d5f60d81a9deba3d94a Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 22:45:41 +0900 Subject: [PATCH 158/161] =?UTF-8?q?docs:=20QUOKKA=20=ED=8E=AB=EC=9D=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + docs/quokka.svg | 109 +++++ .../gitanimals/render/domain/PersonaType.kt | 17 +- .../org/gitanimals/render/domain/Svgs.kt | 3 + src/main/resources/application.properties | 8 +- src/main/resources/persona/animal/quokka.svg | 153 ++++++ src/test/resources/persona/goose/test.svg | 456 ++++++------------ 7 files changed, 426 insertions(+), 321 deletions(-) create mode 100644 docs/quokka.svg create mode 100644 src/main/resources/persona/animal/quokka.svg diff --git a/README.md b/README.md index 2bcc1ff..d854541 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| QUOKKA
| 0.3 | | | FISH_MAN
| 0.001 | | | FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | | diff --git a/docs/quokka.svg b/docs/quokka.svg new file mode 100644 index 0000000..0bdc9b7 --- /dev/null +++ b/docs/quokka.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 9f1c7d6..2e47afe 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1010,6 +1010,21 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String = StringBuilder().moveRandomly("fishman", id, 15, "180s", 5, 16.5) .toString() + }, + QUOKKA(0.3) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return quokkaSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-9 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("quokka", id, 40, "180s", 5, 10.0) + .toString() } ; @@ -1082,7 +1097,7 @@ enum class PersonaType(private val weight: Double) { speed: Int, duration: String, personaWidth: Long, - flippedWidth: Double, + flippedWidth: Double, // flippedWidth = persona width * 3 / 2 ): StringBuilder { val movingPoints = getMovingPoints(speed) diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 3884ade..822dd75 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -178,6 +178,9 @@ val fishManSvg: String = ClassPathResource("persona/animal/fishman.svg") val fishManGlassesSvg: String = ClassPathResource("persona/animal/fishman-glasses.svg") .getContentAsString(Charset.defaultCharset()) +val quokkaSvg: String = ClassPathResource("persona/animal/quokka.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a5779ba..2c7e970 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,8 +2,8 @@ server.name=gitanimals-render server.port=8080 spring.datasource.url=jdbc:mysql://localhost:3306/gitanimalsrender -spring.datasource.username= -spring.datasource.password= +spring.datasource.username=root +spring.datasource.password=Dlwnsdud0414 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect @@ -21,12 +21,12 @@ netx.orphan-milli=60000 netx.backpressure=40 netx.logging.level=info -github.token= +github.token=a sentry.dsn=https://fe1aaf784ec135343909a4a0dfe4f0eb@o4505051656486912.ingest.us.sentry.io/4507088960684032 sentry.traces-sample-rate=1.0 -internal.secret= +internal.secret=a spring.application.name=render.gitanimals management.endpoints.web.exposure.include=prometheus diff --git a/src/main/resources/persona/animal/quokka.svg b/src/main/resources/persona/animal/quokka.svg new file mode 100644 index 0000000..e59d10a --- /dev/null +++ b/src/main/resources/persona/animal/quokka.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/persona/goose/test.svg b/src/test/resources/persona/goose/test.svg index 54046b8..6924b02 100644 --- a/src/test/resources/persona/goose/test.svg +++ b/src/test/resources/persona/goose/test.svg @@ -1,330 +1,154 @@ - - + + + + + + + + + + + + + + + *{contribution} + - - - - - - - - - - - - - - - - + + + + + + + - - - - - - + + + + + + + *{level} + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + From 92222fac1280229b1809816733815aa14766102e Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 22:49:55 +0900 Subject: [PATCH 159/161] =?UTF-8?q?feat:=20QUOKKA=5FLEAF=20persona?= =?UTF-8?q?=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + docs/quokka-leaf.svg | 178 +++++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 17 +- .../org/gitanimals/render/domain/Svgs.kt | 3 + .../resources/persona/animal/quokka-leaf.svg | 209 ++++++++++++++++++ 5 files changed, 407 insertions(+), 1 deletion(-) create mode 100644 docs/quokka-leaf.svg create mode 100644 src/main/resources/persona/animal/quokka-leaf.svg diff --git a/README.md b/README.md index d854541..684ae9e 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QUOKKA
| 0.3 | | +| QUOKKA_LEAF
| 0.1 | | | FISH_MAN
| 0.001 | | | FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | | diff --git a/docs/quokka-leaf.svg b/docs/quokka-leaf.svg new file mode 100644 index 0000000..aaf6f7a --- /dev/null +++ b/docs/quokka-leaf.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 2e47afe..0248039 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1025,7 +1025,22 @@ enum class PersonaType(private val weight: Double) { override fun act(id: Long): String = StringBuilder().moveRandomly("quokka", id, 40, "180s", 5, 10.0) .toString() - } + }, + QUOKKA_LEAF(0.1) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return quokkaLeafSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-9 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("quokka", id, 40, "180s", 5, 10.0) + .toString() + }, ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 822dd75..085ea10 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -181,6 +181,9 @@ val fishManGlassesSvg: String = ClassPathResource("persona/animal/fishman-glasse val quokkaSvg: String = ClassPathResource("persona/animal/quokka.svg") .getContentAsString(Charset.defaultCharset()) +val quokkaLeafSvg: String = ClassPathResource("persona/animal/quokka-leaf.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/quokka-leaf.svg b/src/main/resources/persona/animal/quokka-leaf.svg new file mode 100644 index 0000000..b7cd672 --- /dev/null +++ b/src/main/resources/persona/animal/quokka-leaf.svg @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From aece1fe8c658bc650cabbfbb55de2fd88dda9883 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 22:53:35 +0900 Subject: [PATCH 160/161] =?UTF-8?q?feat:=20QUOKKA=5FSUNGLASSES=20=ED=8E=AB?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + docs/quokka-leaf.svg | 41 ----- docs/quokka-sunglasses.svg | 120 +++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 15 ++ .../org/gitanimals/render/domain/Svgs.kt | 4 + .../persona/animal/quokka-sunglasses.svg | 164 ++++++++++++++++++ 6 files changed, 304 insertions(+), 41 deletions(-) create mode 100644 docs/quokka-sunglasses.svg create mode 100644 src/main/resources/persona/animal/quokka-sunglasses.svg diff --git a/README.md b/README.md index 684ae9e..07ff9c7 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ _μƒˆλ‘œμš΄ contribution은 λ°˜μ˜μ€ μ΅œλŒ€ 1μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμ–΄μš”._ |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QUOKKA
| 0.3 | | | QUOKKA_LEAF
| 0.1 | | +| QUOKKA_SUNGLASSES
| 0.05 | | | FISH_MAN
| 0.001 | | | FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | | diff --git a/docs/quokka-leaf.svg b/docs/quokka-leaf.svg index aaf6f7a..0cfe851 100644 --- a/docs/quokka-leaf.svg +++ b/docs/quokka-leaf.svg @@ -61,47 +61,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/quokka-sunglasses.svg b/docs/quokka-sunglasses.svg new file mode 100644 index 0000000..c6a44f9 --- /dev/null +++ b/docs/quokka-sunglasses.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 0248039..fc2155a 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1041,6 +1041,21 @@ enum class PersonaType(private val weight: Double) { StringBuilder().moveRandomly("quokka", id, 40, "180s", 5, 10.0) .toString() }, + QUOKKA_SUNGLASSES(0.05) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return quokkaSunglassesSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-9 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("quokka", id, 40, "180s", 5, 10.0) + .toString() + }, ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 085ea10..fec10ae 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -184,6 +184,10 @@ val quokkaSvg: String = ClassPathResource("persona/animal/quokka.svg") val quokkaLeafSvg: String = ClassPathResource("persona/animal/quokka-leaf.svg") .getContentAsString(Charset.defaultCharset()) +val quokkaSunglassesSvg: String = ClassPathResource("persona/animal/quokka-sunglasses.svg") + .getContentAsString(Charset.defaultCharset()) + + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/quokka-sunglasses.svg b/src/main/resources/persona/animal/quokka-sunglasses.svg new file mode 100644 index 0000000..a2fe10a --- /dev/null +++ b/src/main/resources/persona/animal/quokka-sunglasses.svg @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f8a1a1b63007a873adb8b2dd738f3c8b26954386 Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 18 May 2024 22:54:23 +0900 Subject: [PATCH 161/161] =?UTF-8?q?docs:=20QUOKKA=20=ED=8E=AB=EB=93=A4?= =?UTF-8?q?=EC=9D=84=20=EC=98=81=EC=96=B4=20=EB=AC=B8=EC=84=9C=EC=97=90?= =?UTF-8?q?=EB=8F=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENGLISH.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ENGLISH.md b/ENGLISH.md index c30f10d..2235cde 100644 --- a/ENGLISH.md +++ b/ENGLISH.md @@ -114,6 +114,9 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| QUOKKA
| 0.3 | | +| QUOKKA_LEAF
| 0.1 | | +| QUOKKA_SUNGLASSES
| 0.05 | | | FISH_MAN
| 0.001 | | | FISH_MAN_GLASSES
| 0.001 | | | flamingo
| 0.08 | |