@@ -71,72 +71,76 @@ public function instance(Request $request)
71
71
->toArray () : [];
72
72
});
73
73
74
- $ res = [
75
- 'domain ' => config ('pixelfed.domain.app ' ),
76
- 'title ' => config_cache ('app.name ' ),
77
- 'version ' => config ('pixelfed.version ' ),
78
- 'source_url ' => 'https://github.com/pixelfed/pixelfed ' ,
79
- 'description ' => config_cache ('app.short_description ' ),
80
- 'usage ' => [
81
- 'users ' => [
82
- 'active_month ' => (int ) Nodeinfo::activeUsersMonthly ()
83
- ]
84
- ],
85
- 'thumbnail ' => [
86
- 'url ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' )),
87
- 'blurhash ' => InstanceService::headerBlurhash (),
88
- 'versions ' => [
89
- '@1x ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' )),
90
- '@2x ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' ))
91
- ]
92
- ],
93
- 'languages ' => [config ('app.locale ' )],
94
- 'configuration ' => [
95
- 'urls ' => [
96
- 'streaming ' => 'wss:// ' . config ('pixelfed.domain.app ' ),
97
- 'status ' => null
98
- ],
99
- 'vapid ' => [
100
- 'public_key ' => config ('webpush.vapid.public_key ' ),
101
- ],
102
- 'accounts ' => [
103
- 'max_featured_tags ' => 0 ,
74
+ $ res = Cache::remember ('api:v2:instance-data-response-v2 ' , 1800 , function () use ($ contact , $ rules ) {
75
+ return [
76
+ 'domain ' => config ('pixelfed.domain.app ' ),
77
+ 'title ' => config_cache ('app.name ' ),
78
+ 'version ' => '3.5.3 (compatible; Pixelfed ' . config ('pixelfed.version ' ) .') ' ,
79
+ 'source_url ' => 'https://github.com/pixelfed/pixelfed ' ,
80
+ 'description ' => config_cache ('app.short_description ' ),
81
+ 'usage ' => [
82
+ 'users ' => [
83
+ 'active_month ' => (int ) Nodeinfo::activeUsersMonthly ()
84
+ ]
104
85
],
105
- 'statuses ' => [
106
- 'max_characters ' => (int ) config ('pixelfed.max_caption_length ' ),
107
- 'max_media_attachments ' => (int ) config_cache ('pixelfed.max_album_length ' ),
108
- 'characters_reserved_per_url ' => 23
86
+ 'thumbnail ' => [
87
+ 'url ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' )),
88
+ 'blurhash ' => InstanceService::headerBlurhash (),
89
+ 'versions ' => [
90
+ '@1x ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' )),
91
+ '@2x ' => config_cache ('app.banner_image ' ) ?? url (Storage::url ('public/headers/default.jpg ' ))
92
+ ]
109
93
],
110
- 'media_attachments ' => [
111
- 'supported_mime_types ' => explode (', ' , config_cache ('pixelfed.media_types ' )),
112
- 'image_size_limit ' => config_cache ('pixelfed.max_photo_size ' ) * 1024 ,
113
- 'image_matrix_limit ' => 3686400 ,
114
- 'video_size_limit ' => config_cache ('pixelfed.max_photo_size ' ) * 1024 ,
115
- 'video_frame_rate_limit ' => 240 ,
116
- 'video_matrix_limit ' => 3686400
94
+ 'languages ' => [config ('app.locale ' )],
95
+ 'configuration ' => [
96
+ 'urls ' => [
97
+ 'streaming ' => null ,
98
+ 'status ' => null
99
+ ],
100
+ 'vapid ' => [
101
+ 'public_key ' => config ('webpush.vapid.public_key ' ),
102
+ ],
103
+ 'accounts ' => [
104
+ 'max_featured_tags ' => 0 ,
105
+ ],
106
+ 'statuses ' => [
107
+ 'max_characters ' => (int ) config ('pixelfed.max_caption_length ' ),
108
+ 'max_media_attachments ' => (int ) config_cache ('pixelfed.max_album_length ' ),
109
+ 'characters_reserved_per_url ' => 23
110
+ ],
111
+ 'media_attachments ' => [
112
+ 'supported_mime_types ' => explode (', ' , config_cache ('pixelfed.media_types ' )),
113
+ 'image_size_limit ' => config_cache ('pixelfed.max_photo_size ' ) * 1024 ,
114
+ 'image_matrix_limit ' => 3686400 ,
115
+ 'video_size_limit ' => config_cache ('pixelfed.max_photo_size ' ) * 1024 ,
116
+ 'video_frame_rate_limit ' => 240 ,
117
+ 'video_matrix_limit ' => 3686400
118
+ ],
119
+ 'polls ' => [
120
+ 'max_options ' => 0 ,
121
+ 'max_characters_per_option ' => 0 ,
122
+ 'min_expiration ' => 0 ,
123
+ 'max_expiration ' => 0 ,
124
+ ],
125
+ 'translation ' => [
126
+ 'enabled ' => false ,
127
+ ],
117
128
],
118
- 'polls ' => [
119
- 'max_options ' => 4 ,
120
- 'max_characters_per_option ' => 50 ,
121
- 'min_expiration ' => 300 ,
122
- 'max_expiration ' => 2629746 ,
129
+ 'registrations ' => [
130
+ 'enabled ' => null ,
131
+ 'approval_required ' => false ,
132
+ 'message ' => null ,
133
+ 'url ' => null ,
123
134
],
124
- 'translation ' => [
125
- 'enabled ' => false ,
135
+ 'contact ' => [
136
+ 'email ' => config ('instance.email ' ),
137
+ 'account ' => $ contact
126
138
],
127
- ],
128
- 'registrations ' => [
129
- 'enabled ' => (bool ) config_cache ('pixelfed.open_registration ' ),
130
- 'approval_required ' => false ,
131
- 'message ' => null
132
- ],
133
- 'contact ' => [
134
- 'email ' => config ('instance.email ' ),
135
- 'account ' => $ contact
136
- ],
137
- 'rules ' => $ rules
138
- ];
139
+ 'rules ' => $ rules
140
+ ];
141
+ });
139
142
143
+ $ res ['registrations ' ]['enabled ' ] = (bool ) config_cache ('pixelfed.open_registration ' );
140
144
return response ()->json ($ res , 200 , [], JSON_UNESCAPED_SLASHES );
141
145
}
142
146
0 commit comments