[backend/masto-client] Limit batch endpoints
This commit is contained in:
parent
7e3320e3b1
commit
02d4b35ab1
2 changed files with 4 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
|
@ -171,7 +172,7 @@ public class AccountController(
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ProducesResults(HttpStatusCode.OK)]
|
[ProducesResults(HttpStatusCode.OK)]
|
||||||
[ProducesErrors(HttpStatusCode.Forbidden)]
|
[ProducesErrors(HttpStatusCode.Forbidden)]
|
||||||
public async Task<IEnumerable<AccountEntity>> GetManyUsers([FromQuery(Name = "id")] List<string> ids)
|
public async Task<IEnumerable<AccountEntity>> GetManyUsers([FromQuery(Name = "id")] [MaxLength(40)] HashSet<string> ids)
|
||||||
{
|
{
|
||||||
var localUser = HttpContext.GetUser();
|
var localUser = HttpContext.GetUser();
|
||||||
if (config.Value.PublicPreview == Enums.PublicPreview.Lockdown && localUser == null)
|
if (config.Value.PublicPreview == Enums.PublicPreview.Lockdown && localUser == null)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using AsyncKeyedLock;
|
using AsyncKeyedLock;
|
||||||
|
@ -75,7 +76,7 @@ public class StatusController(
|
||||||
[Authenticate("read:statuses")]
|
[Authenticate("read:statuses")]
|
||||||
[ProducesResults(HttpStatusCode.OK)]
|
[ProducesResults(HttpStatusCode.OK)]
|
||||||
[ProducesErrors(HttpStatusCode.Forbidden)]
|
[ProducesErrors(HttpStatusCode.Forbidden)]
|
||||||
public async Task<IEnumerable<StatusEntity>> GetManyNotes([FromQuery(Name = "id")] List<string> ids)
|
public async Task<IEnumerable<StatusEntity>> GetManyNotes([FromQuery(Name = "id")] [MaxLength(20)] HashSet<string> ids)
|
||||||
{
|
{
|
||||||
var user = HttpContext.GetUser();
|
var user = HttpContext.GetUser();
|
||||||
if (security.Value.PublicPreview == Enums.PublicPreview.Lockdown && user == null)
|
if (security.Value.PublicPreview == Enums.PublicPreview.Lockdown && user == null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue