mirror of https://github.com/rocboss/paopao-ce
commit
d34068a8c3
@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
*.log
|
||||
__debug_bin
|
||||
settings.json
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "paopao-ce [debug]",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "exec",
|
||||
"program": "${workspaceFolder}/.vscode/__debug_bin",
|
||||
"preLaunchTask": "go: build (debug)",
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
let launch = require('./launch.json');
|
||||
launch.configurations.sort((a, b) => a.name.localeCompare(b.name));
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync('launch.json', JSON.stringify(launch, null, 4));
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "go: build (debug)",
|
||||
"type": "shell",
|
||||
"command": "go",
|
||||
"args": [
|
||||
"build",
|
||||
"-gcflags=all=-N -l",
|
||||
"-tags",
|
||||
"'embed go_json'",
|
||||
"-o",
|
||||
"${workspaceFolder}/.vscode/__debug_bin"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to paopao-ce are documented in this file.
|
||||
|
||||
## 0.3.0+dev ([`dev`](https://github.com/rocboss/paopao-ce/tree/dev))
|
||||
|
||||
### Added
|
||||
|
||||
- add custom comment sort strategy support [#243](https://github.com/rocboss/paopao-ce/pull/243)
|
||||
- add `RedisCacheIndex` feature [#250](https://github.com/rocboss/paopao-ce/pull/250)
|
||||
- add `Sentry` feature [#258](https://github.com/rocboss/paopao-ce/pull/258)
|
||||
- add simple tweet share feature(just copy tweet link to clipboard now) support [#264](https://github.com/rocboss/paopao-ce/pull/264)
|
||||
- add default tweet max length configure in web/.env support. [&a1160ca](https://github.com/rocboss/paopao-ce/commit/a1160ca79380445157146d9eae1710543c153cce 'commit a1160ca')
|
||||
Set the value of `VITE_DEFAULT_TWEET_MAX_LENGTH` in file web/.env to change the tweet max default length.
|
||||
- add custom whether provide user register configure in web/.env support. [#267](https://github.com/rocboss/paopao-ce/pull/267)
|
||||
Set the value of `VITE_ALLOW_USER_REGISTER` in file web/.env to custom whether provide user register feature.
|
||||
```
|
||||
# file: web/.env or web/.env.local
|
||||
...
|
||||
# 局部参数
|
||||
VITE_ALLOW_USER_REGISTER=true
|
||||
...
|
||||
```
|
||||
and disallow user register in backend(add `Web:DisallowUserRegister` feature in `config.yaml`):
|
||||
```yaml
|
||||
# file config.yaml
|
||||
...
|
||||
Features:
|
||||
Default: ["Base", "Postgres", "Zinc", "LocalOSS", "LoggerZinc", "BigCacheIndex", "Friendship", "Service", "Web:DisallowUserRegister"]
|
||||
...
|
||||
```
|
||||
- add topic follow feature support [#273](https://github.com/rocboss/paopao-ce/pull/273)
|
||||
mirgration database first(sql ddl file in `scripts/migration/**/*_topic_follow.up.sql`):
|
||||
```sql
|
||||
CREATE TABLE `p_topic_user` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`topic_id` BIGINT UNSIGNED NOT NULL COMMENT '标签ID',
|
||||
`user_id` BIGINT UNSIGNED NOT NULL COMMENT '创建者ID',
|
||||
`alias_name` VARCHAR ( 255 ) COMMENT '别名',
|
||||
`remark` VARCHAR ( 512 ) COMMENT '备注',
|
||||
`quote_num` BIGINT UNSIGNED COMMENT '引用数',
|
||||
`is_top` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否置顶 0 为未置顶、1 为已置顶',
|
||||
`created_on` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modified_on` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
`deleted_on` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '删除时间',
|
||||
`is_del` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否删除 0 为未删除、1 为已删除',
|
||||
`reserve_a` VARCHAR ( 255 ) COMMENT '保留字段a',
|
||||
`reserve_b` VARCHAR ( 255 ) COMMENT '保留字段b',
|
||||
PRIMARY KEY ( `id` ) USING BTREE,
|
||||
UNIQUE KEY `idx_topic_user_uid_tid` ( `topic_id`, `user_id` ) USING BTREE
|
||||
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户话题';
|
||||
```
|
||||
- add tweet comment thumbs up/down feature support [#275](https://github.com/rocboss/paopao-ce/pull/275)
|
||||
mirgration database first(sql ddl file in `scripts/migration/**/*_comment_thumbs.up.sql`):
|
||||
- add load more comments feature support [&60b217b](https://github.com/rocboss/paopao-ce/commit/60b217bcd950c69ba45cebcaa17efdf8048d5a4f 'commit 60b217b')
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed sql ddl p_contact's column `is_delete` define error (change to `is_del`) in scripts/paopao-mysql.sql [&afd8fe1](https://github.com/rocboss/paopao-ce/commit/afd8fe18d2dce08a4af846c2f822379d99a3d3b3 'commit afd8fe1')
|
||||
- fixed cache index not expire in delete/add tweet error [#266](https://github.com/rocboss/paopao-ce/pull/266)
|
||||
- fixed tweet's owner not allow star/collection action when tweet is private error [#274](https://github.com/rocboss/paopao-ce/pull/274)
|
||||
- fixed user not list owner's collectioned private tweet error [#274](https://github.com/rocboss/paopao-ce/pull/274)
|
||||
- fixed comments thumbs up/down state incorrect error [#283](https://github.com/rocboss/paopao-ce/pull/283)
|
||||
|
||||
### Changed
|
||||
|
||||
- use [github.com/rueian/rueidis](https://github.com/rueian/rueidis) as Redis client [#249](https://github.com/rocboss/paopao-ce/pull/249)
|
||||
the **Old** redis client configure field
|
||||
```yaml
|
||||
...
|
||||
Redis:
|
||||
Host: redis:6379
|
||||
Password:
|
||||
DB:
|
||||
```
|
||||
the **New** redis client configure field
|
||||
```yaml
|
||||
...
|
||||
Redis:
|
||||
InitAddress:
|
||||
- redis:6379
|
||||
Username:
|
||||
Password:
|
||||
SelectDB:
|
||||
ConnWriteTimeout: 60 # 连接写超时时间 多少秒 默认 60秒
|
||||
```
|
||||
- optimize web frontend dark theme [&b082a8f](https://github.com/rocboss/paopao-ce/commit/b082a8fa5e43dd6dacf459df93fa7e243dd901ea 'commit b082a8f')
|
||||
- change web frontend main content layout default size to 544px [&b082a8f](https://github.com/rocboss/paopao-ce/commit/b082a8fa5e43dd6dacf459df93fa7e243dd901ea 'commit b082a8f')
|
||||
- optimize web frontend in mobile environment use Drawer to display menu [#265](https://github.com/rocboss/paopao-ce/pull/265)
|
||||
- optimize Dockerfile use pre-build builder/runner image to prevent network latency problem (`bitbus/paopao-ce-backend-builder` `bitbus/paopao-ce-backend-runner`) [#265](https://github.com/rocboss/paopao-ce/pull/265)
|
||||
- optimize web ui in mobile environment [#280](https://github.com/rocboss/paopao-ce/pull/280)
|
||||
|
||||
### Removed
|
||||
|
||||
- remove `Deprecated:OldWeb` feature [#256](https://github.com/rocboss/paopao-ce/pull/256)
|
||||
|
||||
## 0.2.5
|
||||
|
||||
### Changed
|
||||
|
||||
- fixed sql ddl error for contact table [#281](https://github.com/rocboss/paopao-ce/pull/281)
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Added
|
||||
|
||||
- add PWA support for web frontend [#242](https://github.com/rocboss/paopao-ce/pull/242)
|
||||
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Added
|
||||
|
||||
- add PostgreSQL DDL file [#229](https://github.com/rocboss/paopao-ce/pull/229)
|
||||
|
||||
### Changed
|
||||
|
||||
- optimize MySQL DDL file [#229](https://github.com/rocboss/paopao-ce/pull/229)
|
||||
- optimize Sqlite3 DDL file [#229](https://github.com/rocboss/paopao-ce/pull/229)
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed add star to tweet error [#222](https://github.com/rocboss/paopao-ce/pull/222)
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Changed
|
||||
|
||||
- optimize docker-compose.yaml use bitbus/paopao-ce:latest as release image [#217](https://github.com/rocboss/paopao-ce/pull/217)
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed sql ddl in scripts/paopao-mysql.sql and scripts/paopao-sqlite3.sql [#217](https://github.com/rocboss/paopao-ce/pull/217)
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Added
|
||||
|
||||
- add `Friendship` feature [#192](https://github.com/rocboss/paopao-ce/pull/192)
|
||||
- add `Lightship` feature [#198](https://github.com/rocboss/paopao-ce/pull/198)
|
||||
- add `Pyroscope` feature [#199](https://github.com/rocboss/paopao-ce/pull/199)
|
||||
- add new `Web` service [#196](https://github.com/rocboss/paopao-ce/pull/196)
|
||||
- add `Frontend:Web` feature [#196](https://github.com/rocboss/paopao-ce/pull/196)
|
||||
- add `Deprecated:OldWeb` feature [#196](https://github.com/rocboss/paopao-ce/pull/196)
|
||||
|
||||
### Changes
|
||||
|
||||
- support run multiple service in single paopao-ce instance [#196](https://github.com/rocboss/paopao-ce/pull/196)
|
||||
- use [go-mir](https://github.com/alimy/mir) optimize paopao-ce source code architecture [#196](https://github.com/rocboss/paopao-ce/pull/196)
|
||||
|
||||
### Fixed
|
||||
|
||||
- some other features optimize and bug fix
|
||||
|
||||
---
|
||||
|
||||
**Older change logs can be found on [GitHub](https://github.com/rocboss/paopao-ce/releases?after=v0.2.0).**
|
@ -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 -f2 -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:${VERSION}" \
|
||||
--tag "$IMAGE:latest" \
|
||||
. -f Dockerfile
|
||||
|
||||
# push to image rep
|
||||
# if [ -n "$1" ]; then
|
||||
# docker push "$IMAGE:${VERSION}"
|
||||
# docker push "$IMAGE:latest"
|
||||
# fi
|
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# eg.1 : sh build-image.sh
|
||||
# eg.2, set tags: sh build-image.sh 'embed go_json'
|
||||
|
||||
TAGS='embed go_json'
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
TAGS="$1"
|
||||
fi
|
||||
|
||||
make release CGO_ENABLED=0 TAGS="$TAGS"
|
@ -1,6 +1,6 @@
|
||||
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
|
||||
| ----- | ----- | ----- | ----- | ----- | ----- |
|
||||
| 005| 北野 | 2022-11-21 | 2023-01-04 | v1.1 | 提议 |
|
||||
| 22112109 | 北野 | 2022-11-21 | 2023-01-04 | v1.1 | 提议 |
|
||||
|
||||
### 引入go-mir优化后端架构设计
|
||||
引入[github.com/alimy/mir/v3](https://github.com/alimy/mir)优化后端的架构设计,使得后端代码更具扩展型。
|
@ -1,6 +1,6 @@
|
||||
## Draft
|
||||
* [001-关于paopao-ce的设计定位](001-关于paopao-ce的设计定位.md "关于paopao-ce的设计定位")
|
||||
* [002-关于Friendship功能项的设计](002-关于Friendship功能项的设计.md "关于Friendship功能项的设计")
|
||||
* [003-关于Followship功能项的设计](003-关于Followship功能项的设计.md "关于Followship功能项的设计")
|
||||
* [005-引入go-mir优化后端架构设计](005-引入go-mir优化后端架构设计.md "引入go-mir优化后端架构设计")
|
||||
* [006-关于paopao-ce的结构设计](006-关于paopao-ce的结构设计.md "关于paopao-ce的结构设计")
|
||||
* [22110411-关于paopao-ce的设计定位](22110411-关于paopao-ce的设计定位.md "关于paopao-ce的设计定位")
|
||||
* [22110410-关于Friendship功能项的设计](22110410-关于Friendship功能项的设计.md "关于Friendship功能项的设计")
|
||||
* [22110409-关于Followship功能项的设计](22110409-关于Followship功能项的设计.md "关于Followship功能项的设计")
|
||||
* [22112109-引入go-mir优化后端架构设计](22112109-引入go-mir优化后端架构设计.md "引入go-mir优化后端架构设计")
|
||||
* [22112309-关于paopao-ce的结构设计](22112309-关于paopao-ce的结构设计.md "关于paopao-ce的结构设计")
|
||||
|
@ -1,133 +1,139 @@
|
||||
module github.com/rocboss/paopao-ce
|
||||
|
||||
go 1.18
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/Masterminds/semver/v3 v3.1.1
|
||||
github.com/Masterminds/semver/v3 v3.2.1
|
||||
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868
|
||||
github.com/alimy/cfg v0.3.0
|
||||
github.com/alimy/mir/v3 v3.0.1
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible
|
||||
github.com/alimy/mir/v3 v3.1.1
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
|
||||
github.com/allegro/bigcache/v3 v3.0.2
|
||||
github.com/bytedance/sonic v1.5.0
|
||||
github.com/bytedance/sonic v1.8.8
|
||||
github.com/cockroachdb/errors v1.9.1
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/ethereum/go-ethereum v1.10.16
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/fbsobreira/gotron-sdk v0.0.0-20211102183839-58a64f4da5f4
|
||||
github.com/gin-contrib/cors v1.3.1
|
||||
github.com/gin-gonic/gin v1.8.1
|
||||
github.com/go-redis/redis/v8 v8.11.4
|
||||
github.com/fatih/color v1.15.0
|
||||
github.com/getsentry/sentry-go v0.20.0
|
||||
github.com/gin-contrib/cors v1.4.0
|
||||
github.com/gin-gonic/gin v1.9.0
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/goccy/go-json v0.9.7
|
||||
github.com/gofrs/uuid v4.0.0+incompatible
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/gofrs/uuid v4.4.0+incompatible
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||
github.com/golang-migrate/migrate/v4 v4.15.2
|
||||
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.12+incompatible
|
||||
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.23.3+incompatible
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/meilisearch/meilisearch-go v0.23.0
|
||||
github.com/minio/minio-go/v7 v7.0.45
|
||||
github.com/meilisearch/meilisearch-go v0.24.0
|
||||
github.com/minio/minio-go/v7 v7.0.52
|
||||
github.com/onsi/ginkgo/v2 v2.9.2
|
||||
github.com/onsi/gomega v1.27.6
|
||||
github.com/pyroscope-io/client v0.7.0
|
||||
github.com/rueian/rueidis v0.0.100
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/smartwalle/alipay/v3 v3.1.7
|
||||
github.com/spf13/viper v1.14.0
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.35
|
||||
github.com/smartwalle/alipay/v3 v3.2.1
|
||||
github.com/sourcegraph/conc v0.3.0
|
||||
github.com/spf13/viper v1.15.0
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.41
|
||||
github.com/yinheli/mahonia v0.0.0-20131226213531-0eef680515cc
|
||||
google.golang.org/grpc v1.50.1
|
||||
google.golang.org/protobuf v1.28.1
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
go.uber.org/automaxprocs v1.5.2
|
||||
google.golang.org/grpc v1.54.0
|
||||
google.golang.org/protobuf v1.30.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
gopkg.in/resty.v1 v1.12.0
|
||||
gorm.io/driver/mysql v1.3.4
|
||||
gorm.io/driver/postgres v1.3.7
|
||||
gorm.io/driver/sqlite v1.3.4
|
||||
gorm.io/gorm v1.23.4
|
||||
gorm.io/plugin/dbresolver v1.1.0
|
||||
gorm.io/plugin/soft_delete v1.1.0
|
||||
modernc.org/sqlite v1.17.3
|
||||
gorm.io/driver/mysql v1.5.0
|
||||
gorm.io/driver/postgres v1.5.0
|
||||
gorm.io/driver/sqlite v1.4.4
|
||||
gorm.io/gorm v1.25.0
|
||||
gorm.io/plugin/dbresolver v1.4.1
|
||||
gorm.io/plugin/soft_delete v1.2.1
|
||||
modernc.org/sqlite v1.22.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/andybalholm/brotli v1.0.4 // indirect
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
|
||||
github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06 // indirect
|
||||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/clbanning/mxj v1.8.4 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect
|
||||
github.com/cockroachdb/redact v1.1.3 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.10.1 // indirect
|
||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.11.2 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.12.1 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.3.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
|
||||
github.com/jackc/pgtype v1.11.0 // indirect
|
||||
github.com/jackc/pgx/v4 v4.16.1 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
github.com/jackc/pgx/v5 v5.3.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.15.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
|
||||
github.com/klauspost/compress v1.16.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/lib/pq v1.10.2 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.12 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.16 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mozillazg/go-httpheader v0.3.1 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pyroscope-io/godeltaprof v0.1.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||
github.com/rs/xid v1.4.0 // indirect
|
||||
github.com/smartwalle/crypto4go v1.0.2 // indirect
|
||||
github.com/spf13/afero v1.9.2 // indirect
|
||||
github.com/smartwalle/ncrypto v1.0.0 // indirect
|
||||
github.com/spf13/afero v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/subosito/gotenv v1.4.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.7 // indirect
|
||||
github.com/ugorji/go/codec v1.2.9 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.37.1-0.20220607072126-8a320890c08d // indirect
|
||||
github.com/valyala/fasthttp v1.40.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect
|
||||
golang.org/x/text v0.4.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
|
||||
golang.org/x/mod v0.9.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/sys v0.6.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.7.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.1.1 // indirect
|
||||
modernc.org/cc/v3 v3.36.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.6 // indirect
|
||||
modernc.org/libc v1.16.7 // indirect
|
||||
modernc.org/mathutil v1.4.1 // indirect
|
||||
modernc.org/memory v1.1.1 // indirect
|
||||
modernc.org/opt v0.1.1 // indirect
|
||||
modernc.org/strutil v1.1.1 // indirect
|
||||
modernc.org/token v1.0.0 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.13 // indirect
|
||||
modernc.org/libc v1.22.5 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.5.0 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/strutil v1.1.3 // indirect
|
||||
modernc.org/token v1.0.1 // indirect
|
||||
)
|
||||
|
@ -0,0 +1,34 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package conf
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/rueian/rueidis"
|
||||
)
|
||||
|
||||
var (
|
||||
_redisClient rueidis.Client
|
||||
_onceRedis sync.Once
|
||||
)
|
||||
|
||||
func MustRedisClient() rueidis.Client {
|
||||
_onceRedis.Do(func() {
|
||||
client, err := rueidis.NewClient(rueidis.ClientOption{
|
||||
InitAddress: redisSetting.InitAddress,
|
||||
Username: redisSetting.Username,
|
||||
Password: redisSetting.Password,
|
||||
SelectDB: redisSetting.SelectDB,
|
||||
ConnWriteTimeout: redisSetting.ConnWriteTimeout,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("create a redis client failed: %s", err)
|
||||
}
|
||||
_redisClient = client
|
||||
})
|
||||
return _redisClient
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package conf
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/alimy/cfg"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/rocboss/paopao-ce/pkg/version"
|
||||
)
|
||||
|
||||
func initSentry() {
|
||||
cfg.Be("Sentry", func() {
|
||||
opts := sentry.ClientOptions{
|
||||
Dsn: sentrySetting.Dsn,
|
||||
Debug: sentrySetting.Debug,
|
||||
AttachStacktrace: sentrySetting.AttachStacktrace,
|
||||
TracesSampleRate: sentrySetting.TracesSampleRate,
|
||||
}
|
||||
_ = sentry.Init(opts)
|
||||
if sentrySetting.AttachLogrus {
|
||||
setupSentryLogrus(opts)
|
||||
}
|
||||
sentry.WithScope(func(scope *sentry.Scope) {
|
||||
scope.SetExtras(map[string]any{
|
||||
"version": version.VersionInfo(),
|
||||
"time": time.Now().Local(),
|
||||
})
|
||||
sentry.CaptureMessage("paopao-ce sentry works!")
|
||||
})
|
||||
})
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
type CommentThumbs struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
TweetID int64 `json:"tweet_id"`
|
||||
CommentID int64 `json:"comment_id"`
|
||||
ReplyID int64 `json:"reply_id"`
|
||||
CommentType int8 `json:"comment_type"`
|
||||
IsThumbsUp int8 `json:"is_thumbs_up"`
|
||||
IsThumbsDown int8 `json:"is_thumbs_down"`
|
||||
}
|
||||
|
||||
type CommentThumbsList []*CommentThumbs
|
||||
|
||||
type CommentThumbsMap map[int64]*CommentThumbs
|
@ -0,0 +1,153 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rueian/rueidis"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.RedisCache = (*redisCache)(nil)
|
||||
_ tweetsCache = (*redisCacheTweetsCache)(nil)
|
||||
)
|
||||
|
||||
const (
|
||||
_cacheIndexKeyPattern = _cacheIndexKey + "*"
|
||||
_pushToSearchJobKey = "paopao_push_to_search_job"
|
||||
_countLoginErrKey = "paopao_count_login_err"
|
||||
_imgCaptchaKey = "paopao_img_captcha:"
|
||||
_smsCaptchaKey = "paopao_sms_captcha"
|
||||
_countWhisperKey = "paopao_whisper_key"
|
||||
_rechargeStatusKey = "paopao_recharge_status:"
|
||||
)
|
||||
|
||||
type redisCache struct {
|
||||
c rueidis.Client
|
||||
}
|
||||
|
||||
type redisCacheTweetsCache struct {
|
||||
expireDuration time.Duration
|
||||
expireInSecond int64
|
||||
c rueidis.Client
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) getTweetsBytes(key string) ([]byte, error) {
|
||||
res, err := rueidis.MGetCache(s.c, context.Background(), s.expireDuration, []string{key})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
message := res[key]
|
||||
return message.AsBytes()
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) setTweetsBytes(key string, bs []byte) error {
|
||||
cmd := s.c.B().Set().Key(key).Value(rueidis.BinaryString(bs)).ExSeconds(s.expireInSecond).Build()
|
||||
return s.c.Do(context.Background(), cmd).Error()
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) delTweets(keys []string) error {
|
||||
cmd := s.c.B().Del().Key(keys...).Build()
|
||||
return s.c.Do(context.Background(), cmd).Error()
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) allKeys() ([]string, error) {
|
||||
cmd := s.c.B().Keys().Pattern(_cacheIndexKeyPattern).Build()
|
||||
return s.c.Do(context.Background(), cmd).AsStrSlice()
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) Name() string {
|
||||
return "RedisCacheIndex"
|
||||
}
|
||||
|
||||
func (s *redisCacheTweetsCache) Version() *semver.Version {
|
||||
return semver.MustParse("v0.1.0")
|
||||
}
|
||||
|
||||
func (r *redisCache) SetPushToSearchJob(ctx context.Context) error {
|
||||
return r.c.Do(ctx, r.c.B().Set().
|
||||
Key(_pushToSearchJobKey).Value("1").
|
||||
Nx().ExSeconds(3600).
|
||||
Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) DelPushToSearchJob(ctx context.Context) error {
|
||||
return r.c.Do(ctx, r.c.B().Del().Key(_pushToSearchJobKey).Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) SetImgCaptcha(ctx context.Context, id string, value string) error {
|
||||
return r.c.Do(ctx, r.c.B().Set().
|
||||
Key(_imgCaptchaKey+id).Value(value).
|
||||
ExSeconds(300).
|
||||
Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) GetImgCaptcha(ctx context.Context, id string) (string, error) {
|
||||
res, err := r.c.Do(ctx, r.c.B().Get().Key(_imgCaptchaKey+id).Build()).AsBytes()
|
||||
return unsafe.String(&res[0], len(res)), err
|
||||
}
|
||||
|
||||
func (r *redisCache) DelImgCaptcha(ctx context.Context, id string) error {
|
||||
return r.c.Do(ctx, r.c.B().Del().Key(_imgCaptchaKey+id).Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) GetCountSmsCaptcha(ctx context.Context, phone string) (int64, error) {
|
||||
return r.c.Do(ctx, r.c.B().Get().Key(_smsCaptchaKey+phone).Build()).AsInt64()
|
||||
}
|
||||
|
||||
func (r *redisCache) IncrCountSmsCaptcha(ctx context.Context, phone string) (err error) {
|
||||
if err = r.c.Do(ctx, r.c.B().Incr().Key(_smsCaptchaKey+phone).Build()).Error(); err == nil {
|
||||
currentTime := time.Now()
|
||||
endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())
|
||||
err = r.c.Do(ctx, r.c.B().Expire().Key(_smsCaptchaKey+phone).Seconds(int64(endTime.Sub(currentTime)/time.Second)).Build()).Error()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *redisCache) GetCountLoginErr(ctx context.Context, id int64) (int64, error) {
|
||||
return r.c.Do(ctx, r.c.B().Get().Key(fmt.Sprintf("%s:%d", _countLoginErrKey, id)).Build()).AsInt64()
|
||||
}
|
||||
|
||||
func (r *redisCache) DelCountLoginErr(ctx context.Context, id int64) error {
|
||||
return r.c.Do(ctx, r.c.B().Del().Key(fmt.Sprintf("%s:%d", _countLoginErrKey, id)).Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) IncrCountLoginErr(ctx context.Context, id int64) error {
|
||||
err := r.c.Do(ctx, r.c.B().Incr().Key(fmt.Sprintf("%s:%d", _countLoginErrKey, id)).Build()).Error()
|
||||
if err == nil {
|
||||
err = r.c.Do(ctx, r.c.B().Expire().Key(fmt.Sprintf("%s:%d", _countLoginErrKey, id)).Seconds(3600).Build()).Error()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *redisCache) GetCountWhisper(ctx context.Context, uid int64) (int64, error) {
|
||||
return r.c.Do(ctx, r.c.B().Get().Key(fmt.Sprintf("%s:%d", _countWhisperKey, uid)).Build()).AsInt64()
|
||||
}
|
||||
|
||||
func (r *redisCache) IncrCountWhisper(ctx context.Context, uid int64) (err error) {
|
||||
key := fmt.Sprintf("%s:%d", _countWhisperKey, uid)
|
||||
if err = r.c.Do(ctx, r.c.B().Incr().Key(key).Build()).Error(); err == nil {
|
||||
currentTime := time.Now()
|
||||
endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())
|
||||
err = r.c.Do(ctx, r.c.B().Expire().Key(key).Seconds(int64(endTime.Sub(currentTime)/time.Second)).Build()).Error()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *redisCache) SetRechargeStatus(ctx context.Context, tradeNo string) error {
|
||||
return r.c.Do(ctx, r.c.B().Set().
|
||||
Key(_rechargeStatusKey+tradeNo).Value("1").
|
||||
Nx().ExSeconds(5).Build()).Error()
|
||||
}
|
||||
|
||||
func (r *redisCache) DelRechargeStatus(ctx context.Context, tradeNo string) error {
|
||||
return r.c.Do(ctx, r.c.B().Del().Key(_rechargeStatusKey+tradeNo).Build()).Error()
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package dbr
|
||||
|
||||
type TweetCommentThumbs struct {
|
||||
*Model
|
||||
UserID int64 `json:"user_id"`
|
||||
TweetID int64 `json:"tweet_id"`
|
||||
CommentID int64 `json:"comment_id"`
|
||||
ReplyID int64 `json:"reply_id"`
|
||||
CommentType int8 `json:"comment_type"`
|
||||
IsThumbsUp int8 `json:"is_thumbs_up"`
|
||||
IsThumbsDown int8 `json:"is_thumbs_down"`
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package chain
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/pkg/xerror"
|
||||
)
|
||||
|
||||
// nolint
|
||||
var (
|
||||
_errUserHasBeenBanned = xerror.NewError(20006, "该账户已被封停")
|
||||
_errAccountNoPhoneBind = xerror.NewError(20013, "拒绝操作: 账户未绑定手机号")
|
||||
_errNoAdminPermission = xerror.NewError(20022, "无管理权限")
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue