chore: clean up backend code, fix most inspections

This commit is contained in:
sam 2024-12-14 16:51:58 +01:00
parent 49b2902d6d
commit 11257ae069
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
21 changed files with 86 additions and 27 deletions

View file

@ -14,10 +14,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
using System.Net;
using System.Text.Json.Serialization;
using System.Web;
using Foxnouns.Backend.Database;
using Foxnouns.Backend.Database.Models;
using Foxnouns.Backend.Extensions;
namespace Foxnouns.Backend.Services.Auth;
@ -120,8 +118,7 @@ public partial class FediverseAuthService
private async Task<string> GenerateMisskeyAuthUrlAsync(
FediverseApplication app,
bool forceRefresh,
string? state = null
bool forceRefresh
)
{
if (forceRefresh)

View file

@ -131,8 +131,7 @@ public partial class FediverseAuthService
),
FediverseInstanceType.MisskeyApi => await GenerateMisskeyAuthUrlAsync(
app,
forceRefresh,
state
forceRefresh
),
_ => throw new ArgumentOutOfRangeException(nameof(app), app.InstanceType, null),
};

View file

@ -1,3 +1,17 @@
// Copyright (C) 2023-present sam/u1f320 (vulpine.solutions)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
using System.Collections.Concurrent;
using System.Threading.RateLimiting;
using NodaTime;

View file

@ -17,7 +17,6 @@ using Foxnouns.Backend.Database.Models;
using Foxnouns.Backend.Dto;
using Foxnouns.Backend.Utils;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace Foxnouns.Backend.Services;

View file

@ -38,7 +38,7 @@ public class MetricsCollectionService(ILogger logger, IServiceProvider services,
// ReSharper disable once SuggestVarOrType_SimpleTypes
await using var db = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
List<Instant>? users = await db
List<Instant> users = await db
.Users.Where(u => !u.Deleted)
.Select(u => u.LastActive)
.ToListAsync(ct);

View file

@ -13,7 +13,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.Exceptions;

View file

@ -17,8 +17,6 @@ using Foxnouns.Backend.Database.Models;
using Foxnouns.Backend.Dto;
using Foxnouns.Backend.Utils;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using NodaTime;
namespace Foxnouns.Backend.Services;