Mastodon
  • 什么是 Mastodon?
  • 使用 Mastodon
    • 注册帐户
    • 设置你的个人资料
    • 在你的账户发布内容
    • 使用网络功能
    • 处理不想看到的内容
    • 推广你和他人
    • 进行偏好设置
    • 更多设置
    • 在站点外使用 Mastodon
    • 迁移或离开账户
    • 运行你自己的站点
  • 运营 Mastodon
    • 准备你的服务器
    • 从源代码安装
    • 配置你的环境
    • 安装可选功能
      • 对象存储
      • 洋葱服务
      • 验证码
      • 单点登录
    • 配置全文搜索
    • 设置你的新实例
    • 使用管理 CLI
    • 升级到新版本
    • 备份你的服务器
    • 迁移到新机器
    • 扩大你的站点规模
    • 审核操作
    • 故障排除
      • 数据库索引损坏
    • 用户组
  • 开发 Mastodon 应用
    • API 入门指南
    • 使用公开数据
    • 获取客户端应用访问权限
    • 使用帐户登录
    • 库与实现
  • 向 Mastodon 项目做贡献
    • 技术概览
    • 设置开发环境
    • 代码结构
    • 路由
    • 漏洞赏金与责任披露
  • 遵循的标准
    • ActivityPub
    • WebFinger
    • 安全性
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime 格式
    • 指南与最佳实践
    • OAuth 令牌
    • OAuth 作用域
    • 速率限制
  • API 方法
    • apps
      • oauth
      • emails
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • followed_tags
      • suggestions
      • tags
    • profile
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • grouped notifications
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
      • announcements
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • proofs
    • oembed
  • API 实体
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

Filter

表示用户定义的过滤规则,用于确定哪些嘟文不应向用户显示。

    • 示例
    • 属性
      • id
      • title
      • context
      • expires_at
      • filter_action
      • keywords
      • statuses
    • 参见

示例

{
	"id": "19972",
	"title": "Test filter",
	"context": [
		"home"
	],
	"expires_at": "2022-09-20T17:27:39.296Z",
	"filter_action": "warn",
	"keywords": [
		{
			"id": "1197",
			"keyword": "bad word",
			"whole_word": false
		}
	],
	"statuses": [
		{
			"id": "1",
			"status_id": "109031743575371913"
		}
    ]
}

属性

id

描述: 数据库中过滤规则的 ID。
类型: 字符串 (从整数强制转换,但不保证一定是数字)
版本历史:
4.0.0 - 添加

title

描述: 用户为过滤规则指定的标题。
类型: 字符串
版本历史:
4.0.0 - 添加

context

描述: 过滤规则的应用到场景。
类型: 字符串数组 (可枚举,anyOf)
home = 首页时间线和列表
notifications = 通知时间线
public = 公共时间线
thread = 展开的嘟文串
account = 查看账户时
版本历史:
4.0.0 - 添加

expires_at

描述: 过滤规则何时不再生效。
类型: nullable 字符串 (Datetime),如果过滤规则永不过期,则为 null
版本历史:
4.0.0 - 添加

filter_action

描述: 当嘟文与此过滤规则匹配时要采取的操作。
类型: 字符串 (可枚举,oneOf)
warn = 显示警告,警告内容为命中的过滤规则的标题,并允许用户展开被过滤的嘟文。这是默认值(并且未知值应被视为等同于“warn”)。
hide = 如果匹配到对应的嘟文,则不显示
blur = 隐藏/模糊媒体附件,并显示警告,警告内容为命中的过滤规则的标题 版本历史:
4.0.0 - 添加
4.4.0 (mastodon API 版本 5) - 将 blur 值添加到 filter_action 属性

keywords

描述: 此过滤规则下的关键词。
类型: FilterKeyword 数组
版本历史:
4.0.0 - 添加

statuses

描述: 此过滤规则下的嘟文。
类型: FilterStatus 数组
版本历史:
4.0.0 - 添加

参见

过滤的实现指引
V1::Filter(适用于 Mastodon 3.5 及更早版本)
/api/v2/filters 方法
app/serializers/rest/filter_serializer.rb

翻译状态: 本文是英文页面 Filter 的翻译,最后翻译时间:2025-04-21,点击这里可以查看翻译后页面的改动。

最后更新于 April 21, 2025 · 改进此页面
也可在此找到: English

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

查看源代码 · CC BY-SA 4.0 · 版权信息