mastodon
Auto-generated from mastodon/mastodon by Mutable.ai Auto WikiRevise
mastodon | |
---|---|
GitHub Repository | |
Developer | mastodon |
Written in | Ruby |
Stars | 46k |
Watchers | 709 |
Created | 02/22/2016 |
Last updated | 04/04/2024 |
License | GNU Affero General Public License v3.0 |
Homepage | joinmastodon.org |
Repository | mastodon/mastodon |
Auto Wiki | |
Revision | |
Software Version | 0.0.8Basic |
Generated from | Commit 4045c0 |
Generated at | 04/04/2024 |
The Mastodon repository is a comprehensive open-source social networking platform that provides a self-hosted, globally interconnected microblogging community. The repository contains the core functionality of the Mastodon application, including a wide range of controllers, models, services, and workers that handle user accounts, statuses (posts), content moderation, ActivityPub integration, and various administrative tasks.
The app
directory is the heart of the Mastodon application, containing over 200 files that define the core business logic. This includes controllers that handle user authentication, account management, API interactions, and ActivityPub protocol implementation. The …/models
directory defines the central data structures and entities, such as Account
, Status
, and User
, along with a variety of supporting models that handle file attachments, caching, and other cross-cutting concerns.
The Mastodon application heavily leverages the ActivityPub protocol, an open and decentralized social networking protocol, to enable federated communication between different Mastodon instances. The …/activitypub
directory contains the controllers responsible for handling incoming ActivityPub requests, generating appropriate responses, and synchronizing data between the local instance and remote actors.
In addition to the core application functionality, the Mastodon repository also includes a comprehensive set of administrative features, accessible through the …/admin
directory. These controllers handle tasks such as managing user accounts, moderating content, reviewing trends, and configuring instance-level settings.
The …/services
and …/workers
directories contain a wide range of service classes and Sidekiq workers that handle asynchronous tasks, such as ActivityPub distribution, user account management, notification delivery, and scheduled maintenance operations. These components leverage the database infrastructure defined in the db
directory, which includes migration scripts, seed data, and database views.
The client-side functionality of the Mastodon web application is implemented in the …/mastodon
directory, which includes components, actions, reducers, and utility functions that handle various features and behaviors, such as accounts, announcements, bookmarks, compose, notifications, and more. The application also utilizes a comprehensive set of serializers and presenters, located in the …/serializers
and …/presenters
directories, to convert internal data structures into different formats, including ActivityPub, NodeInfo, and the REST API.
Overall, the Mastodon repository provides a robust and flexible social networking platform that enables users to create self-hosted, interconnected communities, while also offering a rich set of administrative and moderation tools to ensure the health and safety of the network.
Application ControllersRevise
References: app/controllers
The …/controllers
directory contains a comprehensive set of controllers that handle various aspects of the Mastodon application's functionality. These controllers are responsible for processing incoming requests, managing user accounts, handling administrative tasks, and interacting with the ActivityPub protocol.
API ControllersRevise
References: app/controllers/api
, app/controllers/api/v1
The …/api
directory contains a comprehensive set of controllers that handle various API endpoints in the Mastodon application. These controllers provide functionality for managing user accounts, announcements, applications, crypto-related operations, emails, featured tags, instances, lists, notifications, polls, profiles, push subscriptions, statuses, timelines, and trends.
Administrative ControllersRevise
References: app/controllers/admin
The …/admin
directory contains the administrative functionality for the Mastodon application. This includes managing user accounts, reports, trends, settings, and various other administrative tasks.
ActivityPub ControllersRevise
References: app/controllers/activitypub
The …/activitypub
directory contains a set of controllers that handle various aspects of the ActivityPub protocol implementation in the Mastodon application. These controllers are responsible for processing incoming ActivityPub requests, generating appropriate responses, and interacting with other components of the Mastodon system.
Authentication ControllersRevise
References: app/controllers/auth
The Auth::ChallengesController
is responsible for handling the challenge functionality in the Mastodon application. It includes the ChallengableConcern
module and uses the auth
layout.
Settings ControllersRevise
References: app/controllers/settings
The key functionality in the …/settings
directory is as follows:
Web API ControllersRevise
References: app/controllers/api/web
The Api::Web::EmbedsController
class is responsible for handling the display of embedded content (such as posts or statuses) in the Mastodon web application. The main functionality provided by this controller includes:
Admin API ControllersRevise
References: app/controllers/api/v1/admin
The Api::V1::Admin::AccountsController
is responsible for managing user accounts in the Mastodon application's administrative API. It provides functionality for listing, showing, enabling, approving, rejecting, deleting, unsensitizing, unsilencing, and unsuspending user accounts. The controller uses the AccountFilter
class to apply various filters to the account list, such as by local/remote status, activity status, and search parameters.
Application ModelsRevise
References: app/models
The …/models
directory contains the core models and classes that define the business logic of the Mastodon application. This directory covers a wide range of functionality, including user accounts, statuses (posts), trends, administrative tasks, form handling, and various other cross-cutting concerns.
General Functionality ModelsRevise
References: app/models
, app/models/concerns
The …/concerns
directory contains a collection of modules that provide various cross-cutting functionality to the models in the Mastodon application. These modules handle a wide range of responsibilities, including:
User Settings ModelsRevise
References: app/models/user_settings
The …/user_settings
directory in the Mastodon application contains the core functionality for managing user settings. This subsection covers the models that provide a flexible and extensible system for managing user settings in the Mastodon application.
Other ModelsRevise
References: app/models
The AccountAlias
model allows users to associate an alternative account identifier (acct) with their main account, providing a way to manage multiple identities.
Application Services and WorkersRevise
References: app/services
, app/workers
The …/services
directory contains a collection of service classes that handle various aspects of the Mastodon application's functionality. These services are responsible for tasks such as fetching and processing remote ActivityPub data, managing user accounts and relationships, handling notifications, and performing various administrative and moderation tasks.
ActivityPub IntegrationRevise
References: app/services/activitypub
, app/workers/activitypub
The …/activitypub
directory contains a set of service classes that are responsible for handling various aspects of the ActivityPub protocol in the Mastodon application. These services are responsible for fetching and processing remote actors, statuses, polls, and collections, as well as synchronizing followers and managing featured content.
User Account ManagementRevise
References: app/services
, app/workers/admin
The …/services
directory contains a collection of service classes that handle various aspects of user account management in the Mastodon application. These services are responsible for tasks such as signing up new users, deleting accounts, suspending and unsuspending accounts, and handling account imports and exports.
NotificationsRevise
References: app/services
, app/workers/web
The …/services
directory contains a collection of service classes that handle various aspects of the Mastodon application's functionality, including the delivery of push notifications to subscribed clients.
Administrative TasksRevise
References: app/services
, app/workers/scheduler
The …/services
directory contains a collection of service classes that handle various administrative and moderation tasks in the Mastodon application. These services are responsible for performing tasks such as purging domains, cleaning up old user accounts and statuses, maintaining the search index, and capturing PostgreSQL space statistics.
MiscellaneousRevise
The …/concerns
directory contains a set of modules that provide common functionality to Sidekiq workers in the Mastodon application. These modules are "concerns" that can be included in worker classes to add specific behaviors or retry strategies.
Database ManagementRevise
References: db
The db
directory contains the database-related components of the Mastodon application, including database migration scripts, post-migration scripts, seed data, and database views. This directory is crucial for the proper functioning and evolution of the Mastodon application's data infrastructure.
Database MigrationsRevise
References: db/migrate
The …/migrate
directory contains a set of database migration scripts that are responsible for creating and modifying the database schema as the Mastodon application evolves. These migrations cover a wide range of functionality, including:
Post-Migration ScriptsRevise
References: db/post_migrate
The …/post_migrate
directory contains a collection of database migration scripts for the Mastodon application. These migrations are designed to be executed after the main database schema changes have been applied, and they perform various tasks such as:
Seed DataRevise
References: db/seeds
The …/seeds
directory contains several files that are responsible for setting up the initial state of the Mastodon application's database. These files create various entities, such as the instance actor account, user roles, and an administrative user account, which are necessary for the proper functioning of the Mastodon platform.
Database ViewsRevise
References: db/views
The …/views
directory contains several SQL view definitions that provide summarized and aggregated information about various aspects of the Mastodon application. These views are designed to simplify and optimize common data retrieval tasks.
Client-side FunctionalityRevise
References: app/javascript
The Mastodon web application's client-side functionality is implemented in the …/javascript
directory, which contains a wide range of components, actions, reducers, and utility functions that handle various features and behaviors of the application.
ActionsRevise
References: app/javascript/mastodon/actions
The …/actions
directory contains a comprehensive set of actions and action creators that manage the state of various features in the Mastodon application. These actions handle functionality related to accounts, announcements, bookmarks, columns, compose, conversations, custom emojis, directory, domain blocks, dropdown menus, favorites, featured tags, filters, height cache, history, interactions, languages, lists, markers, modals, mutes, notifications, onboarding, and picture-in-picture.
API TypesRevise
References: app/javascript/mastodon/api_types
The …/api_types
directory defines TypeScript interfaces and types for the various JSON objects used in the Mastodon API, including accounts, custom emojis, markers, media attachments, polls, relationships, and statuses.
ComponentsRevise
References: app/javascript/mastodon/components
The …/components
directory contains a variety of React components that are used throughout the Mastodon application. These components provide functionality for rendering user avatars, displaying account information, handling dropdown menus, rendering hashtags, and more.
ContainersRevise
References: app/javascript/mastodon/containers
The …/containers
directory contains the main entry points for various features and functionalities of the Mastodon application, including account management, compose, domain blocking, dropdown menus, media handling, polls, scrolling, and status rendering.
FeaturesRevise
References: app/javascript/mastodon/features
The …/list_adder
directory contains the implementation of the "List Adder" feature in the Mastodon application. This feature allows users to manage the lists they have created and add or remove accounts to those lists.
LocalesRevise
References: app/javascript/mastodon/locales
The …/locales
directory manages the internationalization and localization functionality of the Mastodon application, including loading and setting the appropriate locale data.
ModelsRevise
References: app/javascript/mastodon/models
The …/models
directory defines data models and utility functions for various entities in the Mastodon application, such as accounts, custom emojis, relationships, and statuses.
ReducersRevise
References: app/javascript/mastodon/reducers
The …/reducers
directory contains a collection of Redux reducers that manage the state of various features and components in the Mastodon application.
SelectorsRevise
References: app/javascript/mastodon/selectors
The …/selectors
directory contains utility functions and data structures that are used to retrieve and manipulate data from the Redux store in the Mastodon application.
Service WorkerRevise
References: app/javascript/mastodon/service_worker
The …/service_worker
directory contains the code responsible for the service worker functionality in the Mastodon web application. The key features implemented in this directory include:
StoreRevise
References: app/javascript/mastodon/store
The …/store
directory provides the core state management functionality for the Mastodon application. This includes the configuration of the Redux store, middleware functions for handling cross-cutting concerns, and utility functions for working with the store in a type-safe manner.
UtilitiesRevise
References: app/javascript/mastodon/utils
The …/utils
directory contains a collection of utility functions and types that are used throughout the Mastodon project, covering a wide range of functionality.
Serializers and PresentersRevise
References: app/serializers
, app/presenters
The Serializers and Presenters section covers the serializers and presenters responsible for converting Mastodon's internal data structures into different formats, including ActivityPub, NodeInfo, and the application's REST API responses.
ActivityPub SerializersRevise
References: app/serializers/activitypub
The …/activitypub
directory contains a collection of serializers responsible for converting various Mastodon objects into ActivityPub-compliant JSON format. These serializers handle the serialization of different types of ActivityPub entities, such as actors (users), notes (statuses), collections, and various activities (like, follow, delete, etc.).
NodeInfo SerializersRevise
References: app/serializers/node_info
The …/node_info
directory contains two important files that are responsible for serializing the discovery information and the overall Mastodon instance information, following the NodeInfo 2.0 specification.
REST API SerializersRevise
References: app/serializers/rest
The …/rest
directory contains a collection of serializers responsible for converting various Mastodon data structures into a format suitable for the REST API. The key functionality of this directory includes:
Web SerializersRevise
References: app/serializers/web
The …/notification_serializer.rb
file contains the Web::NotificationSerializer
class, which is responsible for formatting notification data for web-based clients in the Mastodon application.
Other SerializersRevise
References: app/serializers
The …/initial_state_serializer.rb
file contains the InitialStateSerializer
class, which is responsible for serializing the initial state of the Mastodon application. This includes various user-specific settings and preferences, as well as instance-level information.
PresentersRevise
References: app/presenters
The …/presenters
directory contains various presenter classes that are responsible for managing and presenting data in the Mastodon application. These presenters serve as intermediaries between the models and the views, providing a consistent and organized way to work with the data.
Utility LibrariesRevise
References: app/lib
The …/lib
directory contains a wide range of utility functionality that is crucial to the Mastodon application. This includes:
ActivityPub IntegrationRevise
The …/activitypub
directory contains the core functionality for handling ActivityPub-related activities and data within the Mastodon application. This includes classes and modules responsible for parsing, processing, and serializing ActivityPub payloads, as well as managing the various entities and relationships involved in the ActivityPub protocol.
Administrative FeaturesRevise
References: app/lib/admin
, app/lib/admin/metrics
, app/lib/admin/system_check
The …/admin
directory contains the core functionality for the administrative features of the Mastodon application. This directory is divided into several sub-directories, each focusing on a specific aspect of the admin interface.
Connection Pool ManagementRevise
References: app/lib/connection_pool
The ConnectionPool::SharedConnectionPool
class is responsible for managing a shared connection pool that can be used by multiple threads in the Mastodon application. This class is a subclass of the ConnectionPool
class from the connection_pool
gem and provides methods for checking out, checking in, and flushing connections.
Data ImportingRevise
References: app/lib/importer
The …/importer
directory contains a set of classes responsible for importing various types of data into Elasticsearch indices used by the Mastodon application. These classes handle tasks such as batching, parallelism, progress tracking, and index optimization to efficiently import data into the various Elasticsearch indices.
RSS Feed GenerationRevise
References: app/lib/rss
The Mastodon application provides core functionality for handling RSS feeds within the …/rss
directory. The main components in this directory are:
Translation ServicesRevise
References: app/lib/translation_service
The …/translation_service
directory contains the implementation of the translation functionality in the Mastodon application, including support for the DeepL and LibreTranslate APIs.
Other Utility FunctionalityRevise
References: app/lib/vacuum
, app/lib/node_info
, app/lib/ostatus
, app/lib/webhooks
The …/vacuum
directory contains several classes that are responsible for cleaning up and maintaining various aspects of the Mastodon application. These classes perform tasks such as: