Add chinese translation (#772)

* add chinese config and i18n

* Import translation from https://bitbucket.org/mastodoncn/mastodon-zh-cn/src/master/

* translate Using Mastodon

* Translate Running Mastodon
Add Chinese search optimization
Fix some bugs

* substitute 长毛象 to Mastodon

* do some modifications.
This commit is contained in:
yingziwu 2020-05-21 02:54:12 +08:00 committed by GitHub
parent 02839e07ce
commit b6e011265d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 3176 additions and 65 deletions

View File

@ -8,50 +8,99 @@ metaDataFormat = "yaml"
paginate = 100
enableGitInfo = true
[menu]
[[menu.docs]]
[languages.en.menu]
[[languages.en.menu.docs]]
name = "Using Mastodon"
weight = 10
identifier = "user"
url = "/user/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "Running Mastodon"
weight = 20
identifier = "admin"
url = "/admin/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "Developing Mastodon apps"
weight = 30
identifier = "client"
url = "/client/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "Contributing to Mastodon"
weight = 40
identifier = "dev"
url = "/dev/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "Spec compliance"
weight = 50
identifier = "spec"
url = "/spec/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "REST API"
weight = 60
identifier = "api"
url = "/api/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "API Methods"
weight = 70
identifier = "methods"
url = "/methods/"
[[menu.docs]]
[[languages.en.menu.docs]]
name = "API Entities"
weight = 80
identifier = "entities"
url = "/entities/"
[languages.zh-cn.menu]
[[languages.zh-cn.menu.docs]]
name = "使用Mastodon"
weight = 10
identifier = "user"
url = "/user/"
[[languages.zh-cn.menu.docs]]
name = "运营Mastodon"
weight = 20
identifier = "admin"
url = "/admin/"
[[languages.zh-cn.menu.docs]]
name = "开发Mastodon应用"
weight = 30
identifier = "client"
url = "/client/"
[[languages.zh-cn.menu.docs]]
name = "向Mastodon项目做贡献"
weight = 40
identifier = "dev"
url = "/dev/"
[[languages.zh-cn.menu.docs]]
name = "遵循的标准"
weight = 50
identifier = "spec"
url = "/spec/"
[[languages.zh-cn.menu.docs]]
name = "REST API"
weight = 60
identifier = "api"
url = "/api/"
[[languages.zh-cn.menu.docs]]
name = "API 方法"
weight = 70
identifier = "methods"
url = "/methods/"
[[languages.zh-cn.menu.docs]]
name = "API 实体"
weight = 80
identifier = "entities"
url = "/entities/"
[languages]
[languages.en]
contentDir = "content/en"
languageName = "English"
weight = -99
weight = -99
[languages.zh-cn]
contentDir = "content/zh-cn"
languageName = "简体中文"
weight = 1

View File

@ -35,7 +35,7 @@ Mastodon uses a standardized, open protocol to implement federation. It is calle
The **fediverse** \(“federated universe”\) is the name for all websites that can communicate with each other over ActivityPub and the World Wide Web. That includes all Mastodon servers, but also other implementations:
* Pleroma, a modular microblogging engine,
* Pixelfed, which lets you share and consume media posts,
* Pixelfed, federated image sharing platform, which lets you share and consume media posts,
* Misskey, which includes microblogging alongside a customizable dashboard,
* PeerTube, which lets you upload videos to channels,
* Plume, which lets you publish longer-form articles,
@ -71,7 +71,7 @@ Mastodon development is likewise crowdfunded via [Patreon](https://patreon.com/m
### Interoperability between different software {#interoperability}
In practical terms: Imagine if you could follow an Instagram user from your Twitter account and comment on their photos without leaving your account. If Twitter and Instagram were federated services that used the same protocol, that would be possible. With a Mastodon account, **you can communicate with any other compatible website,** _**even if it is not running on Mastodon**_. All that is necessary is that the software support the same subset of the ActivityPub protocol that allows for creating and interacting with status updates. To find out more about the technical specifications required to interoperate with Mastodon, see [ActivityPub](spec/activitypub.md), [WebFinger](spec/webfinger.md), and [Security](spec/security.md). To read more about what ActivityPub allows us to do, see [Why ActivityPub is the future](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/).
In practical terms: Imagine if you could follow an Instagram user from your Twitter account and comment on their photos without leaving your account. If Twitter and Instagram were federated services that used the same protocol, that would be possible. With a Mastodon account, **you can communicate with any other compatible website,** _**even if it is not running on Mastodon**_. All that is necessary is that the software support the same subset of the ActivityPub protocol that allows for creating and interacting with status updates. To find out more about the technical specifications required to interoperate with Mastodon, see [ActivityPub](spec/activitypub), [WebFinger](spec/webfinger), and [Security](spec/security). To read more about what ActivityPub allows us to do, see [Why ActivityPub is the future](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/).
> All of these platforms are different and they focus on different needs. And yet, the foundation is all the same: people subscribing to receive posts from other people. And so, they are all compatible.
>

View File

@ -54,7 +54,7 @@ However, dedicated spammers will get through that. The other measure you can emp
### Blocking by e-mail server {#blocking-by-e-mail-server}
Spammers will often use different e-mail domains so it looks like they are using a lot of different e-mail servers that would all be difficult to blacklist separately. However, sometimes all of those domains resolve to a single e-mail server IP. If you see a lot of spammers signing up at the same time, you can check for this, either using an online DNS lookup tool, or the Linux `dig` utility, e.g. `dig 1.2.3.4` will return all DNS records for that IP. If you notice the IP is the same for all domains, you can add it to the e-mail domain blacklist.
Spammers will often use different e-mail domains so it looks like they are using a lot of different e-mail servers that would all be difficult to blacklist separately. However, sometimes all of those domains resolve to a single e-mail server IP. If you see a lot of spammers signing up at the same time, you can check for this, either using an online DNS lookup tool, or the Linux `dig` utility, e.g. `dig example.com` will return all DNS A records for that Domain. If you notice the IP is the same for all domains, you can add it to the e-mail domain blacklist.
### Blocking by IP {#blocking-by-ip}

View File

@ -32,7 +32,7 @@ apt install elasticsearch
```
{{< hint style="warning" >}}
**Security warning:** By default, ElasticSearch is supposed to bind to localhost only, i.e. be inaccessible from the outside network. You can check which address ElasticSearch binds to by looking at `network.host` within `/etc/elasticsearch/elasticsearch.yml`. Consider that anyone who can access ElasticSearch can access and modify any data within it, as there is no authentication layer. So its really important that the access is secured. Having a firewall that only exposes the 22, 80 and 443 ports is advisable, as outlined in the [main installation instructions](). If you have a multi-host setup, you must know how to secure internal traffic.
**Security warning:** By default, ElasticSearch is supposed to bind to localhost only, i.e. be inaccessible from the outside network. You can check which address ElasticSearch binds to by looking at `network.host` within `/etc/elasticsearch/elasticsearch.yml`. Consider that anyone who can access ElasticSearch can access and modify any data within it, as there is no authentication layer. So its really important that the access is secured. Having a firewall that only exposes the 22, 80 and 443 ports is advisable, as outlined in the [main installation instructions](../../prerequisites/#install-a-firewall-and-only-whitelist-ssh-http-and-https-ports). If you have a multi-host setup, you must know how to secure internal traffic.
{{< /hint >}}
To start ElasticSearch:
@ -77,3 +77,82 @@ RAILS_ENV=production bundle exec rake chewy:sync
**Compatibility note:** There is a known bug in Ruby 2.6.0 that prevents the above task from working. Other versions of Ruby, such as 2.6.1, are fine.
{{< /hint >}}
## Search optimization for other languages
### Chinese search optimization {#chinese-search-optimization}
The default analyzer of the ElasticSearch is the standard analyzer, which may not be the best especially for Chinese. To improve search experience, you can install language specific analyzer. Before create the index in ElasticSearch:
Installing [elasticsearch-analysis-ik](https://github.com/medcl/elasticsearch-analysis-ik), [elasticsearch-analysis-stconvert](https://github.com/medcl/elasticsearch-analysis-stconvert) to ElasticSearch.
And do modify as follows:
```diff
diff --git a/app/chewy/accounts_index.rb b/app/chewy/accounts_index.rb
--- a/app/chewy/accounts_index.rb
+++ b/app/chewy/accounts_index.rb
@@ -4,7 +4,7 @@ class AccountsIndex < Chewy::Index
settings index: { refresh_interval: '5m' }, analysis: {
analyzer: {
content: {
- tokenizer: 'whitespace',
+ tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
},
diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb
--- a/app/chewy/statuses_index.rb
+++ b/app/chewy/statuses_index.rb
@@ -16,9 +16,17 @@ class StatusesIndex < Chewy::Index
language: 'possessive_english',
},
},
+ char_filter: {
+ tsconvert: {
+ type: 'stconvert',
+ keep_both: false,
+ delimiter: '#',
+ convert_type: 't2s',
+ },
+ },
analyzer: {
content: {
- tokenizer: 'uax_url_email',
+ tokenizer: 'ik_max_word',
filter: %w(
english_possessive_stemmer
lowercase
@@ -27,6 +35,7 @@ class StatusesIndex < Chewy::Index
english_stop
english_stemmer
),
+ char_filter: %w(tsconvert),
},
},
}
diff --git a/app/chewy/tags_index.rb b/app/chewy/tags_index.rb
--- a/app/chewy/tags_index.rb
+++ b/app/chewy/tags_index.rb
@@ -2,10 +2,19 @@
class TagsIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
+ char_filter: {
+ tsconvert: {
+ type: 'stconvert',
+ keep_both: false,
+ delimiter: '#',
+ convert_type: 't2s',
+ },
+ },
analyzer: {
content: {
- tokenizer: 'keyword',
+ tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
+ char_filter: %w(tsconvert),
},
edge_ngram: {
```

View File

@ -36,7 +36,7 @@ No local data is actually deleted, because emptying the database or deleting the
{{< /hint >}}
**Version history:**
2.8.0 - added
* 2.8.0 - added
| Option | Description |
| :--- | :--- |
@ -47,7 +47,7 @@ No local data is actually deleted, because emptying the database or deleting the
Show the version of the currently running Mastodon instance.
**Version history:**
2.7.0 - added
* 2.7.0 - added
## Accounts CLI {#accounts}
@ -58,7 +58,7 @@ Show the version of the currently running Mastodon instance.
Generate and broadcast new RSA keys, as part of security maintenance.
**Version history:**
2.5.0 - added
* 2.5.0 - added
| Option | Description |
| :--- | :--- |
@ -70,7 +70,7 @@ Generate and broadcast new RSA keys, as part of security maintenance.
Create a new user account with given USERNAME and provided --email.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
@ -86,11 +86,11 @@ Create a new user account with given USERNAME and provided --email.
Modify a user account's role, email, active status, approval mode, or 2FA requirement.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
| `USERNAME` | Local username for the new account. Required. |
| `USERNAME` | Local username for the account. Required. |
| `--role ROLE` | Define the account as a `user`, `moderator`, or `admin`. |
| `--email EMAIL` | Update the user's email address to EMAIL. |
| `--confirm` | Skip confirmation email, when used with --email. |
@ -104,7 +104,7 @@ Modify a user account's role, email, active status, approval mode, or 2FA requir
Delete a user account with given USERNAME.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
@ -115,7 +115,7 @@ Delete a user account with given USERNAME.
Request a backup for a user account with given USERNAME. The backup will be created in Sidekiq asynchronously, and the user will receive an email with a link to it once it's done.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
@ -126,8 +126,8 @@ Request a backup for a user account with given USERNAME. The backup will be crea
Remove remote accounts that no longer exist. Queries every single remote account in the database to determine if it still exists on the origin server, and if it doesn't, then remove it from the database. Accounts that have had confirmed activity within the last week are excluded from the checks, in case the server is just down.
**Version history:**
2.6.0 - added
2.8.0 - add `--dry_run`
* 2.6.0 - added
* 2.8.0 - add `--dry_run`
| Option | Description |
| :--- | :--- |
@ -139,11 +139,11 @@ Remove remote accounts that no longer exist. Queries every single remote account
Refetch remote user data and files for one or multiple accounts.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
| `USERNAME` | Local username |
| `USERNAME` | Username for the remote accout. |
| `--all` | Can be provided instead of USERNAME to refresh all remote accounts. |
| `--domain DOMAIN` | Can be provided instead of USERNAME. Operate only on remote accounts from this DOMAIN. |
| `--concurrency N` | The number of workers to use for this task. Defaults to N=5. |
@ -155,8 +155,8 @@ Refetch remote user data and files for one or multiple accounts.
Force all local accounts to follow a local account specified by username.
**Version history:**
2.7.0 - added
3.0.0 - now uses USERNAME instead of ACCT
* 2.7.0 - added
* 3.0.0 - now uses USERNAME instead of ACCT
| Option | Description |
| :--- | :--- |
@ -169,7 +169,7 @@ Force all local accounts to follow a local account specified by username.
Force all local accounts to unfollow an account specified by their address.
**Version history:**
2.7.0 - added
* 2.7.0 - added
| Option | Description |
| :--- | :--- |
@ -182,7 +182,7 @@ Force all local accounts to unfollow an account specified by their address.
Reset all follow and/or follower relationships for a local account.
**Version history:**
2.8.0 - added
* 2.8.0 - added
| Option | Description |
| :--- | :--- |
@ -195,11 +195,11 @@ Reset all follow and/or follower relationships for a local account.
Approve new registrations when instance is in approval mode.
**Version history:**
2.8.0 - added
* 2.8.0 - added
| Option | Description |
| :--- | :--- |
| `USERNAME` | Approve the pending account with this username |
| `USERNAME` | Approve the pending account with this username. |
| `--number N` | Approve the N most recent registrations. |
| `--all` | Approve all pending registrations. |
@ -212,14 +212,14 @@ Approve new registrations when instance is in approval mode.
Clear out the cache storage.
**Version history:**
2.8.1 - added
* 2.8.1 - added
### `tootctl cache recount` {#cache-recount}
Update hard-cached counters of TYPE by counting referenced records from scratch. It may take a very long time to finish, depending on the size of the database. Accounts will have their follower, following, and status counts refreshed. Statuses will have their reply, boost, and favourite counts refreshed.
**Version history:**
3.0.0 - added
* 3.0.0 - added
| Option | Description |
| :--- | :--- |
@ -236,10 +236,10 @@ Update hard-cached counters of TYPE by counting referenced records from scratch.
Remove all accounts from a given DOMAIN without leaving behind any records. Unlike a suspension, if the DOMAIN still exists in the wild, it means the accounts could return if they are resolved again.
**Version history:**
2.6.0 - added
2.8.0 - add `--whitelist_mode`
2.9.0 - remove custom emoji as well
3.0.0 - accept multiple domains
* 2.6.0 - added
* 2.8.0 - add `--whitelist_mode`
* 2.9.0 - remove custom emoji as well
* 3.0.0 - accept multiple domains
| Option | Description |
| :--- | :--- |
@ -254,8 +254,8 @@ Remove all accounts from a given DOMAIN without leaving behind any records. Unli
Crawl the known fediverse by using Mastodon REST API endpoints that expose all known peers, and collect statistics from those peers, as long as those peers support those API endpoints. When no START is given, the command uses the server's own database of known peers to seed the crawl. Returns total servers, total registered users, total active users in the last week, and total users joined in the last week.
**Version history:**
2.7.0 - added
3.0.0 - add `--exclude_suspended`
* 2.7.0 - added
* 3.0.0 - add `--exclude_suspended`
| Option | Description |
| :--- | :--- |
@ -273,7 +273,7 @@ Crawl the known fediverse by using Mastodon REST API endpoints that expose all k
Imports custom emoji from a .tar.gz archive at a given path. The archive should contain PNG or GIF files no larger than 50KB, and the shortcode will be set equal to the filename minus the extension, with optional prefixes and/or suffixes.
**Version history:**
2.5.0 - added
* 2.5.0 - added
| Option | Description |
| :--- | :--- |
@ -289,16 +289,13 @@ Imports custom emoji from a .tar.gz archive at a given path. The archive should
Remove all custom emoji.
**Version history:**
3.1.0 - add `--remote_only`
* 2.8.0 - added
* 3.1.0 - add `--remote_only`
| Option | Description |
| :--- | :--- |
| `--remote_only` | If provided, remove only from remote domains. |
**Version history:**
2.8.0 - added
## Feeds CLI {#feeds}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/feeds_cli.rb" caption="lib/mastodon/feeds\_cli.rb" >}}
@ -308,7 +305,7 @@ Remove all custom emoji.
Build home and list feeds for one or all users. Feeds will be built from the database and cached in-memory with Redis. Mastodon manages home feeds for active users automatically.
**Version history:**
2.6.0 - added
* 2.6.0 - added
| Option | Description |
| :--- | :--- |
@ -323,7 +320,7 @@ Build home and list feeds for one or all users. Feeds will be built from the dat
Remove all home and list feeds from Redis.
**Version history:**
2.6.0 - added
* 2.6.0 - added
## Media CLI {#media}
@ -334,8 +331,8 @@ Remove all home and list feeds from Redis.
Remove locally cached copies of media attachments from other servers.
**Version history:**
2.5.0 - added
2.6.2 - show freed disk space
* 2.5.0 - added
* 2.6.2 - show freed disk space
| Option | Description |
| :--- | :--- |
@ -349,7 +346,7 @@ Remove locally cached copies of media attachments from other servers.
Scans for files that do not belong to existing media attachments, and remove them. Please mind that some storage providers charge for the necessary API requests to list objects. Also, this operation requires iterating over every single file individually, so it will be slow.
**Version history:**
3.1.0 - added
* 3.1.0 - added
| Option | Description |
| :--- | :--- |
@ -361,8 +358,8 @@ Scans for files that do not belong to existing media attachments, and remove the
Refetch remote media attachments from other servers. You must specify the source of media attachments with either --status, --account, or --domain. If an attachment already exists in the database, it will not be overwritten unless you use --force.
**Version history:**
3.0.0 - added
3.0.1 - add `--force` and skip already downloaded attachments by default
* 3.0.0 - added
* 3.0.1 - add `--force` and skip already downloaded attachments by default
| Option | Description |
| :--- | :--- |
@ -379,14 +376,14 @@ Refetch remote media attachments from other servers. You must specify the source
Calculate disk space consumed by Mastodon.
**Version history:**
3.0.1 - added
* 3.0.1 - added
### `tootctl media lookup` {#media-lookup}
Prompts for a media URL, then looks up where the media is displayed.
**Version history:**
3.1.0 - added
* 3.1.0 - added
## Preview Cards CLI {#preview_cards}
@ -397,7 +394,7 @@ Prompts for a media URL, then looks up where the media is displayed.
Remove local thumbnails for preview cards.
**Version history:**
3.0.0 - added
* 3.0.0 - added
| Option | Description |
| :--- | :--- |
@ -416,8 +413,8 @@ Remove local thumbnails for preview cards.
Create or update an ElasticSearch index and populate it. If ElasticSearch is empty, this command will create the necessary indices and then import data from the database into those indices. This command will also upgrade indices if the underlying schema has been changed since the last run.
**Version history:**
2.8.0 - added
3.0.0 - add `--processes` for parallelization
* 2.8.0 - added
* 3.0.0 - add `--processes` for parallelization
| Option | Description |
| :--- | :--- |
@ -432,14 +429,14 @@ Create or update an ElasticSearch index and populate it. If ElasticSearch is emp
Opens registrations.
**Version history:**
2.6.0 - added
* 2.6.0 - added
### `tootctl settings registrations close` {#settings-registrations-close}
Closes registrations.
**Version history:**
2.6.0 - added
* 2.6.0 - added
## Statuses CLI {#statuses}
@ -452,7 +449,7 @@ Remove unreferenced statuses from the database, such as statuses that came from
This is a computationally heavy procedure that creates extra database indices before commencing, and removes them afterward.
**Version history:**
2.8.0 - added
* 2.8.0 - added
| Option | Description |
| :--- | :--- |

View File

@ -31,7 +31,7 @@ From the account settings, you can change your email address, set a new password
## Identity proofs {#proofs}
[Link verification](profile.md#link-verification) of profile metadata fields is one way to prove your identity by using rel=me links, but Mastodon also supports a more generalized proof provider subsystem. Currently, the only supported identity provider for this subsystem is Keybase.
[Link verification](../profile#verification) of profile metadata fields is one way to prove your identity by using rel=me links, but Mastodon also supports a more generalized proof provider subsystem. Currently, the only supported identity provider for this subsystem is Keybase.
### Keybase identity verification {#keybase}

View File

@ -47,7 +47,7 @@ As long as you encounter a person within your apps user interface, e.g. the w
However if you come across someones public profile hosted on a different server, theres an obstacle: That server sees you as just another anonymous visitor. Not to worry! You can simply copy the URL of that profile, or of one of their posts, and then paste that URL into the search function.
If you are visiting a public page on another Mastodon site, see [Using Mastodon outside of your site](external.md#remote-interactions-on-another-mastodon-site).
If you are visiting a public page on another Mastodon site, see [Using Mastodon outside of your site](../external/#interact).
## Search {#search}
@ -61,7 +61,7 @@ Mastodon's basic search allows logged-in users to find toots containing a specif
{{< figure src="/assets/image%20%2827%29.png" caption="An example of hashtags returned when searching for &quot;cats&quot;." >}}
Admins may optionally install full-text search. Mastodons full-text search allows logged-in users to find results from their own toots, their favourites, and their mentions. It deliberately does not allow searching for arbitrary strings in the entire database, in order to reduce the risk of abuse by people searching for controversial terms to find people to dogpile.
Admins may optionally install full-text search. Mastodons full-text search allows logged-in users to find results from their own toots, their favourites, their bookmarks and their mentions. It deliberately does not allow searching for arbitrary strings in the entire database, in order to reduce the risk of abuse by people searching for controversial terms to find people to dogpile.
The following operators are supported:

View File

@ -77,7 +77,7 @@ If you want to see posts that are boosted multiple times be reinserted into your
### Posting defaults {#posting}
Posts default to public privacy. You can choose to default new posts as unlisted or followers-only instead. For an explanation of post privacy levels, see [Posting to your Mastodon profile &gt; Publishing levels](posting.md#publishing-levels).
Posts default to public privacy. You can choose to default new posts as unlisted or followers-only instead. For an explanation of post privacy levels, see [Posting to your Mastodon profile &gt; Publishing levels](../posting#privacy).
By default, the language of your posts is automatically detected, but this detection is imprecise and may not be accurate. If you primarily or exclusively post in a certain language, it is a good idea to set that language here.

108
content/zh-cn/_index.md Normal file
View File

@ -0,0 +1,108 @@
---
title: 什么是Mastodon
description: 欢迎来到Mastodon文档
menu:
docs:
weight: -99
---
{{< bilibili id="21139681" caption="一个使用动画介绍Mastodon概念的视频" >}}
## 什么是微博客? {#microblogging}
类似于发布博客是将更新发布到网站上,**发布微博客**是将小的更新发布到你的个人信息流。你可以发布文本也可以附加图片、音频、视频等媒体或是发起投票。Mastodon可以让你发现并关注新的朋友们。
## 什么是联邦? {#federation}
**联邦**是去中心化的一种形式。在联邦中,不是所有人共同使用一个中心服务,而是使用多个不限人数的服务器。
| 中心化等级 | 示例 |
| :--- | :--- |
| 中心化 | Twitter, Facebook, Instagram |
| 联邦式 | 电子邮件, XMPP, 电话网络, 邮政服务 |
| 分布式 | BitTorrent, IPFS, Scuttlebutt |
Mastodon站点可以独立运作。和传统网站一样人们可以在上面注册、发布消息、上传图片、互相聊天。但与传统网站*不同*的是Mastodon网站之间可以互动让跨站用户互相交流就好像只要你知道他们的电子邮件地址你就可以从你的Gmail帐户发送电子邮件给使用Outlook、Fastmail、Protonmail或任何其他电子邮件供应商的用户。在Mastodon里**你可以对任何人在任何网站上的地址进行“@”或私信**。
{{< figure src="/assets/image%20%289%29.png" caption="上图从左到右依次为:集中式、联邦式、分布式" >}}
## ActivityPub是什么 {#fediverse}
Mastodon使用一种标准化的、开放的协议来实现站点之间的互动这种协议叫做**ActivityPub**。任何通过ActivityPub实现互联的软件都可以与Mastodon无缝通信就像Mastodon站点之间的通信一样。
**联邦宇宙**fediverse是所有可以通过ActivityPub和互联网互相交流的网站的统称。这包括所有Mastodon服务器但也包括其他的一些实现
* Pleroma一个模块化的微博客引擎
* Pixelfed联邦式的图片分享平台它可以让你分享和阅读媒体嘟文
* Misskey包括一个可自定义界面的微博客
* PeerTube它可以让你上传视频到频道
* Plume它可以用来发布长篇文章
* 还有更多,包括许多个人网站!
**联邦宇宙**没有自己的所谓品牌所以你可能更常听到“来关注我的Mastodon吧”而不是“来关注我的联邦宇宙吧”。虽说从技术上讲后者的说法更准确。
## 实际影响因素 {#implications}
### 选择合适的服务提供者与用户政策 {#choice}
因为Mastodon只是可以用于驱动任何网站的软件Mastodon的潜在用户拥有选择服务提供者的权利用户可以从现有Mastodon站点中选择或者如果用户愿意的话也可以创建自己的Mastodon站点。Mastodon项目在 [joinmastodon.org](https://joinmastodon.org) 上维护了一个推荐服务提供者列表,该列表可按类别和/或语言进行排序。一些站点可能有额外的管理政策,例如要求对潜在敏感内容打上特定标签,另一些站点可能有更加宽松的管理政策,但是所有在列表中列出的站点均需遵守[《Mastodon服务器公约》](https://joinmastodon.org/covenant)这意味着他们承诺积极处理并反对仇恨言论、每日进行备份、至少有一个应急管理员、关站前至少提前3个月发布关站通告。
> 维护一个让所有成员都感到安全的社区并不容易。Mastodon提供了很多基础性的框架和工具来完成这件事并将改变的权力从一个商业实体转移到社区自己手中。
>
> -- Eugen Rochko, Jul 6 2018, [《将Mastodon关到笼子里去》](https://blog.joinmastodon.org/2018/07/cage-the-mastodon/)
> 一个中心化的社交媒体平台有一个等级结构在这个结构中平台的规则及其实施以及平台的发展方向都是由CEO决定的\[……\] 一个去中心化的网络有意放弃了对平台所有权的控制,从本质上来讲是没有平台所有者的。
>
> -- Eugen Rochko, Dec 30 2018, [《为什么去中心化很重要?》](https://blog.joinmastodon.org/2018/12/why-does-decentralization-matter/)
### 资金和盈利 {#monetization}
Mastodon站点是由不同的人或组织完全独立运营的。Mastodon没有在软件中实现任何盈利策略。
有的服务器运营者选择提供付费帐户有的服务器运营者是公司这样便可以利用他们现有的基础设施有的服务器运营者通过Patreon及其类似服务来众筹资金有的服务器运营者只是自掏腰包为自己和朋友搭建私人服务器。所以如果你想支持你帐户所在服务器的运营者请检查一下它是否提供了捐赠渠道。
Mastodon的开发同样是通过[Patreon](https://patreon.com/mastodon)和[OpenCollective](https://opencollective.com/mastodon)众筹的。**不涉及风险投资。**
> 在我看来,“即时、公开、全球性的信息传递与交流” 实际上应该是*全球性的*。分布于能够自我管理的独立组织与行为者之中。一个公共设施,没有利用交流牟利的动机。
>
> -- Eugen Rochko, Mar 3 2018, [《推特不是公共设施》](https://blog.joinmastodon.org/2018/03/twitter-is-not-a-public-utility/)
### 跨平台互联 {#interoperability}
实际上你能否想象一下从你的推特帐户关注一个Instagram用户并在不离开你的帐户的情况下评论他们的照片。如果推特和Instagram是使用同样协议的联邦服务那么这将是可能的。通过一个Mastodon帐户**你可以与其他相兼容的网站通迅,** _**即使它并没有运行Mastodon**_。这些网站只需要它们的软件支持ActivityPub协议的相同子集该协议子集允许创建消息和通过消息进行交互。想了解更多与Mastodon交互所需的技术规范请参阅[ActivityPub](spec/activitypub)、[WebFinger](spec/webfinger)和[Security](spec/security)。想了解更多关于ActivityPub的用处请参阅[《为什么ActivityPub是未来》](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/)。
> 所有这些平台都是不同的,它们关注不同的需求。然而,它们的基石都是相同的:一些人订阅接收其他人的帖子。因此,它们都是相互兼容的。
>
> -- Eugen Rochko, Jun 27 2018, [《为什么ActivityPub是未来》](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/)
### 自由软件 {#libre}
与专有服务不同,**任何人都拥有运行检查审核复制修改分发和重用Mastodon源代码的完全自由只要他们保证任何衍生作品都具有同等的自由。** 就像Mastodon用户可以选择他们的服务提供者一样你作为一个个体可以自由地向Mastodon贡献功能或者发布包含不同功能的修改版本。这些修改后的版本也被称为软件分支被要求维持与Mastodon原始项目同等的自由。例如[glitch-soc](https://glitch-soc.github.io/docs/)是一个添加了许多实验特性的软件发行版。除此而外还有许多的独立分支存在这些分支可能仅仅是主题稍微不同或者包含对代码库的小修改。因为Mastodon是尊重你的自由的自由软件像这样的个性化不仅是允许的而且是鼓励的。
> 最终的力量在于让人们能够创建自己的空间、自己的社区,以自己的想法修改软件,但又不牺牲与来自不同社区的人们相互交流的能力。
>
> -- Eugen Rochko, Feb 20 2017, [《建立社区的力量:对马克·扎克伯格的回应》](https://blog.joinmastodon.org/2017/02/the-power-to-build-communities/)
> 去中心化是数字世界的生物多样性,是健康生态系统的标志。像联邦宇宙这样的去中心化网络允许不同的用户界面、不同的软件、不同形式的治理方式共存与合作。
>
> -- Eugen Rochko, Dec 30 2018, [《为什么去中心化很重要?》](https://blog.joinmastodon.org/2018/12/why-does-decentralization-matter/)
## 开始你的旅程吧! {#next-steps}
学习如何使用Mastodon
{{< page-ref page="user/signup.md" >}}
学习如何安装Mastodon
{{< page-ref page="admin/prerequisites.md" >}}
学习如何为Mastodon编写应用程序
{{< page-ref page="client/intro.md" >}}
了解Mastodon后端以及如何向Mastodon项目做贡献
{{< page-ref page="dev/overview.md" >}}
{{< translation-status-zh-cn raw_title="What is Mastodon?" raw_link="/" last_tranlation_time="2020-05-02" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,55 @@
---
title: 备份你的服务器
description: 设置日常备份(可选,但并非如此)
menu:
docs:
weight: 80
parent: admin
---
对于任何真实世界用途来说你都应该保证日常备份Mastodon服务器。
## 概览 {#overview}
你所需要备份的东西,按重要程度排序:
1. PostgreSQL 数据库
2. `.env.production` 文件或等效文件中的应用密钥
3. 用户上传的文件
4. Redis 数据库
## 故障模式 {#failure}
人们通常要应对两种类型故障:硬件故障,诸如磁盘上数据损坏;以及人为软件故障,诸如误删特定文件。本文档中,仅考虑前一种类型。
丢失PostgreSQL数据库那一切都完了。Mastodon将所有重要数据存储于PostgreSQL数据库中。如果数据库消失那你服务器上所有的帐户、所有的嘟文、所有关注者都将随之消失。
如果你丢失了应用密钥对你的用户而言Mastodon的某些功能将停止工作。你服务器上的用户将被登出双因子认证2FA将不可用Web Push API订阅将停止工作。
如果你丢失了用户上传的文件你将丢失头像、横幅、媒体附件但Mastodon*仍会*继续工作。
丢失Redis数据库几乎是无害的唯一不可逆的数据是Sidekiq队列及之前失败任务的重试计划。主页与列表时间流虽然存储于Redis但它们可以使用tootctl再生成。
最好的备份是所谓的异地备份即与Mastodon自身不在同一台计算机上存储的备份。如果你托管的服务器起火了硬盘爆炸了存储于同一硬件备份将不可用。
## 备份应用密钥 {#env}
应用密钥是最容易备份的,因为它们是不变的。你只需要将 `.env.production` 存储在安全的地方就可以了。
## 备份 PostgreSQL {#postgresql}
突然断电、硬盘故障、错误迁移数库库schema都会致使数据损坏。由于以上原因推荐偶尔使用 `pg_dump``pg_dumpall` 备份数据库。
如果要求高可用性可以使用热流拷贝hot streaming replication使第二台PostgreSQL服务器始终具有最新数据并做好另一台服务器出现故障切换至此的准备。
## 备份用户上传的文件 {#media}
如果你使用外部对象存储诸如Amazon S3、Google Cloud 或 Wasabi你无需为怎么备份它们而担心。各自的公司将负责处理硬件故障。
如果你使用本地文件存储,复制体积巨大的 `public/system` 目录(默认存储上传文件的地方)。
## 备份 Redis {#redis}
备份Redis是很容易的。Redis会定期将数据写入`/var/lib/redis/dump.rdb`文件,你只需要复制这个文件就可以了。
{{< translation-status-zh-cn raw_title="Backing up your server" raw_link="/admin/backups/" last_tranlation_time="2020-05-06" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,244 @@
---
title: 设置你的环境
description: 为你安装的Mastodon设置环境变量。
menu:
docs:
weight: 30
parent: admin
---
{{< hint style="warning" >}}
本页面仍在建设中。
{{< /hint >}}
Mastodon使用环境变量作为其的配置。
为了方便起见Mastodon从Mastodon目录中的 `.env.production` 文件读取环境变量,但是始终可以用特定方式覆盖它们。例如:在 systemd service 文件中可以使用 `EnvironmentFile` 从特定文件中读取环境变量或使用 `Environment` 定义环境变量因此你可以为不同服务指定不同的环境变量。也可以在从命令行调用运行Mastodon时指定环境变量。
## 基本参数 {#basic}
### 站点互联 {#federation}
* `LOCAL_DOMAIN`
* `WEB_DOMAIN`
* `ALTERNATE_DOMAINS`
#### `AUTHORIZED_FETCH` {#authorized_fetch}
当设置为 `true`Mastodon将停止内联签名活动并要求远程服务器在拉取公开public和不公开unlisted的嘟文时进行身份验证。
这可以阻止被屏蔽的域名拉取你的公开嘟文但代价是可能增加计算量并与不支持附带签名的拉取请求的软件不兼容如低于3.0版本的Mastodon
请注意这个模式并不能保证你的公开嘟文public、unlisted不被恶意操作者获取这仅仅是增加了一点难度。
#### `WHITELIST_MODE` {#whitelist_mode}
当设置为 `true`Mastodon将仅与白名单内的服务器互联同时关闭公开页面和一些客户端API。
白名单模式会启用 authorized fetch 模式。
当一个现存实例站点切换至白名单模式,以下命令可以被用来移除非白名单站点的数据:
```
tootctl domain purge --whitelist-mode
```
请注意虽然Mastodon 3.0 版本便引入了白名单模式 `WHITELIST_MODE`但在Mastodon 3.0和3.0.1版中并没有正确实现。
### 密钥 {#secrets}
* `SECRET_KEY_BASE`
* `OTP_SECRET`
* `VAPID_PRIVATE_KEY`
* `VAPID_PUBLIC_KEY`
### 部署 {#deployment}
* `RAILS_ENV`
* `RAILS_SERVE_STATIC_FILES`
* `RAILS_LOG_LEVEL`
* `TRUSTED_PROXY_IP`
* `SOCKET`
* `PORT`
* `NODE_ENV`
* `BIND`
### 缩放选项 {#scaling}
* `WEB_CONCURRENCY`
* `MAX_THREADS`
* `PREPARED_STATEMENTS`
* `STREAMING_API_BASE_URL`
* `STREAMING_CLUSTER_NUM`
## 数据库连接 {#connections}
### PostgreSQL {#postgresql}
* `DB_HOST`
* `DB_USER`
* `DB_NAME`
* `DB_PASS`
* `DB_PORT`
* `DATABASE_URL`
### Redis {#redis}
* `REDIS_HOST`
* `REDIS_PORT`
* `REDIS_URL`
* `REDIS_NAMESPACE`
* `CACHE_REDIS_HOST`
* `CACHE_REDIS_PORT`
* `CACHE_REDIS_URL`
* `CACHE_REDIS_NAMESPACE`
### ElasticSearch {#elasticsearch}
* `ES_ENABLED`
* `ES_HOST`
* `ES_PORT`
* `ES_PREFIX`
### StatsD {#statsd}
* `STATSD_ADDR`
* `STATSD_NAMESPACE`
## 限制 {#limits}
* `SINGLE_USER_MODE`
* `EMAIL_DOMAIN_WHITELIST`
* `DEFAULT_LOCALE`
* `MAX_SESSION_ACTIVATIONS`
* `USER_ACTIVE_DAYS`
## 电子邮件 {#email}
* `SMTP_SERVER`
* `SMTP_PORT`
* `SMTP_LOGIN`
* `SMTP_PASSWORD`
* `SMTP_FROM_ADDRESS`
* `SMTP_DOMAIN`
* `SMTP_DELIVERY_METHOD`
* `SMTP_AUTH_METHOD`
* `SMTP_CA_FILE`
* `SMTP_OPENSSL_VERIFY_MODE`
* `SMTP_ENABLE_STARTTLS_AUTO`
* `SMTP_TLS`
## 文件存储 {#cdn}
* `CDN_HOST`
* `S3_ALIAS_HOST`
### 本地文件存储 {#paperclip}
* `PAPERCLIP_ROOT_PATH`
* `PAPERCLIP_ROOT_URL`
### Amazon S3 及其兼容存储 {#s3}
* `S3_ENABLED`
* `S3_BUCKET`
* `AWS_ACCESS_KEY_ID`
* `AWS_SECRET_ACCESS_KEY`
* `S3_REGION`
* `S3_PROTOCOL`
* `S3_HOSTNAME`
* `S3_ENDPOINT`
* `S3_SIGNATURE_VERSION`
### Swift {#swift}
* `SWIFT_ENABLED`
* `SWIFT_USERNAME`
* `SWIFT_TENANT`
* `SWIFT_PASSWORD`
* `SWIFT_PROJECT_ID`
* `SWIFT_AUTH_URL`
* `SWIFT_CONTAINER`
* `SWIFT_OBJECT_URL`
* `SWIFT_REGION`
* `SWIFT_DOMAIN_NAME`
* `SWIFT_CACHE_TTL`
## 外部认证 {#external-authentication}
* `OAUTH_REDIRECT_AT_SIGN_IN`
### LDAP {#ldap}
* `LDAP_ENABLED`
* `LDAP_HOST`
* `LDAP_PORT`
* `LDAP_METHOD`
* `LDAP_BASE`
* `LDAP_BIND_DN`
* `LDAP_PASSWORD`
* `LDAP_UID`
* `LDAP_SEARCH_FILTER`
### PAM {#pam}
* `PAM_ENABLED`
* `PAM_EMAIL_DOMAIN`
* `PAM_DEFAULT_SERVICE`
* `PAM_CONTROLLED_SERVICE`
### CAS {#cas}
* `CAS_ENABLED`
* `CAS_URL`
* `CAS_HOST`
* `CAS_PORT`
* `CAS_SSL`
* `CAS_VALIDATE_URL`
* `CAS_CALLBACK_URL`
* `CAS_LOGOUT_URL`
* `CAS_LOGIN_URL`
* `CAS_UID_FIELD`
* `CAS_CA_PATH`
* `CAS_DISABLE_SSL_VERIFICATION`
* `CAS_UID_KEY`
* `CAS_NAME_KEY`
* `CAS_EMAIL_KEY`
* `CAS_NICKNAME_KEY`
* `CAS_FIRST_NAME_KEY`
* `CAS_LAST_NAME_KEY`
* `CAS_LOCATION_KEY`
* `CAS_IMAGE_KEY`
* `CAS_PHONE_KEY`
### SAML {#saml}
* `SAML_ENABLED`
* `SAML_ACS_URL`
* `SAML_ISSUER`
* `SAML_IDP_SSO_TARGET_URL`
* `SAML_IDP_CERT`
* `SAML_IDP_CERT_FINGERPRINT`
* `SAML_NAME_IDENTIFIER_FORMAT`
* `SAML_CERT`
* `SAML_PRIVATE_KEY`
* `SAML_SECURITY_WANT_ASSERTION_SIGNED`
* `SAML_SECURITY_WANT_ASSERTION_ENCRYPTED`
* `SAML_SECURITY_ASSUME_EMAIL_IS_VERIFIED`
* `SAML_ATTRIBUTES_STATEMENTS_UID`
* `SAML_ATTRIBUTES_STATEMENTS_EMAIL`
* `SAML_ATTRIBUTES_STATEMENTS_FULL_NAME`
* `SAML_ATTRIBUTES_STATEMENTS_FIRST_NAME`
* `SAML_ATTRIBUTES_STATEMENTS_LAST_NAME`
* `SAML_UID_ATTRIBUTE`
* `SAML_ATTRIBUTES_STATEMENTS_VERIFIED`
* `SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL`
## 隐藏服务 {#hidden-services}
* `http_proxy`
* `ALLOW_ACCESS_TO_HIDDEN_SERVICE`
## 其它 {#other}
* `SKIP_POST_DEPLOYMENT_MIGRATIONS`
{{< translation-status-zh-cn raw_title="Configuring your environment" raw_link="/admin/config/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,226 @@
---
title: 从源中安装
description: 创建你自己的Mastodon站点的教学指献。
menu:
docs:
weight: 20
parent: admin
---
## 前提条件 {#pre-requisites}
* 一台你有root访问权限的运行 **Ubuntu 18.04** 的机器
* 一个用于Mastodon站点的**域名**(或一个子域名),例如:`example.com`
* 一个电子邮件发送服务提供商,或其他**SMTP服务器**
你需要使用root用户运行命令。如果你现在不是root用户请切换至root用户
### 软件仓库 {#system-repositories}
首先确保已经安装curl
#### Node.js {#node-js}
```bash
curl -sL https://deb.nodesource.com/setup_12.x | bash -
```
#### Yarn {#yarn}
```bash
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
```
### 软件包 {#system-packages}
```bash
apt update
apt install -y \
imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \
g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf \
bison build-essential libssl-dev libyaml-dev libreadline6-dev \
zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev \
nginx redis-server redis-tools postgresql postgresql-contrib \
certbot python-certbot-nginx yarn libidn11-dev libicu-dev libjemalloc-dev
```
### 安装 Ruby {#installing-ruby}
因为使用 rbenv 可以更容易的获得正确的版本并在新版本发布后进行更新,我们将使用 rbenv 来管理Ruby版本。rbenv 必须安装在单个Linux用户中因此我们首先需要使用以下命令创建一个Mastodon用户
```bash
adduser --disabled-login mastodon
```
切换到mastodon用户
```bash
su - mastodon
```
执行以下步骤安装 rbenv 和 rbenv-build
```bash
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec bash
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
```
上述操作完成,我们便可以安装正确的 Ruby 版本:
```bash
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.6
rbenv global 2.6.6
```
我们同样需要安装 bundler
```bash
gem install bundler --no-document
```
返回root用户
```bash
exit
```
## 配置 {#setup}
### 配置 PostgreSQL {#setting-up-postgresql}
#### 性能调优(可选) {#performance-configuration-optional}
为了优化性能,你可以使用 [pgTune](https://pgtune.leopard.in.ua/#/) 生成一个合适的配置文件。编辑 `/etc/postgresql/9.6/main/postgresql.conf` 中的相应数值并使用 `systemctl restart postgresql` 命令重启 PostgreSQL。
#### 创建帐户 {#creating-a-user}
你需创建一个供Mastodon使用的PostgreSQL帐户。创建一个使用“ident”认证方式的帐户是最容易的配置方法即PostgreSQL帐户不需要独立的密码并由同名Linux用户使用。
打开控制台:
```bash
sudo -u postgres psql
```
在控制台中执行:
```sql
CREATE USER mastodon CREATEDB;
\q
```
完成!
### 配置 Mastodon {#setting-up-mastodon}
现在该下载Mastodon代码了。切换至mastodon用户
```bash
su - mastodon
```
#### 检出代码 {#checking-out-the-code}
使用git下载最新稳定版Mastodon
```bash
git clone https://github.com/tootsuite/mastodon.git live && cd live
git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
```
#### 安装依赖 {#installing-the-last-dependencies}
现在安装Ruby和JavaScript依赖
```bash
bundle config deployment 'true'
bundle config without 'development test'
bundle install -j$(getconf _NPROCESSORS_ONLN)
yarn install --pure-lockfile
```
{{< hint style="info" >}}
两个`bundle config`命令仅仅第一次安装依赖时需要。如果你之后进行升级或重安装依赖,只需要`bundle install`就够了。
{{< /hint >}}
#### 生成配置文件 {#generating-a-configuration}
运行交互式安装向导:
```bash
RAILS_ENV=production bundle exec rake mastodon:setup
```
它将:
* 创建一个配置文件
* 预编译静态文件
* 创建数据库schema
配置文件被保存在`.env.production`。如果你愿意的话,你可以查看并编辑这个文件。请参阅[配置文件的文档]({{< relref "config.md" >}})。
你已经完成需使用mastodon用户进行的操作请切换回root用户
```bash
exit
```
### 配置 nginx {#setting-up-nginx}
从Mastodon目录复制配置文件模版到nginx
```bash
cp /home/mastodon/live/dist/nginx.conf /etc/nginx/sites-available/mastodon
ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon
```
编辑 `/etc/nginx/sites-available/mastodon`,替换 `example.com` 为你自己的域名,你可以根据自己的需求做出其它的一些调整。
重载 nginx 以使变更生效:
### 获取SSL证书 {#acquiring-a-ssl-certificate}
我们将使用 Lets Encrypt 获取一个免费的SSL证书
```bash
certbot --nginx -d example.com
```
这个命令将获取一个证书,自动更新 `/etc/nginx/sites-available/mastodon` 以使用新证书并重载nginx以使变更生效。
现在你应该能够通过浏览器访问你的域名然后看到一只大象锤击电脑屏幕的错误页面。这是因为我们还没有启动Mastodon进程。
### 配置 systemd 服务 {#setting-up-systemd-services}
从Mastodon目录复制systemd服务模版
```bash
cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/
```
然后修改以下文件,以保证用户名与路径是正确的:
* `/etc/systemd/system/mastodon-web.service`
* `/etc/systemd/system/mastodon-sidekiq.service`
* `/etc/systemd/system/mastodon-streaming.service`
最后启动新systemd服务并将该服务设为开机自动激活
```bash
systemctl daemon-reload
systemctl start mastodon-web mastodon-sidekiq mastodon-streaming
systemctl enable mastodon-*
```
他们将在开机启动时自动开始运行。
{{< hint style="success" >}}
**欢呼吧!你现在可以从浏览器中访问你的域名了!**
{{< /hint >}}
{{< translation-status-zh-cn raw_title="Installing from source" raw_link="/admin/install/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,95 @@
---
title: 迁移到新机器
description: 在不损失任何东西的情况下把你的Mastodon复制安装至新的服务器上。
menu:
docs:
weight: 90
parent: admin
---
有时出于各种原因你需要将你的Mastodon实例从一台服务器迁移至另一台。幸运的是这个过程并不太困解虽然这可能导致一段时间的下线。
{{< hint style="info" >}}
本篇指南基于Ubuntu Server编写根据其他设置的不同你的过程可能会有变化。
{{< /hint >}}
## 基本步骤 {#basic-steps}
1. 依照[产品指南]({{< relref "install.md" >}})安装新的Mastodon服务器切记不要运行 `mastodon:setup`)。
2. 停止旧服务器上的Mastodon`systemctl stop 'mastodon-*.service'`)。
3. 依照如下指示导出并导入Postgres数据库。
4. 依照如下指示,复制 `system/` 目录下文件。注意如果你使用S3存储你可以跳过此步
5. 复制 `.env.production` 文件。
6. 运行 `RAILS_ENV=production bundle exec rails assets:precompile` 编译 Mastodon。
7. 运行 `RAILS_ENV=production ./bin/tootctl feeds build` 重新构建每个用户的主页时间流。
8. 启动新服务器上的Mastodon。
9. 更新DNS设置将其指向新服务器。
10. 更新或复制你的Nginx设置如果必要的话可重获取LetsEncrypt证书。
11. 享受你的新服务器!
## 详细步骤 {#detailed-steps}
### 什么数据需要被迁移 {#what-data-needs-to-be-migrated}
你必须需要复制如下内容:
* `~/live/public/system`目录里面包含了用户上传的图片与视频如果使用S3可跳过此步
* Postgres数据库使用[pg\_dump](https://www.postgresql.org/docs/9.1/static/backup-dump.html)
* `~/live/.env.production`文件,里面包含了服务器配置与密钥
不太重要的部分,为了方便起见,你也可以复制如下内容:
* nginx配置文件位于`/etc/nginx/sites-available/default`
* systemd配置文件`/etc/systemd/system/mastodon-*.service`),里面可能包括一些你服务器的调优与个性化
* pgbouncer配置文件位于 `/etc/pgbouncer` 如果你使用pgbouncer的话
### 导出并导入Postgres数据库 {#dump-and-load-postgres}
不要运行`mastodon:setup`,而是创建一个名为`template0`的空白Postgres数据库当导入Postgres导出文件时这是很有用的参见[pg\_dump文档](https://www.postgresql.org/docs/9.1/static/backup-dump.html#BACKUP-DUMP-RESTORE))。
在你的旧系统,使用`mastodon`用户运行如下命令:
```bash
pg_dump -Fc mastodon_production -f backup.dump
```
使用 `rsync``scp` 复制 `backup.dump` 文件。然后在新系统,使用`mastodon`帐户创建一个空数据库:
```bash
createdb -T template0 mastodon_production
```
然后导入它:
```bash
pg_restore -U mastodon -n public --no-owner --role=mastodon \
-d mastodon_production backup.dump
```
(注意:如果新服务器上的帐户名不是`mastodon`,你应当修改上面命令中 `-U` **和** `--role` 参数。两台服务器的用户名不同也可以。)
### 复制文件 {#copy-files}
本操作可能花费一些时间,若你希望避免不必要重复制,建议使用`rsync`。在你的旧机器上,使用`mastodon`用户,运行:
```bash
rsync -avz ~/live/public/system/ mastodon@example.com:~/live/public/system/
```
如果旧服务器上任何文件有改动,你需要重运行此命令。
你同样需要复制`.env.production`文件,该文件内含密钥。
可选的你可以复制nginx、systemd、pgbouncer配置文件或者从头开始重写它们。
### 迁移期间 {#during-migration}
你可以编辑旧机器上的`~/live/public/500.html`页面,如果你希望展示一个优雅的错误信息,让现有用户知晓正在进行迁移。
你也应该提前一天将DNS TTL设置为较小数值30-60分钟。这样当你把DNS指向新IP后新纪录可以很快扩散开来。
### 迁移后 {#after-migrating}
你可以使用[whatsmydns.net](https://whatsmydns.net/)来查看DNS扩散的过程。为了跳过这个过程你可以修改你自己的`/etc/hosts`文件,将其指向你的新服务器,这样你可以尽早开始使用新服务器。
{{< translation-status-zh-cn raw_title="Migrating to a new machine" raw_link="/admin/migrating/" last_tranlation_time="2020-05-06" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,76 @@
---
title: 运营操作
description: 处理不想要的用户与域名
menu:
docs:
weight: 110
parent: admin
---
## 帐户管理 {#individual-moderation}
Mastodon运营操作始终作用于本地即从特定服务器查看的内容。一台服务器管理员admin或运营员moderator不能影响另一台服务器上的用户他们只能影响另一台服务器用户的本地服务器副本。
### 禁止登录disable login {#disable-login}
Mastodon可以被禁止登录。这样可以禁止用户对帐户进行任何操作但是其帐户的内容仍保持不变。这个限制是可撤销的任何时候都可以重新激活该用户。本限制仅适用于你服务器的本地用户。
### 隐藏silence {#silence-user}
在Mastodon隐藏silence是沙箱sandbox的同义词。一个被隐藏的帐户不会出现在未关注该帐户的用户面前。该帐户所有内容仍存在这些内容可以通过搜索查找到该帐户可以被提及、被关注但是这些内容是不可见的。
此外,隐藏操作不会影响联邦宇宙。一个本地隐藏了的帐户*不会*自动在其他服务器隐藏。
本限制是可撤销的,任何时间都可以去除该帐户的隐藏。
### 封禁suspension {#suspend-user}
在Mastodon封禁suspension是删除deletion的同义词。该帐户不会出现在搜索之中其用户资料页将消失该帐户的所有嘟文上传关注者以及所有其它数据都将被移除。本限制是**不可逆的**。当一个帐户被解除屏蔽,用户可以重新控制帐户,但旧数据已经一去不复返了。
## 实例管理 {#server-wide-moderation}
由于使用帐户管理单独处理来自行为异常服务器的大量用户是让人精疲力竭的事,所以可以预清空来自特定服务器的所有用户,即所谓的**域名屏蔽domain block**。该操作有多个不同严厉程度。
### 拒绝接收媒体文件reject media {#reject-media}
当这个选项被激活来自该服务器的文件将不会传递至本地。其包括头像、横幅、emoji及媒体附件。
### 隐藏silence {#silence-server}
对来自该服务器的所有帐户应用隐藏silence操作。
### 屏蔽suspend {#suspend-server}
对来自该服务器的所有帐户应用封禁suspension操作。本地将不储存除用户名外的任何数据。
## 反广告措施 {#spam-fighting-measures}
Mastodon有以下基本措施以阻止广告内容
* 注册时需确认电子邮件地址
* 基于IP的注册频率限制
然而专业广告发送者spammer将绕过这些措施。你可以应用的措施是**电子邮件域名屏蔽**。在注册期间Mastodon将解析所给电子邮箱地址的A纪录或MX纪录即电子邮件服务器的IP地址并对照动态存储的黑名单中检查该IP地址。
### 屏蔽电子邮件域名 {#blocking-by-e-mail-server}
广告发送者spammer时常使用不同的电子邮件域名以让他们看起来是使用许多不同的电子邮件服务器注册而这些电子邮件域名很难被分别列入黑名单。但是有时这些域名被解析到了同IP地址电子邮件服务器。如果你发现同一时间有大数广告发送者spammer注册你可以使用在线DNS查询工具或 Linux `dig` 组件来检查,例如:`dig example.com` 将查询该域名的所有DNS A纪录。如果你注意到所有域名指向同一IP你可以把它添加至电子邮件域名屏蔽列表中。
### 封禁IP {#blocking-by-ip}
Mastodon自身不支持基于IP地址的访问者屏蔽这不是一个万无一失的策略。IP有时会被不同的人共享并时常会易手。但可以使用 Linux 防火墙来基于IP地址屏蔽访问者。下面的例子需要使用 `iptables``ipset`
```bash
# Install ipset
sudo apt install ipset
# Create blacklist named "spambots"
sudo ipset create spambots nethash
# Add 1.2.3.4 to the blacklist
sudo ipset add spambots 1.2.3.4
# Add firewall rule based on the blacklist
sudo iptables -I INPUT 1 -m set --match-set spambots src -j DROP
```
但是注意,不要把你自己封禁了。
{{< translation-status-zh-cn raw_title="Moderation actions" raw_link="/admin/moderation/" last_tranlation_time="2020-05-08" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,10 @@
---
title: 安装可选特色功能
menu:
docs:
weight: 40
parent: admin
identifier: admin-optional
---
{{< translation-status-zh-cn raw_title="Installing optional features" raw_link="/admin/optional/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,161 @@
---
title: 全文搜索
description: 设置ElasticSearch来搜索自己发出的嘟文、自己喜欢的嘟文、自己的书签和自己被提及的嘟文。
menu:
docs:
weight: 10
parent: admin-optional
---
当有可用ElasticSearch时Mastodon支持全文搜索。Mastodon的全文搜索允许登录用户从他们自己的嘟文、他们喜欢的嘟文、他们的书签和他们被提及的嘟文中查找相应结果。Mastodon有意禁用了在全数据库搜索任意关键词的功能。
## 安装 ElasticSearch {#install}
ElasticSearch 需要 Java runtime。如果你还没有安装 Java请立刻安装上它。以下操均假定你已经登录为`root`用户:
```bash
apt install openjdk-8-jre-headless
```
添加ElasticSearch官方软件仓库至apt
```bash
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt update
```
现在,你可以安装 ElasticSearch
```bash
apt install elasticsearch
```
{{< hint style="warning" >}}
**安全警告:** 默认情况下ElasticSearch仅绑定于localhost即无法从外部网络访问。你可以通过查看 `/etc/elasticsearch/elasticsearch.yml` 中的 `network.host` 来检查 ElasticSearch 绑定了哪些地址。考虑到由于缺乏认证层,任何能访问 ElasticSearch 的人都可以读取或修改里面的数据。因此,确保访问安全非常重要。如[主要安装说明](../../prerequisites/#install-a-firewall-and-only-whitelist-ssh-http-and-https-ports)中所述防火墙建议仅暴露了22、80、443端口。如果你是一个多主机配置你必须知道如何保证内部流量安全。
{{< /hint >}}
启动 ElasticSearch
```bash
systemctl enable elasticsearch
systemctl start elasticsearch
```
## 配置 Mastodon {#config}
编辑 `.env.production`,添加如下变量:
```bash
ES_ENABLED=true
ES_HOST=localhost
ES_PORT=9200
```
如果你同一台机器上运行多个Mastodon服务器你计划让它们使用同一个ElasticSearch请确保他们都配置了互不重复的 `REDIS_NAMESPACE` 以分别他们的索引。如果你需要覆盖ElasticSearch索引前缀你可以直接设置 `ES_PREFIX`
保存新设置之后使用如下命令创建ElasticSearch索引
```bash
RAILS_ENV=production bundle exec rake chewy:upgrade
```
重启Mastodon进程以使新配置生效
```bash
systemctl restart mastodon-sidekiq
systemctl reload mastodon-web
```
现在新的嘟文将会被写入ElasticSearch索引。最后一步是导入所有旧有数据。这将花费很长一段时间
```bash
RAILS_ENV=production bundle exec rake chewy:sync
```
{{< hint style="warning" >}}
**兼容性提示:** Ruby 2.6.0 由于已知Bug无法进行上述操作。其它Ruby版本例如2.6.1,并不存在这个问题。
{{< /hint >}}
## 其它语言的搜索优化
### 中文搜索优化 {#chinese-search-optimize}
ElasticSearch默认使用标准分析器这对于中文来说可能并不太适合。为了提高搜索体验你可以安装特定语言的专用分析器。在创建ElasticSearch索引之前执行
安装 [elasticsearch-analysis-ik](https://github.com/medcl/elasticsearch-analysis-ik)、[elasticsearch-analysis-stconvert](https://github.com/medcl/elasticsearch-analysis-stconvert) 插件至 ElasticSearch。
并对源码做出如下修改:
```diff
diff --git a/app/chewy/accounts_index.rb b/app/chewy/accounts_index.rb
--- a/app/chewy/accounts_index.rb
+++ b/app/chewy/accounts_index.rb
@@ -4,7 +4,7 @@ class AccountsIndex < Chewy::Index
settings index: { refresh_interval: '5m' }, analysis: {
analyzer: {
content: {
- tokenizer: 'whitespace',
+ tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
},
diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb
--- a/app/chewy/statuses_index.rb
+++ b/app/chewy/statuses_index.rb
@@ -16,9 +16,17 @@ class StatusesIndex < Chewy::Index
language: 'possessive_english',
},
},
+ char_filter: {
+ tsconvert: {
+ type: 'stconvert',
+ keep_both: false,
+ delimiter: '#',
+ convert_type: 't2s',
+ },
+ },
analyzer: {
content: {
- tokenizer: 'uax_url_email',
+ tokenizer: 'ik_max_word',
filter: %w(
english_possessive_stemmer
lowercase
@@ -27,6 +35,7 @@ class StatusesIndex < Chewy::Index
english_stop
english_stemmer
),
+ char_filter: %w(tsconvert),
},
},
}
diff --git a/app/chewy/tags_index.rb b/app/chewy/tags_index.rb
--- a/app/chewy/tags_index.rb
+++ b/app/chewy/tags_index.rb
@@ -2,10 +2,19 @@
class TagsIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
+ char_filter: {
+ tsconvert: {
+ type: 'stconvert',
+ keep_both: false,
+ delimiter: '#',
+ convert_type: 't2s',
+ },
+ },
analyzer: {
content: {
- tokenizer: 'keyword',
+ tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
+ char_filter: %w(tsconvert),
},
edge_ngram: {
```
{{< translation-status-zh-cn raw_title="Full-text search" raw_link="/admin/optional/elasticsearch/" last_tranlation_time="2020-05-05" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,13 @@
---
title: 单点登录SSO
menu:
docs:
weight: 30
parent: admin-optional
---
{{< hint style="danger" >}}
本页面仍在建设中。
{{< /hint >}}
{{< translation-status-zh-cn raw_title="Single Sign On" raw_link="/admin/optional/sso/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,153 @@
---
title: 匿名服务
description: 通过TOR的匿名服务来访问Mastodon。
menu:
docs:
weight: 20
parent: admin-optional
---
可以通过TOR的匿名服务来访问Mastodon。这将给你一个只能通过 TOR 网络连接的 \*.onion 地址。
## 安装 Tor {#install}
首先Tor的Debian软件仓库需要被添加至apt中。
```text
deb https://deb.torproject.org/torproject.org stretch main
deb-src https://deb.torproject.org/torproject.org stretch main
```
接下来添加相应gpg密钥。
```bash
curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
```
最后,安装所需软件包。
```bash
apt install tor deb.torproject.org-keyring
```
## 配置 Tor {#configure}
编辑 `/etc/tor/torrc` 并添加如下设置。
```text
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:80
```
重启 tor。
```bash
sudo service tor restart
```
现在你的tor域名可以在 `/var/lib/tor/hidden_service/hostname` 找到。
## 移动你的Mastodon配置 {#nginx}
我们将需要将你的Mastodon配置告诉Nginx两次。为了不自我重复[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)我们需要将Mastodon配置移动到一个可被引用的独立文件。
`/etc/nginx/snippets/mastodon.conf` 创建一个新文件。放入除`listen`、`server_name`、`include`及所有SSL相关选项之外的所有配置参数至新文件中。你的新文件看起来可能像这样。
```text
add_header Referrer-Policy "same-origin";
keepalive_timeout 70;
sendfile on;
client_max_body_size 80m;
root /home/mastodon/live/public;
error_page 500 501 502 503 504 /500.html;
access_log /var/log/nginx/mastodon_access.log;
error_log /var/log/nginx/mastodon_error.log warn;
```
替换你的旧Mastodon配置文件在新配置文件中添加一个include指令。
你的Nginx配置文件将看起来像这样。
```text
server {
listen 80;
server_name mastodon.myhosting.com;
return 301 https://$server_name$request_uri;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
list [::]:443 ssl http2;
server_name mastodon.myhosting.com;
include /etc/nginx/snippets/mastodon.conf;
ssl_certificate /etc/letsencrypt/live/mastodon.myhosting.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mastodon.myhosting.com/privkey.pem;
}
```
## 通过http提供Tor服务 {#http}
尽管通过https提供你的Tor版Mastodon可能很诱人但对大多数人来说这不是一个好主意。请参阅Tor Project上的[这篇](https://blog.torproject.org/facebook-hidden-services-and-https-certs)博文了解为什么https证书无法增加价值。由于你无法获得onion域名的SSL证书当你尝试使用你的Mastodon时还会被证书错误所困扰。最近一位Tor开发者在[这里](https://matt.traudt.xyz/p/o44SnkW2.html)阐述了为什么通过https提供Tor服务对大多数用例都没有好处的原因。
解决方法是通过http提供你的Mastodon服务但仅供Tor使用。这可以通过在Nginx配置文件中添加额外的设置来完成。
```text
server {
listen 80;
server_name mastodon.qKnFwnNH2oH4QhQ7CoRf7HYj8wCwpDwsa8ohJmcPG9JodMZvVA6psKq7qKnFwnNH2oH4QhQ7CoRf7HYj8wCwpDwsa8ohJmcPG9JodMZvVA6psKq7.onion;
include /etc/nginx/snippets/mastodon.conf;
}
server {
listen 80;
server_name mastodon.myhosting.com;
return 301 https://$server_name$request_uri;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
list [::]:443 ssl http2;
server_name mastodon.myhosting.com;
include /etc/nginx/snippets/mastodon.conf;
ssl_certificate /etc/letsencrypt/live/mastodon.myhosting.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mastodon.myhosting.com/privkey.pem;
}
```
用你位于 `/var/lib/tor/hidden_service/hostname` 文件中的长hash替换上文中提供的。
请注意onion域名已经被附加了“mastodon.”前缀。你的Tor地址充当通配符域名。所有的子域名都将被路由你可以配置你的Nginx来响应你想要的任何子域名。如果你不想在你的tor域名上托管任何其他服务你可以省略子域名或者选择一个不同的子域名。
这里你就可以看出移动你的mastodon配置到不同文件的好处了。如果不移动的话你的所有配置都必须粘贴至两个地方任何对你配置的改动你都必须同时修改两个地方。
重启你的Web服务器。
```bash
service nginx restart
```
## 陷阱 {#gotchas}
你需要注意一些事情。某些重定向会将你的用户跳转至https。他们必须手动把URL替换成http才能继续。
许多的资源诸如图片将仍然从常规非Tor域名加载。问题的严重性很大程度上取决于用户的谨慎程度。
{{< translation-status-zh-cn raw_title="Hidden services" raw_link="/admin/optional/tor/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,97 @@
---
title: 准备你的机器
menu:
docs:
weight: 10
parent: admin
---
如果你正在设置一台全新的机器,推荐你首要完成安全设置。以下内容假定你运行 **Ubuntu 18.04**
## 禁止密码登录SSH仅允许密钥登录
首先请确保你实际上是通过密钥而不是通过密码登录到服务器的否则这将使你无法登录。许多托管服务提供商支持上传公钥并自动为新机器设置基于密钥的root登录。
编辑 `/etc/ssh/sshd_config` 并找到 `PasswordAuthentication`。确保它已被去除注释并被设为 `no`。如果你做了任何改动,请重启 sshd。
## 更新系统
```bash
apt update && apt upgrade -y
```
## 安装 fail2ban 以阻止重复登录尝试
编辑 `/etc/fail2ban/jail.local` 并添加以下内容:
```text
[DEFAULT]
destemail = your@email.here
sendername = Fail2Ban
[sshd]
enabled = true
port = 22
[sshd-ddos]
enabled = true
port = 22
```
最后重启fail2ban
```bash
systemctl restart fail2ban
```
## 安装防火墙并只暴露SSH、HTTP、HTTPS端口
首先,安装 iptables-persistent。在安装期间它将询问你是否保留现有规则。
```bash
apt install -y iptables-persistent
```
编辑 `/etc/iptables/rules.v4` 并添加如下内容:
```text
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL).
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allow SSH connections
# The -dport number should be the same port number you set in sshd_config
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# Log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
```
iptables-persistent 将在机器启动时自动加载配置。但是由于我们现在不会立刻重启,我们需要第一次手动加载它:
```bash
iptables-restore < /etc/iptables/rules.v4
```
{{< translation-status-zh-cn raw_title="Preparing your machine" raw_link="/admin/prerequisites/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,284 @@
---
title: 伸缩你的服务器
descriptions: 为服务更多用户而优化。
menu:
docs:
weight: 100
parent: admin
---
## 并发管理 {#concurrency}
Mastodon有三种进程
* Web \(Puma\)
* Streaming API
* 后台进程 \(Sidekiq\)
### Web \(Puma\) {#web}
web进程处理绝大多数应用的短HTTP请求。以下环境变量可以控制它
* `WEB_CONCURRENCY` 控制worker进程数
* `MAX_THREADS` 控制每进程的线程数
线程共享其父进程的内存。不同的线程被分配了专有内存虽然他们通过copy-on-write共享了一些内存。数量较多的线程会先消耗掉你的CPU数量较多的进程会先消耗掉你的内存。
这些数值会影响到可以同时处理多少HTTP请求。
在吞吐量方面,多进程比多线程要好。
### Streaming API {#streaming}
streaming API处理长HTTP连接与WebSockets连接通过这些连接用户可以接受到实时更新。以下环境变量可以控制它
* `STREAMING_CLUSTER_NUM` 控制worker进程数
* `STREAMING_API_BASE_URL` 控制streaming API的base URL
一个进程可以处理相当数量的连接。 如果您愿意streaming API可以托管在其他子域上例如避免nginx代理连接开销。
### 后台进程 \(Sidekiq\) {#sidekiq}
Mastodon许多任务都分配给后台进程以确保HTTP请求快速响应并防止HTTP请求中止影响到这些任务的执行。Sidekiq是单个进程具有可配置的线程数。
#### 线程数 {#sidekiq-threads}
虽然web进程数与web线程数影响Mastodon实例响应终端用户分配给后台进程的线程数影响嘟文从作者分发至其他人的速度电子邮件花多长时间发完等等。
Sidekiq的线程数并不受环境变量控制但是可通过命令行参数控制例如
```bash
bundle exec sidekiq -c 15
```
将启一个15线程的sidekiq进程。请注意每个线程都需要能够连接数据库这意味着数据库连接池应足够大以满足所有进程。数据库连接池的大小由`DB_POOL`环境变量控制,该变量必须至少与进程数同样大。
#### 队列 {#sidekiq-queues}
Sidekiq根据任务的重要性使用不同队列这里的重要性是指如果队列不工作其对本地用户体验的冲击有多大。按重要性降序排列
| 队列 | 重要性 |
| :--- | :--- |
| `default` | 影响本地用户的所有任务 |
| `push` | 推送消息至其它服务器 |
| `mailers` | 分发电子邮件 |
| `pull` | 从其它服务器拉取信息 |
默认队列及其优先级存储于`config/sidekiq.yml`但可通过调用Sidekiq命令行覆盖例如
```bash
bundle exec sidekiq -q default
```
仅运行`default`队列。
Sidekiq处理队列的方式是它首先检查第一个队列中的任务如果没有则检查下一个队列。这意味着如果第一个队列已满其他队列将延后。
作为一种解决方案可以启动为不同队列启动不同的Sidekiq进程以确保真正的并列执行例如使用不同Sidekiq参数创建多个systemd服务。
## 使用pgBouncer事务池 {#pgbouncer}
### 你为什么要用PgBouncer {#pgbouncer-why}
如果开始耗尽可用的Postgres连接默认为100那PgBouncer可能是一个好方案。本文档将介绍Mastodon的一些常见陷阱及好的默认配置。
请注意你可以在管理界面的“PgHero”查看当前使用了多少Postgres连接。通常Mastodon使用Puma、Sidekiq、streaming API三者线程数总和的连接数。
### 安装PgBouncer {#pgbouncer-install}
在Debian和Ubuntu
```bash
sudo apt install pgbouncer
```
### 配置PgBouncer {#pgbouncer-config}
#### 设置密码 {#pgbouncer-password}
首先如果你的Postgres中`mastodon`帐户没有设置密码的话,你需要设置一个密码。
First off, if your `mastodon` user in Postgres is set up wthout a password, you will need to set a password.
下面是如何重置密码:
```bash
psql -p 5432 -U mastodon mastodon_production -w
```
之后很显然使用一个与单词“password”不同的密码
```sql
ALTER USER mastodon WITH PASSWORD 'password';
```
然后输入 `\q` 退出。
#### 配置userlist.txt {#pgbouncer-userlist}
编辑 `/etc/pgbouncer/userlist.txt`
只要稍后你在 pgbouncer.ini 中指定一个用户名/密码userlist.txt文件中的值*不必*与真实PostgreSQL用户相同。你可以随意设定用户名和密码但是为方便起来你可以重用“真实”的凭证。添加`mastodon`帐户至`userlist.txt`
```text
"mastodon" "md5d75bb2be2d7086c6148944261a00f605"
```
这里我们使用md5格式这里的md5密码就是字符串`密码 + 用户名`的md5值附加上`md5`。例如:为了获得用户名为`mastodon`密码为`password`的散列值,你可以这样做:
```bash
# ubuntu, debian, etc.
echo -n "passwordmastodon" | md5sum
# macOS, openBSD, etc.
md5 -s "passwordmastodon"
```
然后将`md5`添加至开头。
你也可以创建一个`pgbouncer`管理帐户以登入查看PgBouncer管理数据库。下面是一个`userlist.txt`文件的例子:
```text
"mastodon" "md5d75bb2be2d7086c6148944261a00f605"
"pgbouncer" "md5a45753afaca0db833a6f7c7b2864b9d9"
```
以上两个帐户密码者是`password`。
#### 配置 pgbouncer.ini {#pgbouncer-ini}
编辑 `/etc/pgbouncer/pgbouncer.ini`
在`[databases]`行下列出你想连接的Postgres数据库。这里PgBouncer将使用同样的用户名/密码和数据库名称连接下层Postgres数据库
```text
[databases]
mastodon_production = host=127.0.0.1 port=5432 dbname=mastodon_production user=mastodon password=password
```
`listen_addr``listen_port` 告诉 PgBouncer 从哪个地址/端口接收连接。默认值即可:
```text
listen_addr = 127.0.0.1
listen_port = 6432
```
将`auth_type`设为`md5`(假定你在`userlist.txt`使用md5格式
确保`pgbouncer`帐户为管理员:
**接下来的部分极其重要!** 默认连接池模式是基于连接session-based但是Mastodon需要基于事务transaction-based。换而言之当一个事务创建一个Postgres连接随之创建当事务完成该连接也随之结束。因此你需要把`pool_mode`从`session`改为`transaction`
接下来,`max_client_conn`定义PgBouncer自身接受多少连接`default_pool_size`限制后台开启多少Postgres连接。在PgHero显示的连接数将与`default_pool_size`数目一致因为它不知道PgBouncer。
使用默认值启动即可,你可以随后调大他们:
```text
max_client_conn = 100
default_pool_size = 20
```
完成更改后不要忘记重载reload或重启restartpgbouncer
```bash
sudo systemctl reload pgbouncer
```
#### 调试,确保一切正常 {#pgbouncer-debug}
你应该能像连接Postgres一样连接PgBouncer
```bash
psql -p 6432 -U mastodon mastodon_production
```
然后,使用你的密码登录。
你也可以检查PgBouncer日专就像这样
```bash
tail -f /var/log/postgresql/pgbouncer.log
```
#### 配置 Mastodon 以连接 PgBouncer {#pgbouncer-mastodon}
首先,确保`.env.production`文件这样设置:
```bash
PREPARED_STATEMENTS=false
```
因为我们使用基于事务transaction-based的连接池我们不能使用参数化查询prepared statement
接下来配置Mastodon使用6432端口PgBouncer而不是5432端口Postgres就可以了
```bash
DB_HOST=localhost
DB_USER=mastodon
DB_NAME=mastodon_production
DB_PASS=password
DB_PORT=6432
```
{{< hint style="warning" >}}
你不能使用pgBouncer来执行 `db:migrate` 操作。但是这个问题很容易解决。如果你的postgres和pgBouncer位于同一台主机只需要在执行任务时与 `RAILS_ENV=production` 一同定义 `DB_PORT=5432` 就可以了,例如:`RAILS_ENV=production DB_PORT=5432 bundle exec rails db:migrate`(如果主机不同,你也可以指定`DB_HOST`等等)
{{< /hint >}}
#### 管理 PgBouncer {#pgbouncer-admin}
最简单的重启方法:
```bash
sudo systemctl restart pgbouncer
```
但如果你设定了PgBouncer管理员帐户你也可以用管理员帐户连接
```bash
psql -p 6432 -U pgbouncer pgbouncer
```
然后执行:
```sql
RELOAD;
```
使用 `\q` 以退出。
## 单独的Redis缓存 {#redis}
Redis被广泛使用于应用但是某些用途比其他用途更重要。主页时间轴、列表时间轴、Sidekiq队列还有streaming API都是由Redis支持的这些是你不希望丢失的重要数据尽管丢失了也能存活不像PostgreSQL数据库的丢失——永远不要丢失PostgreSQL数据库。然而Redis也被用于易失性缓存。如果你正处于扩展阶段担心你的Redis能否处理所有事情你可以使用一个不同的Redis数据库来做缓存。在环境变量中你可以指定 `CACHE_REDIS_URL` 或分离形式,就像 `CACHE_REDIS_HOST``CACHE_REDIS_PORT`等等。未指定部分将会回落至没有前缀的相同设定值。
至于Redis数据库配置基本上你可以去除后台保存至磁盘因为重启致使数据丢失也没关系你可以以此节省一些磁盘I/O。你还可以添加最大内存限制和 key eviction policy对于这部分请参阅这个指南[Using Redis as an LRU cache](https://redis.io/topics/lru-cache)。
## 只读副本Read-replicas {#read-replicas}
为了减轻你的Postgresql服务器负担你可以使用热流复制hot streaming replication只读副本read replica。有关示例请参见[该指南](https://cloud.google.com/community/tutorials/setting-up-postgres-hot-standby)。你可以给以下Mastodon用途使用副本replica
* streaming API 服务器无需写入因此你可以将其直接使用副本replica。但由于 streaming API 服务器不经常查询数据库,这样的优化影响很小。
* 使用 Makara 驱动 web 与 sidekiq 进程这样可以实现从主master数据库写从副本replica读。让我们开始吧。
编辑 `config/database.yml` 文件,将 `production` 替换为如下内容:
```yaml
production:
<<: *default
adapter: postgresql_makara
prepared_statements: false
makara:
id: postgres
sticky: true
connections:
- role: master
blacklist_duration: 0
url: postgresql://db_user:db_password@db_host:db_port/db_name
- role: slave
url: postgresql://db_user:db_password@db_host:db_port/db_name
```
确保URL指向PostgreSQL服务器所在位置。你可以添加多个副本replica。你可以本地安装一个pgBouncer该pgBouncer可被配置为根据数据库名称连接两个不同服务器例如“mastodon”连接主服务器“mastodon\_replica”连接副本服务器这样上面文件中的两个URL可以使用同样用户名、密码、主机、端口不同数据库名称。可能的设置有很多有关Makara的更多信息请参阅[其文档](https://github.com/taskrabbit/makara#databaseyml)。
{{< hint style="warning" >}}
Sidekiq无法可靠的使用只读副本read-replicas因为即使是最微小的复制延迟也会导致查询不到相关纪录所致的任务失败。
{{< /hint >}}
{{< translation-status-zh-cn raw_title="Scaling up your server" raw_link="/admin/scaling/" last_tranlation_time="2020-05-06" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,47 @@
---
title: 配置你的新实例
description: 一些需要在安装完Mastodon做的事情
menu:
docs:
weight: 50
parent: admin
---
## 创建一个管理员帐户 {#admin}
### 通过浏览器 {#admin-gui}
在通过浏览器完成帐户注册后,你需要使用命令行给你新创建的帐户以管理员特权。假设你帐户的用户名为`alice`
```bash
RAILS_ENV=production bin/tootctl accounts modify alice --role admin
```
### 通过命令行 {#admin-cli}
你可以使用命令行创建一个全新帐户。
```bash
RAILS_ENV=production bin/tootctl accounts create \
alice \
--email alice@example.com \
--confirmed \
--role admin
```
一个随机密码将会显示在终端上。
## 填写站点信息 {#info}
登录后,打开**网站设置**页面。虽然从技术上来说无需填写这些信息,但对于操作服务器的人而言,这被认为是至关重要的。
| 设置 | 含意 |
| :--- | :--- |
| 用于联系的公开用户名 | 你的用户名,人们可以知道谁运营着这台服务器 |
| 用于联系的公开电子邮件地址 | 一个可以联系到你的电子邮件地址,可供那些帐户被锁或没有帐户的人使用 |
| 本站简介 | 你为什么启动这个站点?为谁运营?什么使它与众不同? |
| 本站详细介绍 | 你可以在此放置各种信息,但建议放置**行为准则**。 |
填写完这些后,请点击“保存更改”。
{{< translation-status-zh-cn raw_title="Setting up your new instance" raw_link="/admin/setup/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,458 @@
---
title: 使用管理命令行
description: 可以从命令行运行tootctl命令
menu:
docs:
weight: 60
parent: admin
---
---
Mastodon的命令行界面是一个位于Mastodon根目录内`bin`目录中的名为`tootctl`的可执行文件。你必须通过`RAILS_ENV`环境变量指定你执行时打算使用的环境。除非你是在本地计算机上进行开发工作,否则你需要使用`RAILS_ENV=production`。如果你确信永不使用其它环境(开发、测试),为了方便起见,你可以把它添加到 `.bashrc` 文件,例如:
```bash
echo "export RAILS_ENV=production" >> ~/.bashrc
```
如果这样,便无需在每次执行时指定它。否则,通常会这样调用 `tootctl` 命令假定你的Mastodon代码位于`/home/mastodon/live`
```bash
cd /home/mastodon/live
RAILS_ENV=production bin/tootctl help
```
## 基础命令
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/cli.rb" caption="lib/cli.rb" >}}
### `tootctl self-destruct` {#self-destruct}
通过向所有己知实例广播帐户删除通告将本服务器从联邦宇宙抹除。此命令允许Mastodon服务器“干净退出clean exit即几乎不在其它服务器留下任何缓存。此命令始终是交互式的且需要二次确认。
实际上不会删除任何本地数据因为直接清空数据库或删除整个VPS更快。如果你运行此命令后无论如何都要继续运营实例状态不匹配可能导致与其它站点互联时出错。
{{< hint style="danger" >}}
**运行此命令之前,请确保你确实知道自己正在做什么。**此操作**不**可逆,并且可能花费很长时间。完成此命令之后,服务器将处于**破碎状态**BROKEN STATE。需要一个运行中的Sidekiq进程所以在队列完全被清空之前不要关闭服务器。
{{< /hint >}}
**版本历史:**
* 2.8.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl --version` {#version}
展示目前运行的Mastodon实例版本。
**版本历史:**
* 2.7.0 - 被加入
## 帐户相关命令 {#accounts}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/accounts_cli.rb" caption="lib/mastodon/accounts\_cli.rb" >}}
### `tootctl accounts rotate` {#accounts-rotate}
生成并广播新的RSA密钥作为安全维护的一部分。
**版本历史:**
* 2.5.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地帐户用户名 |
| `--all` | 轮替所有本地帐户密钥,可取代 USERNAME。 |
### `tootctl accounts create` {#accounts-create}
创建一个给定用户名USERNAME和给定电子邮件地址--email的新帐户。
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 新帐户的本地用户名。 必须的。 |
| `--email EMAIL` | 要附加到用户的电子邮件地址。 必须的。 |
| `--confirmed` | 跳过发送确认邮件步骤并立即激活帐户。 |
| `--role ROLE` | 设定新用户的身份为 `user`, `moderator``admin`。默认为 `user`。 |
| `--reattach` | 重用已被删除帐户的旧用户名。 |
| `--force` | 强制删除使用此用户名USERNAME的现有帐户然后重新的新帐户代替刚刚删除的该帐户。 |
### `tootctl accounts modify` {#accounts-modify}
修改某帐户的身份电子邮箱地址激活状态审核状态及禁用双因素认证2FA
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地帐户的用户名。 必须的。 |
| `--role ROLE` | 设定该帐户的身份为 `user`, `moderator``admin`。 |
| `--email EMAIL` | 将该帐户电子邮箱地址改为 EMAIL。 |
| `--confirm` | 跳过邮件确认步骤,当使用 --email 时可用。 |
| `--disable` | 禁止 USERNAME 帐户登录。 |
| `--enable` | 允许 USERNAME 帐户登录,如果该帐户目前被禁止登录。 |
| `--approve` | 审核通过该帐户,如果你的实例为审核制。 |
| `--disable_2fa` | 移除额外认证因素,允许只用密码登录。 |
### `tootctl accounts delete` {#accounts-delete}
删除给定 USERNAME 的用户帐户。
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地帐户的用户名。 必须的。 |
### `tootctl accounts backup` {#accounts-backup}
请求给定 USERNAME 帐户的备份。备份将会被 Sidekiq 异步创建,创建完成后用户将接收到一封带有备份链接的电子邮件。
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地帐户的用户名。 必须的。 |
### `tootctl accounts cull` {#accounts-cull}
移除不在存在的远程帐户。查询数据库中的所有远程帐户,以确认其是否仍存在于原有服务器,如果不存在,那么该帐户将从数据库中删除。在远程服务器刚刚下线的情况下,最近一周有活动痕迹的帐户将被排除在检测范围之外。
**版本历史:**
* 2.6.0 - 被加入
* 2.8.0 - 加入 `--dry_run`
| 选项 | 描述 |
| :--- | :--- |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl accounts refresh` {#accounts-refresh}
重新拉取一个或多个远程帐户的数据与文件。
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 远程用户名 |
| `--all` | 刷新所有远程帐户,可取代 USERNAME。 |
| `--domain DOMAIN` | 仅操作此域名 DOMAIN 下的远程帐户。可取代 USERNAME。 |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl accounts follow` {#accounts-follow}
迫使所有本地帐户关注给定本地帐户。
**版本历史:**
* 2.7.0 - 被加入
* 3.0.0 - 使用 USERNAME 取代 ACCT
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地用户名 |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
### `tootctl accounts unfollow` {#accounts-unfollow}
迫使所有本地帐户取消关注给定帐户。
**版本历史:**
* 2.7.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `ACCT` | `username@domain` 地址 |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
### `tootctl accounts reset-relationships` {#accounts-reset-relationships}
重置某本地帐户所有正在关注和/或关注者。
**版本历史:**
* 2.8.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 本地用户名 |
| `--follows` | 迫使 USERNAME 取消关注所有人后,再重新关注他们。 |
| `--followers` | 移除 USERNAME 的所有关注者。 |
### `tootctl accounts approve` {#accounts-approve}
当实例为审核制时,审核通过新注册者。
**版本历史:**
* 2.8.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 审核通过这个用户名的待审核帐户。 |
| `--number N` | 审核通过最近N个注册者。 |
| `--all` | 审核通过所有待审核帐户。 |
## 缓存相关命令 {#cache}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/cache_cli.rb" caption="lib/mastodon/cache\_cli.rb" >}}
### `tootctl cache clear` {#cache-clear}
清除缓存存储。
**版本历史:**
* 2.8.1 - 被加入
### `tootctl cache recount` {#cache-recount}
通过从头开始进行引用计数,更新指定类型的硬缓存计数。此操作可能会花费很长时间才能完成,这取决于你的数据库大小。帐户将刷新正在关注数、关注者数、嘟文数。嘟文将刷新回复数、转发数及喜爱数。
**版本历史:**
* 3.0.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| TYPE | `accounts``statuses` |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
## 域名相关命令 {#domains}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/domains_cli.rb" caption="lib/mastodon/domains\_cli.rb" >}}
### `tootctl domains purge` {#domains-purge}
移除给定域名的所有帐号不留下任何纪录。与封禁suspension不同如果该域名DOMAIN仍存在这意味着如果该域名上的帐户被再次解析帐户将重新回来。
**版本历史:**
* 2.6.0 - 被加入
* 2.8.0 - 加入 `--whitelist_mode`
* 2.9.0 - 同时移除自定义emoji
* 3.0.0 - 可同时接受多个域名
| 选项 | 描述 |
| :--- | :--- |
| `DOMAIN[...]` | 要移除的域名Domains使用空格进行分隔。 |
| `--whitelist_mode` | 可取代 DOMAIN。不是移除单一域名而是从数据库移除所有来自非白名单站点的帐户。启用白名单模式并完成白名单设定后运行此命令。 |
| `--concurrency N` | 执行该任务的worker数。默认为5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl domains crawl` {#domains-crawl}
通过使用Mastodon REST API爬取API暴露的所有节点收集这些节点的统计数字只要这些节点支持相关API来爬取已知联邦宇宙。当没有给定 START 时,此命令将使用服务器数据库中的已知节点作为爬取的种子。返回总实例数、总注册帐户数、最近一周内的总活跃帐户数、最近一周内新加入的总帐户数。
**版本历史:**
* 2.7.0 - 被加入
* 3.0.0 - 加入 `--exclude_suspended`
| 选项 | 描述 |
| :--- | :--- |
| START | 可选的,从一个不同域名开始。 |
| `--concurrency N` | 执行该任务的worker数。默认为50。 |
| `--format FORMAT` | 控制数据的返回方式。`summary`将打印一个总结。`domains`将返回以换行符分隔的所有已发现节点列表。`json`将输出原始数据汇总。默认为`summary`。 |
| `--exclude_suspended` | 输出中不包括已被你封禁的域名,子域名也将包括内。 |
## Emoji相关命令 {#emoji}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/emoji_cli.rb" caption="lib/mastodon/emoji\_cli.rb" >}}
### `tootctl emoji import` {#emoji-import}
从一个给定路径的 .tar.gz 存档中导入自定义emoji。存档中包含的PNG、GIF文件不能大于50KBemoji短代码shortcode将被设为去除扩展名后的文件名可以使用选项附加前缀与后缀。
**版本历史:**
* 2.5.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `PATH` | 含图片的 .tar.gz 存档文件的路径。 |
| `--prefix PREFIX` | 在生成的短代码开头附加前缀 PREFIX。 |
| `--suffix SUFFIX` | 在生成的短代码结尾附加后缀 SUFFIX。 |
| `--overwrite` | 不是跳过已存在的emoji而是覆盖同名短代码的emoji。 |
| `--unlisted` | 导入的emojis将不在emoji选择器中出现但仍能通过它们的短代码来使用。 |
| `--category CATEGORY` | 导入的emoji在选择器的将会分组至 CATEGORY。 |
### `tootctl emoji purge` {#emoji-purge}
移除所有自定义emoji。
**版本历史:**
* 2.8.0 - 被加入
* 3.1.0 - 加入 `--remote_only`
| 选项 | 描述 |
| :--- | :--- |
| `--remote_only` | 如果被提供,将仅移除远程实例。 |
## 时间流Feeds相关命令 {#feeds}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/feeds_cli.rb" caption="lib/mastodon/feeds\_cli.rb" >}}
### `tootctl feeds build` {#feeds-build}
为某个或所有用户构建主页home和列表list时间流。时间流将从数所库中构建并使用Redis缓存于内存中。Mastodon 自动管理激活用户的主页时间流。
**版本历史:**
* 2.6.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `USERNAME` | 要被生成时间流的本地用户名。 |
| `--all` | 刷新所有本地用户的时间流,可取代 USERNAME。 |
| `--concurrency N` | 执行该任务的worker数。默认N=5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl feeds clear` {#feeds-clear}
从Redis中移除所有主页和列表时间流。
**版本历史:**
* 2.6.0 - 被加入
## 媒体相关命令 {#media}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/media_cli.rb" caption="lib/mastodon/media\_cli.rb" >}}
### `tootctl media remove` {#media-remove}
移除本地缓存的其它实例媒体附件。
**版本历史:**
* 2.5.0 - 被加入
* 2.6.2 - 显示被释放的硬盘空间
| 选项 | 描述 |
| :--- | :--- |
| `--days` | 多久之前的媒体附件将会被清理。默认为7天。 |
| `--concurrency N` | 执行该任务的worker数。默认为5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl media remove-orphans` {#media-remove-orphans}
扫描出不属于任何媒体附件的文件并移除他们。请注意某些存储提供商会对列出对象所必需的API收取费用。另外此操作需要遍历每个文件因此速度很慢。
**版本历史:**
* 3.1.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `--start_after` | 循环开始的附件key值。如果之前中断过此操作请使用此选项。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
### `tootctl media refresh` {#media-refresh}
从其它服务器重拉取远程媒体附件。你必须使用 --status 、 --account 或 --domain 来指定媒体附件来源。如果附件已经存在于数据库,除非你使用 --force否则将不会被覆写。
**版本历史:**
* 3.0.0 - 被加入
* 3.0.1 - 加入 `--force` 选项,并默认跳过已下载的附件
| 选项 | 描述 |
| :--- | :--- |
| `--account ACCT` | 需要被处理的帐号,格式 `username@domain` |
| `--domain DOMAIN` | FQDN string |
| `--status ID` | 数据库中的嘟文本地数字ID。 |
| `--concurrency N` | 执行该任务的worker数。默认为5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
| `--force` | 强制重下载远程资源并覆写本地附件。 |
### `tootctl media usage` {#media-usage}
计算被Mastodon消耗的硬盘空间。
**版本历史:**
* 3.0.1 - 被加入
### `tootctl media lookup` {#media-lookup}
提示输入媒体URL然后查询该媒体显示位置。
**版本历史:**
* 3.1.0 - 被加入
## 预览卡片Preview Cards相关命令 {#preview_cards}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/preview_cards_cli.rb" caption="lib/mastodon/preview\_cards\_cli.rb" >}}
### `tootctl preview_cards remove` {#preview_cards-remove}
移除本地预览卡片缩略图。
**版本历史:**
* 3.0.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `--days` | 多久之前的媒体附件将会被清理。默认为180天。注意不推荐删除14天内的预览卡片因为同一链接两周之内再次发布将不会重抓取。 |
| `--concurrency N` | 执行该任务的worker数。默认为5。 |
| `--verbose` | 任务进行时,打印额外信息。 |
| `--dry_run` | 仅打印预期结果,而不执行任何操作。 |
| `--link` | 仅删除链接型link-type预览卡片。不处理视频与图片卡片。 |
## 搜索相关命令 {#search}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/search_cli.rb" caption="lib/mastodon/search\_cli.rb" >}}
### `tootctl search deploy` {#search-deploy}
创建或更新ElasticSearch索引并进行填充。 如果ElasticSearch为空此命令将创建必要的索引然后将数据从数据库导入到这些索引中。如果自上次运行以来索引结构已更改此命令还将升级索引。
**版本历史:**
* 2.8.0 - 被加入
* 3.0.0 - 加入 `--processes` 选项来并行化
| 选项 | 描述 |
| :--- | :--- |
| `--processes N` | 并行执行命令。默认N=2。可以设为`auto`来基于可用CPU数获取相应数值。 |
## 站点设定相关命令 {#settings}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/settings_cli.rb" caption="lib/mastodon/settings\_cli.rb" >}}
### `tootctl settings registrations open` {#settings-registrations-open}
开放注册。
**版本历史:**
* 2.6.0 - 被加入
### `tootctl settings registrations close` {#settings-registrations-close}
关闭注册。
**版本历史:**
* 2.6.0 - 被加入
## 嘟文相关命令 {#statuses}
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/lib/mastodon/statuses_cli.rb" caption="lib/mastodon/statuses\_cli.rb" >}}
### `tootctl statuses remove` {#statuses-remove}
从数据库中删除未被引用的嘟文,例如来自中继的或来自本地用户不再关注的用户的嘟文,同时没有被回复的或以其他方式与之互动的。
这是一个计算量很大的操作,其会开始之前创建额外的数据库索引,并在结束后删除它们。
**版本历史:**
* 2.8.0 - 被加入
| 选项 | 描述 |
| :--- | :--- |
| `--days` | 多久之前的嘟文将会被清理。默认为90天。 |
{{< translation-status-zh-cn raw_title="Using the admin CLI" raw_link="/admin/tootctl/" last_tranlation_time="2020-05-05" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,29 @@
---
title: 故障分析
menu:
docs:
weight: 120
parent: admin
---
## **我看到一个故障页说一些东西出错了。我怎么找出哪里出错了?**
所有带堆栈追踪stack traces的错误信息都将会被写入系统日志。当使用systemd时可使用 `journalctl -u mastodon-web`(替换以相应的服务名) 来浏览每个服务的日志。当使用Docker时与之类似`docker logs mastodon_web_1`(替换以相应的容器名)。
服务端详细错误信息将*永不会*公开显示,因为它们可能会暴露你的内部设置,并为攻击者提供线索,让他们了解如何更好的入侵或如何更高效的滥用。
来自Mastodon web服务器的每一个响应都带有独一无二的请求IDrequest ID该ID也将反映在日志中。通过检查错误页的请求头你可以在日志中轻松找到与之对应的堆栈追踪stack traces
## **升级新版本后,有些页面看起来很奇怪,就像它们含有未设置样式的元素一样。为什么?**
检查升级后,你是否运行 `RAILS_ENV=production bin/rails assets:precompile` 并重启Mastodon web 进程。因为这看起来像提供了过期的样式与脚本。这也有可能由于内存缺乏导致预编译失败很不幸webpack会占用大量内存。如果是这个原因请确保你已经分配了swap空间。另外也可以在另一台机器上预编译静态文件然后把它们复制至 `public/packs` 目录。
## **升级新版本后,一些请求失败了,日志中的错误信息是 missing columns or tables。为什么**
检查升级后,你是否运行 `RAILS_ENV=production bin/rails db:migrate`。因为这看起来Mastodon代码访问了一个更新或更旧的数据库schema。如果你使用PgBouncer请确保此命令直接连接PostgreSQL因为PgBouncer不支持迁移过程中的锁表操作。
## **我试图运行 `tootctl``rake`/`rails` 命令,但我得到 uninitialized constants 错误信息。哪里出错了?**
检查你是否在命令前使用 `RAILS_ENV=production` 指定正确的环境。默认情况下假定使用开发环境因此代码尝试加载开发相关gem。然而在生产环境中我们避免安装这些gem。这就是错误的来源。
{{< translation-status-zh-cn raw_title="Troubleshooting errors" raw_link="/admin/troubleshooting/" last_tranlation_time="2020-05-08" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,76 @@
---
title: 升级到新版本
menu:
docs:
weight: 70
parent: admin
---
{{< hint style="info" >}}
当一个新的Mastodon版本释出后它将出现在[GitHub releases页面](https://github.com/tootsuite/mastodon/releases)。请注意:运行来自`master`分支的未释出代码,虽然可以进行,但不推荐这样做。
{{< /hint >}}
Mastodon版本与git tags一致。在尝试升级之前请至[GitHub releases页面](https://github.com/tootsuite/mastodon/releases)查找所需版本。该页面包含了一个**更新日专**,其中描述你需要了解的所有差异,以及**特定的升级指令**。
开始之前,切换至`mastodon`用户:
```bash
su - mastodon
```
并转至Mastodon根目录
```bash
cd /home/mastodon/live
```
下载相应版本代码,这里假定版本为`v3.1.2`
```bash
git fetch --tags
git checkout v3.1.2
```
现在执行GitHub版本发布说明中的升级指令。因为不同的版本有不同的指令所以本页面将不包括任何指令。
{{< hint style="info" >}}
从旧版本升级时,你可以安全的跳过中间版本。你无需单独检出他们。然而,你确实需要追踪每一个版本的升级指令。大多数指令都是重叠的,你只需要确保每条至少执行一次即可。
{{< /hint >}}
当你执行完版本发布说明中的指令后切换回root用户
```bash
exit
```
重启**后台worker**
```bash
systemctl restart mastodon-sidekiq
```
并重载**web进程**
```bash
systemctl reload mastodon-web
```
{{< hint style="info" >}}
`reload`操作是零下线时间的重启restart也被称为“分阶段重启phased restart”。因此Mastodon升级通常不需要为计划下线而提前发布公告。罕见情况下你可以改用`restart`操作,但你的用户将感到(短暂的)服务中断。
{{< /hint >}}
罕见情况下,**streaming API** 服务也会被更新并需要重启:
```bash
systemctl restart mastodon-streaming
```
{{< hint style="danger" >}}
更新streaming API服务非常罕见在大多数版本中*不*需要重启它。重启streaming API将导致服务器负载增加因为断线的用户会尝试重连或改用REST API轮询。因此请尽量避免重启streaming API服务
{{< /hint >}}
{{< hint style="success" >}}
**就这样!** 您现在正在运行新版本的Mastodon。
{{< /hint >}}
{{< translation-status-zh-cn raw_title="Upgrading to a new release" raw_link="/admin/upgrading/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,46 @@
---
title: 更多设置
description: 邀请新用户,对你的联系人进行排序,并保护你的帐户。
menu:
docs:
weight: 80
parent: user
---
## 生成邀请链接 {#invites}
{{< figure src="/assets/image%20%2862%29.png" caption="从你的帐户设置中邀请别人加入本站" >}}
邀请链接可以被生成并与其他人分享,有些服务器需要邀请才能注册账号。在生成邀请链接时,你可以设置最多使用次数,以限制某个链接的使用次数,或者限制链接的可使用时间。邀请链接可以在任何时候停用。
## 关注管理 {#relationships}
{{< figure src="/assets/image%20%2849%29.png" caption="所有与你互相关注并且没有启用迁移功能的用户,按最后一次活动时间排序" >}}
在设置中有关注管理器,你可以根据不同的标准,对和你有关的用户进行筛选和排序。
* **关系:** 你关注的、关注你的以及互相关注的账号。
* **帐户状态:** 用户是否已启用迁移功能。
* **帐户活动:** 用户在过去一个月内是否发布过信息。
你可以选择取消关注某些用户,或从你的关注者中删除某些用户,只需勾选方框并点击表头的相应按钮即可。
## 账号设置 {#account}
在帐户设置中,你可以更改你的电子邮件地址,设置新密码,注销活跃会话以及以授权应用,也可以启用双重认证。
## 身份验证 {#proofs}
个人资料附加信息的[链接验证](../profile#verification)是通过使用rel=me链接验证你的身份的一种方法但Mastodon也支持一个更通用的身份验证子系统。目前这个子系统唯一支持的身份验证提供商是Keybase。
### Keybase身份验证 {#keybase}
{{< figure src="/assets/image%20%2860%29.png" caption="个人资料上的身份验证" >}}
首先注册Keybase并生成或上传一个GPG公钥到你的Keybase帐户。接下来进入“证明更多身份prove more identities”。找到你的实例如果没有请联系Keybase寻求帮助。选择你的Mastodon域名输入你的用户名。你可以通过使用你的Mastodon账号进行授权并发布验证消息来验证你的身份。一旦你这样做了身份验证就会建立你的个人资料将会显示Keybase的身份验证。
{{< hint style="danger" >}}
**Keybase的身份验证是不可逆的。** Keybase使用不可变的签名链进行身份验证所以一旦你在Keybase上验证了你的身份你就不能删除它。你只能用你的相关私钥签署一个吊销信息来吊销你的验证。
{{< /hint >}}
{{< translation-status-zh-cn raw_title="More settings" raw_link="/user/contacts/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,40 @@
---
title: 推广自己和他人
description: 推广话题标签、用户资料和嘟文。
menu:
docs:
weight: 60
parent: user
---
## 在你的个人资料上推荐内容 {#featured}
### 精选话题标签 {#featured-tags}
{{< figure src="/assets/image%20%2858%29.png" caption="精选话题标签会显示该标签最后使用日期和总使用量" >}}
你可以选择展示你经常使用的某些话题标签。进入 设置 &gt; 个人资料 &gt; 精选的话题标签 来管理你目前正在使用的精选话题标签。一旦被精选,你的个人资料上就会显示一个指向该话题标签的链接,其中包括上次在嘟文中使用该话题标签的日期,以及使用该话题标签的嘟文总数。
### 推荐用户 {#featured-profiles}
{{< figure src="/assets/image%20%2833%29.png" caption="图为四个被随机展示出来的推荐用户列表" >}}
你可以选择在个人资料中推荐你所关注的人。进入你所关注的人的个人资料页打开下拉菜单点击“在个人资料中推荐该用户”。当你推荐某用户时时一个指向该用户个人资料页的链接将会出现在你个人资料页“你的推荐”栏目下。“你的推荐”栏目一次最多展示4个推荐用户每次加载页面时这四个推荐用户将会从你所有的推荐用户中随机选出。
## 置顶嘟文 {#pinned}
{{< figure src="/assets/image%20%2837%29.png" caption="一篇来自mastodon.social/@gargron的置顶嘟文" >}}
你可以选择在你的个人档案的顶部最多置顶5个自己的公开嘟文。进入嘟文下拉菜单然后点击“在个人资料页面置顶”。置顶后它将出现在你的嘟文选项卡的顶部在所有其他按时间顺序排列的嘟文的之前。
## 用户资料目录 {#directory}
{{< figure src="/assets/image%20%2831%29.png" caption="mastodon.social上的用户资料目录" >}}
用户资料目录显示了所有选择在目录中显示的帐户,可以用来快速找到你可能感兴趣的用户资料。
用户资料目录可以按照最近的活动(最近发布的嘟文)或新来的帐户(最近创建的帐户)进行排序。该目录也可以设定为只显示本地帐户,或者显示你的站点知道的所有已知帐户。
个人资料以卡片的形式出现,其中包括用户的昵称、账号地址、账号简介,以及一些简短的统计信息,比如他们发布了多少条嘟文、有多少关注者、以及最后一次发布嘟文的时间。
{{< translation-status-zh-cn raw_title="Promoting yourself and others" raw_link="/user/discoverability/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,22 @@
---
title: 站外使用Mastodon
description: 你可以通过外部应用程序或网站来浏览Mastodon或与Mastodon进行交互。
menu:
docs:
weight: 90
parent: user
---
## 与另一个Mastodon站点的远程互动 {#interact}
{{< figure src="/assets/image%20%2863%29.png" caption="Mastodon网站上的一个嘟文的永久链接" >}}
当你在跨站浏览其他由Mastodon驱动的远程站点时点击任何一个交互按钮都会加载一个对话框将你重定向到你的本地站点。
{{< figure src="/assets/image%20%288%29.png" caption="跨站嘟文回复对话框" >}}
## 登录到一个客户端应用程序 {#apps}
你可以使用你的Mastodon帐户登录到任何可以实现Mastodon API的应用程序。这些应用程序的列表可以在 [https://joinmastodon.org/apps](https://joinmastodon.org/apps) 中找到。
{{< translation-status-zh-cn raw_title="Using Mastodon externally" raw_link="/user/external/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,108 @@
---
title: 处理不想要的内容
description: 控制你看到的内容,以获得更舒适的社交媒体体验。
menu:
docs:
weight: 50
parent: user
---
## 过滤嘟文 {#filters}
你可以过滤特定关键字和短语的嘟文,自动隐藏它们。
{{< figure src="/assets/image%20%2848%29.png" caption="含有不同内容不同关键词的已激活的过滤器" >}}
要创建或管理过滤器,请转到设置 &gt; 过滤器。点击“添加新的过滤器”按钮,你可以创建、编辑或删除过滤器。你现有的过滤器将汇总在一个表格中。
{{< figure src="/assets/image%20%2814%29.png" caption="可以为筛选器设置到期日期、过滤位置、是否服务器端删除而非隐藏、是否过滤整个词条" >}}
过滤器有以下设置:
### 关键词 {#filter-phrase}
这是将被匹配的字符串用于在嘟文的任意内容包括CW媒体描述和投票选项中搜索该关键字。
### 失效时间 {#filter-expire}
(可选)仅在有限的时间内应用过滤器。过期的过滤器不会自动删除,但可以通过设置新的过期日期(或将其更改回“永不过期”)来重新激活。
### 过滤器场景 {#filter-context}
选择应用过滤器的场景:
* 主页时间轴 = 含有关键词的嘟文将从你的主页时间轴中删除
* 通知 = 不会显示含有关键词的通知
* 公共时间轴 = 含有关键词嘟文不会显示在本站/跨站公共时间轴中
* 对话 = 含有关键词的嘟文将不会显示在对话、嘟文详情页
### 丢弃而非隐藏 {#filter-drop}
过滤通常是在客户端进行的,因此禁用过滤器将使过滤后的嘟文再次可见。但是,如果启用“丢弃而不是隐藏”,则任何匹配嘟文将完全消失,并且永远不会出现在你的主页时间轴或通知中。
### 整个词条 {#filter-whole}
过滤器通常会匹配任何状态下的关键词字符,无论它们是否位于单词中间。当启用“整个词条”后,只有当关键字前后是空格或其他非字母数字字符时,该关键词才会被过滤。
## 用户级操作 {#blocking-and-muting}
{{< figure src="/assets/image%20%2824%29.png" caption="用户下拉菜单提供了多种操作" >}}
### 隐藏转嘟 {#hide-boosts}
如果你隐藏了某人的转嘟,你将不会在你的主页上看到他们的转嘟。这个选项只出现在你当前关注的用户身上。
### 隐藏 {#mute}
{{< figure src="/assets/image%20%2852%29.png" caption="图为被隐藏的帐户" >}}
隐藏某一账号时,你可以选择是否将其通知一并隐藏。隐藏用户,而不隐藏通知时,会将该账号从用户界面中隐藏:
* 你不会在你的主页中看到该账号。
* 你不会看到其他人转嘟的该账号的嘟文。
* 你不会看到其他人提及这个账号。
* 你不会在公共时间轴中看到该账号。
如果你选择了同时隐藏通知,你还将不会收到来自该账号的通知。
用户不会知道他们已经被其他用户隐藏。
### 屏蔽 {#block}
{{< figure src="/assets/image%20%2836%29.png" caption="图为被屏蔽的帐户" >}}
屏蔽会将账号从用户界面中隐藏。
* 你不会在你的主页中看到该账号。
* 你不会看到其他人转嘟的该账号的嘟文。
* 你不会看到其他人提及这个账号。
* 你不会在公共时间轴中看到该账号。
* 你不会收到来自该账号的通知。
此外,在被屏蔽的账号一方,
* 被屏蔽账号会被强制取消对你的关注。
* 被屏蔽账号不能关注你。
* 被屏蔽账号不能看到别人对你的转嘟。
* 被屏蔽账号不能在公共时间轴中看到你。
如果你和被屏蔽的账号在同一服务器上,被屏蔽的用户将无法在登录时查看你的个人资料页。
### 屏蔽整个域名 {#hide-domain}
![](/assets/image%20%2861%29.png)
如果你屏蔽了整个域名:
* 你将无法在公共时间轴上看到来自该域名的嘟文。
* 你将不会在主页看到其他人转发来自该域名的嘟文。
* 你将不会收到来自该域名的通知。
* 你将失去该域名上的所有关注者。
## 向管理员报告有问题的内容 {#report}
{{< figure src="/assets/image%20%283%29.png" caption="报告模块允许选择被报告嘟文、添加注释和是否转发报告" >}}
如果你看到有违反站点规则的嘟文或用户你可以向站点管理员报告该用户。点击用户下拉菜单或嘟文的下拉菜单上的“举报”选项将打开报告模块。在这里你可以并且应该添加一个关于你为什么要举报这个帐号的注释。你可以附加某些有问题的嘟文以了解你为什么要报告该账号如果他们的行为违反了他们所在Mastodon站点的规则你还可以选择将报告转发至他们所在Mastodon站点的管理员。
{{< translation-status-zh-cn raw_title="Dealing with unwanted content" raw_link="/user/moderating/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,46 @@
---
title: 迁移或删除帐户
description: 你的信息,由你掌控。
menu:
docs:
weight: 100
parent: user
---
## 导出你的信息 {#export}
{{< figure src="/assets/image%20%2835%29.png" caption="设置中的数据导出页面" >}}
在任何时候,你都可以在 设置 &gt; 导出 中下载一个CSV文件其中包括你当前关注的帐户、当前创建的列表、当前屏蔽的帐户、当前隐藏的帐户和当前被屏蔽的域名。你可以在 设置 &gt; 导入 中导入你的关注、用户屏蔽、隐藏和域屏蔽列表,在这里可以合并或覆盖它们。
每七天可以申请下载你嘟文与媒体文件的存档一次该存档的格式是ActivityPub JSON。由于技术上的限制Mastodon目前不支持导入嘟文或媒体但你的存档可以使用任何能够解析ActivityPub格式的软件查看。
## 迁入或迁出你的帐户 {#migration}
在 设置 &gt; 帐户 底部,你可以找到与帐户迁入或迁出相关的选项。
### 帐户跳转 {#redirect}
{{< figure src="/assets/image%20%2853%29.png" caption="帐户跳转设置页面" >}}
跳转帐户将禁止从该帐户发布信息,并显示一个指向你的新帐户的“帐户已经迁移”通知。任何查看你的个人资料的人都可以看到这个通知,并知道要关注你的新帐户。已跳转的帐户无法被关注。可以在任何时候取消跳转。
### 帐户迁移 {#move}
{{< figure src="/assets/image%20%2847%29.png" caption="帐户迁移设置页面" >}}
迁移你的帐户等同于跳转你的帐户,但是,如果他们的软件支持迁移功能的话,它将不可逆转地迫使每个人取消关注你当前的帐户并关注你的新帐户。由于技术上的限制,你的嘟文将不会被移动。迁移帐户功能有一个很长的冷却期,在此期间你无法再次迁移,因此在使用这个功能之前要格外小心!
### 账号别名 {#aliases}
{{< figure src="/assets/image%20%2840%29.png" caption="别名管理页面" >}}
仅当你的两个账号都已设置别名后,帐户迁移才会启动。帐户别名当前仅用于帐户迁移,开始迁移之前,你需要将旧帐户设置为新帐户的别名。设置帐户别名本身是无害且可逆的。
## 删除帐户 {#delete}
{{< figure src="/assets/image%20%2816%29.png" caption="删除帐户页面" >}}
在 设置 &gt; 帐户 底部,你可以找到删除帐户的选项。删除你的帐户是不可逆的,并且会导致你的个人资料和用户名永远无法使用。
{{< translation-status-zh-cn raw_title="Moving or leaving accounts" raw_link="/user/moving/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,92 @@
---
title: 使用社交功能
description: 关注并和来自任意服务器的任何人交流
menu:
docs:
weight: 40
parent: user
---
## 浏览公共时间轴 {#timelines}
{{< figure src="/assets/image%20%2830%29.png" caption="公共时间轴上的嘟文" >}}
为了让你发现潜在的有趣内容Mastodon提供了一种浏览所有公共嘟文的方法。当然所有Mastodon服务器之间并不会全局共享嘟文因此无法同时浏览*所有*公共嘟文。当你浏览**跨站公共时间轴**时,你将看到你所在的服务器所知道的所有公共嘟文。你的服务器可以通过多种方式发现嘟文,但其中大部分是来自你服务器上的其他用户关注的人。
这里有一种方法筛选跨站时间轴,以仅查看由你所在服务器发出的公共嘟文:**本站时间轴**。请注意这里的本地\(local\)仅是指服务器,而不是地理位置。
## 与其他人的嘟文互动 {#actions}
{{< figure src="/assets/image%20%2821%29.png" caption="可以通过单击时间轴中的嘟文来加载扩展视图" >}}
你可以直接从时间轴对嘟文执行快速操作,或者你可以单击一条嘟文加载扩展视图,显示额外信息,包括:完整的时间戳、交互计数和嘟文回复(如果有的话)。在每一条嘟文上,你可以执行以下操作:
* **回复** 点击箭头图标回复嘟文。你的嘟文会在你回复的嘟文下面出现。
* **转嘟** 点击循环箭头图标转发嘟文。这篇嘟文将在你的个人资料中出现。
* **喜欢** 点击星星图标喜欢嘟文。这篇嘟文将被添加到你的喜欢列表中,原嘟文作者将会受到这条嘟文被喜欢的通知。
* **添加到书签** 点击缎带图标为嘟文添加书签。这篇嘟文将被添加到你的私有书签列表中,而不会产生通知。
* 点击省略号图标展开**更多选项菜单**。
## 通知 {#notifications}
{{< figure src="/assets/image%20%2850%29.png" caption="通知栏" >}}
当其他人与你或你的嘟文交互时,你将根据事件的类型收到通知消息。在通知栏里,你可以查看所有通知消息,或过滤特定类型的通知消息:
* **提及:** 当有人在嘟文中提到你时会收到通知消息。
* **喜欢:** 当有人喜欢了你的嘟文时会收到通知消息。
* **转嘟:** 当有人转发了你的嘟文时会收到通知消息。
* **投票:** 当你已经投票或创建的投票已经结束时会收到通知消息。
* **关注:** 当有人关注你时会收到通知消息。
## 关注用户 {#follow}
![](/assets/image%20%2811%29.png)
只要你在应用程序界面例如Web界面、手机APP中遇到的用户只需要点击“关注”该用户是否在你所在的服务器上并不会带来用户体验上的差异。
然而如果你在不同的服务器上看到某人的公开资料就会遇到一个障碍该服务器将你视为另一个匿名访问者。不要担心你可以简单地复制该用户资料的URL或其中一个嘟文的URL然后将该URL粘贴到你所在Mastodon的搜索栏中。
如果你正在访问另一个Mastodon站点的公开页面请参阅[站外使用Mastodon](../external#interact)。
## 搜索 {#search}
{{< figure src="/assets/image%20%2819%29.png" caption="搜索功能可以从侧栏中访问" >}}
Mastodon的基本搜索允许登录用户查找包含特定话题标签的嘟文如果他们知道URL或地址的话可以直接加载用户或嘟文。搜索某个关键词将显示包括该关键词的用户以及话题标签。
{{< figure src="/assets/image%20%2839%29.png" caption="直接通过URL加载嘟文" >}}
{{< figure src="/assets/image%20%2823%29.png" caption="搜索“cats”时返回包含“cats”的帐户" >}}
{{< figure src="/assets/image%20%2827%29.png" caption="搜索“cats”时返回话题标签" >}}
管理员可以选择安装全文搜索功能。Mastodon的全文搜索允许登录用户从他们自己的嘟文、他们喜欢的嘟文、他们的书签和他们被提及的嘟文中查找相应结果。为了减少人们通过搜索争议相关关键词来找人撕逼的滥用行为Mastodon有意禁用了在全数据库搜索任意关键词的功能。
全文搜索支持以下操作符:
* **"精确短语"** 将尝试查找包含在一对英文双引号 `"` 内的关键词。Mastodon将只显示完全匹配关键词的搜索结果。例如搜索 `"look at my cluckers"` 将精确查找到包含 `look at my cluckers` 这个短语的嘟文。
* **-排除** 在某个关键词前面加上减号 `-`,可以排除这个关键词。比如搜索 `animals -cats` 就可以搜索到所有不包括cat但包括animals的嘟文。。
* **+包含** 在关键词前面加上加号 `+`,就可以要求搜索结果必须包含的这个关键词。比如搜索 `cat +dog` 就可以搜到同时包含cat和dog的嘟文。
中文译者的话Mastodon项目并没有对中文搜索进行相应的分词优化因此在搜索中文时中文短语将会被拆分成单字致使最终搜索结果含有大量无关结果。例如搜索 `中文搜索好用吗`,默认情况下会被拆分成 `中` `文` `搜` `索` `好` `用` `吗` 而不是被拆分成 `中文搜索` `中文` `搜索` `好用` `吗`。如果你所在实例没有优化中文搜索,**搜索中文词语时,请使用双引号将所需搜索的中文词语包裹起来**。
## 私信 {#direct}
{{< figure src="/assets/image%20%2812%29.png" caption="私信对话列表" >}}
在Mastodon中私信就是选择了“私信”可见范围的嘟文。在私信对话中后续的嘟文可以设置不同的可见范围。私信列中展示了一个包含所有私信对话的列表。点击某个对话将加载相关的嘟文。
{{< figure src="/assets/image%20%2857%29.png" caption="私信对话" >}}
## 列表时间轴 {#lists}
列表是主页时间轴的子集。你可以创建一个列表,给它起一个名称,并将你所关注的用户添加到该列表中。
![](/assets/image%20%2828%29.png)
打开一个列表将加载该列表的时间轴。列表时间轴只包含该列表成员的嘟文,以及对你或对其他列表成员的回复。
{{< figure src="/assets/image%20%285%29.png" caption="一个列表时间轴" >}}
{{< translation-status-zh-cn raw_title="Using the network features" raw_link="/user/network/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,135 @@
---
title: 发布嘟文
description: 分享你的想法,从未如此便捷。
menu:
docs:
weight: 30
parent: user
---
{{< figure src="/assets/image%20%2859%29.png" caption="启用CW后的撰写表单" >}}
## 文本 {#text}
每条嘟文的主体可由文本组成。默认的字符限制为500个字符。
### 链接 {#links}
{{< figure src="/assets/image%20%287%29.png" caption="链接必须以 http\(s\):// 开头无论长度如何都将被视为23个字符" >}}
如果你的嘟文中有链接,它们必须以 `http://``https://` 开头。所有的链接无论实际上有多长都将被记作23个字符。因此没有使用短链接来节省字符的必要。事实上使用短链接是极其不被推荐的。
### 提及 {#mentions}
{{< figure src="/assets/image%20%2820%29.png" caption="键入@后会自动推荐你可能要提及的本站或跨站用户" >}}
你可以通过输入用户的完整地址来提及(@)他们,例如`@alice@example.com`。请注意,`@word`的任何用法都将被解释为提及本地用户名为`word`的用户(如果该用户存在于本站的话)。只有用户名部分才会受到字数限制,域名不被计算在字数内。
### 话题标签 {#hashtags}
{{< figure src="/assets/image%20%2825%29.png" caption="话题标签会根据使用频率自动被系统推荐" >}}
你可以使用 `#话题标签` 使任何搜索该话题标签的人都可以发现你的嘟文。标签可以包含字母数字字符和下划线,但不能只包含数字。
### 自定义emoji {#emoji}
{{< figure src="/assets/image%20%2838%29.png" caption="一组自定义表情符号存在于选择器中" >}}
每个服务器都提供了一套你可以使用的自定义表情符号。你可以使用表情符号的短代码,如`:thounking:`或者点击撰写框中的表情符号图标浏览“自定义”类别。你也可以使用unicode标准表情符号。
## 附加内容 {#attachments}
你可以将媒体文件或投票附加到你的嘟文。
### 媒体文件 {#media}
{{< figure src="/assets/image%20%2844%29.png" caption="带有删除、编辑、标记为敏感媒体选项的附加媒体文件缩略图" >}}
点击回形针将文件附加到你的嘟文上。你可以附上以下文件:
* **图像** \(PNG, JPG, GIF\)**最大8MB**。图像将被压缩至160万像素足够一张1280x1280px的图像。最多可以附加4张图片。
* **GIF动画**GIF动画会转换成无声的mp4就像 Imgur/Gfycat \(**GIFV**\) 一样。你也可以上传无声的MP4和WebM它们将被以同样方式处理。
* **视频** \(MP4, M4V, MOV, WebM\)**最大40MB**。视频将被转换为最大比特率1300kbps最大帧率60fps的H.264 MP4。
* **音频** \(MP3, OGG, WAV, FLAC, OPUS, AAC, M4A, 3GP\)**最大40MB**。音频将使用V2 VBR大约192kbps转码成MP3。
#### 编辑媒体 {#edit}
{{< figure src="/assets/image%20%2826%29.png" caption="编辑媒体以添加媒体描述,或选择预览缩略图的焦点" >}}
通过点击附件缩略图上的“编辑”链接你可以加载模块这个模块允许你添加媒体描述或改变焦点。虽然是可选的但还是建议添加媒体描述来简单地描述媒体中包含的内容。当媒体因任何原因无法加载时或当视觉障碍人士使用屏幕阅读器和其他辅助技术访问时这些描述将被显示出来。设置焦点也是可选的但是当未以169的纵横比显示预览缩略图时可以使预览缩略图看起来更好。
### 投票 {#polls}
{{< figure src="/assets/image%20%2841%29.png" caption="一个含有2个单选选项过期时间为1天的投票" >}}
单击条型图图标将投票附加到你的嘟文。
* 你可以设置最多4个选项每个选项最多可以有25个字符。
* 默认为单选选择。单击圆型单选按钮,投票将切换为多项选择。
* 投票过期时间可以设置为5分钟、30分钟、1小时、6小时、1天、3天或7天。
## 嘟文可见范围 {#privacy}
| 可见范围 | 公共时间轴 | 永久链接 | 个人资料页视图 | 主页时间轴 |
| :--- | :--- | :--- | :--- | :--- |
| 公开 | 可见 | 有 | 可见 | 可见 |
| 不公开 | 不可见 | 有 | 可见 | 可见 |
| 仅关注者 | 不可见 | 登录到同一站点 | 应用内或登录可见 | 可见 |
| 私信 | 不可见 | 登录并被提到后 | 应用内或登录可见 | 不可见 |
嘟文可以发布四个不同的隐私级别:
### 公开 {#public}
这是默认的选项。
* 任何人都可以通过访问永久链接看到你的嘟文,而不需要登录。
* 你的嘟文将出现在应用程序内的公共\(Public\)时间轴上。
* 你的关注者将在他们的主页\(Home\)上接收到这条嘟文,任何被提及的人都将在通知中接收到这条嘟文。
* 你的嘟文可以被转发到其他人的主页中。
### 不公开 {#unlisted}
除了以下不同以外,与公开可见范围一致:
* 你的嘟文将不会出现在Mastodon的公共时间轴。
### 仅关注者 {#private}
这是限制性更高的一种选项。
* 需要与关注你或被提及的人登录同一个站点,才能通过永久链接查看你的嘟文。
* 你的嘟文将不会出现在应用程序内,除非关注者浏览你的个人资料,或者你提及了那些人。
* 你的关注者将在他们的主页上接收这条嘟文,任何被提及的人也将在通知中接收这条嘟文。
* 你的嘟文不能被除你自己以外的人转发。
{{< hint style="warning" >}}
如果你要有效地发布私有(仅限关注者可见)嘟文,你必须**锁定你的帐户(锁嘟)**,否则,任何人都可以关注你,然后查看以前的嘟文。
{{< /hint >}}
{{< hint style="danger" >}}
注意Mastodon上的隐私设置是应用在每条嘟文上的而不是应用在整个帐户上的并且**你无法把已经发布的公开嘟文再设置为私有嘟文**。
{{< /hint >}}
### 私信 {#direct}
仅将你的嘟文发送给被提及的用户。
* 需要与被提及的人登录同一个站点,才能通过永久链接查看你的嘟文。
* 你的嘟文不会出现在应用内,除非你提及的那些人。
* 任何被你提及的人都会接收这条嘟文,但是嘟文不会出现在主页时间轴上。
* 你的嘟文不能被转发。
{{< hint style="warning" >}}
**不要通过私信分享敏感信息。** 与Signal或Wire不同Mastodon不是一个加密消息应用程序发送方和接收方服务器的数据库管理员可以访问到相应文本。使用私信功能时要像使用论坛私信、Discord私信和Twitter私信一样小心。
{{< /hint >}}
## 内容警告CW和敏感内容 {#cw}
{{< figure src="/assets/image.png" caption="在CW中被标记为敏感内容的嘟文" >}}
Mastodon提供了一个你可能在其他社交网络上没有看到的功能那就是在你的嘟文上附加一个内容警告。当包含内容警告时嘟文内容默认会被折叠只显示你设置的CW的警告标题而不直接展开显示嘟文正文起到了类似于电子邮件的主题栏或“阅读更多”的内容中断作用。这可以用于为你的嘟文添加摘要或主题、折叠长嘟文或者为嘟文主体提供上下文。
当附加媒体时将出现一个复选框允许你“标记媒体为敏感内容”。默认情况下这将整个媒体隐藏在一个被模糊的缩略图后面。在一个嘟文中添加一个CW会自动将这个嘟文的媒体标记为敏感。
{{< translation-status-zh-cn raw_title="Posting toots" raw_link="/user/posting/" last_tranlation_time="2020-05-02" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,90 @@
---
title: 设置你的首选项
description: 以你喜欢的方式自定义Mastodon。
menu:
docs:
weight: 70
parent: user
---
## 自定义用户界面外观 {#interface}
### 选择一个站点主题 {#theme}
Mastodon默认为深色主题但可以选择浅色或高对比度主题。
{{< figure src="/assets/image%20%2834%29.png" caption="Mastodon浅色主题" >}}
### 选择你的布局 {#layout}
Mastodon默认为简单的单列布局左侧有一个撰写框右侧有一个列切换器。你可以选择启用高级网页界面该界面允许你同时查看和固定多个列。
{{< figure src="/assets/image%20%2832%29.png" caption="高级 web 界面" >}}
在这两个界面中,当有新的嘟文时,更新会自动加载。你可以启用“慢速模式”在栏目顶部显示一个横幅,显示新嘟文数量,只有当你点击横幅时,时间轴才会在点击后更新。
出于无障碍性的原因GIF动画的自动播放默认是禁用的。如果你想看动图可以启用自动播放 GIF 动画。你也可以在整个界面中减少动画的运动。
趋势标签在高级web界面中的“开始使用”栏下面或者简单web界面中的列切换器下面只有当有足够的空间显示它们时才会显示
### 确认对话框 {#confirm}
你可以选择在执行某些操作前要求确认。目前,可在执行以下操作前设置确认:
* 取消关注
* 转嘟
* 删除
### 敏感内容 {#sensitive}
默认情况下,任何标记为敏感的媒体都会被隐藏在可点击的覆盖层后。你也可以选择始终显示/隐藏在此覆盖层后面的媒体,无论其是否被标记为敏感媒体。
隐藏和未加载的媒体使用由BlurHash算法提供的彩色渐变它使用图像的颜色但模糊了细节。这些渐变可以被禁用。
{{< figure src="/assets/image%20%286%29.png" caption="Blurhash缩略图示例" >}}
带有内容警告的嘟文默认是折叠的,但你可以选择总是展开警告嘟文,以便显示完整的嘟文。
## 控制你的通知 {#notifications}
### 发送电子邮件 {#email}
你可以根据你在Mastodon中收到的通知类型选择接收电子邮件通知。以下的通知类型可以启用。
* 关注
* 关注请求
* 转嘟
* 喜欢
* 提及
你还可以启用摘要邮件,这将为你提供长期不活动期间收到的通知概览。
### 隐藏特定通知 {#hide-notifications}
你可以选择不接收来自你不关注的人,或者不关注你的人的通知。这将导致回复、收藏、喜欢、转嘟和其他互动不会显示给你。
你也可以选择不接收来自你不关注的人的私信消息。
## 杂项选项 {#misc}
如果你选择`禁止搜索引擎建立索引`,你的公开资料和嘟文页面上将会被添加 `noindex` 标签。
你可以选择`隐藏你的社交网络`,这将使你关注的人和关注你的人仅你自己可见。
{{< figure src="/assets/image%20%284%29.png" caption="选择隐藏社交网络后的个人资料" >}}
如果你想看到被多次转嘟的嘟文重新插入到你时间流的最上方,你可以禁用`在时间轴中合并转嘟`。
### 发布默认值 {#posting}
嘟文默认可见范围为公开。你可以将新嘟文的默认可见范围改为不列出或仅关注者。关于嘟文可见范围的解释,请参阅 [发布嘟文 &gt; 嘟文可见范围](../posting#privacy)。
默认情况下,你的嘟文的语言会被自动检测,但这种检测可能不准确。如果你主要或专门用某种语言发帖,最好在`发布语言`设置该语言。
如果你经常发布敏感媒体,你可以选择`总是将我发送的媒体文件标记为敏感内容`。
### 公共时间轴的语言过滤 {#languages}
你可以选择在浏览公共时间轴时只显示特定语言的嘟文。但是,请注意,语言检测可能非常不精确,因此你可能仍然会看到一些使用被禁用语言的嘟文,或者错过一些使用已启用语言的嘟文。
{{< translation-status-zh-cn raw_title="Set your preferences" raw_link="/user/preferences/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,78 @@
---
title: 设置个人资料
description: 开始使用你的新帐户。
menu:
docs:
weight: 20
parent: user
---
## 你的外观 {#appearance}
{{< figure src="/assets/image%20%2829%29.png" caption="用户资料卡会显示你的用户名、头像和横幅图片" >}}
你可以在 设置 &gt; 配置文件 &gt; 外观 页面中配置你的个人资料显示外观。
### 昵称 {#name}
你的昵称会显示在你的Mastodon用户地址之前。默认情况下你可以设置最多30个字符的昵称。
### 简介 {#bio}
自我简介是对你自己的简短描述这会在你的个人资料上显示出来。默认情况下你可以设置最多500个字符的自我简介。
### 头像 {#avatar}
你的头像是一个图标,会显示在你的嘟文旁边,作为你的视觉身份的一部分。头像文件大小限制 2.0 MB只支持 PNG、GIF 或 JPG 格式。图片分辨率将会裁剪至 400x400px。
### 个人资料页横幅图片 {#header}
这个横幅图像会显示在你的个人资料页顶部,以及关注列表和帐户目录中的个人资料卡上。横幅图片文件大小限制 2.0 MB只支持 PNG、GIF 或 JPG 格式。图片分辨率将会裁剪至 1500x500px。
## 账号标志 {#flags}
你可以在你的资料上设置特定的标志让别人知道你会如何使用Mastodon。
![](/assets/image%20%281%29.png)
### 保护你的帐户(锁嘟) {#locked}
勾选 `保护你的帐户(锁嘟)` 后,两件事情将会发生:
* 新关注者不会被自动接受,你需要手动审核所有关注请求。
* 一个锁形图标会显示在你的个人页面上,让其他人知道他们的关注不会立即被接受。
### 机器人bot帐户 {#bot}
勾选 `这是一个机器人帐户`将向你的个人资料页面上添加一个bot图标。此图标将让其他人知道你的帐户可能执行自动化活动并且可能无人监控。其他的软件可能选择用不同方式对待bot账号但是目前Mastodon只将bot标志作为一个视觉标识。
### 用户目录 {#discoverable}
勾选 `在本站用户目录中收录此账号` 后,将使你的个人资料可被通过浏览用户目录发现。
## 个人资料附加信息 {#fields}
个人资料附加信息是一种向你的配置文件添加易于浏览的额外信息的方式。你有4行可自定义标签和值。例如
| 标签 | 内容 |
| :--- | :--- |
| 年龄 | 25 |
| 国家 | 德国 |
| Pronouns | he/him |
| 网站 | https://example.com |
在这里填写什么,完全取决于你自己。附加信息内容可以包含提及、标签、自定义表情和链接。
### 链接验证 {#verification}
没有中心化的权威基于文件材料的验证和加V是不可能的。然而Mastodon可以交叉引用你放置在个人资料中的链接以证明你是这些链接的真正所有者。如果这些链接之一是你的已被他人知晓并信任个人主页那么它可以作为身份验证的次好方法。
如果你把一个链接放在你的个人资料附加信息中Mastodon会检查被链接的页面是否也链接到你的Mastodon个人资料页。如果是你会在链接旁边得到一个验证通过的标记确认你是该页面的所有者。
在后台Mastodon将检查回链链接的`rel="me"`属性。同样的,放置在个人资料附加信息中的链接将会被附加上`rel="me"`属性。
{{< hint style="info" >}}
由于Mastodon可以自托管因此没有比在已经被人们信任的域名之上托管一个Mastodon站点更好的方法来验证你的身份。
{{< /hint >}}
{{< translation-status-zh-cn raw_title="Setting up your profile" raw_link="/user/profile/" last_tranlation_time="2020-05-02" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,62 @@
---
title: 运行自己的服务器
description:
menu:
docs:
weight: 9999
parent: user
---
## 为什么你要运行自己的Mastodon服务器
- 绝对控制自己在网络上的声音,不受制于任何其他人的管理与左右。你的服务器是你的财产,受你的管理。只要你想让它存在,它就会一直存在。
- 你在你自己的服务器上并*不是*孤立的。你可以关注其他任意服务器上任何人,他们也可以关注你,你可以像在同一服务器上一样交换信息。
- 你可以限制注册人数,成为服务器上唯一的一个人,然后像个人(微)博客一样运行;也可以为家人或朋友维护一个邀请制的社区;或者运行一个任何人都可以注册的服务器。这都由你自己决定!
{{< hint style="warning" >}}
请注意,提供公共互联网服务涉及到审核工作和社区管理,而且这些工作会随着服务器的扩大而变得更加复杂。
{{< /hint >}}
## 如果你想要运行自己的Mastodon服务器……
你需要这些:
- 一个**域名**。这是你和其他人访问你的服务器的方式,也是你和你的用户在网络上的身份标识。
**如何获得**Namecheap, Gandi 等任何域名注册商。自带的年费根据域名选择的不同而不同。
- 一个**VPS**。将运行Mastodon代码的东西它将始终连接到互联网。
**如何获得**DigitalOcean, Hetzner, Exoscale, Scaleway 等任何主机提供商都可以。自带月费或年费,根据硬件规格不同,费用也不同。
- 一个**电子邮件发送服务提供商**。Mastodon需要通过电子邮件发送确认链接和各种通知自己托管一个SMTP服务器虽然可行但是相较使用第三方提供商自己托管SMTP服务器要保证可靠是更加困难的。
**如何获得**MailgunSparkPostPostmarkSendgrid任何一个提供SMTP API的电子邮件服务商。每月的费用根据发送的邮件量而定。
- 可选:**对象存储**。Mastodon可以将你和你的用户上传的文件保存在其运行的VPS的硬盘驱动器上但是硬盘驱动器通常不是无限的而且后续很难升级扩容。对象存储实际上为你提供了无限制的计量文件存储。
**如何获得**Amazon S3ExoscaleWasabiGoogle Cloud任何提供S3兼容或OpenStack Swift兼容API的服务商都可以。每用费用取决于存储的文件数量及其访问频率。
有许多**Mastodon专用托管服务提供商**可以满足上述许多(全部)要求,如果你对让他人处理所有技术问题感兴趣的话,你可以选择使用。通常情况下,你仍然需要购买自己的域名。一些这样的提供商是:
{{< caption-link url="https://masto.host" caption="Masto.host" >}}
{{< caption-link url="https://hostdon.jp" caption="Hostdon" >}}
{{< caption-link url="https://app.spacebear.ee/mastodon" caption="Spacebear" >}}
{{< caption-link url="https://nablahost.com/services/activitypub-hosting/" caption="Nablahost" >}}
全托管解决方案非常适合那些没有经验或不想安装和维护软件的人。然而,自己负责硬件的所有组件,可以让你在伸缩性、性能和自定义方面有更大的控制权。
我们提供了一个**DigitalOcean 一键安装镜像**你可以把它放在DigitalOcean vps上通过交互式的安装向导遵照我们的安装说明基本上可以为你提供所需的所有东西。
{{< caption-link url="https://marketplace.digitalocean.com/apps/mastodon" caption="DigitalOcean Mastodon一键安装镜像" >}}
然而这只是假定单机的情况下安装。Mastodon可以很好地横向伸缩。如果你的需求超出了单机的容量Mastodon可以被分成多个应用服务器、后台workers、多个Redis后端、PostgreSQL replicas。如果你有上述需求就不能使用一键安装镜像。
如果你有兴趣自己安装一切,请点击这里:
{{< page-ref page="admin/prerequisites.md" >}}
{{< translation-status-zh-cn raw_title="Running your own server" raw_link="/user/run-your-own/" last_tranlation_time="2020-05-03" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

View File

@ -0,0 +1,57 @@
---
title: 创建一个帐户
description: 找寻属于你的完美社区。
menu:
docs:
weight: 10
parent: user
---
## 选择一个站点 {#picker}
你必须选择一个Mastodon站点进行注册就好比你需要选择一个电子邮件提供商或者像是为你的魔兽世界新角色选择一个地区服务器一样。该站点将是你的服务提供方托管你的帐户、个人资料及个人主页信息流。
{{< hint style="info" >}}
你可以 [在 joinmastodon.org 上按类别和语言浏览Mastodon站点列表](https://joinmastodon.org/#getting-started).
{{< /hint >}}
### 了解站点的政策 {#tos}
在你注册之前了解该Mastodon站点的政策和使用条款是很重要的。Mastodon站点通常会在`/about/more`页面上列出它的政策。你可以在未登录的状态下,点击登录页面上的“了解更多”链接来找到政策和使用条款信息。
### 站点注册模式 {#signup}
Mastodon软件允许站点管理员从三种站点注册模式中选择一种开放注册、邀请制和审核制。
#### 开放注册 {#open}
有些站点可能允许你立即注册。只需使用你的用户名、电子邮件地址和密码填写注册信息,就可以开始使用你的帐户了。
#### 邀请制 {#invite}
有些站点禁用注册表单,而是要求生成并分享邀请链接以允许人们注册。
#### 审核制 {#approval}
有些站点允许你填写注册表单,但是会有一个附加的表单条目来说明你为什么想要加入那个站点。提交了表单之后,你的帐户必须得到管理员的批准才能开始使用。
## 你的用户名和域名 {#address}
Mastodon的用户名由两部分组成
* 本站用户名,比如 `alice`
* Mastodon站点的域名比如 `example.com`
就像电子邮件地址一样为了方便起见Mastodon允许你在向与你相同的服务器上的人发送地址时跳过第二部分但是你必须记住在与他人分享你的用户名时应当包含站点的域名否则他人将不能轻松的找到你。
| | |
| :--- | :--- |
| 我是Mastodon上的 @alice | 错误的表述 |
| 我是Mastodon上的 @alice@example.com | 正确的表述 |
| 我是Mastodon上的 https://example.com/@alice | 正确的表述 |
上述两种地址形式完整用户名、用户主页链接都可以在Mastodon搜索栏中查找相应的用户所以你可以根据你的喜好分享。
相同的用户名*可以*在不同的服务器上注册——无法提前声明所有的域名后缀。就像电子邮件一样,你不应期待 `alice@outlook.com``alice@gmail.com``alice@yahoo.com` 是同一个人。
{{< translation-status-zh-cn raw_title="Signing up for an account" raw_link="/user/signup/" last_tranlation_time="2020-05-02" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}

62
i18n/zh-cn.toml Normal file
View File

@ -0,0 +1,62 @@
[improvePage]
other = "改进此页面"
[lastUpdated]
other = "最后更新于"
[lastUpdatedDateFormat]
other = "{{ .Format \"January 2, 2006\" }}"
[joinTitle]
other = "加入社交媒体革命"
[joinText]
other = "Mastodon是一个有超过300万用户的自由、去中心化的平台"
[joinAction]
other = "现在就加入Mastodon"
[merch]
other = "纪念品商店"
[shirtsAndStickers]
other = "T恤衫和贴纸"
[joinMastodon]
other = "加入Mastodon"
[blog]
other = "博客"
[viewSource]
other = "查看源代码"
[imprint]
other = "版权信息"
[formDataParameters]
other = "表单数据参数"
[headers]
other = "标题"
[required]
other = "必需的"
[optional]
other = "可选的"
[pathParameters]
other = "路径参数"
[queryParameters]
other = "查询参数"
[request]
other = "请求"
[response]
other = "响应"
[otherTranslations]
other = "也可在此找到:"

View File

@ -0,0 +1,10 @@
<figure>
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<iframe src="https://player.bilibili.com/player.html?aid={{ .Get "id" }}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" allowfullscreen title="{{ .Get "caption" }}"></iframe>
</div>
<figcaption>
<p>{{- .Get "caption" | markdownify -}}</p>
</figcaption>
</figure>

View File

@ -0,0 +1,6 @@
<figure>
<p>
<strong>翻译状态:</strong>
本文是英文页面 <a href="{{ .Get "raw_link" }}">{{ .Get "raw_title" }}</a> 的翻译,最后翻译时间:{{ .Get "last_tranlation_time" }},点击<a href="https://github.com/tootsuite/documentation/compare/{{ .Get "raw_commit" }}...master">这里</a>可以查看翻译后页面的改动。
</p>
</figure>