From 0854628c4e041f51096be2490ec173b19a7c724b Mon Sep 17 00:00:00 2001 From: Damillora Date: Mon, 24 Feb 2025 13:50:43 +0000 Subject: [PATCH] feat: shioriko is now phoebe --- .github/workflows/workflow.yml | 6 ++-- Dockerfile | 10 +++--- README.md | 16 +++++---- go.mod | 2 +- main.go | 2 +- phoebe-logo.svg | 33 +++++++++++++++++++ pkg/app/app.go | 6 ++-- pkg/app/auth_routes.go | 8 ++--- pkg/app/blob_routes.go | 10 +++--- pkg/app/post_routes.go | 8 ++--- pkg/app/tag_routes.go | 6 ++-- pkg/app/tag_type_routes.go | 6 ++-- pkg/app/user_routes.go | 10 +++--- pkg/database/main.go | 2 +- pkg/middleware/auth_middleware.go | 4 +-- pkg/services/auth.go | 8 ++--- pkg/services/blob.go | 4 +-- pkg/services/post.go | 4 +-- pkg/services/tag.go | 4 +-- pkg/services/tag_type.go | 4 +-- pkg/services/user.go | 6 ++-- pkg/web/package-lock.json | 15 ++++++--- pkg/web/package.json | 5 +-- pkg/web/src/app.scss | 2 +- pkg/web/src/lib/assets/phoebe-logo.svg | 33 +++++++++++++++++++ pkg/web/src/lib/components/ui/Footer.svelte | 12 +++++++ ...{ShiorikoImage.svelte => ImageView.svelte} | 0 pkg/web/src/lib/components/ui/Navbar.svelte | 4 ++- .../src/lib/components/ui/PostGallery.svelte | 4 +-- pkg/web/src/routes/+layout.svelte | 11 ++----- pkg/web/src/routes/+page.svelte | 18 ++++++++-- pkg/web/src/routes/imagesearch/+page.svelte | 2 +- pkg/web/src/routes/post/[id]/+page.svelte | 6 ++-- pkg/web/src/routes/upload/+page.svelte | 4 +-- pkg/web/svelte.config.js | 10 +++++- 35 files changed, 194 insertions(+), 91 deletions(-) create mode 100644 phoebe-logo.svg create mode 100644 pkg/web/src/lib/assets/phoebe-logo.svg create mode 100644 pkg/web/src/lib/components/ui/Footer.svelte rename pkg/web/src/lib/components/ui/{ShiorikoImage.svelte => ImageView.svelte} (100%) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 7eca864..cb0bf4b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -48,7 +48,7 @@ jobs: name: Upload Binaries uses: actions/upload-artifact@v4 with: - name: shioriko-${{ env.PLATFORM }} + name: phoebe-${{ env.PLATFORM }} path: ./output retention-days: 7 - @@ -59,7 +59,7 @@ jobs: with: push: true platforms: ${{ matrix.platform }} - tags: damillora/shioriko:main + tags: damillora/phoebe:main - name: Build and push (Tagged) if: env.IS_LINUX == 'true' && env.IS_RELEASE == 'true' @@ -68,7 +68,7 @@ jobs: with: push: true platforms: ${{ matrix.platform }} - tags: damillora/shioriko:${{ env.GIT_TAG }}, damillora/shioriko:latest + tags: damillora/phoebe:${{ env.GIT_TAG }}, damillora/phoebe:latest - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile index b996308..729d8c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,14 +7,14 @@ RUN npm ci && npm run build # Go application FROM golang:1.23-alpine AS build -WORKDIR /go/src/shioriko +WORKDIR /go/src/phoebe COPY . . -COPY --from=node_build /src/pkg/web/build/ /go/src/shioriko/pkg/web/build/ +COPY --from=node_build /src/pkg/web/build/ /go/src/phoebe/pkg/web/build/ RUN go get -d -v ./... -RUN CGO_ENABLED=0 GOOS=linux go build -o /shioriko -ldflags '-extldflags "-static"' -tags timetzdata +RUN CGO_ENABLED=0 GOOS=linux go build -o /phoebe -ldflags '-extldflags "-static"' -tags timetzdata FROM scratch AS runtime WORKDIR /app -COPY --from=build /shioriko /app/ +COPY --from=build /phoebe /app/ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -ENTRYPOINT ["/app/shioriko"] +ENTRYPOINT ["/app/phoebe"] diff --git a/README.md b/README.md index 188aa5f..cef784a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# shioriko +# phoebe + +![project logo](./phoebe-logo.svg) a booru-style image gallery and organizer. -Built with the Go language and Svelte framework, shioriko is designed for personal image gathering. +Built with the Go language and Svelte framework, phoebe is designed for personal image gathering. ## Features * Upload and organize images @@ -14,8 +16,8 @@ Built with the Go language and Svelte framework, shioriko is designed for person The easiest way to get started is to use Docker: ```bash -docker pull damillora/shioriko -docker run -e POSTGRES_DATABASE= -e AUTH_SECRET= -e DATA_DIR=/data -e BASE_URL=http://localhost:8080 -p 8080:8080 -v "./data:/data" damillora/shioriko +docker pull damillora/phoebe +docker run -e POSTGRES_DATABASE= -e AUTH_SECRET= -e DATA_DIR=/data -e BASE_URL=http://localhost:8080 -p 8080:8080 -v "./data:/data" damillora/phoebe ``` ## Requirements @@ -24,7 +26,7 @@ docker run -e POSTGRES_DATABASE= -e AUTH_SECRET= -e DATA ## Configuration -Shioriko is configured using environment variables: +phoebe is configured using environment variables: * `POSTGRES_DATABASE`: DSN string of Postgres Database, see [Gorm documentation](https://gorm.io/docs/connecting_to_the_database.html) * `AUTH_SECRET`: Secret used to sign JWTs @@ -33,7 +35,7 @@ Shioriko is configured using environment variables: * `DISABLE_REGISTRATION`: Optional, disable registration on the instance ## Contributing -Shioriko is still in an early stage, but contributions are welcome! +phoebe is still in an early stage, but contributions are welcome! ## License -shioriko is licensed under the [MIT license](https://choosealicense.com/licenses/mit/). \ No newline at end of file +phoebe is licensed under the [MIT license](https://choosealicense.com/licenses/mit/). \ No newline at end of file diff --git a/go.mod b/go.mod index 081eb0c..ceba0ba 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/Damillora/Shioriko +module github.com/Damillora/phoebe go 1.21.0 diff --git a/main.go b/main.go index f58c436..e189cca 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/Damillora/Shioriko/pkg/app" + "github.com/Damillora/phoebe/pkg/app" ) func main() { diff --git a/phoebe-logo.svg b/phoebe-logo.svg new file mode 100644 index 0000000..5e3fa5a --- /dev/null +++ b/phoebe-logo.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/app/app.go b/pkg/app/app.go index 04f5722..48d9c30 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -5,9 +5,9 @@ import ( "net/http" "os" - "github.com/Damillora/Shioriko/pkg/config" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/web" + "github.com/Damillora/phoebe/pkg/config" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/web" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) diff --git a/pkg/app/auth_routes.go b/pkg/app/auth_routes.go index 2f97c45..8aedebc 100644 --- a/pkg/app/auth_routes.go +++ b/pkg/app/auth_routes.go @@ -3,10 +3,10 @@ package app import ( "net/http" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" ) diff --git a/pkg/app/blob_routes.go b/pkg/app/blob_routes.go index b19a03d..e22940b 100644 --- a/pkg/app/blob_routes.go +++ b/pkg/app/blob_routes.go @@ -14,11 +14,11 @@ import ( "golang.org/x/image/draw" _ "golang.org/x/image/webp" - "github.com/Damillora/Shioriko/pkg/config" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/config" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/corona10/goimagehash" "github.com/gin-gonic/gin" "github.com/google/uuid" diff --git a/pkg/app/post_routes.go b/pkg/app/post_routes.go index fb88b09..dec4026 100644 --- a/pkg/app/post_routes.go +++ b/pkg/app/post_routes.go @@ -5,10 +5,10 @@ import ( "strconv" "strings" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" ) diff --git a/pkg/app/tag_routes.go b/pkg/app/tag_routes.go index bad0dd7..45aba9c 100644 --- a/pkg/app/tag_routes.go +++ b/pkg/app/tag_routes.go @@ -3,9 +3,9 @@ package app import ( "net/http" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" ) diff --git a/pkg/app/tag_type_routes.go b/pkg/app/tag_type_routes.go index 8dd6c80..4d38cd8 100644 --- a/pkg/app/tag_type_routes.go +++ b/pkg/app/tag_type_routes.go @@ -4,9 +4,9 @@ import ( "net/http" "strconv" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" ) diff --git a/pkg/app/user_routes.go b/pkg/app/user_routes.go index 100c4a4..4559fec 100644 --- a/pkg/app/user_routes.go +++ b/pkg/app/user_routes.go @@ -3,11 +3,11 @@ package app import ( "net/http" - "github.com/Damillora/Shioriko/pkg/config" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/middleware" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/config" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/middleware" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" ) diff --git a/pkg/database/main.go b/pkg/database/main.go index cf9c790..9372976 100644 --- a/pkg/database/main.go +++ b/pkg/database/main.go @@ -3,7 +3,7 @@ package database import ( "log" - "github.com/Damillora/Shioriko/pkg/config" + "github.com/Damillora/phoebe/pkg/config" "github.com/google/uuid" "gorm.io/gorm" diff --git a/pkg/middleware/auth_middleware.go b/pkg/middleware/auth_middleware.go index 46f9065..8939acb 100644 --- a/pkg/middleware/auth_middleware.go +++ b/pkg/middleware/auth_middleware.go @@ -3,8 +3,8 @@ package middleware import ( "strings" - "github.com/Damillora/Shioriko/pkg/models" - "github.com/Damillora/Shioriko/pkg/services" + "github.com/Damillora/phoebe/pkg/models" + "github.com/Damillora/phoebe/pkg/services" "github.com/gin-gonic/gin" ) diff --git a/pkg/services/auth.go b/pkg/services/auth.go index c259a22..c02bf67 100644 --- a/pkg/services/auth.go +++ b/pkg/services/auth.go @@ -4,8 +4,8 @@ import ( "errors" "time" - "github.com/Damillora/Shioriko/pkg/config" - "github.com/Damillora/Shioriko/pkg/database" + "github.com/Damillora/phoebe/pkg/config" + "github.com/Damillora/phoebe/pkg/database" "github.com/dgrijalva/jwt-go" "golang.org/x/crypto/bcrypt" ) @@ -24,9 +24,9 @@ func CreateToken(user *database.User) string { token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "email": user.Email, "name": user.Username, - "iss": "shioriko-api", + "iss": "phoebe-api", "sub": user.ID, - "aud": "shioriko", + "aud": "phoebe", "exp": time.Now().Add(time.Hour * 24).Unix(), }) jwtToken, _ := token.SignedString([]byte(config.CurrentConfig.AuthSecret)) diff --git a/pkg/services/blob.go b/pkg/services/blob.go index 32815b3..ba15443 100644 --- a/pkg/services/blob.go +++ b/pkg/services/blob.go @@ -3,8 +3,8 @@ package services import ( "encoding/binary" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/models" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/models" "github.com/corona10/goimagehash" ) diff --git a/pkg/services/post.go b/pkg/services/post.go index 73e1a4b..4e880e0 100644 --- a/pkg/services/post.go +++ b/pkg/services/post.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/models" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/models" "github.com/google/uuid" ) diff --git a/pkg/services/tag.go b/pkg/services/tag.go index 220b855..0870485 100644 --- a/pkg/services/tag.go +++ b/pkg/services/tag.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/models" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/models" "github.com/google/uuid" ) diff --git a/pkg/services/tag_type.go b/pkg/services/tag_type.go index 0ea4a61..862138e 100644 --- a/pkg/services/tag_type.go +++ b/pkg/services/tag_type.go @@ -1,8 +1,8 @@ package services import ( - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/models" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/models" ) func GetTagTypeAll() []database.TagType { diff --git a/pkg/services/user.go b/pkg/services/user.go index b0d709f..60db938 100644 --- a/pkg/services/user.go +++ b/pkg/services/user.go @@ -1,8 +1,8 @@ package services import ( - "github.com/Damillora/Shioriko/pkg/database" - "github.com/Damillora/Shioriko/pkg/models" + "github.com/Damillora/phoebe/pkg/database" + "github.com/Damillora/phoebe/pkg/models" "github.com/google/uuid" "golang.org/x/crypto/bcrypt" ) @@ -56,12 +56,10 @@ func UpdateUserProfile(id string, model models.UserUpdateModel) (*database.User, return &user, nil } - func UpdateUserPassword(id string, model models.UserUpdatePasswordModel) (*database.User, error) { var user database.User result := database.DB.Where("id = ?", id).First(&user) - if user.Password != "" { verifyErr := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(model.OldPassword)) if verifyErr != nil { diff --git a/pkg/web/package-lock.json b/pkg/web/package-lock.json index 4d30096..6830bc6 100644 --- a/pkg/web/package-lock.json +++ b/pkg/web/package-lock.json @@ -1,15 +1,16 @@ { - "name": "Shioriko", - "version": "0.0.1", + "name": "phoebe", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "Shioriko", - "version": "0.0.1", + "name": "phoebe", + "version": "0.1.0", "dependencies": { "axios": "^1.4.0", "bulma": "^1.0.3", + "child_process": "^1.0.2", "date-fns": "^4.1.0", "query-string": "^8.1.0" }, @@ -1744,6 +1745,12 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/child_process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz", + "integrity": "sha512-Wmza/JzL0SiWz7kl6MhIKT5ceIlnFPJX+lwUGj7Clhy5MMldsSoJR0+uvRzOS5Kv45Mq7t1PoE8TsOA9bzvb6g==", + "license": "ISC" + }, "node_modules/chokidar": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", diff --git a/pkg/web/package.json b/pkg/web/package.json index 1e9ea12..ccdbeaf 100644 --- a/pkg/web/package.json +++ b/pkg/web/package.json @@ -1,6 +1,6 @@ { - "name": "Shioriko", - "version": "0.0.1", + "name": "phoebe", + "version": "0.1.0", "private": true, "scripts": { "dev": "vite dev", @@ -30,6 +30,7 @@ "dependencies": { "axios": "^1.4.0", "bulma": "^1.0.3", + "child_process": "^1.0.2", "date-fns": "^4.1.0", "query-string": "^8.1.0" } diff --git a/pkg/web/src/app.scss b/pkg/web/src/app.scss index 174c053..c1e75ed 100644 --- a/pkg/web/src/app.scss +++ b/pkg/web/src/app.scss @@ -3,7 +3,7 @@ // Path to Bulma's sass folder @use "../node_modules/bulma/sass/" as * with ( $family-primary: '"Nunito", sans-serif', - $primary: #37b484, + $primary: #4c94e8, ); // Import the Google Font @import "https://fonts.googleapis.com/css?family=Nunito:400,700"; diff --git a/pkg/web/src/lib/assets/phoebe-logo.svg b/pkg/web/src/lib/assets/phoebe-logo.svg new file mode 100644 index 0000000..5e3fa5a --- /dev/null +++ b/pkg/web/src/lib/assets/phoebe-logo.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/web/src/lib/components/ui/Footer.svelte b/pkg/web/src/lib/components/ui/Footer.svelte new file mode 100644 index 0000000..8ef3782 --- /dev/null +++ b/pkg/web/src/lib/components/ui/Footer.svelte @@ -0,0 +1,12 @@ + +
+
+

+ phoebe: a booru-style image gallery and organizer +

+

version {version}

+
+
\ No newline at end of file diff --git a/pkg/web/src/lib/components/ui/ShiorikoImage.svelte b/pkg/web/src/lib/components/ui/ImageView.svelte similarity index 100% rename from pkg/web/src/lib/components/ui/ShiorikoImage.svelte rename to pkg/web/src/lib/components/ui/ImageView.svelte diff --git a/pkg/web/src/lib/components/ui/Navbar.svelte b/pkg/web/src/lib/components/ui/Navbar.svelte index dbd5956..1706b2a 100644 --- a/pkg/web/src/lib/components/ui/Navbar.svelte +++ b/pkg/web/src/lib/components/ui/Navbar.svelte @@ -1,4 +1,5 @@ @@ -13,7 +13,7 @@ diff --git a/pkg/web/src/routes/+layout.svelte b/pkg/web/src/routes/+layout.svelte index f765849..4f8fa53 100644 --- a/pkg/web/src/routes/+layout.svelte +++ b/pkg/web/src/routes/+layout.svelte @@ -1,6 +1,7 @@ - Shioriko + phoebe {@render children?.()} -
-
-

- shioriko: a booru-style image gallery and organizer -

-
-
\ No newline at end of file +