diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cc8258df..feb3c4d9 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -47,7 +47,7 @@ jobs: name: Test strategy: matrix: - go-version: [ 1.21.x ] + go-version: [ 1.21.x, 1.22.x ] platform: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.platform }} steps: @@ -66,7 +66,7 @@ jobs: name: TestOnWindows strategy: matrix: - go-version: [ 1.21.x ] + go-version: [ 1.21.x, 1.22.x ] platform: [ windows-latest ] runs-on: ${{ matrix.platform }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index f5e6d99a..3b2f9eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to paopao-ce are documented in this file. - add all-in-one docker image build scripts. - frontend: add tweets filter support use tag for home page and make it as default behavior. - add pin topic support. +- support upload webp format image as picture when send tweet. ## 0.5.2 ### Change diff --git a/Dockerfile b/Dockerfile index 345ba15a..e98e5dca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # build frontend -FROM node:19-alpine as frontend +FROM node:19-alpine AS frontend ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes @@ -12,17 +12,28 @@ RUN [ $EMBED_UI != yes ] || [ $USE_API_HOST != yes ] || echo "VITE_HOST='$API_HO RUN [ $EMBED_UI != yes ] || [ $USE_DIST != no ] || (yarn && yarn build) RUN [ $EMBED_UI = yes ] || mkdir dist || echo "" -# build backend -FROM bitbus/paopao-ce-backend-builder:latest AS backend +# build go mod cache +FROM bitbus/paopao-ce-backend-builder:latest AS gomodcache ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes ARG USE_DIST=no +ENV GOPROXY=https://goproxy.cn,direct +WORKDIR /paopao-ce +COPY go.mod . +COPY go.sum . +RUN go mod download +# build backend +FROM gomodcache AS backend +ARG API_HOST +ARG USE_API_HOST=yes +ARG EMBED_UI=yes +ARG USE_DIST=no WORKDIR /paopao-ce COPY . . COPY --from=frontend /web/dist ./web/dist -ENV GOPROXY=https://goproxy.cn +ENV GOPROXY=https://goproxy.cn,direct RUN [ $EMBED_UI != yes ] || make build TAGS='go_json' RUN [ $EMBED_UI = yes ] || make build TAGS='slim embed go_json' @@ -32,11 +43,9 @@ ARG USE_API_HOST=yes ARG EMBED_UI=yes ARG USE_DIST=no ENV TZ=Asia/Shanghai - WORKDIR /app/paopao-ce COPY --from=backend /paopao-ce/release/paopao . COPY --from=backend /paopao-ce/config.yaml.sample config.yaml - VOLUME ["/app/paopao-ce/custom"] EXPOSE 8008 HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD ps -ef | grep paopao || exit 1 diff --git a/Dockerfile.allinone b/Dockerfile.allinone index 1624b2b9..efe4be4b 100644 --- a/Dockerfile.allinone +++ b/Dockerfile.allinone @@ -22,9 +22,9 @@ ARG USE_DIST=no WORKDIR /paopao-ce COPY . . COPY --from=frontend /web/dist ./web/dist -ENV GOPROXY=https://goproxy.cn -RUN [ $EMBED_UI != yes ] || make build TAGS='go_json migration' -RUN [ $EMBED_UI = yes ] || make build TAGS='slim embed go_json migration' +ENV GOPROXY=https://goproxy.cn,direct +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI != yes ] || make buildx TAGS='go_json migration' +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI = yes ] || make buildx TAGS='slim embed go_json migration' FROM bitbus/paopao-ce-allinone-runner:latest ARG API_HOST diff --git a/Makefile b/Makefile index 33b32eca..ecfc0d43 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ LDFLAGS = -X "${MOD_NAME}/pkg/version.version=${BUILD_VERSION}" \ all: fmt build build: + @echo Build paopao-ce + @go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_ROOT)/$(TARGET) + +buildx: @go mod download @echo Build paopao-ce @go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_ROOT)/$(TARGET) diff --git a/auto/api/m/v1/user.go b/auto/api/m/v1/user.go index 45d7fbba..bea939a4 100644 --- a/auto/api/m/v1/user.go +++ b/auto/api/m/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/r/v1/user.go b/auto/api/r/v1/user.go index 8c385f14..82850dc2 100644 --- a/auto/api/r/v1/user.go +++ b/auto/api/r/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/s/v1/user.go b/auto/api/s/v1/user.go index a876f6b7..ac25628d 100644 --- a/auto/api/s/v1/user.go +++ b/auto/api/s/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/admin.go b/auto/api/v1/admin.go index 4c3af448..b3c208c7 100644 --- a/auto/api/v1/admin.go +++ b/auto/api/v1/admin.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 @@ -22,6 +22,7 @@ type _render_ interface { type _default_ interface { Bind(*gin.Context, any) mir.Error + BindJson(*gin.Context, any) mir.Error Render(*gin.Context, any, mir.Error) } diff --git a/auto/api/v1/alipay_priv.go b/auto/api/v1/alipay_priv.go index 3c3ee1f5..86669b89 100644 --- a/auto/api/v1/alipay_priv.go +++ b/auto/api/v1/alipay_priv.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/alipay_pub.go b/auto/api/v1/alipay_pub.go index e1c3e8b7..f4bbde51 100644 --- a/auto/api/v1/alipay_pub.go +++ b/auto/api/v1/alipay_pub.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/core.go b/auto/api/v1/core.go index 911445ab..cd564736 100644 --- a/auto/api/v1/core.go +++ b/auto/api/v1/core.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/followship.go b/auto/api/v1/followship.go index c0041feb..f1787fc4 100644 --- a/auto/api/v1/followship.go +++ b/auto/api/v1/followship.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/friendship.go b/auto/api/v1/friendship.go index 6165822b..78747933 100644 --- a/auto/api/v1/friendship.go +++ b/auto/api/v1/friendship.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 @@ -56,7 +56,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.DeleteFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -69,7 +69,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.RejectFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -82,7 +82,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.AddFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -95,7 +95,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.RequestingFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } diff --git a/auto/api/v1/loose.go b/auto/api/v1/loose.go index dbf598d2..80d4f4ae 100644 --- a/auto/api/v1/loose.go +++ b/auto/api/v1/loose.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/priv.go b/auto/api/v1/priv.go index a8f46943..a48ef256 100644 --- a/auto/api/v1/priv.go +++ b/auto/api/v1/priv.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/pub.go b/auto/api/v1/pub.go index 98a41440..28abcb46 100644 --- a/auto/api/v1/pub.go +++ b/auto/api/v1/pub.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/relax.go b/auto/api/v1/relax.go index bc24486c..65aac2aa 100644 --- a/auto/api/v1/relax.go +++ b/auto/api/v1/relax.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/site.go b/auto/api/v1/site.go index 3ec9fcc7..ba523c2d 100644 --- a/auto/api/v1/site.go +++ b/auto/api/v1/site.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/trends.go b/auto/api/v1/trends.go index cce1b739..959fa317 100644 --- a/auto/api/v1/trends.go +++ b/auto/api/v1/trends.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/x/v1/user.go b/auto/api/x/v1/user.go index bf2e84a4..a6ae9a58 100644 --- a/auto/api/x/v1/user.go +++ b/auto/api/x/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/build-allinone.sh b/build-allinone.sh new file mode 100755 index 00000000..06353b81 --- /dev/null +++ b/build-allinone.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# eg.1 : sh build-image.sh +# eg.2, set image: sh build-image.sh bitbus/paopao-ce + +VERSION=`git describe --tags --always | cut -f1,2 -d "-"` # eg.: 0.2.5 +IMAGE="bitbus/paopao-ce" + +if [ -n "$1" ]; then + IMAGE="$1" +fi +if [ -n "$2" ]; then + VERSION="$2" +fi + +# build image +docker buildx build \ + --build-arg USE_DIST="yes" \ + --tag "$IMAGE:all-in-one-${VERSION}" \ + --tag "$IMAGE:all-in-one-latest" \ + . -f Dockerfile.allinone + +# push to image rep +# if [ -n "$1" ]; then +# docker push "$IMAGE:${VERSION}" +# docker push "$IMAGE:latest" +# fi diff --git a/docker-compose.yaml b/docker-compose.yaml index 885c3141..7135f52c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -67,7 +67,7 @@ services: # - paopao-network meili: - image: getmeili/meilisearch:${MEILI_TAG:-v1.6} + image: getmeili/meilisearch:${MEILI_TAG:-v1.7} restart: always ports: - 7700:7700 @@ -124,7 +124,7 @@ services: # - paopao-network backend: - image: bitbus/paopao-ce:${PAOPAOCE_TAG:-nightly} + image: bitbus/paopao-ce:${PAOPAOCE_TAG:-0.6-alpha} restart: always depends_on: - db diff --git a/docs/openapi/index.html b/docs/openapi/index.html index cec190fe..2a30394d 100644 --- a/docs/openapi/index.html +++ b/docs/openapi/index.html @@ -5,7 +5,7 @@ paopao-ce develop documents - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/package.json b/web/package.json index bad4f50e..2a0625aa 100644 --- a/web/package.json +++ b/web/package.json @@ -9,36 +9,36 @@ "tauri": "tauri" }, "dependencies": { - "@opentiny/vue-slide-bar": "^3.12.0", + "@opentiny/vue-slide-bar": "^3.13.0", "@vicons/carbon": "^0.12.0", "@vicons/fa": "^0.12.0", "@vicons/ionicons5": "^0.12.0", "@vicons/material": "^0.12.0", "@vicons/tabler": "^0.12.0", - "axios": "^1.6.3", + "axios": "^1.6.7", "copy-to-clipboard": "^3.3.3", "less": "^4.2.0", "lodash": "^4.17.21", "moment": "^2.30.1", - "naive-ui": "^2.36.0", + "naive-ui": "^2.37.3", "paopao-video-player": "^1.0.0", "qrcanvas-vue": "^3.0.0", "qrcode": "^1.5.3", "unplugin-vue-components": "^0.26.0", "v3-infinite-loading": "^1.3.1", "vfonts": "^0.0.3", - "vue": "^3.4.3", + "vue": "^3.4.21", "vue-router": "4", "vuex": "^4.1.0" }, "devDependencies": { - "@tauri-apps/cli": "^1.5.9", - "@types/node": "^20.10.5", + "@tauri-apps/cli": "^1.5.10", + "@types/node": "^20.11.24", "@types/qrcode": "^1.5.5", - "@vitejs/plugin-vue": "^5.0.0", - "@vue/compiler-sfc": "^3.3.13", + "@vitejs/plugin-vue": "^5.0.4", + "@vue/compiler-sfc": "^3.4.21", "rollup-plugin-visualizer": "^5.12.0", "typescript": "^5.3.3", - "vite": "^5.0.10" + "vite": "^5.1.4" } } diff --git a/web/src/components/compose.vue b/web/src/components/compose.vue index b224a775..1688d645 100644 --- a/web/src/components/compose.vue +++ b/web/src/components/compose.vue @@ -429,11 +429,11 @@ const beforeUpload = async (data: any) => { // 图片类型校验 if ( uploadType.value === 'public/image' && - !['image/png', 'image/jpg', 'image/jpeg', 'image/gif'].includes( + !['image/webp', 'image/png', 'image/jpg', 'image/jpeg', 'image/gif'].includes( data.file.file?.type ) ) { - window.$message.warning('图片仅允许 png/jpg/gif 格式'); + window.$message.warning('图片仅允许 webp/png/jpg/gif 格式'); return false; } diff --git a/web/src/components/main-nav.vue b/web/src/components/main-nav.vue index 0f970573..a398e2ee 100644 --- a/web/src/components/main-nav.vue +++ b/web/src/components/main-nav.vue @@ -49,10 +49,10 @@ class="theme-switch-wrap" >