mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
# Description
This PR updates the Chinese documentation to 6c879186
(the latest commit at present).
It also fixed a small typo in the original docs. Since the change is so minor, I didn't make a separate PR.
Last docs/zh update PR: #3884
## Checklist
Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4117
Co-authored-by: cdn0x12 <git@cdn0x12.dev>
Co-committed-by: cdn0x12 <git@cdn0x12.dev>
This commit is contained in:
@@ -9,9 +9,9 @@ GoToSocial 编译为二进制可执行文件。
|
||||
以下是 `gotosocial --help` 的完整输出,不包括全局配置选项的大列表。
|
||||
|
||||
```text
|
||||
GoToSocial - 一个联邦制社交媒体服务器
|
||||
GoToSocial - 一个联合式社交媒体服务器
|
||||
|
||||
帮助文档参见:https://docs.gotosocial.org。
|
||||
帮助文档参见:https://docs.gotosocial.org/zh-cn/。
|
||||
|
||||
代码仓库:https://codeberg.org/superseriousbusiness/gotosocial
|
||||
|
||||
@@ -57,6 +57,9 @@ GoToSocial - 一个联邦制社交媒体服务器
|
||||
|
||||
此命令可用于在你的实例上创建新账户。
|
||||
|
||||
!!! Warning "警告"
|
||||
执行此命令前,你必须至少运行过一次服务端,以初始化数据库中的必要条目,然后才能运行此命令。
|
||||
|
||||
`gotosocial admin account create --help`:
|
||||
|
||||
```text
|
||||
|
@@ -37,7 +37,7 @@
|
||||
|
||||
例如,实例 `instance-a.example.org`、`instance-b.example.org` 和 `instance-c.example.org` 决定他们只想彼此联合。
|
||||
|
||||
他们可以使用像 GitHub 这样的版本管理平台托管一个纯文本格式的允许列表,比如在 `https://raw.githubusercontent.com/our-cluster/allowlist/refs/heads/main/allows.txt`。
|
||||
他们可以使用像 Codeberg 这样的版本管理平台托管一个纯文本格式的允许列表,比如在 `https://codeberg.org/our-cluster/allowlist/raw/branch/main/allows.txt`。
|
||||
|
||||
纯文本格式的允许列表内容如下:
|
||||
|
||||
@@ -47,7 +47,7 @@ instance-b.example.org
|
||||
instance-c.example.org
|
||||
```
|
||||
|
||||
每个实例管理员都将他们的联合模式设置为`白名单`,并创建一个类型为“允许”,订阅地址为 `https://raw.githubusercontent.com/our-cluster/allowlist/refs/heads/main/allows.txt` 的订阅,这会为他们自己的域名以及集群中的其他域名创建域名允许条目。
|
||||
每个实例管理员都将他们的联合模式设置为`allowlist`,并创建一个类型为“允许”,订阅地址为 `https://codeberg.org/our-cluster/allowlist/raw/branch/main/allows.txt` 的订阅,这会为他们自己的域名以及集群中的其他域名创建域名允许条目。
|
||||
|
||||
在某个时候,来自 `instance-d.example.org` 的某人(在站外)申请被添加到集群中。现有的管理员同意,并更新他们的纯文本格式允许列表为:
|
||||
|
||||
@@ -66,7 +66,7 @@ instance-d.example.org
|
||||
|
||||
例如,实例 `instance-e.example.org`、`instance-f.example.org` 和 `instance-g.example.org` 的管理员认定:他们厌倦了通过与坏人玩打地鼠游戏来重复工作。为了让生活更轻松,他们决定合作开发一个共享的阻止列表。
|
||||
|
||||
他们使用像 GitHub 这样的版本管理平台在类似 `https://raw.githubusercontent.com/baddies/blocklist/refs/heads/main/blocks.csv` 的地方托管一个阻止列表。
|
||||
他们使用像 Codeberg 这样的版本管理平台在类似 `https://codeberg.org/our-cluster/allowlist/raw/branch/main/blocks.csv` 的地方托管一个阻止列表。
|
||||
|
||||
当有人发现另一个他们不喜欢的实例时,他们可以通过合并请求或类似方法添加这个有问题的实例到域名列表中。
|
||||
|
||||
@@ -113,6 +113,27 @@ nothanks.com,suspend,false,false,,false
|
||||
|
||||
JSON列表使用内容类型 `application/json`。
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"domain": "bumfaces.net",
|
||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||
"comment": "这个实例上有坏蛋"
|
||||
},
|
||||
{
|
||||
"domain": "peepee.poopoo",
|
||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||
"comment": "骚扰"
|
||||
},
|
||||
{
|
||||
"domain": "nothanks.com",
|
||||
"suspended_at": "2020-05-13T13:29:12.000Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
可以使用 `"comment"` 字段替代 `"public_comment"`:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
|
@@ -31,13 +31,18 @@ GoToSocial 当前提供“黑名单”和“白名单”联合模式,可以通
|
||||
|
||||
## 结合屏蔽与允许
|
||||
|
||||
可以同时屏蔽和允许同一个域,结合这两者的效果取决于你的实例当前使用的联合模式。
|
||||
!!! danger "危险"
|
||||
结合屏蔽和允许是一项棘手的工作!
|
||||
|
||||
在导入白名单和黑名单时,你应该始终手动审核列表,以确保不会无意中屏蔽你不想屏蔽的实例,因为这可能带来 **非常令人困扰的副作用** ,例如关注/粉丝关系的移除、贴文的删除等。
|
||||
|
||||
有疑问时,请始终首先显式添加白名单条目作为保险策略!
|
||||
|
||||

|
||||
同时屏蔽和允许同一个域名是合法的,而这两个操作结合之后的效果取决于你的实例目前正在使用哪种联合模式,具体如下所述,你可以在下面找到流程图。
|
||||
|
||||
### 在黑名单模式下
|
||||
|
||||
如图所示,在黑名单模式下(图的左侧),显式添加允许条目可以用来覆盖域名屏蔽。
|
||||
如下图所示,在黑名单模式下(图的左侧),显式添加允许条目可以用来覆盖域名屏蔽。
|
||||
|
||||
这在你从其他人处导入黑名单,但导入的黑名单中包含了一些你实际上不想屏蔽的实例时很有用。为了避免屏蔽这些实例,你可以先为这些实例显式创建允许条目。然后,当你导入黑名单时,显式允许的域将不会被屏蔽,并且创建屏蔽所导致的副作用(删除贴文、媒体、关系等)将不会被处理。
|
||||
|
||||
@@ -47,16 +52,11 @@ GoToSocial 当前提供“黑名单”和“白名单”联合模式,可以通
|
||||
|
||||
### 在白名单模式下
|
||||
|
||||
如图所示,在白名单模式下(图的右侧),显式域名屏蔽条目会优先于显式域名允许条目。在运行白名单模式时,必须满足以下两个条件才能允许一个实例通过:
|
||||
如下图所示,在白名单模式下(图的右侧),显式域名屏蔽条目会优先于显式域名允许条目。在运行白名单模式时,必须满足以下两个条件才能允许一个实例通过:
|
||||
|
||||
1. 实例没有存在对应的显式域名屏蔽。
|
||||
2. 实例存在对应的显式域名允许。
|
||||
|
||||
如果上述任何条件不满足,请求将被拒绝。
|
||||
|
||||
!!! danger "危险"
|
||||
结合屏蔽和允许是一项棘手的工作!
|
||||
|
||||
在导入允许和黑名单时,你应该始终手动审核列表,以确保不会无意中屏蔽你不想屏蔽的实例,因为这可能会有**非常烦人的副作用**,例如移除关注/被关注、贴文等。
|
||||
|
||||
有疑问时,请始终首先添加显式允许作为保险策略!
|
||||

|
||||
|
@@ -10,8 +10,6 @@ GoToSocial 在主域名上提供一个 `robots.txt` 文件。该文件包含试
|
||||
|
||||
AI 爬虫来自一个[社区维护的仓库][airobots]。目前是手动保持同步的。如果你知道有任何遗漏的爬虫,请给他们提交一个 PR!
|
||||
|
||||
已知有许多 AI 爬虫即便明确匹配其 User-Agent,也会忽略 `robots.txt` 中的条目。这意味着 `robots.txt` 文件并不是确保 AI 爬虫不抓取你的内容的万无一失的方法。
|
||||
|
||||
如果你想完全屏蔽这些爬虫,需要在反向代理中根据 User-Agent 头进行屏蔽,直到 GoToSocial 能够根据 User-Agent 头过滤请求。
|
||||
众所周知,很多 AI 爬虫在 `robots.txt` 不允许其 User-Agent 的情况下,仍然会忽略对应规则并继续抓去内容。这意味着 `robots.txt` 文件并不是确保 AI 爬虫不抓取你的内容的万无一失的方法。除此以外,你可能还需要考虑通过[请求标头过滤](request_filtering_modes.md)来阻止对应 User-Agent,以及启用基于工作证明的[爬虫防护](../advanced/scraper_deterrence.md)。
|
||||
|
||||
[airobots]: https://github.com/ai-robots-txt/ai.robots.txt/
|
||||
|
@@ -15,6 +15,10 @@
|
||||
|
||||
使用 `nowasm` 构建的 GoToSocial 二进制文件将使用 [modernc 版本的 SQLite](https://pkg.go.dev/modernc.org/sqlite) 而不是 WASM 版本,并将在系统上使用 `ffmpeg` 和 `ffprobe` 二进制文件进行媒体处理。
|
||||
|
||||
!!! tip "提示"
|
||||
要测试你的系统是否支持标准构建,可以使用此命令:
|
||||
`if grep -qE '^flags.* (sse4|LSE)' /proc/cpuinfo; then echo "Your system is supporting GTS!"; else echo "Your system is not supporting GTS, you'll have to use the 'nowasm' builds :("; fi`
|
||||
|
||||
要使用 `nowasm` 标签构建 GoToSocial,可以像这样将标签传入我们的便利 `build.sh` 脚本:
|
||||
|
||||
```bash
|
||||
|
18
docs/locales/zh/advanced/scraper_deterrence.md
Normal file
18
docs/locales/zh/advanced/scraper_deterrence.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# 爬虫防护
|
||||
|
||||
GoToSocial 提供一个可选的、基于工作量证明的爬虫和自动化 HTTP 客户端防护机制,可在账户页和贴文页的网页视图上启用。
|
||||
|
||||
它的工作原理是:针对每个传入的 HTTP 请求,系统会根据客户端信息和当前时间生成一个唯一质询(一个十六进制编码的 SHA256 哈希值)。然后,它要求客户端为该质询的一部分找到一个附加值,使(附加值+质询部分)组合计算出的新 SHA256 哈希值(同样为十六进制编码)至少包含 4 个前导 '0' 字符。这个质询会通过一个极简的等待页面呈现给客户端,该页面包含一个独立的 JavaScript worker 来计算解决方案。
|
||||
|
||||
一旦客户端提供了此质询的解,并通过在查询参数中携带该方案刷新页面,GoToSocial 将验证此方案。验证成功后,服务端会返回用户期望访问的账户或贴文页面,并设置一个 Cookie。该 Cookie 允许用户在接下来最多一小时内免验证访问该实例。
|
||||
|
||||
启用此功能的目的是让自动化数据收集(例如 AI 公司、搜索引擎)对你实例的账户和贴文页面进行爬取的行为,在经济上变得不可行。唯一的缺点是,用户需要启用 JavaScript 才能访问你的账户和贴文网页视图。
|
||||
|
||||
这个功能深受优秀的 [anubis] 项目的启发,但我们最终决定自己实现,只包含我们需要的功能,使用最少的代码,并能与我们现有的授权/认证流程实现更细粒度的结合。
|
||||
|
||||
GoToSocial 实现的这个爬虫防护功能仍然是极其精简的。因此,如果你需要更多功能或对防护措施进行更精细的控制,那么完全可以禁用我们的内置功能,并在你的实例前部署像 [anubis] 这样的服务!
|
||||
|
||||
!!! warning "警告"
|
||||
这个基于工作量证明的爬虫防护机制并不保护用户账户页的 RSS feed,因为这会带来额外的复杂性。如果你需要确保 RSS feed 可被访问,那么在这种情况下,[anubis] 可能是更合适的选择!
|
||||
|
||||
[anubis]: https://github.com/TecharoHQ/anubis
|
@@ -2,6 +2,9 @@
|
||||
|
||||
使用客户端 API 需要进行身份验证。本页记录了如何获取身份验证令牌的通用流程,并提供了使用 `curl` 在命令行界面进行操作的示例。
|
||||
|
||||
!!! tip "提示"
|
||||
如果你不想使用命令行,而是想通过设置面板获取 API 访问令牌,可以参考 [应用文档](https://docs.gotosocial.org/zh-cn/latest/user_guide/settings/#applications)。
|
||||
|
||||
## 创建新应用
|
||||
|
||||
我们需要注册一个新应用,以便请求 OAuth 令牌。这可以通过向 `/api/v1/apps` 端点发送 `POST` 请求来完成。注意将下面命令中的 `your_app_name` 替换为你想使用的应用名称:
|
||||
@@ -19,18 +22,15 @@ curl \
|
||||
|
||||
字符串 `urn:ietf:wg:oauth:2.0:oob` 表示一种称为带外身份验证的技术,这是一种用于多因素身份验证的技术,旨在减少恶意行为者干扰身份验证过程的途径。在此情况下,它允许我们查看并手动复制生成的令牌以便继续使用。
|
||||
|
||||
注意,`scopes` 可以是以下任意空格分隔的组合:
|
||||
|
||||
- `read`
|
||||
- `write`
|
||||
- `admin`
|
||||
!!! tip "权限范围"
|
||||
根据应用执行的工作对应用进行最低限度的授权是一个好习惯。例如,如果你的应用不会发布贴文,请使用 `scope=read` 或进一步仅授权子权限。
|
||||
|
||||
本着这种精神,上例使用了`read`,这意味着应用将仅限于执行`read`操作。
|
||||
|
||||
可用范围列表请参阅[Swagger 文档](https://docs.gotosocial.org/zh-cn/latest/api/swagger/).
|
||||
|
||||
!!! warning "警告"
|
||||
GoToSocial 目前不支持范围授权令牌,因此在此过程中获得的任何令牌都可以代表你执行所有操作,包括如果你的账户具有管理员权限时的管理员操作。然而,始终以最低权限授予你的应用是一个好习惯。例如,如果你的应用不会发布贴文,请使用 scope=read。
|
||||
|
||||
本着这种精神,上述示例使用了`read`,这意味着当未来支持范围令牌时,应用将仅限于执行`read`操作。
|
||||
|
||||
你可以在[此处](https://codeberg.org/superseriousbusiness/gotosocial/issues/2232)阅读更多关于计划中 OAuth 安全功能的信息。
|
||||
GoToSocial 0.19.0 之前的版本并不支持范围授权令牌,因此运行低于 0.19.0 的 GoToSocial 的用户通过此流程获得的任何令牌都可以代表用户执行所有操作。如果用户具有管理权限,那么令牌还可以执行管理操作。
|
||||
|
||||
成功调用会返回一个带有 `client_id` 和 `client_secret` 的响应,我们将在后续流程中需要使用这些信息。它看起来像这样:
|
||||
|
||||
@@ -126,7 +126,6 @@ curl \
|
||||
|
||||
```bash
|
||||
curl \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
|
||||
'https://example.org/api/v1/accounts/verify_credentials'
|
||||
```
|
||||
@@ -141,7 +140,6 @@ curl \
|
||||
|
||||
```bash
|
||||
curl \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
|
||||
'https://example.org/api/v1/notifications'
|
||||
```
|
||||
|
@@ -185,6 +185,13 @@ definitions:
|
||||
description: 新贴文的默认内容格式。
|
||||
type: string
|
||||
x-go-name: StatusContentType
|
||||
web_layout:
|
||||
description: |-
|
||||
账户的网页布局。
|
||||
"microblog": 默认值,经典微博客布局。
|
||||
"gallery": 仅显示媒体的画廊布局。
|
||||
type: string
|
||||
x-go-name: WebLayout
|
||||
web_visibility:
|
||||
description: |-
|
||||
通过网页端API显示的该账户下贴文的最低可见性。
|
||||
@@ -836,6 +843,11 @@ definitions:
|
||||
description: 应用程序关联的客户端密钥。
|
||||
type: string
|
||||
x-go-name: ClientSecret
|
||||
created_at:
|
||||
description: 应用程序创建时间。 (ISO 8601 Datetime)
|
||||
example: "2021-07-30T09:20:25+00:00"
|
||||
type: string
|
||||
x-go-name: CreatedAt
|
||||
id:
|
||||
description: 应用程序的 ID。
|
||||
example: 01FBVD42CQ3ZEEVMW180SBX03B
|
||||
@@ -1093,13 +1105,22 @@ definitions:
|
||||
domain:
|
||||
description: Domain 表示一个外站实例
|
||||
properties:
|
||||
comment:
|
||||
description: |-
|
||||
如果域名被屏蔽,公开声明的屏蔽原因是什么。
|
||||
可用于在通过 /api/v1/instance 执行序列化/反序列化时替代 `public_comment`。
|
||||
example: 这个实例有股味
|
||||
type: string
|
||||
x-go-name: Comment
|
||||
domain:
|
||||
description: 实例的主机名。
|
||||
example: example.org
|
||||
type: string
|
||||
x-go-name: Domain
|
||||
public_comment:
|
||||
description: 若实例被屏蔽,公开的屏蔽原因是什么。
|
||||
description: |-
|
||||
如果实例被屏蔽,公开的屏蔽原因是什么。
|
||||
可用于在 **不** 通过 /api/v1/instance 执行序列化/反序列化时替代 `comment`。
|
||||
example: 它们被骚扰账号攻陷了。
|
||||
type: string
|
||||
x-go-name: PublicComment
|
||||
@@ -1118,6 +1139,13 @@ definitions:
|
||||
x-go-package: code.superseriousbusiness.org/gotosocial/internal/api/model
|
||||
domainPermission:
|
||||
properties:
|
||||
comment:
|
||||
description: |-
|
||||
如果域名被屏蔽,公开声明的屏蔽原因是什么。
|
||||
可用于在通过 /api/v1/instance 执行序列化/反序列化时替代 `public_comment`。
|
||||
example: 它们闻起来很糟糕
|
||||
type: string
|
||||
x-go-name: Comment
|
||||
created_at:
|
||||
description: 此权限条目创建的时间 (ISO 8601 Datetime)。
|
||||
example: "2021-07-30T09:20:25+00:00"
|
||||
@@ -1150,7 +1178,9 @@ definitions:
|
||||
type: string
|
||||
x-go-name: PrivateComment
|
||||
public_comment:
|
||||
description: 若实例被屏蔽,公开的屏蔽原因是什么。
|
||||
description: |-
|
||||
若实例被屏蔽,公开的屏蔽原因是什么。
|
||||
可用于在 **不** 通过 /api/v1/instance 执行序列化/反序列化时替代 `comment`。
|
||||
example: 它们被骚扰账号攻陷了。
|
||||
type: string
|
||||
x-go-name: PublicComment
|
||||
@@ -3509,6 +3539,11 @@ definitions:
|
||||
example: "2021-07-30T09:20:25+00:00"
|
||||
type: string
|
||||
x-go-name: ResetPasswordSentAt
|
||||
two_factor_enabled_at:
|
||||
description: 此用户启用双因素验证的时间。 (ISO 8601 Datetime)
|
||||
example: "2021-07-30T09:20:25+00:00"
|
||||
type: string
|
||||
x-go-name: TwoFactorEnabledAt
|
||||
unconfirmed_email:
|
||||
description: 此用户的未确认电子邮件地址(如果用户设置了电子邮件地址)。
|
||||
example: someone.else@somewhere.else.example.org
|
||||
@@ -3681,12 +3716,60 @@ host: example.org
|
||||
info:
|
||||
contact:
|
||||
email: admin@gotosocial.org
|
||||
name: 全体 GotoSocial 开发者
|
||||
name: GotoSocial 开发者
|
||||
description: |-
|
||||
该文档描述了 GoToSocial HTTP API。
|
||||
|
||||
有关如何使用 OAuth 访问令牌进行 API 身份验证的信息,请参阅此处的文档:https://docs.gotosocial.org/zh-cn/latest/api/authentication/。
|
||||
|
||||
可用权限范围:
|
||||
|
||||
admin: 授予对所有内容的管理权限
|
||||
admin:read: 授予对所有内容的管理读权限
|
||||
admin:read:accounts: 授予对账号的管理读权限
|
||||
admin:read:domain_allows: 授予对域名白名单的管理读权限
|
||||
admin:read:domain_blocks: 授予对域名黑名单的管理读权限
|
||||
admin:read:reports: 授予对举报的管理读权限
|
||||
admin:write: 授予对所有内容的管理写权限
|
||||
admin:write:accounts: 授予对账号的管理写权限
|
||||
admin:write:domain_allows: 授予对域名白名单的管理写权限
|
||||
admin:write:domain_blocks: 授予对域名黑名单的管理写权限
|
||||
admin:write:reports: 授予对举报的管理写权限
|
||||
profile: 授予对 verify_credentials 的读权限
|
||||
push: 授予对 push 的读写权限
|
||||
read: 授予对所有内容的读权限
|
||||
read:accounts: 授予对账号的读权限
|
||||
read:applications: 授予对用户管理的应用的读权限
|
||||
read:blocks: 授予对屏蔽的读权限
|
||||
read:bookmarks: 授予对收藏的读权限
|
||||
read:favourites: 授予对点赞的读权限
|
||||
read:filters: 授予对过滤规则的读权限
|
||||
read:follows: 授予对关注的读权限
|
||||
read:lists: 授予对列表的读权限
|
||||
read:mutes: 授予对隐藏的读权限
|
||||
read:notifications: 授予对通知的读权限
|
||||
read:search: 授予对搜索的读权限
|
||||
read:statuses: 授予对贴文的读权限
|
||||
write: 授予对所有内容的写权限
|
||||
write:accounts: 授予对账号的写权限
|
||||
write:applications: 授予对用户管理的应用的写权限
|
||||
write:blocks: 授予对屏蔽的写权限
|
||||
write:bookmarks: 授予对收藏的写权限
|
||||
write:conversations: 授予对对话的写权限
|
||||
write:favourites: 授予对点赞的写权限
|
||||
write:filters: 授予对过滤规则的写权限
|
||||
write:follows: 授予对关注的写权限
|
||||
write:lists: 授予对列表的写权限
|
||||
write:media: 授予对媒体的写权限
|
||||
write:mutes: 授予对隐藏的写权限
|
||||
write:notifications: 授予对通知的写权限
|
||||
write:reports: 授予对举报的写权限
|
||||
write:statuses: 授予对贴文的写权限
|
||||
license:
|
||||
name: AGPL3
|
||||
url: https://www.gnu.org/licenses/agpl-3.0.zh-cn.html
|
||||
title: GoToSocial Swagger 文档
|
||||
version: 0.18.2-SNAPSHOT-98c4cae8
|
||||
version: 0.19.1-SNAPSHOT-6c879186
|
||||
paths:
|
||||
/.well-known/host-meta:
|
||||
get:
|
||||
@@ -4898,6 +4981,13 @@ paths:
|
||||
in: formData
|
||||
name: web_visibility
|
||||
type: string
|
||||
- description: |-
|
||||
此账户使用的网页布局。
|
||||
"microblog": 默认,经典的微博客布局。
|
||||
"gallery": 仅显示媒体的画廊布局。
|
||||
in: formData
|
||||
name: web_layout
|
||||
type: string
|
||||
- description: 要添加到此帐户的资料页的第一个资料字段的名称。 (索引可以是任何字符串;添加更多索引以发送更多字段。)
|
||||
in: formData
|
||||
name: fields_attributes[0][name]
|
||||
@@ -5823,6 +5913,53 @@ paths:
|
||||
description: 查看具有给定 ID 的实例白名单条目。
|
||||
tags:
|
||||
- admin
|
||||
put:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
operationId: domainAllowUpdate
|
||||
parameters:
|
||||
- description: 实例白名单条目的 ID。
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: 公开展示时对域名进行混淆。例如,`example.org` 将变为类似于 `ex***e.org` 的文本。
|
||||
in: formData
|
||||
name: obfuscate
|
||||
type: boolean
|
||||
- description: 对该实例白名单条目的公开评论。当选择公开白名单时,此评论将显示在对应的实例白名单条目旁边。
|
||||
in: formData
|
||||
name: public_comment
|
||||
type: string
|
||||
- description: 对该实例白名单条目的私密评论。仅显示给其他管理员,因此这是一个有用的内部方法,可用于跟踪为什么某个域名最终被允许。
|
||||
in: formData
|
||||
name: private_comment
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 更新后的实例白名单条目。
|
||||
schema:
|
||||
$ref: '#/definitions/domainPermission'
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止
|
||||
"404":
|
||||
description: not found 未找到
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- admin:write:domain_allows
|
||||
summary: 更新单个实例白名单条目
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/domain_blocks:
|
||||
get:
|
||||
operationId: domainBlocksGet
|
||||
@@ -5859,6 +5996,53 @@ paths:
|
||||
description: 查看当前所有实例黑名单。
|
||||
tags:
|
||||
- admin
|
||||
put:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
operationId: domainBlockUpdate
|
||||
parameters:
|
||||
- description: 实例黑名单条目的 ID。
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: 公开展示时对域名进行混淆。例如,`example.org` 将变成类似于 `ex***e.org`。
|
||||
in: formData
|
||||
name: obfuscate
|
||||
type: boolean
|
||||
- description: 对此实例黑名单条目的公开评论。如果选择公开黑名单,此评论将显示在对应的实例黑名单条目旁边。
|
||||
in: formData
|
||||
name: public_comment
|
||||
type: string
|
||||
- description: 对此实例黑名单条目的私密评论。仅显示给其他管理员,因此这是一个有用的内部方法,用于追踪为什么某个域名最终被屏蔽。
|
||||
in: formData
|
||||
name: private_comment
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 更新后的实例黑名单条目。
|
||||
schema:
|
||||
$ref: '#/definitions/domainPermission'
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止访问
|
||||
"404":
|
||||
description: not found 未找到
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- admin:write:domain_blocks
|
||||
summary: 更新单个实例黑名单条目
|
||||
tags:
|
||||
- admin
|
||||
post:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
@@ -7560,6 +7744,64 @@ paths:
|
||||
tags:
|
||||
- announcements
|
||||
/api/v1/apps:
|
||||
get:
|
||||
description: |-
|
||||
获取由请求者管理的应用程序的数组。
|
||||
可从返回的 Link 标头解析出下一页和上一页的查询地址。
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
<https://example.org/api/v1/apps?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/apps?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
|
||||
````
|
||||
operationId: appsGet
|
||||
parameters:
|
||||
- description: 只返回比给定的 max ID *旧* 的应用。具有指定 ID 的应用不会包含在响应中。
|
||||
in: query
|
||||
name: max_id
|
||||
type: string
|
||||
- description: 只返回比给定的 since ID *新* 的应用。具有指定 ID 的应用不会包含在响应中。
|
||||
in: query
|
||||
name: since_id
|
||||
type: string
|
||||
- description: 只返回比给定的 min ID *相邻且更新* 的应用(用于向上翻页)。具有指定 ID 的应用不会包含在响应中。
|
||||
in: query
|
||||
name: min_id
|
||||
type: string
|
||||
- default: 20
|
||||
description: 要返回的应用数量。
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
headers:
|
||||
Link:
|
||||
description: 下一/上一查询的链接。
|
||||
type: string
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/application'
|
||||
type: array
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"404":
|
||||
description: not found 未找到
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- read:applications
|
||||
summary: 获取应用列表
|
||||
tags:
|
||||
- apps
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -7570,6 +7812,8 @@ paths:
|
||||
注册的应用程序可用于获取应用程序令牌。
|
||||
然后可以使用此令牌注册新帐户,或(通过用户身份验证)获取访问令牌。
|
||||
|
||||
如果应用程序是通过在 Authorization 标头中使用 Bearer 令牌创建的,则新创建的应用程序将由经过对应的的用户管理(Bearer 令牌必须具有 write:applications 范围)。
|
||||
|
||||
若 Content-Type 为 'application/json',则参数也可以在请求体中以 JSON 形式给出。
|
||||
若 Content-Type 为 'application/xml',则参数也可以在请求体中以 XML 形式给出。
|
||||
operationId: appCreate
|
||||
@@ -7625,6 +7869,71 @@ paths:
|
||||
summary: 创建应用程序
|
||||
tags:
|
||||
- apps
|
||||
/api/v1/apps/{id}:
|
||||
delete:
|
||||
operationId: appDelete
|
||||
parameters:
|
||||
- description: 要删除的应用程序的 ID。
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 被删除的应用程序。
|
||||
schema:
|
||||
$ref: '#/definitions/application'
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"404":
|
||||
description: not found 未找到
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- write:applications
|
||||
summary: 删除单个应用
|
||||
description: 删除单个由请求者管理的应用程序。
|
||||
tags:
|
||||
- apps
|
||||
get:
|
||||
operationId: appGet
|
||||
parameters:
|
||||
- description: 要请求的应用程序的 ID。
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 请求的应用程序。
|
||||
schema:
|
||||
$ref: '#/definitions/application'
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"404":
|
||||
description: not found 未找到
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- read:applications
|
||||
summary: 获取单个应用
|
||||
description: 获取单个由请求者管理的应用程序。
|
||||
tags:
|
||||
- apps
|
||||
/api/v1/blocks:
|
||||
get:
|
||||
description: |-
|
||||
@@ -10671,6 +10980,11 @@ paths:
|
||||
- application/x-www-form-urlencoded
|
||||
operationId: statusEdit
|
||||
parameters:
|
||||
- description: 要编辑的贴文 ID。
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: |-
|
||||
贴文的文本内容。
|
||||
如果提供了 media_ids,此项变为可选。
|
||||
@@ -10773,7 +11087,7 @@ paths:
|
||||
/api/v1/statuses/{id}:
|
||||
delete:
|
||||
description: |-
|
||||
删除给定 ID 的贴文。贴文必须属于您。
|
||||
删除给定 ID 的贴文。贴文必须属于调用API的用户。
|
||||
删除的贴文将在响应中返回。`text` 字段将包含贴文的原始文本,就像它被提交时一样。这在执行“删除并重新撰写”类型操作时很有用。
|
||||
operationId: statusDelete
|
||||
parameters:
|
||||
@@ -10985,7 +11299,7 @@ paths:
|
||||
- statuses
|
||||
/api/v1/statuses/{id}/history:
|
||||
get:
|
||||
description: '查看给定 ID 的贴文的编辑历史。 **未实现**:当前此端点将始终返回一个长度为 1 的数组,仅包含贴文的最新/当前版本。'
|
||||
description: '查看给定 ID 的贴文的编辑历史。'
|
||||
operationId: statusHistoryGet
|
||||
parameters:
|
||||
- description: 目标贴文 ID。
|
||||
@@ -11986,6 +12300,150 @@ paths:
|
||||
description: 获取自己的用户模型。
|
||||
tags:
|
||||
- user
|
||||
/api/v1/user/2fa/disable:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
- application/x-www-form-urlencoded
|
||||
description: |-
|
||||
如果双因素验证已被禁用,将返回 409 Conflict。
|
||||
|
||||
如果实例正在运行 OIDC,那么将无法在 GtS 中启用或禁用双因素验证,必须在 OIDC 提供商处启用或禁用。所有对双因素验证 API 端点的调用在 OIDC 启用时将返回 422 Unprocessable Entity。
|
||||
operationId: TwoFactorDisablePost
|
||||
parameters:
|
||||
- description: 用户的当前密码,用于验证。
|
||||
in: formData
|
||||
name: password
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: 二维码
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"409":
|
||||
description: conflict 冲突
|
||||
"422":
|
||||
description: unprocessable entity 无法处理
|
||||
"500":
|
||||
description: internal error 内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- write:accounts
|
||||
summary: 禁用双因素验证
|
||||
description: 为当前用户禁用双因素验证,必须提供用户当前密码用于验证。
|
||||
tags:
|
||||
- user
|
||||
/api/v1/user/2fa/enable:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
- application/x-www-form-urlencoded
|
||||
description: |-
|
||||
如果双因素验证已被启用,将返回 409 Conflict。
|
||||
|
||||
如果实例正在运行 OIDC,那么将无法在 GtS 中启用或禁用双因素验证,必须在 OIDC 提供商处启用或禁用。所有对双因素验证 API 端点的调用在 OIDC 启用时将返回 422 Unprocessable Entity。
|
||||
operationId: TwoFactorEnablePost
|
||||
parameters:
|
||||
- description: |-
|
||||
用户的双因素验证代码。
|
||||
示例:123456
|
||||
in: formData
|
||||
name: code
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 二维码
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"409":
|
||||
description: conflict 冲突
|
||||
"422":
|
||||
description: unprocessable entity 无法处理
|
||||
"500":
|
||||
description: internal error 内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- write:accounts
|
||||
summary: 启用双因素验证
|
||||
description: 为当前用户启用双因素验证,使用验证器应用提供的代码,返回一个一次性恢复代码数组,以允许绕过双因素验证。
|
||||
tags:
|
||||
- user
|
||||
/api/v1/user/2fa/qr.png:
|
||||
get:
|
||||
description: |-
|
||||
若希望获取二维码 URI 的明文版本,请调用 /api/v1/user/2fa/qruri 接口。
|
||||
|
||||
若用户已经启用了双因素认证,将不会再次分享二维码(及其密钥)。反之,会返回 409 Conflict 错误。要获取新的密钥,请先使用 POST /api/v1/user/2fa/disable 接口禁用双因素认证,然后再调用此接口。
|
||||
|
||||
若实例启用了 OIDC,则无法在 GtS 中开启或关闭双因素认证,必须使用 OIDC 提供商进行启用或禁用。在启用 OIDC 期间,所有对 2fa API 接口的调用都将返回 422 Unprocessable Entity 错误。
|
||||
operationId: TwoFactorQRCodePngGet
|
||||
produces:
|
||||
- image/png
|
||||
responses:
|
||||
"200":
|
||||
description: 二维码 PNG 图片
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"409":
|
||||
description: conflict 冲突
|
||||
"422":
|
||||
description: unprocessable entity 无法处理
|
||||
"500":
|
||||
description: internal error 内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- read:accounts
|
||||
summary: 查看用于启用双因素认证的二维码
|
||||
description: 返回一个二维码 PNG 图片,允许对应用户启用双因素认证。
|
||||
tags:
|
||||
- user
|
||||
/api/v1/user/2fa/qruri:
|
||||
get:
|
||||
description: |-
|
||||
若需要 PNG 格式的二维码,请调用 /api/v1/user/2fa/qr.png 接口。
|
||||
|
||||
若用户已经启用了双因素验证,将不会再次分享二维码(及其密钥)。反之,会返回 409 Conflict 错误。要获取新的密钥,请先使用 POST /api/v1/user/2fa/disable 接口禁用双因素验证,然后再调用此接口。
|
||||
|
||||
若实例启用了 OIDC,则无法在 GtS 中开启或关闭双因素验证,必须使用 OIDC 提供商进行启用或禁用。在启用 OIDC 期间,所有对双因素验证 API 接口的调用都将返回 422 Unprocessable Entity 错误。
|
||||
operationId: TwoFactorQRCodeURIGet
|
||||
produces:
|
||||
- text/plain
|
||||
responses:
|
||||
"200":
|
||||
description: 二维码 URI
|
||||
"401":
|
||||
description: unauthorized 未授权
|
||||
"403":
|
||||
description: forbidden 禁止
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"409":
|
||||
description: conflict 冲突
|
||||
"422":
|
||||
description: unprocessable entity 无法处理
|
||||
"500":
|
||||
description: internal error 内部错误
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- read:accounts
|
||||
summary: 查看用于启用双因素验证的二维码 URI
|
||||
description: 返回一个二维码 URI,允许对应用户启用双因素验证。
|
||||
tags:
|
||||
- user
|
||||
/api/v1/user/email_change:
|
||||
post:
|
||||
consumes:
|
||||
@@ -12915,6 +13373,44 @@ paths:
|
||||
summary: NodeInfo 2.0
|
||||
tags:
|
||||
- nodeinfo
|
||||
/oauth/revoke:
|
||||
post:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
operationId: oauthTokenRevoke
|
||||
parameters:
|
||||
- description: 客户端 ID,在注册应用时获取。
|
||||
in: formData
|
||||
name: client_id
|
||||
required: true
|
||||
type: string
|
||||
- description: 客户端密钥,在注册应用时获取。
|
||||
in: formData
|
||||
name: client_secret
|
||||
required: true
|
||||
type: string
|
||||
- description: 已获取的令牌,令牌将作废。
|
||||
in: formData
|
||||
name: token
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK - 如果你拥有你所提供的令牌,API 调用将返回 OK 和一个空响应 `{}`。此操作是幂等的,因此多次调用此 API 将仍然返回 OK。
|
||||
"400":
|
||||
description: bad request 无效请求
|
||||
"403":
|
||||
description: forbidden - 如果你提供了一个你并不拥有的令牌,API 调用将返回 403 错误。
|
||||
"406":
|
||||
description: not acceptable 不可接受
|
||||
"500":
|
||||
description: internal server error 服务器内部错误
|
||||
summary: 撤销访问令牌
|
||||
description: 撤销访问令牌,使其不再可用。
|
||||
tags:
|
||||
- oauth
|
||||
/readyz:
|
||||
get:
|
||||
description: 若 GoToSocial 服务“就绪” (即能够连接到数据库后端并执行简单的 SELECT),则返回无响应体的 200 状态码。若 GtS 尚未准备就绪,则在日志中记录错误(但不返回给调用方,以避免泄露内部信息)。
|
||||
@@ -13101,6 +13597,7 @@ securityDefinitions:
|
||||
push: 授予对推送的读取和写入权限
|
||||
read: 授予对所有内容的读取权限
|
||||
read:accounts: 授予对账户的读取权限
|
||||
read:applications: 授予对用户管理的应用的读取权限
|
||||
read:blocks: 授予对屏蔽状态的读取权限
|
||||
read:bookmarks: 授予对收藏的读取权限
|
||||
read:favourites: 授予对点赞的读取权限
|
||||
@@ -13113,6 +13610,7 @@ securityDefinitions:
|
||||
read:statuses: 授予对贴文的读取权限
|
||||
write: 授予对所有内容的写入权限
|
||||
write:accounts: 授予对账户的写入权限
|
||||
write:applications: 授予对用户管理的应用的写入权限
|
||||
write:blocks: 授予对屏蔽状态的写入权限
|
||||
write:bookmarks: 授予对收藏的写入权限
|
||||
write:conversations: 授予对对话的写入权限
|
||||
|
@@ -149,4 +149,21 @@ advanced-csp-extra-uris: []
|
||||
# 选项: ["block", "allow", ""]
|
||||
# 默认: ""
|
||||
advanced-header-filter-mode: ""
|
||||
|
||||
# 布尔值。启用基于工作量证明的爬虫威慑机制,
|
||||
# 作用于账户页和贴文页面。这将为每个 HTTP 客户端生成一个唯一确定
|
||||
# 的质询,需要由客户端在访问上述端点时完成。
|
||||
# 完成后,客户端会获得一个 Cookie,允许其在 1 小时窗口内免验证访问。
|
||||
#
|
||||
# 这样做的结果是,它理论上使得对这些端点的抓取在经济上变得不可行,
|
||||
# 同时对你自己的实例的性能影响可以忽略不计。
|
||||
#
|
||||
# 缺点是它要求客户端启用 JavaScript。
|
||||
#
|
||||
# 更多详情请查阅文档:
|
||||
# https://docs.gotosocial.org/zh-cn/latest/admin/scraper_deterrence
|
||||
#
|
||||
# 选项: [true, false]
|
||||
# 默认值: true
|
||||
advanced-scraper-deterrence: false
|
||||
```
|
@@ -42,6 +42,13 @@ create user gotosocial with password 'some_really_good_password';
|
||||
grant all privileges on database gotosocial to gotosocial;
|
||||
```
|
||||
|
||||
如果开始使用时你使用的是 Postgres 14 或更高版本,或者遇到 `error executing command: error creating dbservice: db migration error: ERROR: permission denied for schema public`,你应当授予你的 db 用户 `CREATE` 权限 *(这 **必须** 在连接到 gotosocial 数据库的 postgres shell 中执行)*:
|
||||
|
||||
```psql
|
||||
GRANT CREATE ON SCHEMA public TO gotosocial;
|
||||
SELECT has_schema_privilege('gotosocial', 'public', 'CREATE'); -- should return t
|
||||
```
|
||||
|
||||
GoToSocial 使用 ULIDs(全局唯一且按字典顺序可排序的标识符),这在非英文排序环境中不起作用。因此,创建数据库时使用 `C.UTF-8` 地区设置很重要。在已经使用非 C 地区初始化的系统上,必须使用 `template0` 原始数据库模板才能进行。
|
||||
|
||||
如果你希望使用特定选项连接到 Postgres,可以使用 `db-postgres-connection-string` 定义连接字符串。如果 `db-postgres-connection-string` 已定义,则所有其他与数据库相关的配置字段将被忽略。例如,可以使用 `db-postgres-connection-string` 连接到 `mySchema`,用户名为 `myUser`,密码为 `myPass`,在 `localhost` 上,数据库名称为 `db`:
|
||||
|
@@ -1,5 +1,56 @@
|
||||
# 帖文及其属性
|
||||
|
||||
## 媒体附件, Blurhash, 与焦点
|
||||
|
||||
GoToSocial 在贴文的 `attachment` 属性中使用以下类型发送媒体附件:
|
||||
|
||||
- `Image` - 任何图片类型 (webp, jpeg, gif, png, 等等)。
|
||||
- `Video` - 任何视频类型 (mp4, mkv, webm, 等等)。
|
||||
- `Audio` - 任何音频类型 (mp3, flac, wma, 等等)。
|
||||
- `Document` - 任何其他 / 未知类型。
|
||||
|
||||
GoToSocial 发送的附件包含 MIME 类型(`mediaType`)、媒体文件的完整尺寸版本的 `url` 以及摘要(`summary`)属性,外站实例可以将摘要属性解析为附件的简短描述或替代文本。
|
||||
|
||||
`Image` 和 `Video` 类型还会包含 `http://joinmastodon.org/ns#blurhash` 属性,以便外站实例可以生成图片的彩色哈希值。如果音频文件包含嵌入的封面图片,那么 `Audio` 类型也会包含 blurhash。请参阅 [Mastodon blurhash 文档](https://docs.joinmastodon.org/spec/activitypub/#blurhash)。
|
||||
|
||||
`Image` 类型还可能包含 `http://joinmastodon.org/ns#focalPoint` 属性,它是一个包含两个浮点数的数组,取值范围在 -1.0 到 1.0 之间,表示图片的焦点 x-y 坐标。请参阅 [Mastodon focalPoint 文档](https://docs.joinmastodon.org/spec/activitypub/#focalPoint)。
|
||||
|
||||
以下是一个包含一个附件的 `Note` 示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
{
|
||||
"blurhash": "toot:blurhash",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"toot": "http://joinmastodon.org/ns#"
|
||||
}
|
||||
],
|
||||
"type": "Note",
|
||||
[...],
|
||||
"attachment": [
|
||||
{
|
||||
"blurhash": "LIIE|gRj00WB-;j[t7j[4nWBj[Rj",
|
||||
"focalPoint": [
|
||||
-0.5,
|
||||
0.5
|
||||
],
|
||||
"mediaType": "image/jpeg",
|
||||
"summary": "Black and white image of some 50's style text saying: Welcome On Board",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/original/01F8MH6NEM8D7527KZAECTCR76.jpg"
|
||||
}
|
||||
],
|
||||
[...]
|
||||
}
|
||||
```
|
||||
|
||||
当接收来自外站实例的带有附件的贴文时,GoToSocial 会尝试将 `Image`、`Video`、`Audio` 或 `Document` 类型解析为媒体附件。实际使用这四种类型中的哪种类型并不重要。它会检查 `blurhash` 和 `focalPoint` 属性,若这些属性存在,就使用它们。它会使用 `summary` 值作为简短描述 / 替代文本,如果 `summary` 未设置,则回退到 `name`。
|
||||
|
||||
## 话题标签
|
||||
|
||||
GoToSocial 用户可以在贴文中包含话题标签,用于向其他实例表明该用户希望将其贴文与其他使用相同话题标签的贴文加入同一分组,以便于发现。
|
||||
|
@@ -123,7 +123,7 @@ sudo usermod -a -G gotosocial gotosocial
|
||||
sudo chown -R gotosocial:gotosocial /gotosocial
|
||||
```
|
||||
|
||||
你可以在 [Codeberg](https://codeberg.org/superseriousbusiness/gotosocial/raw/branch/main/example/gotosocial.service) 或你的安装文件夹中的 `example` 文件夹中找到一个 `gotosocial.service` 文件。
|
||||
你可以在 [我们的 Codeberg 存储库](https://codeberg.org/superseriousbusiness/gotosocial/raw/branch/main/example/gotosocial.service) 或你的安装文件夹中的 `example` 文件夹中找到一个 `gotosocial.service` 文件。
|
||||
|
||||
将它复制到 `/etc/systemd/system/gotosocial.service`:
|
||||
|
||||
|
@@ -80,6 +80,7 @@ nav:
|
||||
- "advanced/tracing.md"
|
||||
- "advanced/metrics.md"
|
||||
- "advanced/replicating-sqlite.md"
|
||||
- "advanced/scraper_deterrence.md"
|
||||
- "advanced/sqlite-networked-storage.md"
|
||||
- "适用进阶场景的构建":
|
||||
- "advanced/builds/nowasm.md"
|
||||
|
@@ -41,11 +41,11 @@
|
||||
|
||||
## 错误报告与功能请求
|
||||
|
||||
目前,我们使用 Github 的问题追踪系统来管理错误报告与功能请求。
|
||||
目前,我们使用 Codeberg 的问题追踪系统来管理错误报告与功能请求。
|
||||
|
||||
你可以在[此处](https://codeberg.org/superseriousbusiness/gotosocial/issues "GoToSocial 的 Github 问题页")查看所有开放的问题。
|
||||
你可以在[此处](https://codeberg.org/superseriousbusiness/gotosocial/issues "GoToSocial 的 Codeberg 问题追踪页")查看所有开放的问题。
|
||||
|
||||
在创建新问题之前,不论是错误还是功能请求,**请现仔细搜索所有仍处于打开状态和已被关闭的问题,以确保它尚未被解决过**。你可以使用 Github 的关键字搜索来进行此操作。如果你的问题与已有问题重复,它将被关闭。
|
||||
在创建新问题之前,不论是错误还是功能请求,**请现仔细搜索所有仍处于打开状态和已被关闭的问题,以确保它尚未被解决过**。你可以使用 Codeberg 的关键字搜索来进行此操作。如果你的问题与已有问题重复,它将被关闭。
|
||||
|
||||
在打开功能请求之前,请考虑以下几点:
|
||||
|
||||
@@ -121,16 +121,14 @@ conda env export -n gotosocial-docs --from-history --override-channels -c conda-
|
||||
|
||||
### Golang 的分支特点
|
||||
|
||||
Golang 的一个特点是,它所依赖的源代码管理路径与 `go.mod` 中使用的路径以及各 Go 文件中的包导入路径相同。这使得使用分支有些棘手。
|
||||
|
||||
正确的解决方案是先派生存储库,然后克隆上游存储库,并将上游存储库的 `origin` 设置为你分支的源。
|
||||
Golang 的一个特点是,它所依赖的源代码管理路径与 `go.mod` 中使用的路径以及各 Go 文件中的包导入路径相同。这使得使用分支版本变得有些棘手。这个问题的解决方案是先派生存储库,然后克隆上游存储库,并将上游存储库的 `origin` 设置为你派生的存储库的源。
|
||||
|
||||
有关更多细节,请参阅[这篇博客](https://blog.sgmansfield.com/2016/06/working-with-forks-in-go/)。
|
||||
|
||||
为防此文章消失,此处是步骤(有轻微修改):
|
||||
|
||||
>
|
||||
> 在 GitHub 上派生存储库或设置任何其他远程 git 存储库。在这种情况下,我会转到 GitHub 并分支存储库。
|
||||
> 在 Codeberg 上派生存储库或设置任何其他远端 git 存储库。在这种情形下,我会转到 Codeberg 并派生存储库。
|
||||
>
|
||||
> 现在克隆上游存储库(而非派生的存储库):
|
||||
>
|
||||
@@ -155,9 +153,9 @@ Golang 的一个特点是,它所依赖的源代码管理路径与 `go.mod` 中
|
||||
|
||||
#### 二进制文件
|
||||
|
||||
要开始构建,你需要先安装 Go。GtS 目前使用 Go 1.21,因此你也应该使用这个版本。安装指南见[此处](https://golang.org/doc/install)。
|
||||
要开始构建,你首先需要安装 Go。你可以在顶层目录的 `go.mod` 文件中查看需要安装的 Go 版本,然后按照[此处](https://golang.org/doc/install)的指引进行安装。
|
||||
|
||||
安装 go 后,将此存储库克隆到你的 Go 路径中。通常,此路径为 `~/go/src/code.superseriousbusiness.org/gotosocial`。
|
||||
安装 Go 后,将此存储库克隆到你的 Go 路径中。通常,此路径为 `~/go/src/code.superseriousbusiness.org/gotosocial`。
|
||||
|
||||
安装完上述环境与依赖后,可以尝试构建项目:`./scripts/build.sh`。此命令将构建 `gotosocial` 二进制文件。
|
||||
|
||||
@@ -185,8 +183,6 @@ GoReleaser 还被 GoToSocial 用于构建和推送 Docker 镜像。
|
||||
|
||||
为此,首先[安装 GoReleaser](https://goreleaser.com/install/)。
|
||||
|
||||
然后按照[Swagger 部分](#更新-swagger-文档)的说明安装 GoSwagger。
|
||||
|
||||
接着按[样式表 / Web开发](#样式表--web开发)的说明安装 Node 和 Yarn。
|
||||
|
||||
最后,创建快照构建,执行:
|
||||
@@ -199,7 +195,7 @@ goreleaser release --clean --snapshot
|
||||
|
||||
##### 手动构建
|
||||
|
||||
如果你更喜欢以简单方法构建 Docker 容器,使用更少的依赖(go-swagger, Node, Yarn),也可以这样构建:
|
||||
如果你更喜欢以简单方法构建 Docker 容器,使用更少的依赖(Node, Yarn),也可以这样构建:
|
||||
|
||||
```bash
|
||||
./scripts/build.sh && docker buildx build -t superseriousbusiness/gotosocial:latest .
|
||||
@@ -207,6 +203,8 @@ goreleaser release --clean --snapshot
|
||||
|
||||
上述命令首先构建 `gotosocial` 二进制文件,然后调用 Docker buildx 构建容器镜像。
|
||||
|
||||
如果在构建过程中出现错误,提示 `"/web/assets/swagger.yaml": not found`,则需要(重新)生成 Swagger 文档,参见 [更新 Swagger 文档](#更新-swagger-文档)。
|
||||
|
||||
如果想为不同 CPU 架构构建 docker 镜像而不设置 buildx(例如 ARMv7 aka 32-bit ARM),首先需要通过添加以下几行到 Dockerfile 顶部来修改 Dockerfile(但不要提交此更改!):
|
||||
|
||||
```dockerfile
|
||||
@@ -481,64 +479,24 @@ GTS_DB_TYPE="postgres" GTS_DB_ADDRESS="localhost" go test -p 1 ./...
|
||||
|
||||
GoToSocial 使用 [go-swagger](https://goswagger.io) 根据代码注释生成 Swagger API 文档。
|
||||
|
||||
你可以遵循 [此处](https://goswagger.io/go-swagger/install/) 的说明安装 go-swagger。
|
||||
|
||||
如果你更改了任何 API 路径上的 Swagger 注释,可以通过运行以下命令在 `./docs/api/swagger.yaml` 生成一个新的 Swagger 文件:
|
||||
如果你修改了任何 API 端点上的 Swagger 注释,你可以通过运行以下命令在 `./docs/api/swagger.yaml` 生成一个新的 Swagger 文件,并通过以下命令将该文件复制到 web 资源目录中:
|
||||
|
||||
```bash
|
||||
go run github.com/go-swagger/go-swagger/cmd/swagger generate spec --scan-models --exclude-deps --output docs/api/swagger.yaml
|
||||
go run ./vendor/github.com/go-swagger/go-swagger/cmd/swagger \
|
||||
generate spec --scan-models --exclude-deps -o docs/api/swagger.yaml \
|
||||
&& cp docs/api/swagger.yaml web/assets/swagger.yaml
|
||||
```
|
||||
|
||||
你无需安装 go-swagger 来运行此命令,因为 `vendor` 目录中已经包含了 go-swagger。
|
||||
|
||||
### CI/CD 配置
|
||||
|
||||
GoToSocial 使用 [Drone](https://www.drone.io/) 进行 CI/CD 任务,如运行测试、代码检查和构建 Docker 容器。
|
||||
GoToSocial 使用 [Woodpecker CI](https://woodpecker-ci.org/) 进行 CI/CD 任务,如运行测试、代码检查和构建 Docker 容器。
|
||||
|
||||
这些运行与 GitHub 集成,在打开拉取请求或合并到主干时执行。
|
||||
这些运行与 Codeberg 集成,在打开拉取请求或合并到主干时执行。
|
||||
|
||||
GoToSocial 的 Drone 实例在 [此处](https://drone.superseriousbusiness.org/superseriousbusiness/gotosocial)。
|
||||
`woodpecker` 流水线文件在 [此处](../../../../.woodpecker) —— 它们定义了 Woodpecker 如何运行及何时运行。
|
||||
|
||||
`drone.yml` 文件在 [此处](../../../../.drone.yml) —— 它定义了 Drone 如何运行及何时运行。Drone 的文档在 [此处](https://docs.drone.io/)。
|
||||
GoToSocial 的 Woodpecker 实例地址在 [此处](https://woodpecker.superseriousbusiness.org/repos/2).
|
||||
|
||||
值得注意的是,`drone.yml` 文件必须由 Drone 管理员帐户签名后才被视为有效。每次修改该文件时都必须这样做。这是为了防止篡改和劫持 Drone 实例。请参阅 [此处](https://docs.drone.io/signature/)。
|
||||
|
||||
要签署文件,请首先安装并设置 [drone cli 工具](https://docs.drone.io/cli/install/)。然后,运行:
|
||||
|
||||
```bash
|
||||
drone -t PUT_YOUR_DRONE_ADMIN_TOKEN_HERE -s https://drone.superseriousbusiness.org sign superseriousbusiness/gotosocial --save
|
||||
```
|
||||
|
||||
### 发布检查清单
|
||||
|
||||
首先:如果这是一个安全修复,我们可能会加急处理此清单,并在几天后发布包含此修复的版本。
|
||||
|
||||
现在,解决完安全问题后,此处是我们的清单。
|
||||
|
||||
GoToSocial 遵循 [语义化版本控制](https://semver.org/)。
|
||||
因此,清单上的首要问题是:
|
||||
|
||||
- 我们正在发布哪个版本?
|
||||
|
||||
接下来我们需要检查:
|
||||
|
||||
- 这些资源是否需要重新构建并提交到存储库。
|
||||
- Swagger 文档是否需要重新生成?
|
||||
|
||||
在项目管理方面:
|
||||
|
||||
- 是否有需要移动到其他里程碑的问题?
|
||||
- [路线图](./ROADMAP.md) 上是否有可以勾掉的事情?
|
||||
|
||||
一旦我们对清单满意,我们就可以创建标签并推送它。
|
||||
剩下的事情 [是自动化](../../../../.drone.yml)。
|
||||
|
||||
然后我们可以前往 GitHub,为发布说明增添个性。
|
||||
最后,我们在所有渠道上发布公告,宣布发布已完成!
|
||||
|
||||
#### 如果出问题了怎么办?
|
||||
|
||||
有时事情会出错。
|
||||
我们发布了有 Bug 的版本,或者忘记了什么重要的东西。
|
||||
|
||||
如果该版本不可用,甚至对很大一部分用户而言是危险的,我们可以删除标签。
|
||||
|
||||
无论怎样,一旦我们解决了问题,我们就重新开始这个清单。版本号并不昂贵,可以随意更改。
|
||||
Woodpecker 的文档参见 [此处](https://woodpecker-ci.org/docs/intro).
|
@@ -3,7 +3,7 @@
|
||||
|
||||
**有关企业赞助的更新:我们欢迎与符合我们价值观的组织建立赞助关系;请查看下述条件**
|
||||
|
||||
GoToSocial 是一个用 Golang 编写的 [ActivityPub](https://activitypub.rocks/) 社交网络服务端。
|
||||
🏳️🌈 GoToSocial 是一个用 Golang 编写的 [ActivityPub](https://activitypub.rocks/) 社交网络服务端。 🏳️⚧️
|
||||
|
||||
通过 GoToSocial,你可以与朋友保持联系,发帖、阅读和分享图片及文章,且不会被追踪或广告打扰!
|
||||
|
||||
@@ -40,6 +40,7 @@ GoToSocial 是一个用 Golang 编写的 [ActivityPub](https://activitypub.rocks
|
||||
- [多种联合模式](#多种联合模式)
|
||||
- [OIDC 集成](#oidc-集成)
|
||||
- [后端优先设计](#后端优先设计)
|
||||
- [替代实现](#替代实现)
|
||||
- [已知问题](#已知问题)
|
||||
- [安装 GoToSocial](#安装-gotosocial)
|
||||
- [支持的平台](#支持的平台)
|
||||
@@ -231,6 +232,7 @@ GoToSocial 仅需约 250-350MiB 的 RAM,并且只要求极少的 CPU 频率,
|
||||
- [导入/导出](https://docs.gotosocial.org/zh-cn/latest/admin/settings/#导入导出) 社区创建的域名允许和域名阻止列表,并[订阅](https://docs.gotosocial.org/zh-cn/latest/admin/domain_permission_subscriptions)这些列表。
|
||||
- HTTP 签名认证:GoToSocial 在发送和接收消息时要求 [HTTP 签名](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12),以确保消息不能被篡改,身份不能被伪造。
|
||||
- 内置 [Let's Encrypt](https://letsencrypt.org/) 的自动使用 HTTPS 支持。
|
||||
- 支持基于时间的一次性双因素认证代码(Google 认证器,LastPass 认证器等)。
|
||||
|
||||
### 多种联合模式
|
||||
|
||||
@@ -256,9 +258,21 @@ GoToSocial 支持 [OpenID Connect (OIDC)](https://openid.net/connect/) 身份提
|
||||
|
||||
---
|
||||
|
||||
## 替代实现
|
||||
|
||||
不喜欢 GtS 但还是想搭建联邦宇宙服务?喜欢 GtS 但不想用测试版软件?有很多替代实现可能更适合你!这里列出一些我们知道的使用效果不错的实现(按字母顺序排列):
|
||||
|
||||
- [Akkoma](https://akkoma.social/):功能齐全的 ActivityPub 微博客,支持表情反应和引用贴文(Elixir)。
|
||||
- [Honk](https://humungus.tedunangst.com/r/honk/m/activitypub.7):极简、有特点的微博客服务端,特点是“没有点赞、没有收藏、没有投票、没有加星、没有鼓掌、没有互动计数”(Go)。
|
||||
- [Iceshrimp.net](https://iceshrimp.dev/iceshrimp/Iceshrimp.NET):Iceshrimp 的全新重写版本(.Net)。
|
||||
- [Mastodon](https://joinmastodon.org/):积极开发、广为人知、可扩展的 ActivityPub 微博客服务端(Ruby)。
|
||||
- [Snac2](https://codeberg.org/grunfink/snac2):简约、最小化的实例,系统要求非常低(可移植 C)。
|
||||
|
||||
---
|
||||
|
||||
## 已知问题
|
||||
|
||||
由于 GoToSocial 仍处于测试阶段,存在很多错误。我们使用 [GitHub issues](https://codeberg.org/superseriousbusiness/gotosocial/issues?q=is%3Aissue+is%3Aopen+label%3Abug) 跟踪这些问题。
|
||||
由于 GoToSocial 仍处于测试阶段,存在很多错误。我们使用 [Codeberg issues](https://codeberg.org/superseriousbusiness/gotosocial/issues?q=is%3Aissue+is%3Aopen+label%3Abug) 跟踪这些问题。
|
||||
|
||||
由于每个 ActivityPub 服务端实现对协议的解释略有不同,有些服务端尚未与 GoToSocial 正常联合。我们在 [这个项目](https://codeberg.org/superseriousbusiness/gotosocial/projects/4) 中跟踪这些问题。最终,我们希望确保任何可以与 Mastodon 正确联合的 ActivityPub 实现也能够与 GoToSocial 联合。
|
||||
|
||||
@@ -294,13 +308,13 @@ GoToSocial 支持 [OpenID Connect (OIDC)](https://openid.net/connect/) 身份提
|
||||
|
||||
#### 64位
|
||||
|
||||
64位平台需要以下(现在很常见的)CPU指令:
|
||||
对 64 位 CPU 的特性要求注释:
|
||||
|
||||
- x86-64需要SSE4.1(用于媒体解码和WASM SQLite)
|
||||
- x86_64 需要支持 SSE4.1 指令集 (自2010年左右起生产的CPU大多支持)
|
||||
|
||||
- Armv8需要ARM64大型系统扩展(ARM64 Large System Extensions)(特别是在使用WASM SQLite时)
|
||||
- ARM64 没有特定指令集要求, ARMv8 CPU(及后续版本)已支持全部所需特性。
|
||||
|
||||
如果没有这些指令,性能将会受到影响。在这些情况下,您可以尝试使用完全**不受支持、实验性的**[nowasm](https://docs.gotosocial.org/en/latest/advanced/builds/nowasm/)标签自行构建二进制文件。
|
||||
如果没有这些指令集,媒体处理性能将会受到影响(多数情况下,SQLite性能也会收到影响)。在这些情况下,您可以尝试使用完全**不受支持、实验性的**[nowasm](https://docs.gotosocial.org/zh-cn/latest/advanced/builds/nowasm/)标签自行构建二进制文件。
|
||||
|
||||
#### BSD系
|
||||
|
||||
@@ -340,7 +354,7 @@ Docker 镜像 `superseriousbusiness/gotosocial:latest` 始终对应于最新稳
|
||||
|
||||
要使用二进制发布从主分支运行,请从我们的 [自托管 Minio S3 仓库](https://minio.s3.superseriousbusiness.org/browser/gotosocial-snapshots)下载适合你架构的 .tar.gz 文件。
|
||||
|
||||
S3 存储桶中的快照版二进制发布由 Github 提交哈希控制。要获取最新的,请按上次修改时间排序,或者查看 [这里的提交列表](https://codeberg.org/superseriousbusiness/gotosocial/commits/main),复制最新的 SHA,并在 Minio 控制台过滤器中粘贴。快照二进制发布会在 28 天后过期,以降低我们的托管成本。
|
||||
S3 存储桶中的快照版二进制发布由代码提交哈希控制。要获取最新的,请按上次修改时间排序,或者查看 [这里的提交列表](https://codeberg.org/superseriousbusiness/gotosocial/commits/main),复制最新的 SHA,并在 Minio 控制台过滤器中粘贴。快照二进制发布会在 28 天后过期,以降低我们的托管成本。
|
||||
|
||||
### 从源代码构建
|
||||
|
||||
@@ -428,15 +442,16 @@ GoToSocial 使用以下开源库、框架和工具,在此声明并致谢 💕
|
||||
- [mvdan.cc/xurls](https://github.com/mvdan/xurls); URL 解析正则表达式。 [BSD-3-Clause 许可证](https://spdx.org/licenses/BSD-3-Clause.html)。
|
||||
- [oklog/ulid](https://github.com/oklog/ulid); 顺序友好的数据库 ID 生成。 [Apache-2.0 许可证](https://spdx.org/licenses/Apache-2.0.html)。
|
||||
- [open-telemetry/opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go); OpenTelemetry API + SDK。 [Apache-2.0 许可证](https://spdx.org/licenses/Apache-2.0.html)。
|
||||
- [pquerna/otp](https://github.com/pquerna/otp); 一次性代码工具。 [Apache-2.0 许可证](https://spdx.org/licenses/Apache-2.0.html)。
|
||||
- spf13:
|
||||
- [spf13/cobra](https://github.com/spf13/cobra); 命令行工具。 [Apache-2.0 许可证](https://spdx.org/licenses/Apache-2.0.html)。
|
||||
- [spf13/viper](https://github.com/spf13/viper); 配置管理。 [Apache-2.0 许可证](https://spdx.org/licenses/Apache-2.0.html)。
|
||||
- [stretchr/testify](https://github.com/stretchr/testify); 测试框架。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
- superseriousbusiness:
|
||||
- [superseriousbusiness/activity](https://codeberg.org/superseriousbusiness/activity) 从 [go-fed/activity](https://github.com/go-fed/activity) 派生; Golang ActivityPub/ActivityStreams 库。 [BSD-3-Clause 许可证](https://spdx.org/licenses/BSD-3-Clause.html)。
|
||||
- [superseriousbusiness/exif-terminator](https://codeberg.org/superseriousbusiness/exif-terminator); EXIF 数据擦除。 [GNU AGPL v3 许可证](https://spdx.org/licenses/AGPL-3.0-or-later.html)。
|
||||
- [superseriousbusiness/httpsig](https://codeberg.org/superseriousbusiness/httpsig) 从 [go-fed/httpsig](https://github.com/go-fed/httpsig) 派生; 安全 HTTP 签名库。 [BSD-3-Clause 许可证](https://spdx.org/licenses/BSD-3-Clause.html)。
|
||||
- [superseriousbusiness/oauth2](https://codeberg.org/superseriousbusiness/oauth2) 从 [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2) 派生; OAuth 服务器框架和令牌处理。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
- [superseriousbusiness/activity](https://code.superseriousbusiness.org/activity) 从 [go-fed/activity](https://github.com/go-fed/activity) 派生; Golang ActivityPub/ActivityStreams 库。 [BSD-3-Clause 许可证](https://spdx.org/licenses/BSD-3-Clause.html)。
|
||||
- [superseriousbusiness/exif-terminator](https://code.superseriousbusiness.org/exif-terminator); EXIF 数据擦除。 [GNU AGPL v3 许可证](https://spdx.org/licenses/AGPL-3.0-or-later.html)。
|
||||
- [superseriousbusiness/httpsig](https://code.superseriousbusiness.org/httpsig) 从 [go-fed/httpsig](https://github.com/go-fed/httpsig) 派生; 安全 HTTP 签名库。 [BSD-3-Clause 许可证](https://spdx.org/licenses/BSD-3-Clause.html)。
|
||||
- [superseriousbusiness/oauth2](https://code.superseriousbusiness.org/oauth2) 从 [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2) 派生; OAuth 服务器框架和令牌处理。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
- [temoto/robotstxt](https://github.com/temoto/robotstxt); robots.txt 解析。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
- [tdewolff/minify](https://github.com/tdewolff/minify); Markdown 帖文的 HTML 压缩。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
- [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs); GOMAXPROCS 自动化。 [MIT 许可证](https://spdx.org/licenses/MIT.html)。
|
||||
|
@@ -73,10 +73,10 @@
|
||||
- [x] **无评论区的帖文** -- 设计无评论区帖文的相关逻辑,让用户创建无评论区的帖文。
|
||||
- [x] **屏蔽/允许列表订阅** -- 允许实例管理员为其实例订阅屏蔽/允许列表。
|
||||
- [x] **私信对话视图** -- 让用户能够轻松浏览他们参与的所有私信对话。
|
||||
- [ ] **Oauth 令牌管理** -- 通过设置面板创建/查看/吊销 OAuth 令牌。
|
||||
- [ ] **贴文编辑支持** -- 编辑已创建的贴文,而无需删除并重新编辑。并正确地将编辑传播出去。
|
||||
- [x] **Oauth 令牌管理** -- 通过设置面板创建/查看/吊销 OAuth 令牌。
|
||||
- [x] **贴文编辑支持** -- 编辑已创建的贴文,而无需删除并重新编辑。并正确地将编辑传播出去。
|
||||
- [ ] **Fediverse 中继支持** -- 与中继通信,发布和接收帖文。
|
||||
- [ ] **两步验证 (2fa)** -- 允许用户通过设置面板为其账户启用 2FA,并在登录时实施 2FA。
|
||||
- [x] **两步验证 (2fa)** -- 允许用户通过设置面板为其账户启用 2FA,并在登录时实施 2FA。
|
||||
- [ ] **管理:附加内容警告/将所有内容标记为敏感内容**。
|
||||
|
||||
更多内容待定!
|
||||
|
1
docs/locales/zh/repo/SECURITY.md
Normal file
1
docs/locales/zh/repo/SECURITY.md
Normal file
@@ -0,0 +1 @@
|
||||
请将安全问题反馈发送至:admin@gotosocial.org
|
@@ -31,6 +31,30 @@ GoToSocial 提供主题供你选择,以更改账户的外观和氛围。
|
||||
!!! tip "添加更多主题"
|
||||
实例管理员可以通过将 CSS 文件放入 `web/assets/themes` 文件夹中来添加更多主题。有关详细信息,请参阅管理员文档中的[主题](../admin/themes.md)部分。
|
||||
|
||||
### 选择布局
|
||||
|
||||
使用 GoToSocial,你可以为你的账户页的网页视图选择两种不同的布局。
|
||||
|
||||
这个设置不会影响 API 的行为,也不会影响客户端应用的外观或工作方式,它纯粹是网页视图的一个外观上的改变。
|
||||
|
||||
这两种布局都只会显示顶层贴文(或顶层贴文中的媒体),不显示回复或转发,并且会遵守[在你的账户页上显示的贴文的可见性级别](#visibility-level-of-posts-to-show-on-your-profile)设置。
|
||||
|
||||
#### 微博
|
||||
|
||||
GtS 经典的微博客布局。你的账户页被分成两列,显示你的简介和最近/置顶的贴文。
|
||||
|
||||
如果你主要发布文字,或者文字与媒体的混合内容,这是一个不错的选择。
|
||||
|
||||

|
||||
|
||||
#### 画廊
|
||||
|
||||
类似 Instagram 的布局。贴文不会在你的账户页上直接显示,反之,你最近/置顶的媒体会以画廊网格视图的形式显示。贴文(及其回复)仍然可以通过链接访问。
|
||||
|
||||
如果你主要发布媒体,这是一个不错的选择。
|
||||
|
||||

|
||||
|
||||
### 基本信息
|
||||
|
||||
#### 昵称
|
||||
@@ -201,7 +225,9 @@ markdown 设置表示你的贴文应被按 Markdown 格式解析,这是一种
|
||||
|
||||
随着更多 ActivityPub 服务端推出互动规则支持,这个问题有望减少,但在此期间,GoToSocial 只能在“尽力而为”范围内进行尝试,以根据你设定的规则限制与贴文的互动。
|
||||
|
||||
## 电子邮箱和密码
|
||||
## 账户
|
||||
|
||||
在账户部分,你可以设置你的电子邮箱和密码,以及为你的账户设置双因素验证。
|
||||
|
||||
### 更改电子邮箱
|
||||
|
||||
@@ -221,6 +247,24 @@ markdown 设置表示你的贴文应被按 Markdown 格式解析,这是一种
|
||||
|
||||
有关 GoToSocial 如何管理密码的更多信息,请参阅[密码管理文档](./password_management.md)。
|
||||
|
||||
### 双因素身份验证
|
||||
|
||||
你可以使用面板的这一部分为你的账户启用双因素身份验证。
|
||||
|
||||
启用双因素身份验证后,除密码外,你还必须在登录时提供一个来自你配置的验证器应用(Google 验证器、LastPass 验证器等)的代码。
|
||||
|
||||
要启用双因素身份验证,请在移动设备上安装一个验证器应用,然后用它扫描二维码。你也可以手动复制双因素验证密钥并将其粘贴到验证器中。完成后,输入验证器中的代码,验证验证器和服务器是否正确同步。
|
||||
|
||||
成功后,你将看到一个包含八个双因素验证备份/恢复代码的列表。将这些代码保存在安全的地方(如密码管理器)。如果你失去了对身份验证程序的访问权限,例如丢失了设备,那么可以在登录时使用这些代码之一来代替 2FA 代码。这些代码使用后将无法再次使用。如果你用完了全部八个恢复代码,你应该禁用并重新启用 2FA,以生成新的密码。
|
||||
|
||||
要禁用双因素验证,请在表单中输入当前密码,然后点击 "禁用 2FA "按钮。
|
||||
|
||||
!!! tip "提示"
|
||||
建议使用双因素身份验证,因为它可以增加坏人通过猜测密码登录账户的难度,因为他们还需要访问你的身份验证设备。有关不同类型 2FA 的更多信息,请参阅 [互联网常见双因素验证类型指南](https://www.eff.org/deeplinks/2017/09/guide-common-types-two-factor-authentication-web)。
|
||||
|
||||
!!! info "注意"
|
||||
如果你的实例使用 OIDC 作为授权/身份提供商,则无法在设置面板中启用 2FA,此时应联系 OIDC 提供商管理双因素身份验证。
|
||||
|
||||
## 迁移
|
||||
|
||||
在迁移部分,你可以管理与与账户别名、迁移到其他账户或从其他账户迁移相关的设置。
|
||||
@@ -289,3 +333,71 @@ markdown 设置表示你的贴文应被按 Markdown 格式解析,这是一种
|
||||
!!! note "附注"
|
||||
|
||||
令牌的“最后使用”时间是近似值,可能存在正负一小时的误差。
|
||||
|
||||
|
||||
## 应用
|
||||
|
||||
在“应用”部分,您可以新建托管的 OAuth 客户端应用,并搜索你已创建的应用。
|
||||
|
||||
### 什么是 OAuth 客户端应用?
|
||||
|
||||
GoToSocial OAuth 客户端应用等同于 [Auth0 身份组文档](https://auth0.com/intro-to-iam/what-is-oauth-2#oauth20-roles) 中描述的 OAuth 2.0 客户端。
|
||||
|
||||
创建一个应用后,你可以作为你账户的“资源所有者”,通过访问令牌授予该应用访问你账户的权限。应用可以使用此令牌,以“你的身份”或“代表你”与 GoToSocial 客户端 API 进行交互。
|
||||
|
||||
例如,当使用 Tusky 登录你的 GoToSocial 账户时,Tusky 首先在你的实例作为一个 OAuth 客户端应用注册,然后请求实例将你重定向到一个页面。在该页面,你可以使用你的 GoToSocial 邮箱地址和密码登录,以授权 Tusky 获取访问令牌。随后,Tusky 存储并在所有后续请求中使用该访问令牌,来执行你指示的操作:发布贴文、读取时间线等。
|
||||
|
||||
OAuth 客户端应用的优势在于它们从不存储(甚至看不到)你的密码:它们仅使用访问令牌以你的身份执行操作。该令牌可以被撤销,这样应用就无法再访问你的账户,而你无需更改密码(请参阅 [访问令牌](#访问令牌))。
|
||||
|
||||
!!! note "托管应用程序 vs 非托管应用程序"
|
||||
*托管* 应用程序是你通过设置面板自行创建的应用程序,你有权为其请求令牌和删除它。这与像 Tusky 这样的应用程序有所不同,后者不被视为 *托管* 应用程序,因为它们不是由用户在设置面板中创建的。
|
||||
|
||||
### 什么是重定向 URI?
|
||||
|
||||
重定向 URI 提供了一种安全措施,可防止应用程序在授权后重定向到恶意地址。OAuth 2.0 文档对此有最好的解释,请参阅:
|
||||
|
||||
- [重定向 URI](https://www.oauth.com/oauth2-servers/redirect-uris/)
|
||||
- [重定向 URL 注册](https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uri-registration/)
|
||||
|
||||
任何需要你为之创建 OAuth 应用的服务通常会告知你,在创建应用时需要输入哪些重定向 URI。
|
||||
|
||||
### 什么是范围?
|
||||
|
||||
范围是一个以空格分隔的标识符列表,可以在创建应用(或为其获取令牌)时指定,以防止应用或其访问令牌访问超出其工作所需的数据。
|
||||
|
||||
例如,如果你创建一个仅具有 `read` 范围的应用,那么该应用拥有的任何令牌将仅对你的账户具有 `read` 访问权限:它们将无法以你的身份执行发布、删除或其他 *写入* 类型的操作。
|
||||
|
||||
GoToSocial 提供了一系列与 Mastodon API 非常相似的范围。您可以在这里查看范围列表(及其作用):https://docs.gotosocial.org/zh-cn/latest/api/swagger/。
|
||||
|
||||
与 Mastodon 类似,GoToSocial 允许你在创建应用 *以及* 随后请求令牌时指定范围。因此,你可以创建一个具有 `read write` 范围的应用,但请求一个仅具有 `read` 范围的令牌,或者请求一个更小的范围,如 `read:accounts`。请求令牌时指定的任何范围都必须被应用所被允许的范围所覆盖。例如,如果您的应用只有 `read` 范围,您就不能请求具有 `write` 范围的令牌。
|
||||
|
||||
有关范围的更多一般信息,请参阅 OAuth 2.0 文档:
|
||||
|
||||
- [范围](https://www.oauth.com/oauth2-servers/scope/)
|
||||
- [定义范围](https://www.oauth.com/oauth2-servers/scope/defining-scopes/)
|
||||
|
||||
### 搜索应用程序
|
||||
|
||||
使用此部分,你可以查看通过设置面板创建的应用程序的概览,并单击某个应用程序以进入该应用程序的详情视图。
|
||||
|
||||
### 新建应用程序
|
||||
|
||||

|
||||
|
||||
要创建一个新的托管 OAuth 应用,你必须至少提供应用的名称。如果需要,也可以提供网站地址。
|
||||
|
||||
如果你不提供任何范围,则应用将默认具有 `read` 范围。
|
||||
|
||||
如果你不指定任何重定向 URI,则应用将默认使用非常规重定向 URI `urn:ietf:wg:oauth:2.0:oob`。
|
||||
|
||||
如果你希望使用设置面板轻松地为你的应用获取访问令牌,那么你必须在重定向 URI 列表中包含给定的设置面板回调 URL。其格式为 `https://[your_instance_host]/settings/user/applications/callback`。
|
||||
|
||||
### 应用程序详情
|
||||
|
||||

|
||||
|
||||
在应用的详情页面上,你可以查看应用的客户端 ID 和客户端密钥,你可以在像 `curl` 这样的命令行工具中使用它们来手动获取该应用的授权码和访问令牌。
|
||||
|
||||
如果你在重定向 URI 列表中包含了设置面板回调 URL,你也可以使用此页面为你的账户请求访问令牌。这将把你重定向到你实例的登录页面,你必须在该页面提供你的凭据以授权你的应用。然后你将再次被重定向到设置面板回调 URL,在那里你可以接收你的访问令牌。
|
||||
|
||||
你也可以使用此页面删除你的应用。当托管应用被删除时,所有通过该应用创建的令牌也将被删除,因此请确保仅在你的应用未使用时才执行此操作。
|
||||
|
Reference in New Issue
Block a user