♻️ No idea what happended
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
    <PropertyGroup>
 | 
			
		||||
        <TargetFramework>net9.0</TargetFramework>
 | 
			
		||||
@@ -9,8 +9,10 @@
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
        <PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
 | 
			
		||||
        <PackageReference Include="MagicOnion.Abstractions" Version="7.0.5" />
 | 
			
		||||
        <PackageReference Include="MagicOnion.Client" Version="7.0.5" />
 | 
			
		||||
        <PackageReference Include="MagicOnion.Server" Version="7.0.5" />
 | 
			
		||||
        <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.7" />
 | 
			
		||||
        <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.6" />
 | 
			
		||||
        <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3">
 | 
			
		||||
            <PrivateAssets>all</PrivateAssets>
 | 
			
		||||
@@ -26,7 +28,7 @@
 | 
			
		||||
        <PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.1" />
 | 
			
		||||
        <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.1" />
 | 
			
		||||
        <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0" />
 | 
			
		||||
        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
 | 
			
		||||
        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.7" />
 | 
			
		||||
        <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
 | 
			
		||||
        <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.6" />
 | 
			
		||||
        <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
 | 
			
		||||
@@ -38,12 +40,6 @@
 | 
			
		||||
        <ProjectReference Include="..\DysonNetwork.Shared\DysonNetwork.Shared.csproj" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
      <Reference Include="Microsoft.AspNetCore">
 | 
			
		||||
        <HintPath>..\..\..\..\..\..\opt\homebrew\Cellar\dotnet\9.0.6\libexec\shared\Microsoft.AspNetCore.App\9.0.6\Microsoft.AspNetCore.dll</HintPath>
 | 
			
		||||
      </Reference>
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
      <Content Update="Pages\Emails\ContactVerificationEmail.razor">
 | 
			
		||||
        <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
 | 
			
		||||
@@ -74,4 +70,17 @@
 | 
			
		||||
      <AdditionalFiles Include="Pages\Emails\VerificationEmail.razor" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\appsettings.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\DysonNetwork.Pass.deps.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\DysonNetwork.Pass.runtimeconfig.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\DysonNetwork.Pass.staticwebassets.endpoints.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\Keys\Solian.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\package-lock.json" />
 | 
			
		||||
        <_ContentIncludedByDefault Remove="app\publish\package.json" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
 | 
			
		||||
    <ItemGroup>
 | 
			
		||||
      <Folder Include="wwwroot\" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +1,50 @@
 | 
			
		||||
using System.Text.Json;
 | 
			
		||||
using DysonNetwork.Pass;
 | 
			
		||||
using DysonNetwork.Pass.Account;
 | 
			
		||||
using DysonNetwork.Pass.Auth;
 | 
			
		||||
using DysonNetwork.Pass.Localization;
 | 
			
		||||
using DysonNetwork.Pass.Startup;
 | 
			
		||||
using DysonNetwork.Shared.Etcd;
 | 
			
		||||
using DysonNetwork.Shared.Startup;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using MagicOnion.Server;
 | 
			
		||||
using NodaTime;
 | 
			
		||||
using NodaTime.Serialization.SystemTextJson;
 | 
			
		||||
 | 
			
		||||
var builder = WebApplication.CreateBuilder(args);
 | 
			
		||||
 | 
			
		||||
builder.ConfigureAppKestrel();
 | 
			
		||||
builder.Services.AddHttpClient();
 | 
			
		||||
 | 
			
		||||
builder.Services.AddControllers().AddJsonOptions(options =>
 | 
			
		||||
{
 | 
			
		||||
    options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
 | 
			
		||||
    options.JsonSerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower;
 | 
			
		||||
 | 
			
		||||
    options.JsonSerializerOptions.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
 | 
			
		||||
}).AddDataAnnotationsLocalization(options =>
 | 
			
		||||
{
 | 
			
		||||
    options.DataAnnotationLocalizerProvider = (type, factory) =>
 | 
			
		||||
        factory.Create(typeof(SharedResource));
 | 
			
		||||
});
 | 
			
		||||
builder.Services.AddRazorPages();
 | 
			
		||||
builder.Services.AddAppSwagger();
 | 
			
		||||
builder.Services.AddAppAuthentication();
 | 
			
		||||
builder.Services.AddAppRateLimiting();
 | 
			
		||||
 | 
			
		||||
builder.Services.AddMagicOnion();
 | 
			
		||||
builder.Services.AddEtcdService(builder.Configuration);
 | 
			
		||||
 | 
			
		||||
builder.Services.AddAppBusinessServices(builder.Configuration);
 | 
			
		||||
builder.Services.AddAppServices(builder.Configuration);
 | 
			
		||||
 | 
			
		||||
builder.Services.AddControllers();
 | 
			
		||||
builder.Services.AddMagicOnion();
 | 
			
		||||
builder.Services.AddDbContext<AppDatabase>(options =>
 | 
			
		||||
    options.UseNpgsql(builder.Configuration.GetConnectionString("App")));
 | 
			
		||||
 | 
			
		||||
builder.Services.AddScoped<AccountService>();
 | 
			
		||||
builder.Services.AddScoped<AuthService>();
 | 
			
		||||
builder.Services.AddScoped<DysonNetwork.Pass.Publisher.PublisherService>();
 | 
			
		||||
builder.Services.AddScoped<DysonNetwork.Pass.Developer.CustomAppService>();
 | 
			
		||||
 | 
			
		||||
var app = builder.Build();
 | 
			
		||||
 | 
			
		||||
// Configure the HTTP request pipeline.
 | 
			
		||||
app.UseStaticFiles();
 | 
			
		||||
app.UseAuthorization();
 | 
			
		||||
app.ConfigureAppMiddleware(builder.Configuration);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								DysonNetwork.Pass/Properties/launchSettings.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								DysonNetwork.Pass/Properties/launchSettings.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
{
 | 
			
		||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
			
		||||
  "profiles": {
 | 
			
		||||
    "http": {
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": false,
 | 
			
		||||
      "applicationUrl": "http://localhost:5072",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
      },
 | 
			
		||||
      "workingDirectory": "/Users/littlesheep/Documents/Projects/DysonNetwork/DysonNetwork.Pass"
 | 
			
		||||
    },
 | 
			
		||||
    "https": {
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": false,
 | 
			
		||||
      "applicationUrl": "https://localhost:7098;http://localhost:5072",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
      },
 | 
			
		||||
      "workingDirectory": "/Users/littlesheep/Documents/Projects/DysonNetwork/DysonNetwork.Pass"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -10,35 +10,28 @@ using NodaTime;
 | 
			
		||||
 | 
			
		||||
namespace DysonNetwork.Pass.Publisher;
 | 
			
		||||
 | 
			
		||||
public class PublisherService : ServiceBase<IPublisherService>, IPublisherService
 | 
			
		||||
public class PublisherService(AppDatabase db) : ServiceBase<IPublisherService>, IPublisherService
 | 
			
		||||
{
 | 
			
		||||
    private readonly AppDatabase _db;
 | 
			
		||||
 | 
			
		||||
    public PublisherService(AppDatabase db)
 | 
			
		||||
    {
 | 
			
		||||
        _db = db;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public async Task<Shared.Models.Publisher?> GetPublisherByName(string name)
 | 
			
		||||
    {
 | 
			
		||||
        return await _db.Publishers.FirstOrDefaultAsync(p => p.Name == name);
 | 
			
		||||
        return await db.Publishers.FirstOrDefaultAsync(p => p.Name == name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public async Task<List<Shared.Models.Publisher>> GetUserPublishers(Guid accountId)
 | 
			
		||||
    {
 | 
			
		||||
        var publisherIds = await _db.PublisherMembers
 | 
			
		||||
        var publisherIds = await db.PublisherMembers
 | 
			
		||||
            .Where(m => m.AccountId == accountId)
 | 
			
		||||
            .Select(m => m.PublisherId)
 | 
			
		||||
            .ToListAsync();
 | 
			
		||||
 | 
			
		||||
        return await _db.Publishers
 | 
			
		||||
        return await db.Publishers
 | 
			
		||||
            .Where(p => publisherIds.Contains(p.Id))
 | 
			
		||||
            .ToListAsync();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public async Task<bool> IsMemberWithRole(Guid publisherId, Guid accountId, PublisherMemberRole role)
 | 
			
		||||
    {
 | 
			
		||||
        return await _db.PublisherMembers.AnyAsync(m =>
 | 
			
		||||
        return await db.PublisherMembers.AnyAsync(m =>
 | 
			
		||||
            m.PublisherId == publisherId &&
 | 
			
		||||
            m.AccountId == accountId &&
 | 
			
		||||
            m.Role >= role);
 | 
			
		||||
@@ -46,7 +39,7 @@ public class PublisherService : ServiceBase<IPublisherService>, IPublisherServic
 | 
			
		||||
 | 
			
		||||
    public async Task<List<PublisherFeature>> GetPublisherFeatures(Guid publisherId)
 | 
			
		||||
    {
 | 
			
		||||
        return await _db.PublisherFeatures
 | 
			
		||||
        return await db.PublisherFeatures
 | 
			
		||||
            .Where(f => f.PublisherId == publisherId)
 | 
			
		||||
            .ToListAsync();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ using DysonNetwork.Shared.Cache;
 | 
			
		||||
using DysonNetwork.Shared.Services;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.RateLimiting;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.OpenApi.Models;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,130 @@
 | 
			
		||||
{
 | 
			
		||||
  "ConnectionStrings": {
 | 
			
		||||
    "App": "Host=localhost;Port=5432;Database=dyson_network_pass;Username=postgres;Password=password"
 | 
			
		||||
  },
 | 
			
		||||
  "Debug": true,
 | 
			
		||||
  "BaseUrl": "http://localhost:5071",
 | 
			
		||||
  "Logging": {
 | 
			
		||||
    "LogLevel": {
 | 
			
		||||
      "Default": "Information",
 | 
			
		||||
      "Microsoft.AspNetCore": "Warning"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
  },
 | 
			
		||||
  "AllowedHosts": "*",
 | 
			
		||||
  "ConnectionStrings": {
 | 
			
		||||
    "App": "Host=localhost;Port=5432;Database=dyson_network_pass;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60",
 | 
			
		||||
    "FastRetrieve": "localhost:6379",
 | 
			
		||||
    "Etcd": "localhost:2379"
 | 
			
		||||
  },
 | 
			
		||||
  "Authentication": {
 | 
			
		||||
    "Schemes": {
 | 
			
		||||
      "Bearer": {
 | 
			
		||||
        "ValidAudiences": [
 | 
			
		||||
          "http://localhost:5071",
 | 
			
		||||
          "https://localhost:7099"
 | 
			
		||||
        ],
 | 
			
		||||
        "ValidIssuer": "solar-network"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "AuthToken": {
 | 
			
		||||
    "PublicKeyPath": "Keys/PublicKey.pem",
 | 
			
		||||
    "PrivateKeyPath": "Keys/PrivateKey.pem"
 | 
			
		||||
  },
 | 
			
		||||
  "OidcProvider": {
 | 
			
		||||
    "IssuerUri": "https://nt.solian.app",
 | 
			
		||||
    "PublicKeyPath": "Keys/PublicKey.pem",
 | 
			
		||||
    "PrivateKeyPath": "Keys/PrivateKey.pem",
 | 
			
		||||
    "AccessTokenLifetime": "01:00:00",
 | 
			
		||||
    "RefreshTokenLifetime": "30.00:00:00",
 | 
			
		||||
    "AuthorizationCodeLifetime": "00:30:00",
 | 
			
		||||
    "RequireHttpsMetadata": true
 | 
			
		||||
  },
 | 
			
		||||
  "Tus": {
 | 
			
		||||
    "StorePath": "Uploads"
 | 
			
		||||
  },
 | 
			
		||||
  "Storage": {
 | 
			
		||||
    "PreferredRemote": "minio",
 | 
			
		||||
    "Remote": [
 | 
			
		||||
      {
 | 
			
		||||
        "Id": "minio",
 | 
			
		||||
        "Label": "Minio",
 | 
			
		||||
        "Region": "auto",
 | 
			
		||||
        "Bucket": "solar-network-development",
 | 
			
		||||
        "Endpoint": "localhost:9000",
 | 
			
		||||
        "SecretId": "littlesheep",
 | 
			
		||||
        "SecretKey": "password",
 | 
			
		||||
        "EnabledSigned": true,
 | 
			
		||||
        "EnableSsl": false
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "Id": "cloudflare",
 | 
			
		||||
        "Label": "Cloudflare R2",
 | 
			
		||||
        "Region": "auto",
 | 
			
		||||
        "Bucket": "solar-network",
 | 
			
		||||
        "Endpoint": "0a70a6d1b7128888c823359d0008f4e1.r2.cloudflarestorage.com",
 | 
			
		||||
        "SecretId": "8ff5d06c7b1639829d60bc6838a542e6",
 | 
			
		||||
        "SecretKey": "fd58158c5201be16d1872c9209d9cf199421dae3c2f9972f94b2305976580d67",
 | 
			
		||||
        "EnableSigned": true,
 | 
			
		||||
        "EnableSsl": true
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "Captcha": {
 | 
			
		||||
    "Provider": "cloudflare",
 | 
			
		||||
    "ApiKey": "0x4AAAAAABCDUdOujj4feOb_",
 | 
			
		||||
    "ApiSecret": "0x4AAAAAABCDUWABiJQweqlB7tYq-IqIm8U"
 | 
			
		||||
  },
 | 
			
		||||
  "Notifications": {
 | 
			
		||||
    "Topic": "dev.solsynth.solian",
 | 
			
		||||
    "Endpoint": "http://localhost:8088"
 | 
			
		||||
  },
 | 
			
		||||
  "Email": {
 | 
			
		||||
    "Server": "smtp4dev.orb.local",
 | 
			
		||||
    "Port": 25,
 | 
			
		||||
    "UseSsl": false,
 | 
			
		||||
    "Username": "no-reply@mail.solsynth.dev",
 | 
			
		||||
    "Password": "password",
 | 
			
		||||
    "FromAddress": "no-reply@mail.solsynth.dev",
 | 
			
		||||
    "FromName": "Alphabot",
 | 
			
		||||
    "SubjectPrefix": "Solar Network"
 | 
			
		||||
  },
 | 
			
		||||
  "RealtimeChat": {
 | 
			
		||||
    "Endpoint": "https://solar-network-im44o8gq.livekit.cloud",
 | 
			
		||||
    "ApiKey": "APIs6TiL8wj3A4j",
 | 
			
		||||
    "ApiSecret": "SffxRneIwTnlHPtEf3zicmmv3LUEl7xXael4PvWZrEhE"
 | 
			
		||||
  },
 | 
			
		||||
  "GeoIp": {
 | 
			
		||||
    "DatabasePath": "./Keys/GeoLite2-City.mmdb"
 | 
			
		||||
  },
 | 
			
		||||
  "Oidc": {
 | 
			
		||||
    "Google": {
 | 
			
		||||
      "ClientId": "961776991058-963m1qin2vtp8fv693b5fdrab5hmpl89.apps.googleusercontent.com",
 | 
			
		||||
      "ClientSecret": ""
 | 
			
		||||
    },
 | 
			
		||||
    "Apple": {
 | 
			
		||||
      "ClientId": "dev.solsynth.solian",
 | 
			
		||||
      "TeamId": "W7HPZ53V6B",
 | 
			
		||||
      "KeyId": "B668YP4KBG",
 | 
			
		||||
      "PrivateKeyPath": "./Keys/Solarpass.p8"
 | 
			
		||||
    },
 | 
			
		||||
    "Microsoft": {
 | 
			
		||||
      "ClientId": "YOUR_MICROSOFT_CLIENT_ID",
 | 
			
		||||
      "ClientSecret": "YOUR_MICROSOFT_CLIENT_SECRET",
 | 
			
		||||
      "DiscoveryEndpoint": "YOUR_MICROSOFT_DISCOVERY_ENDPOINT"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "Payment": {
 | 
			
		||||
    "Auth": {
 | 
			
		||||
      "Afdian": "<token here>"
 | 
			
		||||
    },
 | 
			
		||||
    "Subscriptions": {
 | 
			
		||||
      "Afdian": {
 | 
			
		||||
        "7d17aae23c9611f0b5705254001e7c00": "solian.stellar.primary",
 | 
			
		||||
        "7dfae4743c9611f0b3a55254001e7c00": "solian.stellar.nova",
 | 
			
		||||
        "141713ee3d6211f085b352540025c377": "solian.stellar.supernova"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "KnownProxies": [
 | 
			
		||||
    "127.0.0.1",
 | 
			
		||||
    "::1"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user