Coder Social home page Coder Social logo

bangumi / server Goto Github PK

View Code? Open in Web Editor NEW
579.0 579.0 62.0 5.83 MB

The next-generation api backend server for bgm.tv

Home Page: https://bangumi.github.io/api/

License: GNU Affero General Public License v3.0

Dockerfile 0.02% Go 99.37% HTML 0.25% JavaScript 0.36%
anime wiki

server's People

Contributors

aspectleft avatar dependabot[bot] avatar everettsummer avatar everpcpc avatar fdkevin0 avatar fiochen avatar iwakura-reinn avatar jarvie8176 avatar kagaya85 avatar michaelmai2000 avatar mikelei8291 avatar mogucloud avatar rankki avatar renovate[bot] avatar sociosarbis avatar trim21 avatar twt233 avatar wattlebird avatar zhoukuncheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

server's Issues

[Feature Request]: 提供条目筛选搜索

  • 希望能够增加条目的筛选搜索,简单的比如年份/类别/tag的筛选。

目前这个搜索功能感觉有点弱。

之前没有用python写过后端,底层数据库用的是mysql么?方便后续做复杂查询吗?

获取编辑历史API设计

编辑历史API拥有一个公用前缀 /v0/revisions/, 按照不同的编辑种类分成不同的子路由

  • 列出某个条目所有的修订 /v0/revsions/subjects?subject_id=$value
  • 条目编辑历史 /v0/revsions/subjects/{rev_id}

其他wiki类型如人物/角色/章节类似。

[BUG]: 人物的关联角色v0 API与bgm网页上不一致

描述

简短的表述你遇到的问题
使用 API https://api.bgm.tv/v0/persons/13565/characters 获取到的关联角色与 页面角色列表不一致 https://bgm.tv/person/13565/works/voice
如何重现

直接对比上述两个链接返回结果
预期
API获取结果应该与页面一致
实际行为
API获取的可能是其他人物的关联角色
额外信息
我随便试了几个角色似乎都有问题

  • CF-Ray: ``
  • User-Agent: ``

讨论贴 API 设计 (小组贴/条目讨论/日志回复/章节讨论)

Bangumi 的讨论贴仅支持二级回复,目前考虑了两种可能的响应结构:

跟网页一样返回一个树装(最多二级)的结构,分页仅针对顶级回复。

{
  "title": "请教大神R2为什么节奏没有R1好",
  "created_at": "2021-08-10T10:06:09+00:00",
  "content": "请教大神R2为什么节奏没有R1好 我R2通篇看完下来没觉着有啥不妥的",
  "creator": $Creator,
  "replies": {
    "total": 0,
    "limit": 0,
    "offset": 0,
    "data": [
      {
        "id": 171126,
        "text": "不好意思 没有熟悉操作发送了两遍",
        "created_at": "2021-08-10T10:07:04+00:00",
        "creator": $Creator
      },
      {
        "id": 171127,
        "text": "凭空出现的设定、暴风般的剧情进展、语焉不详的心理活动。",
        "created_at": "2021-08-10T10:19:09+00:00",
        "reply_to": 0,
        "creator": null,
        "replies": [
          {
            "id": 171128,
            "text": "凭空设定出自哪集? 是什么设定?",
            "created_at": "2021-08-10T10:21:29+00:00",
            "creator": $Creator
          },
          {
            "id": 171129,
            "text": "[quote][b]翔の意识[/b] 说: 凭空设定出自哪集? 是什么设定?[/quote]\n“C的世界”整集都是在神棍式地乱抛设定。",
            "created_at": "2021-08-10T10:39:05+00:00",
            "creator": $Creator
          },
        ]
      },
      {
        "id": 171148,
        "text": "据一位业内人士说是大人的原因……\r\n好像原本预定有三季还是怎么回事,结果做了几集突然被金主告知要在两季内结束。",
        "created_at": "2021-08-11T01:56:40+00:00",
        "creator": $Creator
      }
    ]
  }
}

返回一个一维结构,由客户端进一步处理。

这样一来分页仅按照时间顺序进行。

{
  "title": "请教大神R2为什么节奏没有R1好",
  "created_at": "2021-08-10T10:06:09+00:00",
  "content": "请教大神R2为什么节奏没有R1好 我R2通篇看完下来没觉着有啥不妥的",
  "creator": $Creator,
  "replies": {
    "total": 0,
    "limit": 0,
    "offset": 0,
    "data": [
      {
        "id": 171126,
        "text": "不好意思 没有熟悉操作发送了两遍",
        "created_at": "2021-08-10T10:07:04+00:00",
        "reply_to": 0,
        "creator": $Creator
      },
      {
        "id": 171127,
        "text": "凭空出现的设定、暴风般的剧情进展、语焉不详的心理活动。",
        "created_at": "2021-08-10T10:19:09+00:00",
        "reply_to": 0,
        "creator": null
      },
      {
        "id": 171128,
        "text": "凭空设定出自哪集? 是什么设定?",
        "created_at": "2021-08-10T10:21:29+00:00",
        "reply_to": 171127,
        "creator":$Creator
      },
      {
        "id": 171129,
        "text": "[quote][b]翔の意识[/b] 说: 凭空设定出自哪集? 是什么设定?[/quote]\n“C的世界”整集都是在神棍式地乱抛设定。",
        "created_at": "2021-08-10T10:39:05+00:00",
        "reply_to": 171127,
        "creator": $Creator
      },
      {
        "id": 171148,
        "text": "据一位业内人士说是大人的原因……\r\n好像原本预定有三季还是怎么回事,结果做了几集突然被金主告知要在两季内结束。",
        "created_at": "2021-08-11T01:56:40+00:00",
        "reply_to": 0,
        "creator": $Creator
      }
    ]
  }
}

剧集api会获取到失效数据

https://api.bgm.tv/v0/episodes?subject_id=86895&limit=50&offset=0

{
    "total": 2,
    "limit": 50,
    "offset": 0,
    "data": [
        {
            "id": 357730,
            "type": 0,
            "name": "沖縄へ行くことになった",
            "name_cn": "",
            "sort": 13.0,
            "ep": 1.0,
            "airdate": "2014-07-23",
            "comment": 37,
            "duration": "",
            "desc": "脚本:吉田玲子    分镜/演出:川面真也",
            "disc": 0
        },
        {
            "id": 602249,
            "type": 0,
            "name": "",
            "name_cn": "",
            "sort": 13.0,
            "ep": 1.0,
            "airdate": "2016-09-23",
            "comment": 0,
            "duration": "",
            "desc": "",
            "disc": 0
        }
    ]
}

id为602249的数据是无效的,直接用id访问网站也会报错 https://bgm.tv/ep/602249

条目tags

之前因为tag是php serialize之后存在数据库的,所以没做这个。

对应表中这一列:

field_tags = Column(MEDIUMTEXT, nullable=False)

[Feature Request]: 日志

关联到 bangumi/dev-docs#1Stage 2

SQL Schema:

模块:

  1. 枚举日志
    a} 在 /user/{uid}/blog 中枚举
    b} 在 /{category}/blog 中枚举

    与仅好友可见相关功能

  2. 新增日志 /blog/create

  3. 修改日志 /blog/{id}/edit

  4. 删除日志 /erase/entry/{id}

  5. 展示日志 /blog/{id}

用户鉴权

因为小组/讨论贴涉及部分用户权限的问题(某些帖子的隐藏,下沉,关闭),所以先做用户鉴权相关的内容再做讨论贴相关的内容。

调用需要授权的新API还是通过原有的OAuth流程获取一个access token,然后用token来请求新API。新旧API的用户鉴权方法相同。

[feature request] subject请求请带上nsfw字段

隔壁客户端经常被谷歌商店下架(bgm38)

subject列表请求也需要带上过滤或者标记,类似于

api.bgm.tv/subject/search?key=xxx&filter=nsfw,eq,0

最好是小组和讨论也能带上

小组

状态:

实现了私有的小组预览API

讨论贴 API: #170

关于获取用户收藏 API 的 limit 参数设计

现状

获取用户收藏的 GET /v0/users/{username}/collections 其中 limit 参数接收最大值 100,默认值 30。

当 limit 参数大于 用户总收藏数 时会 Bad Request,产生了无意义的失败请求,徒增 API 使用难度,也为服务器增大了压力。

{
    "title": "Bad Request",
    "details": {
        "error": "limit should less equal than 40",
        "path": "/v0/users/{username}/collections",
        "query_string": "limit=50&offset=0"
    },
    "description": "limit should less equal than 40"
}

建议

  1. 新增一个获取用户收藏数的 API,开发者自行避免使用大于总数的 limit 参数进行请求。
  2. 修改逻辑。当 limit 大于用户总收藏数时,返回尽可能多的收藏条目数。

临时方案

个人认为当前可行的解决方案,采用一个小于 100 的 limit 参数进行请求,如果出现 Bad Request,从信息中拿到 limit 允许的最大值(即上面 description 中的数字),并进行第二次请求。

[Feature Request]: 对于书籍类条目建立系列与单行本的关系

你想添加的新功能
以这个漫画系列为例 https://bgm.tv/subject/135218 该条目为 漫画 系列 其下有若干个单行本条目
你希望的解决方案
可为subject增加一个property: isSet (或者isSeries, isCollection)
对于系列类subject,增加一个API,查找其所有的单行本的subject
其他可能的替代方案
暂未找到其他API可以替代, 从数据库角度可以找关联条目只有该系列条目的条目,但API似乎没找到反过来查的
其他相关信息

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • build(deps): update module go.uber.org/fx to v1.22.2
  • build(deps): update module github.com/go-resty/resty/v2 to v2.14.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
etc/Dockerfile
  • gcr.io/distroless/static sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05
github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • actions/setup-go v5
  • actions/cache v4
  • arduino/setup-task v2
  • ubuntu 22.04
.github/workflows/lint-review.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/setup-go v5
  • autofix-ci/action dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
.github/workflows/lint.yaml
  • actions/checkout v4
  • actions/setup-go v5
  • actions/cache v4
  • golangci/golangci-lint-action v6
  • ubuntu 22.04
.github/workflows/release-docker.yaml
  • actions/checkout v4
  • actions/setup-go v5
  • actions/cache v4
  • arduino/setup-task v2
  • docker/metadata-action v5
  • docker/login-action v3
  • docker/build-push-action v6
  • ubuntu 22.04
.github/workflows/release-openapi.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • peter-evans/create-pull-request v6
  • actions/checkout v4
  • ubuntu 22.04
.github/workflows/release.yaml
  • actions/checkout v4
  • requarks/changelog-action v1.10.2
  • ubuntu 22.04
.github/workflows/test-openapi.yaml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/test.yaml
  • actions/checkout v4
  • actions/setup-go v5
  • arduino/setup-task v2
  • actions/cache v4
  • codecov/codecov-action v4
  • ubuntu 22.04
gomod
go.mod
  • github.com/avast/retry-go/v4 v4.6.0
  • github.com/aws/aws-sdk-go v1.54.11
  • github.com/davecgh/go-spew v1.1.1
  • github.com/elliotchance/phpserialize v1.4.0
  • github.com/go-playground/locales v0.14.1
  • github.com/go-playground/universal-translator v0.18.1
  • github.com/go-playground/validator/v10 v10.22.0
  • github.com/go-redis/redismock/v9 v9.2.0
  • github.com/go-resty/resty/v2 v2.13.1
  • github.com/go-sql-driver/mysql v1.8.1
  • github.com/ilyakaznacheev/cleanenv v1.5.0
  • github.com/jarcoal/httpmock v1.3.1
  • github.com/labstack/echo/v4 v4.12.0
  • github.com/mattn/go-colorable v0.1.13
  • github.com/meilisearch/meilisearch-go v0.26.3
  • github.com/mitchellh/mapstructure v1.5.0
  • github.com/prometheus/client_golang v1.19.1
  • github.com/redis/go-redis/v9 v9.5.3
  • github.com/samber/lo v1.44.0
  • github.com/segmentio/kafka-go v0.4.47
  • github.com/spf13/cobra v1.8.1
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/testify v1.9.0
  • github.com/trim21/errgo v0.0.2
  • github.com/trim21/go-phpserialize v0.0.22
  • github.com/trim21/go-redis-prometheus v0.0.0
  • github.com/trim21/htest v0.0.4
  • github.com/trim21/pkg v0.0.3
  • go.etcd.io/etcd/client/v3 v3.5.14
  • go.uber.org/fx v1.22.1
  • go.uber.org/zap v1.27.0
  • golang.org/x/crypto v0.24.0
  • google.golang.org/grpc v1.64.1
  • google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0
  • google.golang.org/protobuf v1.34.2
  • gopkg.in/yaml.v3 v3.0.1
  • gorm.io/driver/mysql v1.5.7
  • gorm.io/gen v0.3.26
  • gorm.io/gorm v1.25.10
  • gorm.io/plugin/dbresolver v1.5.2
  • gorm.io/plugin/soft_delete v1.2.1
npm
package.json
  • @apidevtools/json-schema-ref-parser ^11.7.0
  • js-yaml ^4.1.0
  • lodash ^4.17.21
  • colors ^1.4.0
  • oas-validator ^5.0.8
  • prettier ^3.3.3

  • Check this box to trigger a request for Renovate to run again on this repository

[BUG]: 获取用户收藏 HTTP Code500

描述

	
{
  "level":"error","time":"2022-04-23T00:43:43.863269623Z",
  "logger":"user.mysqlRepo",
  "caller":"user/mysql_repository.go:100",
  "msg":"unexpected error happened",
  "error":"sql: Scan error on column index 17, name \"interest_private\": sql/driver: couldn't convert 2 into type bool","trace":"github.com/bangumi/server/user.mysqlRepo.ListCollections
	/home/runner/work/server/server/user/mysql_repository.go:100
github.com/bangumi/server/web/handler.Handler.listCollection
	/home/runner/work/server/server/web/handler/collection.go:90
github.com/bangumi/server/web/handler.Handler.ListCollection
	/home/runner/work/server/server/web/handler/collection.go:66
github.com/bangumi/server/web.ResistRouter.func1.1
	/home/runner/work/server/server/web/handler.go:42
github.com/gofiber/fiber/v2.(*App).next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*Ctx).Next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:792
github.com/bangumi/server/web/handler.Handler.MiddlewareAccessUser.func2
	/home/runner/work/server/server/web/handler/auth.go:54
github.com/gofiber/fiber/v2.(*App).next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*Ctx).Next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:792
github.com/bangumi/server/web/middleware/recovery.New.func1
	/home/runner/work/server/server/web/middleware/recovery/new.go:52
github.com/gofiber/fiber/v2.(*Ctx).Next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:789
github.com/bangumi/server/web.New.func1
	/home/runner/work/server/server/web/index.go:58
github.com/gofiber/fiber/v2.(*App).next
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*App).handler
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:160
github.com/valyala/fasthttp.(*Server).serveConn
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:2341
github.com/valyala/fasthttp.(*workerPool).workerFunc
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:224
github.com/valyala/fasthttp.(*workerPool).getCh.func1
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196"
}

如何重现

  1. ...

预期

实际行为

额外信息

  • CF-Ray: ``
  • User-Agent: ``

[Feature Request]: get /v0/persons/{person_id}/characters 与/v0/characters/{character_id}/persons 是否考虑增加关系字段

你想添加的新功能

网页上,角色的出演列表,以及人物的角色列表,均包含了作品中,角色的类别:按照源码看,有三个类别:
1: 主角
2: 配角
3: 客串
这个字段目前只能从/v0/subjects/{subject_id}/characters或者characters/{character_id}/subjects结果获得。
那么实现网页上的效果,就要请求两次

你希望的解决方案

在上述API中加入staff字段

其他可能的替代方案

GraphQL(长远考虑

其他相关信息

条目编辑历史

  • 数据表: https://github.com/bangumi/dev-env/blob/main/sql/schema/chii_subject_revisions.sql
  • 路由1: /subjects/{subject_id}/revisions
  • 返回1: 参考 #44 ,其中 id 为表中 rev_id。按时间倒叙,不允许任何过滤。
    e.g.
    {
      "total": 1,
      "limit": 100,
      "offset": 0,
      "data": [
        {
          "id": 1,
          "creator": {
            "id": 2,
            "username": "abc",
            "nickname": "def",
            "avatar": "..."
          },
          "timestamp": "2021-11-20T15:06:03+00:00",
          "summary": ""
        }
      ]
    }
    
  • 路由2: /subjects/{subject_id}/revisions/{rev_id}
  • 返回2:WIP

应用崩溃

今天看错误日志看到有服务重启,检查了下log,没明白是为啥发生的。

对应的是这个 commit https://github.com/bangumi/server/tree/v0.17.1

runtime: marked free object in span 0x7fbb8e183db8, elemsize=2048 freeindex=1 (bad use of unsafe.Pointer? try -d=checkptr)
0xc000724000 alloc marked  
0xc000724800 free  unmarked
0xc000725000 free  marked   zombie
0x000000c000725000:  0x0000000000000000  0x0000000000000000 
0x000000c000725010:  0x0000000000000000  0x0000000000000000 
0x000000c000725020:  0x0000000000000000  0x0000000000000000 
0x000000c000725030:  0x0000000000000000  0x0000000000000000 
0x000000c000725040:  0x0000000000000000  0x0000000000000000 
0x000000c000725050:  0x0000000000000000  0x0000000000000000 
0x000000c000725060:  0x0000000000000000  0x0000000000000000 
0x000000c000725070:  0x0000000000000000  0x0000000000000000 
0x000000c000725080:  0x0000000000000000  0x0000000000000000 
0x000000c000725090:  0x0000000000000000  0x0000000000000000 
0x000000c0007250a0:  0x0000000000000000  0x0000000000000000 
0x000000c0007250b0:  0x0000000000000000  0x0000000000000000 
0x000000c0007250c0:  0x0000000000000000  0x0000000000000000 
0x000000c0007250d0:  0x0000000000000000  0x0000000000000000 
0x000000c0007250e0:  0x0000000000000000  0x0000000000000000 
0x000000c0007250f0:  0x0000000000000000  0x0000000000000000 
0x000000c000725100:  0x0000000000000000  0x0000000000000000 
0x000000c000725110:  0x0000000000000000  0x0000000000000000 
0x000000c000725120:  0x0000000000000000  0x0000000000000000 
0x000000c000725130:  0x0000000000000000  0x0000000000000000 
0x000000c000725140:  0x0000000000000000  0x0000000000000000 
0x000000c000725150:  0x0000000000000000  0x0000000000000000 
0x000000c000725160:  0x0000000000000000  0x0000000000000000 
0x000000c000725170:  0x0000000000000000  0x0000000000000000 
0x000000c000725180:  0x0000000000000000  0x0000000000000000 
0x000000c000725190:  0x0000000000000000  0x0000000000000000 
0x000000c0007251a0:  0x0000000000000000  0x0000000000000000 
0x000000c0007251b0:  0x0000000000000000  0x0000000000000000 
0x000000c0007251c0:  0x0000000000000000  0x0000000000000000 
0x000000c0007251d0:  0x0000000000000000  0x0000000000000000 
0x000000c0007251e0:  0x0000000000000000  0x0000000000000000 
0x000000c0007251f0:  0x0000000000000000  0x0000000000000000 
0x000000c000725200:  0x0000000000000000  0x0000000000000000 
0x000000c000725210:  0x0000000000000000  0x0000000000000000 
0x000000c000725220:  0x0000000000000000  0x0000000000000000 
0x000000c000725230:  0x0000000000000000  0x0000000000000000 
0x000000c000725240:  0x0000000000000000  0x0000000000000000 
0x000000c000725250:  0x0000000000000000  0x0000000000000000 
0x000000c000725260:  0x0000000000000000  0x0000000000000000 
0x000000c000725270:  0x0000000000000000  0x0000000000000000 
0x000000c000725280:  0x0000000000000000  0x0000000000000000 
0x000000c000725290:  0x0000000000000000  0x0000000000000000 
0x000000c0007252a0:  0x0000000000000000  0x0000000000000000 
0x000000c0007252b0:  0x0000000000000000  0x0000000000000000 
0x000000c0007252c0:  0x0000000000000000  0x0000000000000000 
0x000000c0007252d0:  0x0000000000000000  0x0000000000000000 
0x000000c0007252e0:  0x0000000000000000  0x0000000000000000 
0x000000c0007252f0:  0x0000000000000000  0x0000000000000000 
0x000000c000725300:  0x0000000000000000  0x0000000000000000 
0x000000c000725310:  0x0000000000000000  0x0000000000000000 
0x000000c000725320:  0x0000000000000000  0x0000000000000000 
0x000000c000725330:  0x0000000000000000  0x0000000000000000 
0x000000c000725340:  0x0000000000000000  0x0000000000000000 
0x000000c000725350:  0x0000000000000000  0x0000000000000000 
0x000000c000725360:  0x0000000000000000  0x0000000000000000 
0x000000c000725370:  0x0000000000000000  0x0000000000000000 
0x000000c000725380:  0x0000000000000000  0x0000000000000000 
0x000000c000725390:  0x0000000000000000  0x0000000000000000 
0x000000c0007253a0:  0x0000000000000000  0x0000000000000000 
0x000000c0007253b0:  0x0000000000000000  0x0000000000000000 
0x000000c0007253c0:  0x0000000000000000  0x0000000000000000 
0x000000c0007253d0:  0x0000000000000000  0x0000000000000000 
0x000000c0007253e0:  0x0000000000000000  0x0000000000000000 
0x000000c0007253f0:  0x0000000000000000  0x0000000000000000 
0xc000725800 free  unmarked
fatal error: found pointer to free object
runtime stack:
runtime.throw({0x113fa1f, 0xc000725400})
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/panic.go:1198 +0x71
runtime.(*mspan).reportZombies(0x7fbb8e183db8)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgcsweep.go:691 +0x2e5
runtime.(*sweepLocked).sweep(0x0, 0x0)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgcsweep.go:519 +0x33a
runtime.(*mcentral).uncacheSpan(0xc000061e60, 0xc000061e50)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcentral.go:223 +0xa9
runtime.(*mcache).releaseAll(0x7fbbb4f59108)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcache.go:279 +0x125
runtime.(*mcache).prepareForSweep(0x7fbbb4f59108)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcache.go:317 +0x39
runtime.procresize(0x2)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/proc.go:5060 +0x476
runtime.startTheWorldWithSema(0x1)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/proc.go:1256 +0x8b
runtime.gcMarkTermination.func3()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1032 +0x1e
runtime.systemstack()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:383 +0x49
goroutine 5 [running]:
runtime.systemstack_switch()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:350 fp=0xc000048560 sp=0xc000048558 pc=0x464a60
runtime.gcMarkTermination(0x1c38fa0)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1032 +0x4fa fp=0xc000048708 sp=0xc000048560 pc=0x41b93a
runtime.gcMarkDone()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:902 +0x27d fp=0xc000048760 sp=0xc000048708 pc=0x41b33d
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1330 +0x2f1 fp=0xc0000487e0 sp=0xc000048760 pc=0x41c4d1
runtime.goexit()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000487e8 sp=0xc0000487e0 pc=0x466b41
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1124 +0x25
goroutine 1 [chan receive, 359 minutes]:
go.uber.org/fx.(*App).run(0xc00007f380, 0x0)
	/home/runner/go/pkg/mod/go.uber.org/[email protected]/app.go:618 +0x91
go.uber.org/fx.(*App).Run(0xc00007f380)
	/home/runner/go/pkg/mod/go.uber.org/[email protected]/app.go:605 +0x2b
main.start()
	/home/runner/work/server/server/main.go:89 +0x615
main.main()
	/home/runner/work/server/server/main.go:48 +0x2b
goroutine 22 [select, 2 minutes]:
github.com/uber-go/tally/v4.(*scope).reportLoop(0xc000414900, 0x0)
	/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:238 +0xd6
github.com/uber-go/tally/v4.newRootScope.func1()
	/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:180 +0x65
created by github.com/uber-go/tally/v4.newRootScope
	/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:178 +0x78d
goroutine 25 [select, 359 minutes]:
database/sql.(*DB).connectionOpener(0xc0000a4c30, {0x139ded0, 0xc00065c140})
	/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1196 +0x93
created by database/sql.OpenDB
	/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:794 +0x188
goroutine 26 [select, 2 minutes]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
	/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:614 +0xb0
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
	/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:611 +0x105
goroutine 27 [select, 359 minutes]:
database/sql.(*DB).connectionCleaner(0xc0000a4c30, 0x0)
	/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1068 +0xbd
created by database/sql.(*DB).startCleanerLocked
	/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1055 +0x105
goroutine 30 [select, 2 minutes]:
github.com/go-redis/redis/v8/internal/pool.(*ConnPool).reaper(0xc0005c7860, 0xc0000b9860)
	/home/runner/go/pkg/mod/github.com/go-redis/redis/[email protected]/internal/pool/pool.go:485 +0xda
created by github.com/go-redis/redis/v8/internal/pool.NewConnPool
	/home/runner/go/pkg/mod/github.com/go-redis/redis/[email protected]/internal/pool/pool.go:111 +0x229
goroutine 35 [IO wait, 2 minutes]:
internal/poll.runtime_pollWait(0x7fbb8e2f6278, 0x72)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/netpoll.go:303 +0x85
internal/poll.(*pollDesc).wait(0xc000684000, 0xc0006e9000, 0x0)
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000684000, {0xc0006e9000, 0x1000, 0x1000})
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc000684000, {0xc0006e9000, 0xc000684000, 0xc000778000})
	/opt/hostedtoolcache/go/1.17.10/x64/src/net/fd_posix.go:56 +0x29
net.(*conn).Read(0xc0006e6008, {0xc0006e9000, 0xfd7000, 0xc0006f9350})
	/opt/hostedtoolcache/go/1.17.10/x64/src/net/net.go:183 +0x45
bufio.(*Reader).fill(0xc0006fe300)
	/opt/hostedtoolcache/go/1.17.10/x64/src/bufio/bufio.go:101 +0x103
bufio.(*Reader).Peek(0xc0006fe300, 0x1)
	/opt/hostedtoolcache/go/1.17.10/x64/src/bufio/bufio.go:139 +0x5d
github.com/valyala/fasthttp.(*Server).serveConn(0xc00065ab40, {0x13b9990, 0xc0006e6008})
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:2155 +0x5d1
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0007fe000, 0xc0006ec000)
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:224 +0xa9
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196 +0x38
created by github.com/valyala/fasthttp.(*workerPool).getCh
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x1b5
goroutine 8 [syscall, 359 minutes]:
os/signal.signal_recv()
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/sigqueue.go:169 +0x98
os/signal.loop()
	/opt/hostedtoolcache/go/1.17.10/x64/src/os/signal/signal_unix.go:24 +0x19
created by os/signal.Notify.func1.1
	/opt/hostedtoolcache/go/1.17.10/x64/src/os/signal/signal.go:151 +0x2c
goroutine 11 [sleep, 2 minutes]:
time.Sleep(0x2540be400)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/time.go:193 +0x12e
github.com/valyala/fasthttp.(*workerPool).Start.func2()
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:67 +0x56
created by github.com/valyala/fasthttp.(*workerPool).Start
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:59 +0xde
goroutine 10 [IO wait, 2 minutes]:
internal/poll.runtime_pollWait(0x7fbb8e2f6368, 0x72)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/netpoll.go:303 +0x85
internal/poll.(*pollDesc).wait(0xc0007bad00, 0xc000040800, 0x0)
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc0007bad00)
	/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_unix.go:402 +0x22c
net.(*netFD).accept(0xc0007bad00)
	/opt/hostedtoolcache/go/1.17.10/x64/src/net/fd_unix.go:173 +0x35
net.(*TCPListener).accept(0xc0003e45b8)
	/opt/hostedtoolcache/go/1.17.10/x64/src/net/tcpsock_posix.go:140 +0x28
net.(*TCPListener).Accept(0xc0003e45b8)
	/opt/hostedtoolcache/go/1.17.10/x64/src/net/tcpsock.go:262 +0x3d
github.com/valyala/fasthttp.acceptConn(0xc00065ab40, {0x1395818, 0xc0003e45b8}, 0xc000804e80)
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:1913 +0x62
github.com/valyala/fasthttp.(*Server).Serve(0xc00065ab40, {0x1395818, 0xc0003e45b8})
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:1826 +0x4ea
github.com/gofiber/fiber/v2.(*App).Listener(0xc00000a780, {0x1395818, 0xc0003e45b8})
	/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/app.go:776 +0xd0
github.com/bangumi/server/internal/web.Listen.func1.1()
	/home/runner/work/server/server/internal/web/index.go:88 +0x37
created by github.com/bangumi/server/internal/web.Listen.func1
	/home/runner/work/server/server/internal/web/index.go:87 +0x1da
goroutine 39 [sleep]:
time.Sleep(0x3b9aca00)
	/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/time.go:193 +0x12e
github.com/valyala/fasthttp.updateServerDate.func1()
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/header.go:2050 +0x1e
created by github.com/valyala/fasthttp.updateServerDate
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/header.go:2048 +0x27
goroutine 22000 [select, 2 minutes]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
	/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:614 +0xb0
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
	/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:611 +0x105
goroutine 32742 [chan receive, 2 minutes]:
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0007fe000, 0xc0003380c0)
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:219 +0x65
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196 +0x38
created by github.com/valyala/fasthttp.(*workerPool).getCh
	/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x1b5

获取条目讨论

#53

Endpoint

  • GET /v0/subjects/:subjectId/topics 获取条目下全部讨论
  • GET /v0/subjects-topics/:topicId 获取条目讨论内容

Authz

  • 讨论查看权限
  • 回复查看权限

条目相关的新api

条目主API

Path

/v0/subjects/{subject_id}

Description

话说有个小建议,旧api读条目信息,只能获取到作品原名(name)和中文名(name_cn),获取不到“别名”信息。比如条目14435,只能读到原名いろとりどりのセカイ与中文名 五彩斑斓的世界 ,读不到别名 色鸟鸟 。
要命的是,很多游戏条目的汉化名实际上是写在别名栏里的;这样用api就永远读不到作品的中文名(bgm38)
万望新api能改善(bgm106)

https://bgm.tv/group/topic/366500#post_1916978

参照人物使用 pol.wiki.parse() 解析 infobox 并且作为一个字段返回

关联人物api:

Path

/v0/subjects/{subject_id}/persons

Description

至少提供足够多的信息让客户端可以实现网页端已有的此功能
image

关联角色api:

Path

/v0/subjects/{subject_id}/characters

章节api:

Path

/v0/subjects/{subject_id}/episodes

Description

#9

参照原有的分页api /v0/persons ,以相同的参数支持分页。

以名侦探柯南为例。
官网的章节信息已经更新到了1000以上。
https://bangumi.tv/subject/899/ep
api中只返回到第1000章(这可能是为了限制返回数据的大小),应该有一个分页参数。
https://api.bgm.tv/subject/899/ep/

#17

MAL Sync integration

I'm requesting MAL Sync to add support for Bangumi but they need the following APIs to be implemented. Detailed discussions can be found at MALSync/MALSync#792.

lolamtisch commented on Jul 9

This should prety much be all informations needed per api call.

Single Entry
    internalId: any
    malId: number
    type: 'anime' | 'manga'
    url: string
    userStatus: 'watching' | 'pantowatch' | 'completed' ....
    userScore: any
    userWatchedEpisode / chapter: number
    userWatchedVolumens: number
    totalEpisodes: number
    totalVolumes: number
    image: string
    globalScore: any


// possible to filter by userState 
list[]
    internalId: any
    malId: number
    type: 'anime' | 'manga'
    title: string
    url: string
    totalEp: number
    userWatchedEpisode / chapter: number
    userStatus: 'watching' | 'pantowatch' | 'completed' ....
    userScore: any
    image: string
    
Search[]
    id: number;
    name: string;
    altNames: string[];
    url: string;
    image: string;
    
Overview metadata:
   Just metadata not important

go rewrite

修改历史

  • /v0/revisions/persons
  • /v0/revisions/persons/:id
  • /v0/revisions/characters
  • /v0/revisions/characters/:id
  • /v0/revisions/subjects
  • /v0/revisions/subjects/:id
  • /v0/revisions/episodes
  • /v0/revisions/episodes/:id

[Feature Request]: 目录

大概的路由

GET /v0/indices/{index_id}

GET /v0/indices/{index_id}/subjects

支持 type 参数进行条目类型筛选,应该支持分页。

GET /v0/indices/{index_id}/comments (这个参照帖子详情的响应)

如果包含任何一个 NSFW 条目,本目录应该被认为是 NSFW 目录,不允许没有 NSFW 条目查看权限的人查看目录,返回HTTP 404。

SQL 表这里 https://github.com/bangumi/dev-env/blob/master/un-processed/bangumi_index%20(2).sql

条目图片api

能不能有一个api能302到指定subject的图片,比如
/api/subject/xxx/image?type=large
在某些只有标题id没有其他信息的地方能用上
角色和人物同理

[Feature Request]: 小组概览接口

你想添加的新功能

私有小组概览接口

你希望的解决方案
新增接口

GET /p/group/${name}

期望返回:

字段 类型 意义
title string 小组名称
created_at string 创建时间,格式 YYYY-MM-DD HH:mm
description string 小组介绍
total_members number 小组成员数量
new_members User[] 最近加入的小组成员,最多 10 个
related_groups Group[] 成员喜欢去的小组,最多 6 个
new_topics Topic[] 最新讨论,最多 10 个

其他可能的替代方案

其他相关信息

Screen Shot 2022-06-21 at 23 38 43

[Feature Request]: 进度管理

主要分为两部分,条目进度管理和单集进度管理。

两部分有些耦合,修改剧集收藏状态时应该同时修改条目的进度状态。反之亦然。

同时还要生成对应的时间线。

关于与其他网站的条目进行关联

https://bgm.tv/group/topic/366561#post_1921543

是不是可以到时候把bangumi-data的关联条目一起整合起来?或者更进一步,把数据系统化,和bangumi-data的数据做融合?(毕竟同时存在多套轮子也会产生不便)

以及,关于数据关联数据,是不是可以考虑对每一个分集都做关联。因为会有很多特殊情况,如:

  • 一部番有SP,然而某个数据源SP和本体在一起
  • 上下两季分割放送的两部番,有的数据源序号从1开始,有的数据源序号从13开始

@wxt2005 @weizhenye

虚拟角色API

响应和分页大致参照人物API。

path:

/v0/characters
/v0/characters/{character_id}
/v0/characters/{character_id}/subjects

查询数据的表不同

虚拟角色的关联只有三种,

$typeList = array(
    1 => '主角',
    2 => '配角',
    3 => '客串',
);

章节编辑历史

  • 数据表: https://github.com/bangumi/dev-env/blob/main/sql/schema/chii_ep_revisions.sql
  • 路由1: /episodes/{episode_id}/revisions
  • 返回1: 参考 #44 ,其中 id 为表中 rev_id。按时间倒叙,不允许任何过滤。
    e.g.
    {
      "total": 1,
      "limit": 100,
      "offset": 0,
      "data": [
        {
          "id": 1,
          "creator": {
            "id": 2,
            "username": "abc",
            "nickname": "def",
            "avatar": "..."
          },
          "timestamp": "2021-11-20T15:06:03+00:00",
          "summary": ""
        }
      ]
    }
    
  • 路由2: /episodes/{episode_id}/revisions/{rev_id}
  • 返回2:WIP

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.