├── class_map └── GuzzleHttp │ └── Client.php ├── storage └── view │ ├── search.blade.php │ ├── status.blade.php │ └── index.blade.php ├── config ├── autoload │ ├── crontab.php │ ├── es.php │ ├── aspects.php │ ├── processes.php │ ├── dependencies.php │ ├── translation.php │ ├── listeners.php │ ├── middlewares.php │ ├── annotations.php │ ├── cache.php │ ├── passport.php │ ├── encryption.php │ ├── session.php │ ├── redis.php │ ├── nsq.php │ └── commands.php ├── container.php └── config.php ├── app ├── Exception │ ├── JsonResponseException.php │ ├── AttachmentDownloadException.php │ ├── InboxException.php │ ├── HttpResponseException.php │ └── AppException.php ├── Nsq │ ├── NsqQueueMessage.php │ ├── Consumer │ │ ├── StatusFaveConsumer.php │ │ ├── FollowConsumer.php │ │ ├── StatusReBlogConsumer.php │ │ └── NsqQueueMessageConsumer.php │ └── AnnotationNsqJob.php ├── Resource │ ├── Mastodon │ │ ├── Model │ │ │ ├── AccountRoleModel.php │ │ │ ├── InstanceV2UsageModel.php │ │ │ ├── InstanceRuleModel.php │ │ │ ├── HostmetaModel.php │ │ │ ├── NodeInfoUsersModel.php │ │ │ ├── MultiStatusModel.php │ │ │ ├── MediaMetaModel.php │ │ │ ├── AdminActionResponseModel.php │ │ │ ├── NodeInfoUsageModel.php │ │ │ ├── LinkModel.php │ │ │ ├── NodeInfoServicesModel.php │ │ │ ├── InstanceRuleCreateRequestModel.php │ │ │ ├── InstanceRuleUpdateRequestModel.php │ │ │ ├── SearchResultModel.php │ │ │ ├── StatusContextModel.php │ │ │ ├── UpdateFieldModel.php │ │ │ ├── InstanceV2UsersModel.php │ │ │ ├── NodeInfoSoftwareModel.php │ │ │ ├── EmojiCategoryModel.php │ │ │ ├── DomainKeysExpireRequestModel.php │ │ │ ├── InstanceConfigurationEmojisModel.php │ │ │ ├── InstanceV1URLsModel.php │ │ │ ├── InstanceV2URLsModel.php │ │ │ ├── PollOptionModel.php │ │ │ ├── InstanceV2ConfigurationTranslationModel.php │ │ │ ├── MultiStatusMetadataModel.php │ │ │ ├── MediaFocusModel.php │ │ │ ├── InstanceV2ContactModel.php │ │ │ ├── WellKnownResponseModel.php │ │ │ ├── HeaderFilterCreateRequestModel.php │ │ │ ├── InstanceV1ConfigurationModel.php │ │ │ ├── AdvancedVisibilityFlagsFormModel.php │ │ │ ├── MultiStatusEntryModel.php │ │ │ ├── InstanceV2ThumbnailVersionsModel.php │ │ │ ├── ListModel.php │ │ │ ├── InstanceV2ConfigurationModel.php │ │ │ ├── FieldModel.php │ │ │ ├── TagModel.php │ │ │ ├── UpdateSourceModel.php │ │ │ ├── EmojiUpdateRequestModel.php │ │ │ ├── InstanceV2RegistrationsModel.php │ │ │ ├── DebugAPUrlResponseModel.php │ │ │ ├── EmojiCreateRequestModel.php │ │ │ ├── OauthTokenModel.php │ │ │ ├── NodeinfoModel.php │ │ │ ├── DomainModel.php │ │ │ ├── SwaggerCollectionModel.php │ │ │ ├── InstanceConfigurationPollsModel.php │ │ │ ├── MentionModel.php │ │ │ ├── InstanceConfigurationAccountsModel.php │ │ │ ├── EmojiModel.php │ │ │ └── InstanceConfigurationStatusesModel.php │ │ ├── FeaturedTagsCollection.php │ │ ├── TagCollection.php │ │ ├── AccountCollection.php │ │ ├── StatusCollection.php │ │ ├── AttachmentCollection.php │ │ ├── StatusEditCollection.php │ │ ├── InstanceRuleCollection.php │ │ ├── SearchResource.php │ │ ├── StatusSource.php │ │ ├── FilterKeywordCollection.php │ │ ├── TokenResource.php │ │ ├── FilterResultCollection.php │ │ ├── ApplicationResource.php │ │ ├── MentionCollection.php │ │ ├── TagResource.php │ │ ├── EmojiCollection.php │ │ ├── ContextResource.php │ │ ├── RelationshipCollection.php │ │ ├── V1FilterCollection.php │ │ └── FilterResource.php │ ├── StatusResource.php │ └── StatusPaginateResource.php ├── Service │ ├── MuteService.php │ ├── BlockService.php │ ├── FavouriteService.php │ ├── BookmarkService.php │ ├── Mastodon │ │ └── BearerTokenResponse.php │ └── CacheService.php ├── QueryBuilder │ ├── Mastodon │ │ ├── TimelineHashtagQueryBuilder.php │ │ └── TimelineQueryBuilder.php │ └── QueryBuildable.php ├── Model │ ├── Concerns │ │ └── StatusWaitAttachment.php │ ├── Model.php │ ├── Admin │ │ ├── UserRole.php │ │ ├── InstanceRule.php │ │ ├── RolePermission.php │ │ ├── ServerSettings.php │ │ ├── Permission.php │ │ └── PermissionGroup.php │ ├── EmailDomainBlock.php │ ├── CustomEmojiCategory.php │ ├── Block.php │ ├── ListModel.php │ ├── Migration.php │ ├── Scope │ │ └── StatusWaitAttachmentScope.php │ ├── PreviewCardsStatus.php │ ├── CustomEmoji.php │ ├── UnavailableDomain.php │ ├── WalletAddressLog.php │ ├── SiteConfig.php │ ├── FollowHashtag.php │ ├── App.php │ ├── Setting.php │ ├── StatusesHashtag.php │ ├── StatusHashtag.php │ ├── ListAccount.php │ └── PollVote.php ├── Controller │ ├── Mastodon │ │ └── V1 │ │ │ ├── ListsController.php │ │ │ ├── MarkerController.php │ │ │ ├── FeaturedTagController.php │ │ │ ├── TagController.php │ │ │ ├── CustomEmojiController.php │ │ │ ├── FilterController.php │ │ │ └── BlockController.php │ ├── RuleController.php │ ├── RecommendController.php │ ├── View │ │ ├── IndexController.php │ │ ├── AccountController.php │ │ └── StatusController.php │ └── Admin │ │ └── SettingController.php ├── Util │ └── Table.php ├── Schema │ └── BookmarkSchema.php ├── Aspect │ └── Annotation │ │ └── ExecTimeLogger.php ├── Request │ ├── Admin │ │ ├── SettingRequest.php │ │ ├── RoleRequest.php │ │ ├── ReportRequest.php │ │ ├── EmailDomainBlockRequest.php │ │ ├── ReportNoteRequest.php │ │ ├── InstanceSettingRequest.php │ │ ├── Settings │ │ │ ├── AboutRequest.php │ │ │ └── BrandingRequest.php │ │ └── UserRequest.php │ ├── ListRequest.php │ ├── BlockRequest.php │ ├── AttachmentRequest.php │ ├── BillRequest.php │ ├── SubscribeRequest.php │ ├── MuteRequest.php │ ├── ChangePasswordRequest.php │ ├── WithdrawRequest.php │ ├── ImportRequest.php │ ├── WalletRequest.php │ ├── Mastodon │ │ ├── MediaRequest.php │ │ ├── AppsRequest.php │ │ ├── PaginateRequest.php │ │ ├── RegRequest.php │ │ ├── AuthorizeRequest.php │ │ ├── ReportRequest.php │ │ └── TokenRequest.php │ ├── RelayRequest.php │ ├── FollowRecommendationRequest.php │ ├── SiteConfigRequest.php │ ├── FilterRequest.php │ ├── IpBlockRequest.php │ ├── ResetPasswordRequest.php │ ├── PayLogRequest.php │ ├── DirectMessageRequest.php │ ├── SearchRequest.php │ ├── LikeRequest.php │ ├── FollowRequest.php │ ├── StatuesRequest.php │ └── ThingSettingRequest.php ├── Middleware │ ├── OAuthOrRedirectToLoginMiddleware.php │ ├── OAuthClientMiddleware.php │ └── AuthMiddleware.php └── Listener │ └── ResumeExitCoordinatorListener.php ├── .gitignore ├── test └── Cases │ ├── EmailServiceTest.php │ └── ExampleTest.php ├── docs ├── supervisor.conf └── nginx.conf └── migrations ├── 2024_03_07_073800_add_fields_to_account.php ├── 2024_03_01_091346_add_focus_to_attachment.php ├── 2024_06_19_094803_add_mode_to_relay.php ├── 2024_04_15_124502_add_deleted_at_to_status.php ├── 2024_07_15_085144_add_fee_to_status.php ├── 2023_12_21_061641_create_instace_rule_table.php ├── 2024_03_07_115649_add_edited_at_to_status.php ├── 2024_03_27_073804_create_email_domain_block.php ├── 2024_02_28_073239_add_client_to_account.php ├── 2024_03_09_040512_add_expires_in_to_filter_table.php ├── 2024_06_25_123037_create_unavailable_domain_table.php ├── 2024_03_07_074437_add_application_id_to_status.php ├── 2024_08_28_074739_add_reward_type_to_pay_log.php ├── 2024_02_21_135920_add_column_spoiler_text_to_status.php ├── 2023_12_26_024635_create_role_table.php ├── 2024_03_27_090949_add_report_id_nullable_to_account_warning.php ├── 2024_07_30_090523_add_index_to_status_fave.php ├── 2024_01_17_073050_add_published_at_to_status.php ├── 2024_01_24_055606_change_name_type_text_to_attachment.php ├── 2024_06_12_020038_add_status_to_attachment.php ├── 2024_06_17_113221_add_wallet_address_to_account.php ├── 2024_07_17_080614_add_deleted_account_to_conversation.php ├── 2023_12_01_055521_preview_card_status.php ├── 2024_08_07_060146_add_unread_num_to_account_subscriber_log.php ├── 2023_12_26_032701_create_permission_group_table.php ├── 2024_01_08_141514_create_oauth_personal_access_clients_table.php ├── 2024_02_04_121934_add_thumbnail_url_to_previewcard.php ├── 2024_03_19_115957_add_manually_approves_follower_to_account.php ├── 2024_04_26_044411_add_enable_activitypub_to_status.php ├── 2024_07_03_071813_add_is_display_sensitive_to_account.php ├── 2024_09_05_055042_change_description_length_for_preview_card.php ├── 2024_06_26_115859_create_wallet_address_logs_table.php ├── 2024_01_08_141417_create_oauth_refresh_tokens_table.php ├── 2024_08_07_060050_add_target_account_id_to_status_unlock_log.php ├── 2024_03_27_071735_add_enable_activitypub_to_account.php ├── 2024_04_15_090554_create_report_note_table.php ├── 2024_03_19_093219_add_file_size_to_attachment.php ├── 2024_07_15_085122_add_fee_plan_to_account.php ├── 2024_07_31_111233_add_notification_notify_type_default_value.php ├── 2023_12_26_024650_create_permission_table.php ├── 2024_01_09_080704_create_setting_table.php ├── 2024_07_30_084921_add_views_to_status_table.php ├── 2024_07_30_090506_add_index_to_status_mention.php ├── 2024_04_15_131605_create_admin_action_log_table.php ├── 2024_03_19_062511_create_follow_request_table.php ├── 2023_12_05_093621_create_block_table.php ├── 2024_07_23_092529_create_follow_hashtag_table.php ├── 2024_02_21_081401_add_meta_to_attachment.php ├── 2024_03_14_055855_create_relay_table.php ├── 2024_09_03_111337_drop_wallet_address_index_to_account.php ├── 2023_12_26_024724_create_role_permission_table.php ├── 2024_06_14_065932_add_index_to_notification.php ├── 2023_11_13_104829_create_bookmark_table.php ├── 2024_01_08_141309_create_oauth_codes_table.php ├── 2024_02_04_062012_add_thumbnail_url_to_attachment.php ├── 2024_03_22_095206_add_index_uri_url_to_status.php ├── 2023_12_05_093922_create_mute_table.php ├── 2024_03_29_082554_create_export_table.php ├── 2024_04_18_120952_create_thing_setting_table.php ├── 2024_03_25_073626_create_instance_table.php └── 2024_03_22_095124_add_index_uri_to_account.php /class_map/GuzzleHttp/Client.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/view/search.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/autoload/crontab.php: -------------------------------------------------------------------------------- 1 | true, 5 | ]; -------------------------------------------------------------------------------- /storage/view/status.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | @section('content') 3 | 4 | @endsection -------------------------------------------------------------------------------- /config/autoload/es.php: -------------------------------------------------------------------------------- 1 | [env('ES_LINK')], 7 | 'api_id' => '', 8 | 'api_key' => '', 9 | ]; -------------------------------------------------------------------------------- /storage/view/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | @section('content') 3 | @foreach ($statuses as $status) 4 | @include('common.tweet', ['status' => $status]) 5 | @endforeach 6 | @include('common.page') 7 | @endsection 8 | -------------------------------------------------------------------------------- /app/Exception/JsonResponseException.php: -------------------------------------------------------------------------------- 1 | paginate()->pluck('target_account_id'); 13 | return Account::whereIn('id',$muteAccountIds)->get(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | .phpintel/ 10 | .env 11 | .DS_Store 12 | .phpunit* 13 | *.cache 14 | .vscode/ 15 | deploy.test.yml 16 | LICENSE 17 | phpstan.neon 18 | public 19 | storage/swagger/http.json 20 | storage/twitter-json 21 | .env.prod 22 | storage/keys 23 | docker-compose.yml 24 | app/Command/SyncTwitterListCommand.php -------------------------------------------------------------------------------- /app/QueryBuilder/Mastodon/TimelineHashtagQueryBuilder.php: -------------------------------------------------------------------------------- 1 | query->whereHas('hashtags',fn ($q) => $q->whereIn('name',$values)) ; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceRuleCreateRequestModel.php: -------------------------------------------------------------------------------- 1 | App\Middleware\CoreMiddleware::class, 14 | ]; 15 | -------------------------------------------------------------------------------- /app/Service/BlockService.php: -------------------------------------------------------------------------------- 1 | paginate()->pluck('target_account_id'); 14 | return Account::whereIn('id',$blockAccountIds)->get(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Exception/HttpResponseException.php: -------------------------------------------------------------------------------- 1 | 'zh_CN', 14 | 'fallback_locale' => 'en', 15 | 'path' => BASE_PATH . '/storage/languages', 16 | ]; 17 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/FeaturedTagsCollection.php: -------------------------------------------------------------------------------- 1 | response->json([]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV2UsersModel.php: -------------------------------------------------------------------------------- 1 | queryBuilder = new $queryBuilder(); 12 | $this->queryBuilder->setup($this->removeEmptyInput($input), $query); 13 | return $this->queryBuilder->handle($query); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/DomainKeysExpireRequestModel.php: -------------------------------------------------------------------------------- 1 | atomic = new Atomic(); 14 | } 15 | 16 | public static function getInstance() 17 | { 18 | if (!self::$_obj instanceof self) { 19 | self::$_obj = new self(); 20 | } 21 | return self::$_obj; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceConfigurationEmojisModel.php: -------------------------------------------------------------------------------- 1 | query->where('is_local',1); 12 | } 13 | 14 | public function remote($value) 15 | { 16 | $this->query->where('is_local',0); 17 | } 18 | 19 | public function onlyMedia($value) 20 | { 21 | $this->query->whereHas('attachments'); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV2ContactModel.php: -------------------------------------------------------------------------------- 1 | [ 17 | \App\Middleware\CorsMiddleware::class, 18 | \Hyperf\Validation\Middleware\ValidationMiddleware::class, 19 | \Hyperf\Session\Middleware\SessionMiddleware::class, 20 | ], 21 | ]; 22 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/TagCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Hashtag $hashtag) { 19 | return TagResource::make($hashtag); 20 | })->toArray(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Model/CustomEmojiCategory.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Account $account) { 19 | return AccountResource::make($account); 20 | })->toArray(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV1ConfigurationModel.php: -------------------------------------------------------------------------------- 1 | 'required|between:3,255', 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/StatusCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Status $status) { 19 | return StatusResource::make($status); 20 | })->toArray(); 21 | 22 | } 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/AttachmentCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Attachment $attachment) { 19 | return AttachmentResource::make($attachment); 20 | })->toArray(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/StatusEditCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (StatusEdit $statusEdit) { 19 | return StatusEditResource::make($statusEdit); 20 | })->toArray(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Request/BlockRequest.php: -------------------------------------------------------------------------------- 1 | 'required|exists:account,id' 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/InstanceRuleCollection.php: -------------------------------------------------------------------------------- 1 | collection->map(function ($rule, $key) { 18 | $id = $key + 1; 19 | return ['id' => (string)$id, 'text' => (string)$rule->text]; 20 | })->toArray(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Cases/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 25 | $this->assertTrue(is_array($this->get('/'))); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/AdvancedVisibilityFlagsFormModel.php: -------------------------------------------------------------------------------- 1 | orderBy('followers_count','desc')->paginate(10); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:mastodon_php] 2 | command=/usr/bin/php /home/mastodon_php/bin/hyperf.php start ; 要执行的程序或命令 3 | directory=/home/mastodon_php ; 程序的工作目录 4 | autostart=true ; 是否在 supervisor 启动时自动启动该程序 5 | autorestart=true ; 是否在程序退出时自动重启 6 | startsecs=3 ; 程序启动的等待时间 7 | user=root ; 程序运行的用户 8 | redirect_stderr=true ; 是否将标准错误输出重定向到日志文件 9 | stdout_logfile=/var/log/supervisor/mastodon_php.log ; 标准输出日志文件路径 10 | stdout_logfile_maxbytes=10MB ; 标准输出日志文件大小上限 11 | stdout_logfile_backups=5 -------------------------------------------------------------------------------- /app/Request/AttachmentRequest.php: -------------------------------------------------------------------------------- 1 | 'file|mimes:jpg,jpeg,png,mp4,mov|max:256000000', 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Resource/StatusResource.php: -------------------------------------------------------------------------------- 1 | resource instanceof Status) { 20 | return []; 21 | } 22 | $status = $this->resource; 23 | $this->setUnlockAttachmentsByStatus($status); 24 | return $status->toArray(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/MultiStatusEntryModel.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'paths' => [ 16 | BASE_PATH . '/app', 17 | ], 18 | 'ignore_annotations' => [ 19 | 'mixin', 20 | ], 21 | 'class_map' => [ 22 | // Client::class => BASE_PATH . '/class_map/GuzzleHttp/Client.php', 23 | ], 24 | ], 25 | ]; 26 | -------------------------------------------------------------------------------- /config/container.php: -------------------------------------------------------------------------------- 1 | 'nullable|string', 26 | 'trade_type' => 'nullable|string' 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Model/Block.php: -------------------------------------------------------------------------------- 1 | hasOne(Account::class,'id','target_account_id'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Request/SubscribeRequest.php: -------------------------------------------------------------------------------- 1 | 'integer|in:1,2,3,4', 26 | 'hash' => 'required|string', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV2ThumbnailVersionsModel.php: -------------------------------------------------------------------------------- 1 | AccountCollection::make($this->resource['accounts']), 19 | 'statuses' => StatusCollection::make($this->resource['statuses']), 20 | 'hashtags' => TagCollection::make($this->resource['hashtags']), 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Model/ListModel.php: -------------------------------------------------------------------------------- 1 | timelineService->index(); 22 | return view('index',compact('statuses')); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /config/autoload/cache.php: -------------------------------------------------------------------------------- 1 | [ 14 | 'driver' => Hyperf\Cache\Driver\RedisDriver::class, 15 | 'packer' => Hyperf\Codec\Packer\PhpSerializerPacker::class, 16 | 'prefix' => 'c:', 17 | ], 18 | 'co' => [ 19 | 'driver' => Hyperf\Cache\Driver\CoroutineMemoryDriver::class, 20 | 'packer' => Hyperf\Codec\Packer\PhpSerializerPacker::class, 21 | ], 22 | ]; 23 | -------------------------------------------------------------------------------- /app/Request/Admin/RoleRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string|min:3|max:200', 26 | 'permission.ids' => 'array', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Request/MuteRequest.php: -------------------------------------------------------------------------------- 1 | 'required|exists:account,id', 26 | 'duration' => 'required' 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Controller/Mastodon/V1/TagController.php: -------------------------------------------------------------------------------- 1 | 'storage', 9 | 'client_uuids' => true, 10 | 'key' => 'CpmLVtjV8diGbhEsVD3IWoVOn31pRpmupEcxMCgtXp9LGpe39F', 11 | 'token_days' => null, 12 | 'refresh_token_days' => null, 13 | 'person_token_days' => null, 14 | 'private_key' => BASE_PATH.'/storage/oauth-private.key', 15 | 'public_key' => BASE_PATH.'/storage/oauth-public.key', 16 | 'storage' => [ 17 | 'database' => [ 18 | 'connection' => env('DB_CONNECTION', 'default'), 19 | ], 20 | ], 21 | ]; 22 | -------------------------------------------------------------------------------- /app/Request/ChangePasswordRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'password'=>'required|string|between:6,18' 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV2ConfigurationModel.php: -------------------------------------------------------------------------------- 1 | 'integer', 'batch' => 'integer']; 30 | } 31 | -------------------------------------------------------------------------------- /app/Request/Admin/ReportRequest.php: -------------------------------------------------------------------------------- 1 | 'in:1,2', 26 | 'source' => 'in:0,1,2', 27 | 'domain' => 'nullable', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Service/FavouriteService.php: -------------------------------------------------------------------------------- 1 | latest() 14 | ->paginate() 15 | ->pluck('status_id') 16 | ->toArray(); 17 | if(!$favoruiteStatusIds){ 18 | return []; 19 | } 20 | return Status::withInfo($account)->whereIn('id',$favoruiteStatusIds) 21 | ->orderByRaw("FIELD(id, " . implode(',', $favoruiteStatusIds) . ")") 22 | ->get(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Request/WithdrawRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'address'=>'required|string', 27 | 'amount'=>'required|string' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/FieldModel.php: -------------------------------------------------------------------------------- 1 | 'required|file', 26 | 'type' => 'required|in:1,2,3,4,5,6', 27 | 'mode' => 'required|in:1,2', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Request/WalletRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 26 | 'signature'=>'required', 27 | 'wallet_address'=> 'required|unique:account' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Model/Admin/Permission.php: -------------------------------------------------------------------------------- 1 | belongsTo(PermissionGroup::class,'group_id','id'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/TagModel.php: -------------------------------------------------------------------------------- 1 | hasMany(Permission::class, 'group_id', 'id'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Model/Scope/StatusWaitAttachmentScope.php: -------------------------------------------------------------------------------- 1 | whereDoesntHave('attachments', fn ($q) => $q->where('status', '=', Attachment::STATUS_WAIT)); 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /app/Request/Admin/EmailDomainBlockRequest.php: -------------------------------------------------------------------------------- 1 | 'required|unique:email_domain_block' 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/StatusSource.php: -------------------------------------------------------------------------------- 1 | resource instanceof Status) { 19 | return []; 20 | } 21 | $status = $this->resource; 22 | return [ 23 | 'id' => (string) $status->id, 24 | 'text' => (string) $status->content, 25 | 'spoiler_text' => '', 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/Admin/ReportNoteRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 26 | 'report_id' => 'required', 27 | 'is_resolve' => 'nullable|in:1,2', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /config/autoload/encryption.php: -------------------------------------------------------------------------------- 1 | 'aes', 15 | 16 | 'driver' => [ 17 | 'aes' => [ 18 | 'class' => \HyperfExt\Encryption\Driver\AesDriver::class, 19 | 'options' => [ 20 | 'key' => env('AES_KEY', 'e5gXiqTZ6s2yzYeSz635lg=='), 21 | 'cipher' => env('AES_CIPHER', 'AES-128-CBC'), 22 | ], 23 | ], 24 | ], 25 | ]; 26 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/FilterKeywordCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function ($kw) { 18 | return [ 19 | 'id' => (string) $kw['key'], 20 | 'keyword' => (string) $kw['kw'], 21 | 'whole_word' => (bool) $kw['whole_word'], 22 | ]; 23 | })->toArray(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Resource/StatusPaginateResource.php: -------------------------------------------------------------------------------- 1 | resource instanceof LengthAwarePaginator) { 20 | return []; 21 | } 22 | $statusPaginator = $this->resource; 23 | $this->setUnlockAttachmentsByStatusPaginator($statusPaginator); 24 | return $statusPaginator->toArray(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /migrations/2024_03_07_073800_add_fields_to_account.php: -------------------------------------------------------------------------------- 1 | json('fields')->nullable(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account', function (Blueprint $table) { 25 | $table->dropColumn('fields'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/Mastodon/MediaRequest.php: -------------------------------------------------------------------------------- 1 | 'required|file', 26 | 'thumbnail' => 'image', 27 | 'description' => 'string', 28 | 'focus' => 'string', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/UpdateSourceModel.php: -------------------------------------------------------------------------------- 1 | string('focus', 16)->nullable(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('attachment', function (Blueprint $table) { 25 | $table->dropColumn('focus'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_06_19_094803_add_mode_to_relay.php: -------------------------------------------------------------------------------- 1 | boolean('mode')->nullable()->comment('同步模式:1 只读 2 只写'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('relay', function (Blueprint $table) { 25 | $table->dropColumn('mode'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/Admin/InstanceSettingRequest.php: -------------------------------------------------------------------------------- 1 | 'filled|in:0,1', 26 | 'is_proxy'=>'filled|in:0,1', 27 | 'is_disable_sync'=>'filled|in:0,1', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /migrations/2024_04_15_124502_add_deleted_at_to_status.php: -------------------------------------------------------------------------------- 1 | dateTime('deleted_at')->nullable(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('deleted_at'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_07_15_085144_add_fee_to_status.php: -------------------------------------------------------------------------------- 1 | string('fee')->nullable()->comment('订阅价格/大于0即是允许付费订阅'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('fee'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2023_12_21_061641_create_instace_rule_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->text('text')->comment('规则说明文字'); 17 | $table->datetimes(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('instance_rule'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Exception/AppException.php: -------------------------------------------------------------------------------- 1 | getMessage()); 24 | if($transMessage){ 25 | return $transMessage; 26 | } 27 | return $this->message; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Request/RelayRequest.php: -------------------------------------------------------------------------------- 1 | ['required', Rule::unique('relay')->where(function ($query) { 27 | $query->whereNull('deleted_at'); 28 | })] 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_03_07_115649_add_edited_at_to_status.php: -------------------------------------------------------------------------------- 1 | dateTime('edited_at')->nullable()->comment('编辑时间'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('edited_at'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_03_27_073804_create_email_domain_block.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('domain')->unique(); 17 | $table->datetimes(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('email_domain_block'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Model/PreviewCardsStatus.php: -------------------------------------------------------------------------------- 1 | 'integer', 'status_id' => 'integer']; 31 | } 32 | -------------------------------------------------------------------------------- /app/Request/FollowRecommendationRequest.php: -------------------------------------------------------------------------------- 1 | 'array', 26 | 'language' => 'nullable', 27 | 'status' => 'in:1,2', 28 | 'batch_checkbox_all' => '0,1', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/TokenResource.php: -------------------------------------------------------------------------------- 1 | (int) $this->resource['created_at'], 19 | 'scope' => (string) $this->resource['scope'], 20 | 'token_type' => (string) $this->resource['token_type'], 21 | 'expires_in' => (int) $this->resource['expires_in'], 22 | 'access_token' => (string) $this->resource['access_token'], 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /migrations/2024_02_28_073239_add_client_to_account.php: -------------------------------------------------------------------------------- 1 | tinyInteger('client')->nullable()->comment('1: 网页端 2:app'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account', function (Blueprint $table) { 25 | $table->dropColumn('client'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_03_09_040512_add_expires_in_to_filter_table.php: -------------------------------------------------------------------------------- 1 | unsignedInteger('expires_in')->nullable(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('filter', function (Blueprint $table) { 25 | $table->dropColumn('expires_in'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_06_25_123037_create_unavailable_domain_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('domain'); 17 | $table->datetimes(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('unavailable_domain'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_03_07_074437_add_application_id_to_status.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('application_id')->nullable(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('application_id'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_08_28_074739_add_reward_type_to_pay_log.php: -------------------------------------------------------------------------------- 1 | tinyInteger('reward_type')->nullable()->comment('打赏类型'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('pay_log', function (Blueprint $table) { 25 | $table->dropColumn('reward_type'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/Mastodon/AppsRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'redirect_uris' => 'required|string', 27 | 'scopes' => 'nullable|string', 28 | 'website' => 'nullable|string', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/FilterResultCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Filter $filter) { 20 | return [ 21 | 'filter' => FilterResource::make($filter), 22 | 'keyword_matches' => [], 23 | 'status_matches' => [], 24 | ]; 25 | })->toArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Service/BookmarkService.php: -------------------------------------------------------------------------------- 1 | latest() 14 | ->paginate() 15 | ->pluck('status_id') 16 | ->toArray(); 17 | if(!$bookmarkStatusIds){ 18 | return []; 19 | } 20 | return Status::withInfo($account) 21 | ->orderByRaw("FIELD(id, " . implode(',', $bookmarkStatusIds) . ")") 22 | ->whereIn('id',$bookmarkStatusIds)->get(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /migrations/2024_02_21_135920_add_column_spoiler_text_to_status.php: -------------------------------------------------------------------------------- 1 | text('spoiler_text')->nullable()->comment(''); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('spoiler_text'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2023_12_26_024635_create_role_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 16 | $table->string('name', 255)->unique(); 17 | $table->string('description', 255)->nullable(); 18 | $table->datetimes(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('role'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /migrations/2024_03_27_090949_add_report_id_nullable_to_account_warning.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('report_id')->nullable()->change(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account_warning', function (Blueprint $table) { 25 | // 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_07_30_090523_add_index_to_status_fave.php: -------------------------------------------------------------------------------- 1 | index('target_account_id', 'idx_target_account_id'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status_fave', function (Blueprint $table) { 25 | $table->dropIndex('idx_target_account_id'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/Mastodon/PaginateRequest.php: -------------------------------------------------------------------------------- 1 | 'nullable|string', 26 | 'since_id' => 'nullable|string', 27 | 'min_id' => 'nullable|string', 28 | 'limit' => 'nullable|integer|between:1,200', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/ApplicationResource.php: -------------------------------------------------------------------------------- 1 | resource; 18 | return [ 19 | 'id' => (string) $client->id, 20 | 'name' => $client->name, 21 | 'website' => null, 22 | 'redirect_uri' => $client->redirect, 23 | 'client_id' => (string) $client->id, 24 | 'client_secret' => $client->secret, 25 | 'vapid_key' => null 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_01_17_073050_add_published_at_to_status.php: -------------------------------------------------------------------------------- 1 | dateTime('published_at')->nullable()->comment('远程推文发布时间')->after('pinned_at'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('published_at'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_01_24_055606_change_name_type_text_to_attachment.php: -------------------------------------------------------------------------------- 1 | text('name')->nullable()->comment('media name')->change(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('attachment', function (Blueprint $table) { 25 | $table->dropColumn('name'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_06_12_020038_add_status_to_attachment.php: -------------------------------------------------------------------------------- 1 | unsignedTinyInteger('status')->after('tid')->default(1)->comment('附件下载状态'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('attachment', function (Blueprint $table) { 25 | $table->dropColumn('status'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Model/CustomEmoji.php: -------------------------------------------------------------------------------- 1 | 'datetime', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 30 | } 31 | -------------------------------------------------------------------------------- /app/Nsq/Consumer/StatusFaveConsumer.php: -------------------------------------------------------------------------------- 1 | $message['account_id'], 18 | 'target_account_id' => $message['target_account_id'], 19 | 'status_id' => $message['status_id'], 20 | 'notify_type' => Notification::NOTIFY_TYPE_FAVOURITE 21 | ]); 22 | return Result::ACK; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Request/SiteConfigRequest.php: -------------------------------------------------------------------------------- 1 | 'array', 26 | 'configs.*.key' => 'required|string', 27 | 'configs.*.type' => 'required|string|in:text,json', 28 | 'configs.*.value' => 'required|string', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_06_17_113221_add_wallet_address_to_account.php: -------------------------------------------------------------------------------- 1 | string('wallet_address')->unique()->nullable()->after("is_sensitive"); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account', function (Blueprint $table) { 25 | $table->dropColumn('wallet_address'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/FilterRequest.php: -------------------------------------------------------------------------------- 1 | 'nullable', 26 | 'title' => 'required|string', 27 | 'expires_in' => 'int', 28 | 'context' => 'required|array', 29 | 'act' => 'required', 30 | 'kw_attr' => 'array', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/EmojiUpdateRequestModel.php: -------------------------------------------------------------------------------- 1 | time(), 22 | 'scope' => 'read write follow push' 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /migrations/2024_07_17_080614_add_deleted_account_to_conversation.php: -------------------------------------------------------------------------------- 1 | json('deleted_account')->nullable()->comment('已删除的账号ID'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('conversation', function (Blueprint $table) { 25 | $table->dropColumn('deleted_account'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Model/UnavailableDomain.php: -------------------------------------------------------------------------------- 1 | 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/MentionCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (Account $mention) { 19 | return [ 20 | 'id' => (string)$mention->id, 21 | 'username' => (string)$mention->username, 22 | 'url' => (string)$mention->permaurl(), 23 | 'acct' => (string)$mention->acct, 24 | ]; 25 | })->toArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /migrations/2023_12_01_055521_preview_card_status.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('preview_card_id'); 16 | $table->unsignedBigInteger('status_id'); 17 | 18 | $table->primary(['preview_card_id','status_id']); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('preview_cards_status'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /migrations/2024_08_07_060146_add_unread_num_to_account_subscriber_log.php: -------------------------------------------------------------------------------- 1 | unsignedInteger('unread_num')->default(0); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account_subscriber_log', function (Blueprint $table) { 25 | $table->dropColumn('unread_num'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2023_12_26_032701_create_permission_group_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 16 | $table->string('name', 255); 17 | $table->string('description', 255)->nullable(); 18 | $table->datetimes(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('permission_group'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /migrations/2024_01_08_141514_create_oauth_personal_access_clients_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('client_id'); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('oauth_personal_access_clients'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_02_04_121934_add_thumbnail_url_to_previewcard.php: -------------------------------------------------------------------------------- 1 | string('thumbnail_url')->nullable()->comment('缩略图片地址')->after('image_url'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('preview_card', function (Blueprint $table) { 25 | $table->dropColumn('thumbnail_url'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_03_19_115957_add_manually_approves_follower_to_account.php: -------------------------------------------------------------------------------- 1 | boolean('manually_approves_follower')->default(false); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account', function (Blueprint $table) { 25 | $table->dropColumn('manually_approves_follower'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_04_26_044411_add_enable_activitypub_to_status.php: -------------------------------------------------------------------------------- 1 | boolean('enable_activitypub')->default(true)->comment('是否开放协议推送')->after('scope'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status', function (Blueprint $table) { 25 | $table->dropColumn('enable_activitypub'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_07_03_071813_add_is_display_sensitive_to_account.php: -------------------------------------------------------------------------------- 1 | boolean('is_display_sensitive')->default(false)->comment('是否显示可能含有敏感内容'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('account', function (Blueprint $table) { 25 | $table->dropColumn('is_display_sensitive'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_09_05_055042_change_description_length_for_preview_card.php: -------------------------------------------------------------------------------- 1 | text('description')->nullable()->change(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('preview_card', function (Blueprint $table) { 25 | $table->string('description')->nullable()->change(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Request/IpBlockRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 27 | 'expires_in' => 'required|in:'.join(',', array_keys(IpBlock::EXPIRES_IN_MAP)), 28 | 'severity' => 'required|in:1,2,3', 29 | 'comment' => 'nullable', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceV2RegistrationsModel.php: -------------------------------------------------------------------------------- 1 | Registrations are currently closed on example.org because of spam bots!

21 | * Description: A custom message (html string) to be shown when registrations are closed. 22 | * Value will be null if no message is set. 23 | */ 24 | public string $message; 25 | } 26 | -------------------------------------------------------------------------------- /app/Model/WalletAddressLog.php: -------------------------------------------------------------------------------- 1 | 'integer', 'account_id' => 'integer', 'created_at' => 'datetime']; 32 | } 33 | -------------------------------------------------------------------------------- /migrations/2024_06_26_115859_create_wallet_address_logs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('address')->unique(); 17 | $table->unsignedBigInteger('account_id'); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('wallet_address_log'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Controller/Mastodon/V1/CustomEmojiController.php: -------------------------------------------------------------------------------- 1 | whereNull('domain')->get() 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Request/Mastodon/RegRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'email' => 'required|string', 27 | 'password' => 'required|string', 28 | 'agreement' => 'required', 29 | 'locale' => 'required|string', 30 | 'reason' => 'string', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Request/ResetPasswordRequest.php: -------------------------------------------------------------------------------- 1 | is('*mail')){ 25 | return [ 26 | 'email' => 'required|email|exists:user' 27 | ]; 28 | } 29 | return [ 30 | 'token'=>'required', 31 | 'password'=> 'required|string|between:6,18' 32 | ]; 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /config/autoload/session.php: -------------------------------------------------------------------------------- 1 | Handler\RedisHandler::class, 18 | 'options' => [ 19 | 'connection' => 'default', 20 | 'path' => $sessionDir, 21 | 'gc_maxlifetime' => 1200, 22 | 'session_name' => 'HYPERF_SESSION_ID', 23 | 'domain' => null, 24 | 'cookie_lifetime' => 5 * 60 * 60, 25 | 'cookie_same_site' => 'lax', 26 | 'secure' => true, 27 | ], 28 | ]; 29 | -------------------------------------------------------------------------------- /app/Controller/Admin/SettingController.php: -------------------------------------------------------------------------------- 1 | request->input('keys','')); 22 | return Setting::whereNull('settingable_id')->whereIn('key',$keys) 23 | ->get()->keyBy('key'); 24 | } 25 | 26 | #[OA\Put('/admin/api/setting')] 27 | public function store() 28 | { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/TagResource.php: -------------------------------------------------------------------------------- 1 | resource; 20 | 21 | if (empty($hashtag->href)) { 22 | $hashtag->href = getApHostUrl().'/explore/hashtag/'.urlencode($hashtag->name); 23 | } 24 | 25 | return [ 26 | 'name' => (string)$hashtag->name, 27 | 'url' => (string)$hashtag->href, 28 | 'history'=> [ 29 | 30 | ], 31 | 'following'=> (boolean)false 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Service/CacheService.php: -------------------------------------------------------------------------------- 1 | get($key); 25 | if (! is_null($value)) { 26 | return $value; 27 | } 28 | $value = $callback(); 29 | $cache->set($key, $value, $ttl); 30 | return $value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/DebugAPUrlResponseModel.php: -------------------------------------------------------------------------------- 1 | redirect('/oauth/login?'.http_build_query($request->getQueryParams())); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Request/PayLogRequest.php: -------------------------------------------------------------------------------- 1 | 'required|in:1,2,3', 26 | 'reward_type' => 'in:1,2', 27 | 'amount' => 'min:1', 28 | 'target_account_id'=>'nullable|exists:account,id', 29 | 'status_id' => 'nullable|exists:status,id', 30 | 'plan_id' => 'nullable', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Request/DirectMessageRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 28 | 'message' => 'required|string|min:1|max:500', 29 | 'type' => 'required|in:1,2,3', 30 | 'url' => 'url', 31 | 'file_type' => 'in:1,2,3,4' 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/EmojiCollection.php: -------------------------------------------------------------------------------- 1 | collection->transform(function ($emoji) { 18 | return [ 19 | 'shortcode' =>(string) $emoji['shortcode'], 20 | 'url' => (string)$emoji['image_url'], 21 | 'static_url' => (string)$emoji['image_url'], 22 | 'visible_in_picker' => (bool) $emoji['visible_in_picker'], 23 | 'category' => 'default' 24 | ]; 25 | })->filter()->toArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /migrations/2024_01_08_141417_create_oauth_refresh_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->string('access_token_id', 100)->index(); 17 | $table->boolean('revoked'); 18 | $table->dateTime('expires_at')->nullable(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('oauth_refresh_tokens'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Model/SiteConfig.php: -------------------------------------------------------------------------------- 1 | 'datetime', 'updated_at' => 'datetime']; 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/Request/SearchRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string|min:1|max:100', 26 | 'type' => 'nullable|in:accounts,statuses,hashtags', 27 | 'resolve' => 'nullable', 28 | 'limit' => 'nullable|integer|max:40', 29 | 'offset' => 'nullable|integer', 30 | 'following' => 'nullable' 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/OauthTokenModel.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('target_account_id')->nullable()->index()->comment('解锁推文作者ID,status.account.id'); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | */ 22 | public function down(): void 23 | { 24 | Schema::table('status_unlock_log', function (Blueprint $table) { 25 | $table->dropColumn('target_account_id'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Nsq/Consumer/FollowConsumer.php: -------------------------------------------------------------------------------- 1 | targetAccount->isLocal()) { 20 | Notification::create([ 21 | 'account_id'=> $message['account_id'], 22 | 'target_account_id'=>$message['target_account_id'], 23 | 'notify_type' => Notification::NOTIFY_TYPE_FOLLOW 24 | ]); 25 | } 26 | return Result::ACK; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/ContextResource.php: -------------------------------------------------------------------------------- 1 | collect($this->resource['ancestors'])->transform(function (Status $status) { 22 | return StatusResource::make($status); 23 | }), 24 | 'descendants' => collect($this->resource['descendants'])->transform(function (Status $status) { 25 | return StatusResource::make($status); 26 | }), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/RelationshipCollection.php: -------------------------------------------------------------------------------- 1 | collection->get('idArr'); 21 | $account = $this->collection->get('account'); 22 | $accountId = $account->id; 23 | $data = []; 24 | foreach ($idArr as $id) { 25 | $tmp = RelationshipResource::make(compact('id', 'accountId'))->toArray(); 26 | $data[] = $tmp; 27 | } 28 | return $data; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Request/Mastodon/AuthorizeRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'client_id' => 'required|string', 27 | 'redirect_uri' => 'required|string', 28 | 'scope' => 'nullable|string', 29 | 'force_login' => 'nullable', 30 | 'lang' => 'nullable|string', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Request/Mastodon/ReportRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'status_ids' => 'array', 27 | 'comment' => 'string', 28 | 'forward' => 'nullable', 29 | 'forward_to_domains' => 'array', 30 | 'category' => 'string', 31 | 'rule_ids' => 'array', 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Request/Mastodon/TokenRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 26 | 'client_secret' => 'required|string', 27 | 'redirect_uri' => 'required|string', 28 | 'grant_type' => 'required|string', 29 | 'code' => 'nullable|string', 30 | 'scope' => 'nullable|string', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /migrations/2024_03_27_071735_add_enable_activitypub_to_account.php: -------------------------------------------------------------------------------- 1 | unsignedTinyInteger('enable_activitypub')->comment('是否开放协议推送') 17 | ->default(1)->after('is_activate'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::table('account', function (Blueprint $table) { 27 | $table->dropColumn('enable_activitypub'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Model/FollowHashtag.php: -------------------------------------------------------------------------------- 1 | 'integer', 'account_id' => 'integer', 'hashtag_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 32 | } 33 | -------------------------------------------------------------------------------- /app/Request/LikeRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 27 | 'id' => 'required|string', 28 | 'type' => [ 29 | 'required', 30 | Rule::in(['Like']) 31 | ], 32 | 'actor' => 'required|url', 33 | 'object' => 'required|url' 34 | ]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Request/FollowRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 27 | 'id' => 'required|string', 28 | 'type' => [ 29 | 'required', 30 | Rule::in(['Follow']) 31 | ], 32 | 'actor' => 'required|url', 33 | 'object' => 'required|url' 34 | ]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/NodeinfoModel.php: -------------------------------------------------------------------------------- 1 | [ 16 | 'host' => env('REDIS_HOST', 'localhost'), 17 | 'auth' => env('REDIS_AUTH', null), 18 | 'port' => (int) env('REDIS_PORT', 6379), 19 | 'db' => (int) env('REDIS_DB', 0), 20 | 'pool' => [ 21 | 'min_connections' => 1, 22 | 'max_connections' => 10, 23 | 'connect_timeout' => 10.0, 24 | 'wait_timeout' => 3.0, 25 | 'heartbeat' => -1, 26 | 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60), 27 | ], 28 | ], 29 | ]; 30 | -------------------------------------------------------------------------------- /migrations/2024_04_15_090554_create_report_note_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->text('content'); 17 | $table->unsignedBigInteger('report_id')->comment('report.id'); 18 | $table->unsignedBigInteger('account_id')->comment('account.id'); 19 | $table->datetimes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('report_note'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/DomainModel.php: -------------------------------------------------------------------------------- 1 | string('file_size')->nullable()->after('thumbnail_width'); 16 | $table->string('thumbnail_file_size')->nullable()->after('thumbnail_width'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('attachment', function (Blueprint $table) { 26 | $table->dropColumn(['file_size','thumbnail_file_size']); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /migrations/2024_07_15_085122_add_fee_plan_to_account.php: -------------------------------------------------------------------------------- 1 | string('fee')->nullable()->comment('订阅价格/大于0即是允许付费订阅'); 16 | $table->json('subscriber_plan')->nullable()->comment('长期订阅计划'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('account', function (Blueprint $table) { 26 | $table->dropColumn('fee'); 27 | $table->dropColumn('subscriber_plan'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /migrations/2024_07_31_111233_add_notification_notify_type_default_value.php: -------------------------------------------------------------------------------- 1 | unsignedInteger('notify_type')->unsigned()->default(0)->nullable(false)->change(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('notification', function (Blueprint $table) { 26 | $table->unsignedInteger('notify_type')->nullable()->change(); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Request/Admin/Settings/AboutRequest.php: -------------------------------------------------------------------------------- 1 | 'nullable', 26 | 'show_domain_blocks' => 'nullable', 27 | 'show_domain_blocks_rationale' => 'nullable', 28 | 'status_page_url' => 'nullable|url', 29 | 'site_terms' => 'nullable', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/SwaggerCollectionModel.php: -------------------------------------------------------------------------------- 1 | increments('id'); 16 | $table->unsignedInteger('group_id')->nullable(); 17 | $table->string('name', 255); 18 | $table->string('key')->unique(); 19 | $table->string('description', 255)->nullable(); 20 | $table->datetimes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('permission'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_01_09_080704_create_setting_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('key')->index(); 17 | $table->text('value'); 18 | $table->string('settingable_type')->nullable(); 19 | $table->unsignedBigInteger('settingable_id')->index()->nullable(); 20 | $table->datetimes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('setting'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_07_30_084921_add_views_to_status_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('view_count')->default(0)->after('reblog_count')->index(); 16 | $table->timestamp('view_count_updated_at')->nullable()->after('reblog_count'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('status', function (Blueprint $table) { 26 | $table->dropColumn(['view_count','view_count_updated_at']); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /migrations/2024_07_30_090506_add_index_to_status_mention.php: -------------------------------------------------------------------------------- 1 | index('account_id', 'idx_account_id'); 16 | $table->index('target_account_id', 'idx_target_account_id'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('status_mention', function (Blueprint $table) { 26 | $table->dropIndex('idx_account_id'); 27 | $table->dropIndex('idx_target_account_id'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /migrations/2024_04_15_131605_create_admin_action_log_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('account_id'); 17 | $table->string('action'); 18 | $table->string('target_type'); 19 | $table->unsignedBigInteger('target_id'); 20 | $table->datetimes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('admin_action_log'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Controller/View/AccountController.php: -------------------------------------------------------------------------------- 1 | accountService->details($acct)['account']; 28 | $statuses = $this->statusesService->statuses($account); 29 | return view('account',compact('account','statuses')); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Model/Setting.php: -------------------------------------------------------------------------------- 1 | 'integer', 'settingable_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 34 | } 35 | -------------------------------------------------------------------------------- /migrations/2024_03_19_062511_create_follow_request_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedbigInteger('account_id')->unsigned()->index(); 17 | $table->unsignedbigInteger('target_account_id')->unsigned()->index(); 18 | $table->json('activity')->nullable(); 19 | $table->datetimes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('follow_request'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceConfigurationPollsModel.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('account_id'); 17 | $table->unsignedBigInteger('target_account_id'); 18 | 19 | $table->datetimes(); 20 | 21 | $table->index('target_account_id'); 22 | $table->index(['target_account_id','account_id']); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('block'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /migrations/2024_07_23_092529_create_follow_hashtag_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('account_id')->comment('account.id'); 17 | $table->unsignedBigInteger('hashtag_id')->comment('hashtag.id'); 18 | $table->unique(['account_id', 'hashtag_id']); 19 | $table->datetimes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('follow_hashtag'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/MentionModel.php: -------------------------------------------------------------------------------- 1 | collection->transform(function (UserFilter $userFilter) { 18 | return [ 19 | 'id' => (string) $userFilter->id, 20 | 'phrase' => (string) $userFilter->status->content, 21 | 'context' => $userFilter->filter->context_enum, 22 | 'whole_word' => true, 23 | 'expires_at' => $userFilter->filter?->expired_at?->toIso8601String(), 24 | 'irreversible' => false 25 | ]; 26 | })->toArray(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /migrations/2024_02_21_081401_add_meta_to_attachment.php: -------------------------------------------------------------------------------- 1 | unsignedInteger('thumbnail_width')->nullable()->after('height'); 16 | $table->unsignedInteger('thumbnail_height')->nullable()->after('height'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('attachment', function (Blueprint $table) { 26 | $table->dropColumn('thumbnail_width'); 27 | $table->dropColumn('thumbnail_height'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Middleware/OAuthClientMiddleware.php: -------------------------------------------------------------------------------- 1 | guards as $name) { 17 | $guard = $this->auth->guard($name); 18 | 19 | if (!$guard->client() instanceof Client) { 20 | throw new \Richard\HyperfPassport\Exception\PassportException("Without authorization from {$guard->getName()} guard", $guard); 21 | } 22 | } 23 | 24 | return $handler->handle($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Nsq/Consumer/StatusReBlogConsumer.php: -------------------------------------------------------------------------------- 1 | $status->account_id, 21 | 'target_account_id' => $parent, 22 | 'notify_type' => Notification::NOTIFY_TYPE_REBLOG, 23 | 'status_id' => $message['statusId'] 24 | ]); 25 | return Result::ACK; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /config/autoload/nsq.php: -------------------------------------------------------------------------------- 1 | [ 16 | 'enable' => true, 17 | 'host' => env('NSQ_HOST', '127.0.0.1'), 18 | 'port' => (int) env('NSQ_PORT', 4150), 19 | 'pool' => [ 20 | 'min_connections' => 1, 21 | 'max_connections' => 10, 22 | 'connect_timeout' => 10.0, 23 | 'wait_timeout' => 3.0, 24 | 'heartbeat' => -1, 25 | 'max_idle_time' => 30.0, 26 | ], 27 | 'nsqd' => [ 28 | 'port' => (int) env('NSQD_PORT', 4151), 29 | 'options' => [ 30 | ], 31 | ], 32 | ], 33 | ]; 34 | -------------------------------------------------------------------------------- /migrations/2024_03_14_055855_create_relay_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('inbox_url'); 17 | $table->string('follow_activity_id')->nullable(); 18 | $table->tinyInteger('state')->default(0)->comment('one of [0:idle, 1:pending, 2:accepted, 3:rejected]'); 19 | $table->datetimes(); 20 | $table->softDeletes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('relay'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_09_03_111337_drop_wallet_address_index_to_account.php: -------------------------------------------------------------------------------- 1 | dropIndex('account_wallet_address_unique'); 16 | $table->index('wallet_address', 'idx_wallet_address'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('account', function (Blueprint $table) { 26 | $table->unique('wallet_address', 'account_wallet_address_unique'); 27 | $table->dropIndex('idx_wallet_address'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Listener/ResumeExitCoordinatorListener.php: -------------------------------------------------------------------------------- 1 | resume(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Model/StatusesHashtag.php: -------------------------------------------------------------------------------- 1 | 'integer', 'status_id' => 'integer', 'hashtag_id' => 'integer', 'account_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 33 | } 34 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'skeleton'), 19 | 'app_env' => env('APP_ENV', 'dev'), 20 | 'scan_cacheable' => env('SCAN_CACHEABLE', false), 21 | StdoutLoggerInterface::class => [ 22 | 'log_level' => [ 23 | LogLevel::ALERT, 24 | LogLevel::CRITICAL, 25 | // LogLevel::DEBUG, 26 | LogLevel::EMERGENCY, 27 | LogLevel::ERROR, 28 | LogLevel::INFO, 29 | LogLevel::NOTICE, 30 | LogLevel::WARNING, 31 | ], 32 | ], 33 | ]; 34 | -------------------------------------------------------------------------------- /migrations/2023_12_26_024724_create_role_permission_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 16 | $table->unsignedInteger('role_id')->nullable()->comment('role.id'); 17 | $table->unsignedInteger('permission_id')->nullable()->comment('permissions.id'); 18 | $table->unique(['role_id', 'permission_id']); 19 | $table->datetimes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('role_permission'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /migrations/2024_06_14_065932_add_index_to_notification.php: -------------------------------------------------------------------------------- 1 | index('account_id'); 16 | $table->index('target_account_id'); 17 | $table->index('status_id'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::table('notification', function (Blueprint $table) { 27 | $table->dropIndex('account_id'); 28 | $table->dropIndex('target_account_id'); 29 | $table->dropIndex('status_id'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Model/StatusHashtag.php: -------------------------------------------------------------------------------- 1 | 'integer', 'status_id' => 'integer', 'hashtag_id' => 'integer', 'account_id' => 'integer', 33 | 'created_at' => 'datetime', 'updated_at' => 'datetime']; 34 | } 35 | -------------------------------------------------------------------------------- /migrations/2023_11_13_104829_create_bookmark_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('status_id')->comment('status.id'); 17 | $table->unsignedBigInteger('account_id')->index()->comment('account.id'); 18 | $table->unique(['status_id', 'account_id']); 19 | $table->datetimes(); 20 | $table->comment('书签表'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('bookmark'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_01_08_141309_create_oauth_codes_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->unsignedBigInteger('user_id')->index(); 17 | $table->unsignedBigInteger('client_id'); 18 | $table->text('scopes')->nullable(); 19 | $table->boolean('revoked'); 20 | $table->dateTime('expires_at')->nullable(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('oauth_auth_codes'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_02_04_062012_add_thumbnail_url_to_attachment.php: -------------------------------------------------------------------------------- 1 | string('remote_url')->nullable()->comment('远程地址')->after('local_url'); 16 | $table->string('thumbnail_url')->nullable()->comment('缩略图片地址')->after('remote_url'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('attachment', function (Blueprint $table) { 26 | $table->dropColumn('remote_url'); 27 | $table->dropColumn('thumbnail_url'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/FilterResource.php: -------------------------------------------------------------------------------- 1 | resource instanceof Filter) { 19 | return []; 20 | } 21 | 22 | $filter = $this->resource; 23 | return [ 24 | 'id' => (string) $filter->id, 25 | 'title' => (string) $filter->title, 26 | 'context' => $filter->context_enum, 27 | 'expires_at' => $filter->expired_at?->toIso8601String(), 28 | 'filter_action' => Filter::actMap[$filter->act], 29 | 'keywords' => FilterKeywordCollection::make($filter->kw_attr ?? []), 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceConfigurationAccountsModel.php: -------------------------------------------------------------------------------- 1 | string('uri')->nullable()->comment('activitypub URI of this status')->index('idx_uri')->change(); 16 | $table->string('url')->nullable()->comment('web url for viewing this status')->index('idx_url')->change(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('status', function (Blueprint $table) { 26 | $table->dropIndex('idx_uri'); 27 | $table->dropIndex('idx_url'); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Controller/Mastodon/V1/FilterController.php: -------------------------------------------------------------------------------- 1 | id)->get(); 24 | return V1FilterCollection::make($userFilters); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docs/nginx.conf: -------------------------------------------------------------------------------- 1 | client_max_body_size 256m; 2 | server { 3 | listen 80; 4 | server_name activitypub.good.news; 5 | root /wwwroot/dist; 6 | 7 | 8 | ## 文件上传 9 | location /uploads/ { 10 | proxy_pass http://127.0.0.1:9501; 11 | } 12 | 13 | ## 文件上传 14 | location /remote/ { 15 | proxy_pass http://127.0.0.1:9501; 16 | } 17 | 18 | ## vue 19 | location / { 20 | if ($is_bot = 1 ){ 21 | proxy_pass http://127.0.0.1:9501; 22 | break; 23 | } 24 | try_files $uri $uri/ /index.html; 25 | } 26 | 27 | ## hyperf 28 | location ~ /(embed|_api|api|users|\.well-known|oauth) { 29 | proxy_set_header Host $host; 30 | proxy_set_header Cookie $http_cookie; 31 | proxy_set_header X-Real-IP $remote_addr; 32 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 33 | proxy_set_header X-Forwarded-Proto $scheme; 34 | proxy_pass http://127.0.0.1:9501; 35 | } 36 | } -------------------------------------------------------------------------------- /app/Model/ListAccount.php: -------------------------------------------------------------------------------- 1 | 'integer', 'list_id' => 'integer', 'account_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 32 | 33 | public function account() 34 | { 35 | return $this->belongsTo(Account::class); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Nsq/Consumer/NsqQueueMessageConsumer.php: -------------------------------------------------------------------------------- 1 | unpack($message->getBody()); 23 | try{ 24 | $class->handle(); 25 | }catch(\Exception $e){ 26 | var_dump($e->getMessage()); 27 | }finally{ 28 | return Result::ACK; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2023_12_05_093922_create_mute_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | 17 | $table->unsignedBigInteger('account_id'); 18 | $table->unsignedBigInteger('target_account_id'); 19 | $table->timestamp('expires_at')->nullable()->comment('过期时间'); 20 | $table->datetimes(); 21 | $table->index('target_account_id'); 22 | $table->index(['target_account_id','account_id']); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('mute'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /migrations/2024_03_29_082554_create_export_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->unsignedBigInteger('account_id')->comment('account.id'); 17 | $table->bigInteger('filesize')->nullable()->comment('文件大小'); 18 | $table->string('file_url')->nullable()->comment('文件地址'); 19 | $table->tinyInteger('status')->nullable()->comment('状态 1正在导出 2导出完成'); 20 | $table->datetimes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('export'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /migrations/2024_04_18_120952_create_thing_setting_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('var', 24); 17 | $table->text('value')->nullable(); 18 | $table->unsignedBigInteger('thing_id'); 19 | $table->string('thing_type', 24); 20 | $table->unique(['thing_type', 'thing_id', 'var'], 'uniq_type_and_id_and_var'); 21 | $table->datetimes(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('thing_setting'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Controller/View/StatusController.php: -------------------------------------------------------------------------------- 1 | findOrFail($statusId); 24 | $replies = $this->statusesService->statusReplies($statusId); 25 | return view('status',compact('status','replies')); 26 | } 27 | public function card($acct,$statusId) 28 | { 29 | $status = Status::withInfo()->findOrFail($statusId); 30 | return view('status_card',compact('status')); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Request/Admin/Settings/BrandingRequest.php: -------------------------------------------------------------------------------- 1 | 'nullable', 26 | 'site_contact_username' => 'nullable', 27 | 'site_contact_email' => 'nullable', 28 | 'site_short_description' => 'nullable', 29 | 'thumbnail_id' => 'nullable', 30 | 'receive_remote_sensitive' => 'nullable', 31 | 'push_local_sensitive' => 'nullable', 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Request/Admin/UserRequest.php: -------------------------------------------------------------------------------- 1 | 'in:0,1,2|nullable', 26 | 'status' => 'nullable', 27 | 'role_id' => 'nullable', 28 | 'sortord' => 'nullable', 29 | 'username' => 'nullable', 30 | 'domain' => 'nullable', 31 | 'nickname' => 'nullable', 32 | 'email' => 'nullable|email', 33 | 'ip' => 'nullable|ip', 34 | 'is_match_all' => 'nullable', 35 | ]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Model/PollVote.php: -------------------------------------------------------------------------------- 1 | 'integer', 'status_id' => 'integer', 'account_id' => 'integer', 'poll_id' => 'integer', 'choice' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; 35 | } 36 | -------------------------------------------------------------------------------- /migrations/2024_03_25_073626_create_instance_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->string('domain')->unique()->index(); 17 | $table->boolean('is_disable_download')->default(false); 18 | $table->boolean('is_proxy')->default(false); 19 | $table->boolean('is_disable_sync')->default(false); 20 | $table->boolean('is_banned')->default(false); 21 | $table->datetimes(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('instance'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Request/StatuesRequest.php: -------------------------------------------------------------------------------- 1 | 'required_without:attachments|string|max:500', 26 | 'scope' => 'in:1,2,3,4', 27 | 'who_can_reply' => 'nullable', 28 | 'reply_to_id' => 'nullable', 29 | 'is_sensitive' => 'nullable', 30 | 'attachments' => 'array', 31 | 'poll' => 'array', 32 | 'enable_activitypub' => 'in:0,1', 33 | 'fee' => 'nullable' 34 | ]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /config/autoload/commands.php: -------------------------------------------------------------------------------- 1 | auth->guard("jwt"); 24 | if (! $guard->user() instanceof Authenticatable) { 25 | throw new UnauthorizedException("Without authorization from {$guard->getName()} guard", $guard); 26 | } 27 | 28 | 29 | return $handler->handle($request); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /app/Nsq/AnnotationNsqJob.php: -------------------------------------------------------------------------------- 1 | get($this->class); 22 | 23 | $params = []; 24 | foreach ($this->params as $key => $value) { 25 | if ($value instanceof UnCompressInterface) { 26 | $value = $value->uncompress(); 27 | } 28 | $params[$key] = $value; 29 | } 30 | // var_dump($this->method); 31 | $container->get(Environment::class)->setAsyncQueue(true); 32 | $class->{$this->method}(...$params); 33 | return Result::ACK; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Request/ThingSettingRequest.php: -------------------------------------------------------------------------------- 1 | 'nullable|in:1,2,3', 26 | 'default_privacy' => 'nullable|in:1,2,4', 27 | 'default_sensitive' => 'nullable|in:0,1', 28 | 'show_application' => 'nullable|in:0,1', 29 | 'use_blurhash' => 'nullable|in:0,1', 30 | 'expand_spoilers' => 'nullable|in:0,1', 31 | 'publish_language' => 'nullable|string', 32 | 'filter_language' => 'nullable|array', 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/EmojiModel.php: -------------------------------------------------------------------------------- 1 | blockService->blocks($account); 28 | return AccountCollection::make($accounts); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Resource/Mastodon/Model/InstanceConfigurationStatusesModel.php: -------------------------------------------------------------------------------- 1 | string('uri')->nullable()->comment('ActivityPub URI for this account.')->index('idx_uri')->change(); 16 | $table->string('public_key_uri')->nullable()->comment('Web-reachable location of this account/s public key')->index('idx_public_key_uri')->change(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('account', function (Blueprint $table) { 26 | $table->dropIndex('idx_uri'); 27 | $table->dropIndex('idx_public_key_uri'); 28 | }); 29 | } 30 | } 31 | --------------------------------------------------------------------------------