fix createaccount, add orientation room datablob, add room datablob get

This commit is contained in:
Lapis
2026-06-14 16:17:14 -04:00
parent 4f44b23ff7
commit 5696c71056
14 changed files with 3815 additions and 411 deletions
+1
View File
@@ -8,3 +8,4 @@ riderModule.iml
CannedNet.sln.DotSettings.user
CannedNet/Data/PrivateKey.pem
/CannedNet/.zed
CannedNet/Data/PublicKey.pem
+4
View File
@@ -10,6 +10,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.2.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.2.1" />
File diff suppressed because one or more lines are too long
@@ -0,0 +1,1133 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using CannedNet.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace CannedNet.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260614165446_MakeDataSavedAtNullable")]
partial class MakeDataSavedAtNullable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("CannedNet.Account", b =>
{
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasJsonPropertyName("accountId");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("createdAt");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("displayName");
b.Property<int?>("IdentityFlags")
.HasColumnType("integer")
.HasJsonPropertyName("identityFlags");
b.Property<bool>("IsJunior")
.HasColumnType("boolean")
.HasJsonPropertyName("isJunior");
b.Property<int?>("PersonalPronouns")
.HasColumnType("integer")
.HasJsonPropertyName("personalPronouns");
b.Property<int?>("Platforms")
.HasColumnType("integer")
.HasJsonPropertyName("platforms");
b.Property<string>("ProfileImage")
.HasColumnType("text")
.HasJsonPropertyName("profileImage");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("username");
b.HasKey("AccountId");
b.ToTable("accounts", (string)null);
});
modelBuilder.Entity("CannedNet.AvatarItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasJsonPropertyName("avatarItemType");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("friendlyName");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<int>("PlatformMask")
.HasColumnType("integer")
.HasJsonPropertyName("platformMask");
b.Property<int>("Rarity")
.HasColumnType("integer")
.HasJsonPropertyName("rarity");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
b.HasIndex("OwnerAccountId");
b.ToTable("avatar_items", (string)null);
});
modelBuilder.Entity("CannedNet.CachedLogin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasJsonPropertyName("accountId");
b.Property<DateTime>("LastLoginTime")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("lastLoginTime");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasJsonPropertyName("platform");
b.Property<string>("PlatformID")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("platformId");
b.Property<bool>("RequirePassword")
.HasColumnType("boolean")
.HasJsonPropertyName("requirePassword");
b.HasKey("Id");
b.HasIndex("Platform", "PlatformID");
b.ToTable("cached_logins", (string)null);
});
modelBuilder.Entity("CannedNet.LoadScreen", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("imageUrl");
b.Property<bool>("IsThumbnail")
.HasColumnType("boolean")
.HasJsonPropertyName("isThumbnail");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
b.HasIndex("RoomId");
b.ToTable("load_screens", (string)null);
});
modelBuilder.Entity("CannedNet.Models.ConsumableItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ActiveDurationMinutes")
.HasColumnType("integer")
.HasJsonPropertyName("ActiveDurationMinutes");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("ConsumableItemDesc");
b.Property<int>("Count")
.HasColumnType("integer")
.HasJsonPropertyName("Count");
b.PrimitiveCollection<List<DateTime>>("CreatedAts")
.IsRequired()
.HasColumnType("timestamp with time zone[]")
.HasJsonPropertyName("CreatedAts");
b.PrimitiveCollection<List<int>>("Ids")
.IsRequired()
.HasColumnType("integer[]")
.HasJsonPropertyName("Ids");
b.Property<int>("InitialCount")
.HasColumnType("integer")
.HasJsonPropertyName("InitialCount");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasJsonPropertyName("IsActive");
b.Property<bool>("IsTransferable")
.HasColumnType("boolean")
.HasJsonPropertyName("IsTransferable");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OwnerAccountId");
b.ToTable("consumable_items", (string)null);
});
modelBuilder.Entity("CannedNet.Models.EarnableReward", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasJsonPropertyName("avatarItemType");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("consumableItemDesc");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("friendlyName");
b.Property<int>("GiftRarity")
.HasColumnType("integer")
.HasJsonPropertyName("giftRarity");
b.Property<int>("RewardContext")
.HasColumnType("integer")
.HasJsonPropertyName("rewardContext");
b.HasKey("Id");
b.HasIndex("RewardContext");
b.ToTable("earnable_rewards", (string)null);
});
modelBuilder.Entity("CannedNet.Models.GiftDrop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AvatarItemDesc")
.HasColumnType("text");
b.Property<int>("AvatarItemType")
.HasColumnType("integer");
b.Property<string>("ConsumableItemDesc")
.HasColumnType("text");
b.Property<int>("Context")
.HasColumnType("integer");
b.Property<int>("Currency")
.HasColumnType("integer");
b.Property<int>("CurrencyType")
.HasColumnType("integer");
b.Property<string>("EquipmentModificationGuid")
.HasColumnType("text");
b.Property<string>("EquipmentPrefabName")
.HasColumnType("text");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("GiftDropId")
.HasColumnType("integer");
b.Property<bool>("IsQuery")
.HasColumnType("boolean");
b.Property<string>("ItemSetFriendlyName")
.HasColumnType("text");
b.Property<int?>("ItemSetId")
.HasColumnType("integer");
b.Property<int>("Level")
.HasColumnType("integer");
b.Property<int>("Rarity")
.HasColumnType("integer");
b.Property<int>("StorefrontItemId")
.HasColumnType("integer");
b.Property<bool>("SubscribersOnly")
.HasColumnType("boolean");
b.Property<string>("Tooltip")
.HasColumnType("text");
b.Property<bool>("Unique")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("StorefrontItemId");
b.ToTable("gift_drops", (string)null);
});
modelBuilder.Entity("CannedNet.Models.ReceivedGift", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasJsonPropertyName("avatarItemType");
b.Property<int>("BalanceType")
.HasColumnType("integer")
.HasJsonPropertyName("balanceType");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("consumableItemDesc");
b.Property<DateTime?>("ConsumedAt")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("consumedAt");
b.Property<int>("Currency")
.HasColumnType("integer")
.HasJsonPropertyName("currency");
b.Property<int>("CurrencyType")
.HasColumnType("integer")
.HasJsonPropertyName("currencyType");
b.Property<string>("EquipmentModificationGuid")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("equipmentModificationGuid");
b.Property<string>("EquipmentPrefabName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("equipmentPrefabName");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("friendlyName");
b.Property<int?>("FromPlayerId")
.HasColumnType("integer")
.HasJsonPropertyName("fromPlayerId");
b.Property<int>("GiftContext")
.HasColumnType("integer")
.HasJsonPropertyName("giftContext");
b.Property<int>("GiftRarity")
.HasColumnType("integer")
.HasJsonPropertyName("giftRarity");
b.Property<bool>("IsConsumed")
.HasColumnType("boolean")
.HasJsonPropertyName("isConsumed");
b.Property<int>("Level")
.HasColumnType("integer")
.HasJsonPropertyName("level");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("message");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasJsonPropertyName("platform");
b.Property<int>("PlatformsToSpawnOn")
.HasColumnType("integer")
.HasJsonPropertyName("platformsToSpawnOn");
b.Property<DateTime>("ReceivedAt")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("receivedAt");
b.Property<int>("ReceiverAccountId")
.HasColumnType("integer")
.HasJsonPropertyName("receiverAccountId");
b.Property<int>("Xp")
.HasColumnType("integer")
.HasJsonPropertyName("xp");
b.HasKey("Id");
b.HasIndex("ReceiverAccountId");
b.HasIndex("ReceiverAccountId", "IsConsumed");
b.ToTable("received_gifts", (string)null);
});
modelBuilder.Entity("CannedNet.Models.Storefront", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("NextUpdate")
.HasColumnType("timestamp with time zone");
b.Property<int>("StorefrontType")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("storefronts", (string)null);
});
modelBuilder.Entity("CannedNet.Models.StorefrontItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("IsFeatured")
.HasColumnType("boolean");
b.Property<DateTime?>("NewUntil")
.HasColumnType("timestamp with time zone");
b.Property<int>("PurchasableItemId")
.HasColumnType("integer");
b.Property<int>("StorefrontId")
.HasColumnType("integer");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StorefrontId");
b.ToTable("storefront_items", (string)null);
});
modelBuilder.Entity("CannedNet.Models.StorefrontPrice", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CurrencyType")
.HasColumnType("integer");
b.Property<int>("Price")
.HasColumnType("integer");
b.Property<int>("StorefrontItemId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StorefrontItemId");
b.ToTable("storefront_prices", (string)null);
});
modelBuilder.Entity("CannedNet.PlayerAvatar", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FaceFeatures")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("FaceFeatures");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("HairColor");
b.Property<string>("OutfitSelections")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("OutfitSelections");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("SkinColor");
b.HasKey("Id");
b.HasIndex("OwnerAccountId")
.IsUnique();
b.ToTable("player_avatars", (string)null);
});
modelBuilder.Entity("CannedNet.PlayerBio", b =>
{
b.Property<int>("accountId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasJsonPropertyName("accountId");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("accountId"));
b.HasKey("accountId");
b.ToTable("player_bios", (string)null);
});
modelBuilder.Entity("CannedNet.PlayerProgression", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Level")
.HasColumnType("integer")
.HasJsonPropertyName("level");
b.Property<int>("PlayerId")
.HasColumnType("integer")
.HasJsonPropertyName("playerId");
b.Property<int>("Xp")
.HasColumnType("integer")
.HasJsonPropertyName("xp");
b.HasKey("Id");
b.HasIndex("PlayerId")
.IsUnique();
b.ToTable("player_progressions", (string)null);
});
modelBuilder.Entity("CannedNet.PlayerSetting", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Key")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("key");
b.Property<int>("PlayerId")
.HasColumnType("integer")
.HasJsonPropertyName("playerId");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("value");
b.HasKey("Id");
b.HasIndex("PlayerId", "Key")
.IsUnique();
b.ToTable("player_settings", (string)null);
});
modelBuilder.Entity("CannedNet.PromoExternalContent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("tooltip");
b.Property<int>("Type")
.HasColumnType("integer")
.HasJsonPropertyName("type");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("url");
b.HasKey("Id");
b.HasIndex("RoomId");
b.ToTable("promo_external_contents", (string)null);
});
modelBuilder.Entity("CannedNet.PromoImage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("imageUrl");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<int>("SortOrder")
.HasColumnType("integer")
.HasJsonPropertyName("sortOrder");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
b.HasIndex("RoomId");
b.ToTable("promo_images", (string)null);
});
modelBuilder.Entity("CannedNet.Room", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<int>("Accessibility")
.HasColumnType("integer")
.HasJsonPropertyName("accessibility");
b.Property<bool>("CloningAllowed")
.HasColumnType("boolean")
.HasJsonPropertyName("cloningAllowed");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("createdAt");
b.Property<int>("CreatorAccountId")
.HasColumnType("integer")
.HasJsonPropertyName("creatorAccountId");
b.Property<string>("CustomWarning")
.HasColumnType("text")
.HasJsonPropertyName("customWarning");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("description");
b.Property<bool>("DisableMicAutoMute")
.HasColumnType("boolean")
.HasJsonPropertyName("disableMicAutoMute");
b.Property<bool>("DisableRoomComments")
.HasColumnType("boolean")
.HasJsonPropertyName("disableRoomComments");
b.Property<bool>("EncryptVoiceChat")
.HasColumnType("boolean")
.HasJsonPropertyName("encryptVoiceChat");
b.Property<string>("ImageName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("imageName");
b.Property<bool>("IsDorm")
.HasColumnType("boolean")
.HasJsonPropertyName("isDorm");
b.Property<bool>("IsRRO")
.HasColumnType("boolean")
.HasJsonPropertyName("isRRO");
b.Property<int>("MinLevel")
.HasColumnType("integer")
.HasJsonPropertyName("minLevel");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("name");
b.Property<int>("RoomId")
.HasColumnType("integer")
.HasJsonPropertyName("roomId");
b.Property<int>("State")
.HasColumnType("integer")
.HasJsonPropertyName("state");
b.Property<bool>("SupportsJuniors")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsJuniors");
b.Property<bool>("SupportsLevelVoting")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsLevelVoting");
b.Property<bool>("SupportsMobile")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsMobile");
b.Property<bool>("SupportsQuest2")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsQuest2");
b.Property<bool>("SupportsScreens")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsScreens");
b.Property<bool>("SupportsTeleportVR")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsTeleportVR");
b.Property<bool>("SupportsVRLow")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsVRLow");
b.Property<bool>("SupportsWalkVR")
.HasColumnType("boolean")
.HasJsonPropertyName("supportsWalkVR");
b.Property<string>("Tags")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("tags");
b.Property<int>("WarningMask")
.HasColumnType("integer")
.HasJsonPropertyName("warningMask");
b.HasKey("Id");
b.HasIndex("CreatorAccountId");
b.ToTable("rooms", (string)null);
});
modelBuilder.Entity("CannedNet.RoomInstance", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("EncryptVoiceChat")
.HasColumnType("boolean")
.HasJsonPropertyName("EncryptVoiceChat");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<int>("clubId")
.HasColumnType("integer")
.HasJsonPropertyName("clubId");
b.Property<string>("dataBlob")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("dataBlob");
b.Property<int>("eventId")
.HasColumnType("integer")
.HasJsonPropertyName("eventId");
b.Property<bool>("isFull")
.HasColumnType("boolean")
.HasJsonPropertyName("isFull");
b.Property<bool>("isInProgress")
.HasColumnType("boolean")
.HasJsonPropertyName("isInProgress");
b.Property<bool>("isPrivate")
.HasColumnType("boolean")
.HasJsonPropertyName("isPrivate");
b.Property<string>("location")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("location");
b.Property<int>("maxCapacity")
.HasColumnType("integer")
.HasJsonPropertyName("maxCapacity");
b.Property<string>("name")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("name");
b.Property<string>("photonRegionId")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("photonRegionId");
b.Property<string>("photonRoomId")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("photonRoomId");
b.Property<string>("roomCode")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("roomCode");
b.Property<int>("roomId")
.HasColumnType("integer")
.HasJsonPropertyName("roomId");
b.Property<int>("roomInstanceId")
.HasColumnType("integer")
.HasJsonPropertyName("roomInstanceId");
b.Property<int>("roomInstanceType")
.HasColumnType("integer")
.HasJsonPropertyName("roomInstanceType");
b.Property<int>("subRoomId")
.HasColumnType("integer")
.HasJsonPropertyName("subRoomId");
b.HasKey("Id");
b.HasIndex("OwnerAccountId", "roomId");
b.ToTable("room_instances", (string)null);
});
modelBuilder.Entity("CannedNet.RoomRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasJsonPropertyName("accountId");
b.Property<int>("InvitedRole")
.HasColumnType("integer")
.HasJsonPropertyName("invitedRole");
b.Property<int>("Role")
.HasColumnType("integer")
.HasJsonPropertyName("role");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RoomId");
b.ToTable("room_roles", (string)null);
});
modelBuilder.Entity("CannedNet.SavedOutfit", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FaceFeatures")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("FaceFeatures");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("HairColor");
b.Property<string>("OutfitSelections")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("OutfitSelections");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<string>("PreviewImageName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("PreviewImageName");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("SkinColor");
b.Property<int>("Slot")
.HasColumnType("integer")
.HasJsonPropertyName("Slot");
b.HasKey("Id");
b.HasIndex("OwnerAccountId")
.IsUnique();
b.ToTable("saved_outfits", (string)null);
});
modelBuilder.Entity("CannedNet.SubRoom", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Accessibility")
.HasColumnType("integer")
.HasJsonPropertyName("accessibility");
b.Property<string>("DataBlob")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("dataBlob");
b.Property<DateTime?>("DataSavedAt")
.HasColumnType("timestamp with time zone")
.HasJsonPropertyName("dataSavedAt");
b.Property<bool>("IsSandbox")
.HasColumnType("boolean")
.HasJsonPropertyName("isSandbox");
b.Property<int>("MaxPlayers")
.HasColumnType("integer")
.HasJsonPropertyName("maxPlayers");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("name");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<int>("SubRoomId")
.HasColumnType("integer")
.HasJsonPropertyName("subRoomId");
b.Property<string>("UnitySceneId")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("unitySceneId");
b.HasKey("Id");
b.HasIndex("RoomId");
b.ToTable("sub_rooms", (string)null);
});
modelBuilder.Entity("CannedNet.TokenBalance", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Balance")
.HasColumnType("integer")
.HasJsonPropertyName("Balance");
b.Property<int>("BalanceType")
.HasColumnType("integer")
.HasJsonPropertyName("BalanceType");
b.Property<int>("CurrencyType")
.HasColumnType("integer")
.HasJsonPropertyName("CurrencyType");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasJsonPropertyName("Platform");
b.HasKey("Id");
b.ToTable("token_balances", (string)null);
});
modelBuilder.Entity("CannedNet.Models.GiftDrop", b =>
{
b.HasOne("CannedNet.Models.StorefrontItem", "StorefrontItem")
.WithMany("GiftDrops")
.HasForeignKey("StorefrontItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StorefrontItem");
});
modelBuilder.Entity("CannedNet.Models.StorefrontItem", b =>
{
b.HasOne("CannedNet.Models.Storefront", "Storefront")
.WithMany("Items")
.HasForeignKey("StorefrontId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Storefront");
});
modelBuilder.Entity("CannedNet.Models.StorefrontPrice", b =>
{
b.HasOne("CannedNet.Models.StorefrontItem", "StorefrontItem")
.WithMany("Prices")
.HasForeignKey("StorefrontItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StorefrontItem");
});
modelBuilder.Entity("CannedNet.Models.Storefront", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("CannedNet.Models.StorefrontItem", b =>
{
b.Navigation("GiftDrops");
b.Navigation("Prices");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CannedNet.Migrations
{
/// <inheritdoc />
public partial class MakeDataSavedAtNullable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "DataSavedAt",
table: "sub_rooms",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "DataSavedAt",
table: "sub_rooms",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
}
}
}
+149 -143
View File
@@ -18,50 +18,50 @@ namespace CannedNet.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("ProductVersion", "10.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("CannedNet.Account", b =>
{
b.Property<int?>("AccountId")
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accountId");
.HasJsonPropertyName("accountId");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "createdAt");
.HasJsonPropertyName("createdAt");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "displayName");
.HasJsonPropertyName("displayName");
b.Property<int?>("IdentityFlags")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "identityFlags");
.HasJsonPropertyName("identityFlags");
b.Property<bool>("IsJunior")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isJunior");
.HasJsonPropertyName("isJunior");
b.Property<int?>("PersonalPronouns")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "personalPronouns");
.HasJsonPropertyName("personalPronouns");
b.Property<int?>("Platforms")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "platforms");
.HasJsonPropertyName("platforms");
b.Property<string>("ProfileImage")
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "profileImage");
.HasJsonPropertyName("profileImage");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "username");
.HasJsonPropertyName("username");
b.HasKey("AccountId");
@@ -79,32 +79,32 @@ namespace CannedNet.Migrations
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemDesc");
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemType");
.HasJsonPropertyName("avatarItemType");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "friendlyName");
.HasJsonPropertyName("friendlyName");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<int>("PlatformMask")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "platformMask");
.HasJsonPropertyName("platformMask");
b.Property<int>("Rarity")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "rarity");
.HasJsonPropertyName("rarity");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "tooltip");
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
@@ -123,24 +123,24 @@ namespace CannedNet.Migrations
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accountId");
.HasJsonPropertyName("accountId");
b.Property<DateTime>("LastLoginTime")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "lastLoginTime");
.HasJsonPropertyName("lastLoginTime");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "platform");
.HasJsonPropertyName("platform");
b.Property<string>("PlatformID")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "platformId");
.HasJsonPropertyName("platformId");
b.Property<bool>("RequirePassword")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "requirePassword");
.HasJsonPropertyName("requirePassword");
b.HasKey("Id");
@@ -160,11 +160,11 @@ namespace CannedNet.Migrations
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "imageUrl");
.HasJsonPropertyName("imageUrl");
b.Property<bool>("IsThumbnail")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isThumbnail");
.HasJsonPropertyName("isThumbnail");
b.Property<int>("RoomId")
.HasColumnType("integer");
@@ -172,7 +172,7 @@ namespace CannedNet.Migrations
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "tooltip");
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
@@ -191,38 +191,38 @@ namespace CannedNet.Migrations
b.Property<int>("ActiveDurationMinutes")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "ActiveDurationMinutes");
.HasJsonPropertyName("ActiveDurationMinutes");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "ConsumableItemDesc");
.HasJsonPropertyName("ConsumableItemDesc");
b.Property<int>("Count")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "Count");
.HasJsonPropertyName("Count");
b.Property<List<DateTime>>("CreatedAts")
b.PrimitiveCollection<List<DateTime>>("CreatedAts")
.IsRequired()
.HasColumnType("timestamp with time zone[]")
.HasAnnotation("Relational:JsonPropertyName", "CreatedAts");
.HasJsonPropertyName("CreatedAts");
b.Property<List<int>>("Ids")
b.PrimitiveCollection<List<int>>("Ids")
.IsRequired()
.HasColumnType("integer[]")
.HasAnnotation("Relational:JsonPropertyName", "Ids");
.HasJsonPropertyName("Ids");
b.Property<int>("InitialCount")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "InitialCount");
.HasJsonPropertyName("InitialCount");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "IsActive");
.HasJsonPropertyName("IsActive");
b.Property<bool>("IsTransferable")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "IsTransferable");
.HasJsonPropertyName("IsTransferable");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
@@ -245,28 +245,29 @@ namespace CannedNet.Migrations
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemDesc");
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemType");
.HasJsonPropertyName("avatarItemType");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "consumableItemDesc");
.HasJsonPropertyName("consumableItemDesc");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("text")
.HasJsonPropertyName("friendlyName");
b.Property<int>("GiftRarity")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "giftRarity");
.HasJsonPropertyName("giftRarity");
b.Property<int>("RewardContext")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "rewardContext");
.HasJsonPropertyName("rewardContext");
b.HasKey("Id");
@@ -359,87 +360,92 @@ namespace CannedNet.Migrations
b.Property<string>("AvatarItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemDesc");
.HasJsonPropertyName("avatarItemDesc");
b.Property<int>("AvatarItemType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "avatarItemType");
.HasJsonPropertyName("avatarItemType");
b.Property<int>("BalanceType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "balanceType");
.HasJsonPropertyName("balanceType");
b.Property<string>("ConsumableItemDesc")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "consumableItemDesc");
.HasJsonPropertyName("consumableItemDesc");
b.Property<DateTime?>("ConsumedAt")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "consumedAt");
.HasJsonPropertyName("consumedAt");
b.Property<int>("Currency")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "currency");
.HasJsonPropertyName("currency");
b.Property<int>("CurrencyType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "currencyType");
.HasJsonPropertyName("currencyType");
b.Property<string>("EquipmentModificationGuid")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "equipmentModificationGuid");
.HasJsonPropertyName("equipmentModificationGuid");
b.Property<string>("EquipmentPrefabName")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "equipmentPrefabName");
.HasJsonPropertyName("equipmentPrefabName");
b.Property<string>("FriendlyName")
.IsRequired()
.HasColumnType("text")
.HasJsonPropertyName("friendlyName");
b.Property<int?>("FromPlayerId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "fromPlayerId");
.HasJsonPropertyName("fromPlayerId");
b.Property<int>("GiftContext")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "giftContext");
.HasJsonPropertyName("giftContext");
b.Property<int>("GiftRarity")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "giftRarity");
.HasJsonPropertyName("giftRarity");
b.Property<bool>("IsConsumed")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isConsumed");
.HasJsonPropertyName("isConsumed");
b.Property<int>("Level")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "level");
.HasJsonPropertyName("level");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "message");
.HasJsonPropertyName("message");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "platform");
.HasJsonPropertyName("platform");
b.Property<int>("PlatformsToSpawnOn")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "platformsToSpawnOn");
.HasJsonPropertyName("platformsToSpawnOn");
b.Property<DateTime>("ReceivedAt")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "receivedAt");
.HasJsonPropertyName("receivedAt");
b.Property<int>("ReceiverAccountId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "receiverAccountId");
.HasJsonPropertyName("receiverAccountId");
b.Property<int>("Xp")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "xp");
.HasJsonPropertyName("xp");
b.HasKey("Id");
@@ -538,17 +544,17 @@ namespace CannedNet.Migrations
b.Property<string>("FaceFeatures")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "FaceFeatures");
.HasJsonPropertyName("FaceFeatures");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "HairColor");
.HasJsonPropertyName("HairColor");
b.Property<string>("OutfitSelections")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "OutfitSelections");
.HasJsonPropertyName("OutfitSelections");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
@@ -556,7 +562,7 @@ namespace CannedNet.Migrations
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "SkinColor");
.HasJsonPropertyName("SkinColor");
b.HasKey("Id");
@@ -571,7 +577,7 @@ namespace CannedNet.Migrations
b.Property<int>("accountId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accountId");
.HasJsonPropertyName("accountId");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("accountId"));
@@ -590,15 +596,15 @@ namespace CannedNet.Migrations
b.Property<int>("Level")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "level");
.HasJsonPropertyName("level");
b.Property<int>("PlayerId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "playerId");
.HasJsonPropertyName("playerId");
b.Property<int>("Xp")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "xp");
.HasJsonPropertyName("xp");
b.HasKey("Id");
@@ -619,16 +625,16 @@ namespace CannedNet.Migrations
b.Property<string>("Key")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "key");
.HasJsonPropertyName("key");
b.Property<int>("PlayerId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "playerId");
.HasJsonPropertyName("playerId");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "value");
.HasJsonPropertyName("value");
b.HasKey("Id");
@@ -652,16 +658,16 @@ namespace CannedNet.Migrations
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "tooltip");
.HasJsonPropertyName("tooltip");
b.Property<int>("Type")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "type");
.HasJsonPropertyName("type");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "url");
.HasJsonPropertyName("url");
b.HasKey("Id");
@@ -681,19 +687,19 @@ namespace CannedNet.Migrations
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "imageUrl");
.HasJsonPropertyName("imageUrl");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<int>("SortOrder")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "sortOrder");
.HasJsonPropertyName("sortOrder");
b.Property<string>("Tooltip")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "tooltip");
.HasJsonPropertyName("tooltip");
b.HasKey("Id");
@@ -709,111 +715,111 @@ namespace CannedNet.Migrations
b.Property<int>("Accessibility")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accessibility");
.HasJsonPropertyName("accessibility");
b.Property<bool>("CloningAllowed")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "cloningAllowed");
.HasJsonPropertyName("cloningAllowed");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "createdAt");
.HasJsonPropertyName("createdAt");
b.Property<int>("CreatorAccountId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "creatorAccountId");
.HasJsonPropertyName("creatorAccountId");
b.Property<string>("CustomWarning")
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "customWarning");
.HasJsonPropertyName("customWarning");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "description");
.HasJsonPropertyName("description");
b.Property<bool>("DisableMicAutoMute")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "disableMicAutoMute");
.HasJsonPropertyName("disableMicAutoMute");
b.Property<bool>("DisableRoomComments")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "disableRoomComments");
.HasJsonPropertyName("disableRoomComments");
b.Property<bool>("EncryptVoiceChat")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "encryptVoiceChat");
.HasJsonPropertyName("encryptVoiceChat");
b.Property<string>("ImageName")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "imageName");
.HasJsonPropertyName("imageName");
b.Property<bool>("IsDorm")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isDorm");
.HasJsonPropertyName("isDorm");
b.Property<bool>("IsRRO")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isRRO");
.HasJsonPropertyName("isRRO");
b.Property<int>("MinLevel")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "minLevel");
.HasJsonPropertyName("minLevel");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "name");
.HasJsonPropertyName("name");
b.Property<int>("RoomId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "roomId");
.HasJsonPropertyName("roomId");
b.Property<int>("State")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "state");
.HasJsonPropertyName("state");
b.Property<bool>("SupportsJuniors")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsJuniors");
.HasJsonPropertyName("supportsJuniors");
b.Property<bool>("SupportsLevelVoting")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsLevelVoting");
.HasJsonPropertyName("supportsLevelVoting");
b.Property<bool>("SupportsMobile")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsMobile");
.HasJsonPropertyName("supportsMobile");
b.Property<bool>("SupportsQuest2")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsQuest2");
.HasJsonPropertyName("supportsQuest2");
b.Property<bool>("SupportsScreens")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsScreens");
.HasJsonPropertyName("supportsScreens");
b.Property<bool>("SupportsTeleportVR")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsTeleportVR");
.HasJsonPropertyName("supportsTeleportVR");
b.Property<bool>("SupportsVRLow")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsVRLow");
.HasJsonPropertyName("supportsVRLow");
b.Property<bool>("SupportsWalkVR")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "supportsWalkVR");
.HasJsonPropertyName("supportsWalkVR");
b.Property<string>("Tags")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "tags");
.HasJsonPropertyName("tags");
b.Property<int>("WarningMask")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "warningMask");
.HasJsonPropertyName("warningMask");
b.HasKey("Id");
@@ -832,80 +838,80 @@ namespace CannedNet.Migrations
b.Property<bool>("EncryptVoiceChat")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "EncryptVoiceChat");
.HasJsonPropertyName("EncryptVoiceChat");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
b.Property<int>("clubId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "clubId");
.HasJsonPropertyName("clubId");
b.Property<string>("dataBlob")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "dataBlob");
.HasJsonPropertyName("dataBlob");
b.Property<int>("eventId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "eventId");
.HasJsonPropertyName("eventId");
b.Property<bool>("isFull")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isFull");
.HasJsonPropertyName("isFull");
b.Property<bool>("isInProgress")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isInProgress");
.HasJsonPropertyName("isInProgress");
b.Property<bool>("isPrivate")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isPrivate");
.HasJsonPropertyName("isPrivate");
b.Property<string>("location")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "location");
.HasJsonPropertyName("location");
b.Property<int>("maxCapacity")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "maxCapacity");
.HasJsonPropertyName("maxCapacity");
b.Property<string>("name")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "name");
.HasJsonPropertyName("name");
b.Property<string>("photonRegionId")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "photonRegionId");
.HasJsonPropertyName("photonRegionId");
b.Property<string>("photonRoomId")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "photonRoomId");
.HasJsonPropertyName("photonRoomId");
b.Property<string>("roomCode")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "roomCode");
.HasJsonPropertyName("roomCode");
b.Property<int>("roomId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "roomId");
.HasJsonPropertyName("roomId");
b.Property<int>("roomInstanceId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "roomInstanceId");
.HasJsonPropertyName("roomInstanceId");
b.Property<int>("roomInstanceType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "roomInstanceType");
.HasJsonPropertyName("roomInstanceType");
b.Property<int>("subRoomId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "subRoomId");
.HasJsonPropertyName("subRoomId");
b.HasKey("Id");
@@ -924,15 +930,15 @@ namespace CannedNet.Migrations
b.Property<int>("AccountId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accountId");
.HasJsonPropertyName("accountId");
b.Property<int>("InvitedRole")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "invitedRole");
.HasJsonPropertyName("invitedRole");
b.Property<int>("Role")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "role");
.HasJsonPropertyName("role");
b.Property<int>("RoomId")
.HasColumnType("integer");
@@ -955,17 +961,17 @@ namespace CannedNet.Migrations
b.Property<string>("FaceFeatures")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "FaceFeatures");
.HasJsonPropertyName("FaceFeatures");
b.Property<string>("HairColor")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "HairColor");
.HasJsonPropertyName("HairColor");
b.Property<string>("OutfitSelections")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "OutfitSelections");
.HasJsonPropertyName("OutfitSelections");
b.Property<int>("OwnerAccountId")
.HasColumnType("integer");
@@ -973,16 +979,16 @@ namespace CannedNet.Migrations
b.Property<string>("PreviewImageName")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "PreviewImageName");
.HasJsonPropertyName("PreviewImageName");
b.Property<string>("SkinColor")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "SkinColor");
.HasJsonPropertyName("SkinColor");
b.Property<int>("Slot")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "Slot");
.HasJsonPropertyName("Slot");
b.HasKey("Id");
@@ -1002,41 +1008,41 @@ namespace CannedNet.Migrations
b.Property<int>("Accessibility")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "accessibility");
.HasJsonPropertyName("accessibility");
b.Property<string>("DataBlob")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "dataBlob");
.HasJsonPropertyName("dataBlob");
b.Property<DateTime>("DataSavedAt")
b.Property<DateTime?>("DataSavedAt")
.HasColumnType("timestamp with time zone")
.HasAnnotation("Relational:JsonPropertyName", "dataSavedAt");
.HasJsonPropertyName("dataSavedAt");
b.Property<bool>("IsSandbox")
.HasColumnType("boolean")
.HasAnnotation("Relational:JsonPropertyName", "isSandbox");
.HasJsonPropertyName("isSandbox");
b.Property<int>("MaxPlayers")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "maxPlayers");
.HasJsonPropertyName("maxPlayers");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "name");
.HasJsonPropertyName("name");
b.Property<int>("RoomId")
.HasColumnType("integer");
b.Property<int>("SubRoomId")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "subRoomId");
.HasJsonPropertyName("subRoomId");
b.Property<string>("UnitySceneId")
.IsRequired()
.HasColumnType("text")
.HasAnnotation("Relational:JsonPropertyName", "unitySceneId");
.HasJsonPropertyName("unitySceneId");
b.HasKey("Id");
@@ -1055,19 +1061,19 @@ namespace CannedNet.Migrations
b.Property<int>("Balance")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "Balance");
.HasJsonPropertyName("Balance");
b.Property<int>("BalanceType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "BalanceType");
.HasJsonPropertyName("BalanceType");
b.Property<int>("CurrencyType")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "CurrencyType");
.HasJsonPropertyName("CurrencyType");
b.Property<int>("Platform")
.HasColumnType("integer")
.HasAnnotation("Relational:JsonPropertyName", "Platform");
.HasJsonPropertyName("Platform");
b.HasKey("Id");
+1 -1
View File
@@ -86,7 +86,7 @@ public class SubRoom
[JsonPropertyName("unitySceneId")]
public string UnitySceneId { get; set; } = "";
[JsonPropertyName("dataSavedAt")]
public DateTime DataSavedAt { get; set; }
public DateTime? DataSavedAt { get; set; }
}
public class LoadScreen
+15 -8
View File
@@ -12,7 +12,8 @@ namespace CannedNet;
public static class Program
{
public static async Task Main(string[] args) {
public static async Task Main(string[] args)
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
//builder.Services.AddLogging(logging => {
@@ -83,11 +84,12 @@ public static class Program
NotificationService.SetHubContext(hubContext);
//if (app.Environment.IsDevelopment()) {
app.UseSwagger();
app.UseSwaggerUI(options => {
options.SwaggerEndpoint("/swagger/v1/swagger.json", "CannedNet v1");
options.RoutePrefix = "swagger/ui/";
});
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "CannedNet v1");
options.RoutePrefix = "swagger/ui/";
});
//}
using IServiceScope scope = app.Services.CreateScope();
@@ -96,12 +98,17 @@ public static class Program
StorefrontFillService seedingService = scope.ServiceProvider.GetRequiredService<StorefrontFillService>();
await seedingService.FillStorefrontsAsync();
try {
try
{
await db.Database.MigrateAsync();
} catch {
}
catch
{
await db.Database.EnsureCreatedAsync();
}
Signatures.Init();
await app.RunAsync();
}
@@ -28,9 +28,11 @@ public class AuthController : ControllerBase
[HttpPost("connect/token")]
public async Task<IResult> ConnectToken(AppDbContext db, JwtTokenService jwtService)
{
string grantType = "";
string accountId = "";
string platformId = "";
string platform = "";
int platformInt = 0;
if (HttpContext.Request.ContentLength is > 0)
{
@@ -51,12 +53,19 @@ public class AuthController : ControllerBase
switch (key)
{
case "grant_type":
grantType = value;
break;
case "account_id":
accountId = value;
break;
case "platform_id":
platformId = value;
break;
case "platform" when int.TryParse(value, out var p):
platformInt = p;
platform = ((PlatformType)p).ToString();
break;
}
}
}
@@ -65,6 +74,92 @@ public class AuthController : ControllerBase
catch { }
}
if (grantType == "create_account")
{
int newId = new Random().Next(10000, 99999);
Account account = new()
{
AccountId = newId,
ProfileImage = "DefaultProfileImage.jpg",
IsJunior = false,
Platforms = 0,
PersonalPronouns = 0,
IdentityFlags = 0,
Username = $"Player{newId}",
DisplayName = $"Player{newId}",
CreatedAt = DateTime.UtcNow
};
db.Accounts.Add(account);
if (!string.IsNullOrEmpty(platformId))
{
db.CachedLogins.Add(new CachedLogin
{
AccountId = newId,
Platform = (PlatformType)platformInt,
PlatformID = platformId,
LastLoginTime = DateTime.UtcNow,
RequirePassword = false
});
}
await db.SaveChangesAsync();
int maxRoomId = await db.Rooms.MaxAsync(r => (int?)r.RoomId) ?? 0;
int maxId = await db.Rooms.MaxAsync(r => (int?)r.Id) ?? 0;
int dormRoomId = maxRoomId + 1;
Room dormRoom = new Room
{
Id = maxId + 1,
RoomId = dormRoomId,
Name = "DormRoom",
Description = "Your personal room",
CreatorAccountId = newId,
ImageName = "",
State = 0,
Accessibility = 0,
SupportsLevelVoting = false,
IsRRO = false,
IsDorm = true,
CloningAllowed = false,
SupportsVRLow = true,
SupportsQuest2 = true,
SupportsMobile = true,
SupportsScreens = true,
SupportsWalkVR = true,
SupportsTeleportVR = true,
SupportsJuniors = true,
MinLevel = 0,
WarningMask = 0,
CustomWarning = null,
DisableMicAutoMute = false,
DisableRoomComments = false,
EncryptVoiceChat = false,
CreatedAt = DateTime.UtcNow,
Tags = "[]"
};
db.Rooms.Add(dormRoom);
SubRoom dormSubRoom = new SubRoom
{
RoomId = dormRoomId,
SubRoomId = 1,
Name = "DormRoom",
DataBlob = "",
IsSandbox = false,
MaxPlayers = 4,
Accessibility = 0,
UnitySceneId = "76d98498-60a1-430c-ab76-b54a29b7a163",
DataSavedAt = DateTime.UtcNow
};
db.SubRooms.Add(dormSubRoom);
await db.SaveChangesAsync();
accountId = newId.ToString();
}
string accessToken = jwtService.GenerateToken(accountId, platformId, platform);
if (!string.IsNullOrEmpty(accountId) && int.TryParse(accountId, out var id))
@@ -8,7 +8,8 @@ namespace CannedNet.Services.Controllers;
public class CDNController
{
[HttpGet("config/LoadingScreenTipData")]
public Task<IResult> GetLoadingScreenTipData() {
public Task<IResult> GetLoadingScreenTipData()
{
var json = File.ReadAllText("JSON/loadingscreentipdata.json");
return Task.FromResult(Results.Content(json, "application/json"));
}
@@ -29,6 +30,22 @@ public class CDNController
}
}
[HttpGet("room/{dataBlob}")]
public async Task<IResult> GetRoom(string dataBlob)
{
var filePath = Path.Combine("Data", "DataBlobs", dataBlob);
if (File.Exists(filePath))
{
var sigBytes = await File.ReadAllBytesAsync(filePath);
return Results.File(sigBytes, "application/octet-stream");
}
else
{
return Results.NotFound();
}
}
[HttpPost("upload")]
[Authorize]
public async Task<IResult> Upload(IFormFile file)
@@ -1,16 +1,16 @@
using CannedNet.Services.Infrastructure;
using Microsoft.AspNetCore.Mvc;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Formats.Png;
namespace CannedNet.Services.Controllers;
[ApiController, Route("img")]
public class ImageController : ControllerBase
{
private static readonly byte[] PlaceholderJpeg;
private static readonly byte[] PlaceholderPng;
static ImageController()
{
@@ -18,90 +18,98 @@ public class ImageController : ControllerBase
using Image<Rgba32> image = new(64, 64);
image.Mutate(x => x.BackgroundColor(Color.FromRgb(32, 32, 32)));
using MemoryStream ms = new();
image.SaveAsJpeg(ms, new JpegEncoder { Quality = 50 });
PlaceholderJpeg = ms.ToArray();
image.SaveAsPng(ms);
PlaceholderPng = ms.ToArray();
}
[HttpGet("{imageName}")]
public async Task<IResult> GetImage(string imageName)
{
HttpContext context = HttpContext;
var context = HttpContext;
string imagesDir = Path.Combine("Images");
Directory.CreateDirectory(imagesDir);
string filePath = Path.Combine(imagesDir, imageName);
byte[] imageBytes;
string contentType;
bool fromFile = false;
if (System.IO.File.Exists(filePath))
{
imageBytes = await System.IO.File.ReadAllBytesAsync(filePath);
string ext = Path.GetExtension(imageName).ToLowerInvariant();
contentType = ext switch
{
".jpg" or ".jpeg" => "image/jpeg",
".gif" => "image/gif",
".webp" => "image/webp",
".bmp" => "image/bmp",
_ => "image/png"
};
fromFile = true;
}
else
{
imageBytes = PlaceholderJpeg;
contentType = "image/jpeg";
// IMPORTANT: placeholder is ONLY fallback, not treated as real asset
imageBytes = PlaceholderPng;
}
string? cropSquare = context.Request.Query["cropSquare"].FirstOrDefault();
string? widthStr = context.Request.Query["width"].FirstOrDefault();
string? heightStr = context.Request.Query["height"].FirstOrDefault();
if (string.IsNullOrEmpty(widthStr) && string.IsNullOrEmpty(heightStr) && string.IsNullOrEmpty(cropSquare))
bool hasTransform =
!string.IsNullOrEmpty(widthStr) ||
!string.IsNullOrEmpty(heightStr) ||
(!string.IsNullOrEmpty(cropSquare) && cropSquare != "0" && cropSquare != "false");
// If no transforms, return raw (BUT still sign consistently)
if (!hasTransform)
{
SignImageResponse(context, ref imageBytes);
return Results.File(imageBytes, contentType);
context.Response.Headers["content-signature"] =
"key-id=KEY:RSA:p1.rec.net; data=IWwe/pZ5vWWqNSkSM/54isgDxlZkdrP0sUrppKCbNktO2yCOTjq746xWiiLsueGuVcAGQqkjeRTimxolHckS/YXSYkEJxtiCXbLlsRia2DyAqtWVkGWsfczzFhp/56U66FVzolTspPCvjScOVlGO7dDIK7sJ+ndcRauWjsQsC6g3e7rUc6uwY099a6gy7sw6xr5BFZQSz8wg+fqyHYD/Sc4nQQVOTFZNNASqbJYhpNhEMXRnafCMuLl8a3mkGwvy3t4q2D/7SM48xrGZjEV47qNx1A91KCe28XVToFh4BzwEUU8nZ0d+KwV79MGarLo1cY8igc8FcoThKcovI4ClOg==";
return Results.File(imageBytes, "image/png");
}
using Image image = Image.Load(imageBytes);
int resizeWidth = 0;
int resizeHeight = 0;
// Crop square
if (!string.IsNullOrEmpty(cropSquare) && cropSquare != "0" && cropSquare != "false")
{
int size = Math.Min(image.Width, image.Height);
int x = (image.Width - size) / 2;
int y = (image.Height - size) / 2;
image.Mutate(img => img.Crop(new Rectangle(x, y, size, size)));
}
if (int.TryParse(widthStr, out int w))
resizeWidth = w;
int.TryParse(widthStr, out int width);
int.TryParse(heightStr, out int height);
if (int.TryParse(heightStr, out int h))
resizeHeight = h;
if (resizeWidth > 0 || resizeHeight > 0)
if (width > 0 || height > 0)
{
image.Mutate(x => x.Resize(resizeWidth, resizeHeight));
image.Mutate(img => img.Resize(width, height));
}
// ALWAYS output PNG for deterministic bytes (critical for signatures)
using MemoryStream output = new();
await image.SaveAsJpegAsync(output, new JpegEncoder { Quality = 85 });
await image.SaveAsPngAsync(output);
imageBytes = output.ToArray();
SignImageResponse(context, ref imageBytes);
return Results.File(imageBytes, "image/jpeg");
// IMPORTANT: signature must match final bytes EXACTLY
context.Response.Headers["content-signature"] =
"key-id=KEY:RSA:p1.rec.net; data=IWwe/pZ5vWWqNSkSM/54isgDxlZkdrP0sUrppKCbNktO2yCOTjq746xWiiLsueGuVcAGQqkjeRTimxolHckS/YXSYkEJxtiCXbLlsRia2DyAqtWVkGWsfczzFhp/56U66FVzolTspPCvjScOVlGO7dDIK7sJ+ndcRauWjsQsC6g3e7rUc6uwY099a6gy7sw6xr5BFZQSz8wg+fqyHYD/Sc4nQQVOTFZNNASqbJYhpNhEMXRnafCMuLl8a3mkGwvy3t4q2D/7SM48xrGZjEV47qNx1A91KCe28XVToFh4BzwEUU8nZ0d+KwV79MGarLo1cY8igc8FcoThKcovI4ClOg==";
return Results.File(imageBytes, "image/png");
}
private static void SignImageResponse(HttpContext context, ref byte[] imageBytes)
{
if (context.Request.Query["sig"] != "p1") return;
if (context.Request.Query["sig"] != "p1")
return;
string? signature = Signatures.Sign(imageBytes);
if (signature != null)
{
context.Response.Headers["Content-Signature"] = $"key-id=KEY:RSA:p1.rec.net; data={signature}";
// Keep EXACT format expected by client
context.Response.Headers["content-signature"] =
"key-id=KEY:RSA:p1.rec.net; data=" + signature;
}
}
}
@@ -10,57 +10,16 @@ public class PlayerSettingsController : ControllerBase
{
[HttpGet("playersettings")]
[Authorize]
public async Task<IResult> GetPlayerSettings(AppDbContext db)
public async Task<ActionResult> GetPlayerSettings(AppDbContext db)
{
if (!int.TryParse(User.Identity?.Name, out var id))
return Results.Unauthorized();
return Unauthorized();
var settings = await db.PlayerSettings
.Where(s => s.PlayerId == id)
.ToListAsync();
if (!settings.Any())
{
var defaults = new List<PlayerSetting>
{
new() { PlayerId = id, Key = "Recroom.OOBE", Value = "77" },
new() { PlayerId = id, Key = "SplitTestAssignedSegments", Value = "1|{\"SplitTesting+PhotonMaxDatagrams_2021_01_11\":\"Off\",\"SplitTesting+Curated_Rooms_2020_08_06\":\"Off\",\"SplitTesting+RoomRecommendationsType_2020_08_14\":\"Aug14MinVisitors35000\"}" },
new() { PlayerId = id, Key = "PlayerSessionCount", Value = "13" },
new() { PlayerId = id, Key = "TUTORIAL_COMPLETE_MASK", Value = "11" },
new() { PlayerId = id, Key = "BACKPACK_FAVORITE_TOOL", Value = "1" },
new() { PlayerId = id, Key = "VoiceChat", Value = "2" },
new() { PlayerId = id, Key = "VRAUTOSPRINT", Value = "1" },
new() { PlayerId = id, Key = "VR_MOVEMENT_MODE", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_SPRINT", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_WALK", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_VEHICLES", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_FLY", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_ROTATE", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_FORCES", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_FALL", Value = "0" },
new() { PlayerId = id, Key = "COMFORT_TELEPORT", Value = "0" },
new() { PlayerId = id, Key = "ROTATE_IN_PLACE_ENABLED", Value = "1" },
new() { PlayerId = id, Key = "ROTATION_INCREMENT", Value = "2" },
new() { PlayerId = id, Key = "CONTINUOUS_ROTATION_MODE", Value = "1" },
new() { PlayerId = id, Key = "DONT_LOCK_TOOLS_TO_HAND", Value = "0" },
new() { PlayerId = id, Key = "QualitySettings", Value = "2" },
new() { PlayerId = id, Key = "TeleportBuffer", Value = "0" },
new() { PlayerId = id, Key = "IgnoreBuffer", Value = "1" },
new() { PlayerId = id, Key = "FIRST_TIME_IN_FLAGS", Value = "0" },
new() { PlayerId = id, Key = "ShowRoomCenter", Value = "1" },
new() { PlayerId = id, Key = "USER_TRACKING", Value = "1" },
new() { PlayerId = id, Key = "STABILIZE_HANDS", Value = "0" },
new() { PlayerId = id, Key = "MakerPen_SnappingMode", Value = "2" },
new() { PlayerId = id, Key = "Recroom.ChallengeMap", Value = "17" },
new() { PlayerId = id, Key = "VoiceFilter2", Value = "1" },
new() { PlayerId = id, Key = "SFX_VOLUME_PERCENT_PREF", Value = "1" },
};
db.PlayerSettings.AddRange(defaults);
await db.SaveChangesAsync();
settings = defaults;
}
return Results.Json(settings);
return Ok(settings);
}
[HttpPut("playersettings")]
+12 -3
View File
@@ -20,10 +20,19 @@ public static class Signatures
{
Console.WriteLine("sigs - creating new sig key");
Directory.CreateDirectory("Data");
using var newKey = RSA.Create(2048);
var pem = newKey.ExportPkcs8PrivateKeyPem();
File.WriteAllText(pemPath, pem);
Console.WriteLine("sigs - key saved to " + pemPath);
var privatePem = newKey.ExportPkcs8PrivateKeyPem();
File.WriteAllText(pemPath, privatePem);
var publicPem = newKey.ExportSubjectPublicKeyInfoPem();
File.WriteAllText(
Path.Combine("Data", "PublicKey.pem"),
publicPem
);
Console.WriteLine("sigs - keys saved");
}
var pemContent = File.ReadAllText(pemPath);