Skip to content

Commit

Permalink
feat: anonymity user
Browse files Browse the repository at this point in the history
  • Loading branch information
liaosunny123 committed Sep 1, 2023
1 parent c041c56 commit ad67c5f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/constant/config/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ GORSE_APIKEY=
# MagicUserId, please use output value
MAGIC_USER_ID=
# Configure your clash proxy
CHATGPT_PROXY=
CHATGPT_PROXY=
# Default anonymity user
ANONYMITY_USER=
1 change: 1 addition & 0 deletions src/constant/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type envConfig struct {
PostgreSQLReplicaPassword string `env:"POSTGRESQL_REPLICA_PASSWORD"`
OtelState string `env:"TRACING_STATE" envDefault:"enable"`
OtelSampler float64 `env:"TRACING_SAMPLER" envDefault:"0.01"`
AnonymityUser string `env:"ANONYMITY_USER" envDefault:"114514"`
}

func init() {
Expand Down
2 changes: 1 addition & 1 deletion src/web/middleware/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TokenAuthMiddleware() gin.HandlerFunc {
c.Request.URL.Path == "/douyin/publish/list/" ||
c.Request.URL.Path == "/douyin/favorite/list/" ||
c.Request.URL.Path == "/douyin/relation/follower/list/" {
c.Request.URL.RawQuery += "&actor_id=114514"
c.Request.URL.RawQuery += "&actor_id=" + config.EnvCfg.AnonymityUser
c.Next()
logger.WithFields(logrus.Fields{
"Path": c.Request.URL.Path,
Expand Down
8 changes: 3 additions & 5 deletions test/k6/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ export const options = {
executor: 'ramping-vus',
gracefulStop: '30s',
stages: [
{ target: 1000, duration: '15s' },
{ target: 1500, duration: '30s' },
{ target: 1000, duration: '15s' },
{ target: 1000, duration: '60s' },
],
gracefulRampDown: '30s',
exec: 'login',
exec: 'feed',
},
},
}

export function login() {
export function feed() {
http.get('https://gugotik.endymx.qzwxsaedc.cn/douyin/feed?')

sleep(3)
Expand Down

0 comments on commit ad67c5f

Please sign in to comment.