add mastoapi route for blocked instances
Some checks are pending
/ test-build-and-push (push) Waiting to run
Some checks are pending
/ test-build-and-push (push) Waiting to run
This commit is contained in:
parent
b79de70345
commit
8bb1ead80e
1 changed files with 16 additions and 0 deletions
|
@ -7,7 +7,9 @@ using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
|
||||||
using Iceshrimp.Backend.Controllers.Shared.Attributes;
|
using Iceshrimp.Backend.Controllers.Shared.Attributes;
|
||||||
using Iceshrimp.Backend.Core.Configuration;
|
using Iceshrimp.Backend.Core.Configuration;
|
||||||
using Iceshrimp.Backend.Core.Database;
|
using Iceshrimp.Backend.Core.Database;
|
||||||
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Extensions;
|
using Iceshrimp.Backend.Core.Extensions;
|
||||||
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Services;
|
using Iceshrimp.Backend.Core.Services;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -23,6 +25,8 @@ namespace Iceshrimp.Backend.Controllers.Mastodon;
|
||||||
[Produces(MediaTypeNames.Application.Json)]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public class InstanceController(
|
public class InstanceController(
|
||||||
IOptions<Config.InstanceSection> instance,
|
IOptions<Config.InstanceSection> instance,
|
||||||
|
// ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
|
||||||
|
IOptionsSnapshot<Config.SecuritySection> security,
|
||||||
DatabaseContext db,
|
DatabaseContext db,
|
||||||
MetaService meta
|
MetaService meta
|
||||||
) : ControllerBase
|
) : ControllerBase
|
||||||
|
@ -100,6 +104,18 @@ public class InstanceController(
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/v1/domain_blocks")]
|
||||||
|
[ProducesResults(HttpStatusCode.OK)]
|
||||||
|
public async Task<List<BlockedInstance>> GetBlockedInstances()
|
||||||
|
{
|
||||||
|
if (security.Value.FederationMode == Enums.FederationMode.AllowList)
|
||||||
|
throw GracefulException.BadRequest("Federation mode is set to allowlist.");
|
||||||
|
|
||||||
|
var q = db.BlockedInstances.OrderBy(p => p.Host).AsQueryable();
|
||||||
|
|
||||||
|
return await q.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("/api/v1/instance/translation_languages")]
|
[HttpGet("/api/v1/instance/translation_languages")]
|
||||||
[ProducesResults(HttpStatusCode.OK)]
|
[ProducesResults(HttpStatusCode.OK)]
|
||||||
public Dictionary<string, IEnumerable<string>> GetTranslationLanguages() => new();
|
public Dictionary<string, IEnumerable<string>> GetTranslationLanguages() => new();
|
||||||
|
|
Loading…
Add table
Reference in a new issue