Compare commits
15 Commits
db-changes
...
unbanbydis
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d758f58f8 | ||
|
|
9631f521bc | ||
|
|
f6b33425b5 | ||
|
|
42ed164c54 | ||
|
|
9cd77d2b55 | ||
|
|
332f7f7bb2 | ||
|
|
56bc277436 | ||
|
|
176f0e7e56 | ||
|
|
b700f58d88 | ||
|
|
232b3d535c | ||
|
|
b5aa817d0b | ||
|
|
7c81f880e1 | ||
|
|
4f249a2db9 | ||
|
|
3f76121e26 | ||
|
|
4feb64f015 |
@@ -92,22 +92,13 @@ public partial class LightlessWizardModule
|
||||
var desiredVanityUid = modal.DesiredVanityUID;
|
||||
using var db = await GetDbContext().ConfigureAwait(false);
|
||||
bool canAddVanityId = !db.Users.Any(u => u.UID == modal.DesiredVanityUID || u.Alias == modal.DesiredVanityUID);
|
||||
var forbiddenWords = new[] { "null", "nil" };
|
||||
|
||||
Regex rgx = new(@"^[_\-a-zA-Z0-9]{3,15}$", RegexOptions.ECMAScript);
|
||||
Regex rgx = new(@"^[_\-a-zA-Z0-9]{5,15}$", RegexOptions.ECMAScript);
|
||||
if (!rgx.Match(desiredVanityUid).Success)
|
||||
{
|
||||
eb.WithColor(Color.Red);
|
||||
eb.WithTitle("Invalid Vanity UID");
|
||||
eb.WithDescription("A Vanity UID must be between 3 and 15 characters long and only contain the letters A-Z, numbers 0-9, dashes (-) and underscores (_).");
|
||||
cb.WithButton("Cancel", "wizard-vanity", ButtonStyle.Secondary, emote: new Emoji("❌"));
|
||||
cb.WithButton("Pick Different UID", "wizard-vanity-uid-set:" + uid, ButtonStyle.Primary, new Emoji("💅"));
|
||||
}
|
||||
else if (forbiddenWords.Contains(desiredVanityUid.Trim().ToLowerInvariant()))
|
||||
{
|
||||
eb.WithColor(Color.Red);
|
||||
eb.WithTitle("Invalid Vanity UID");
|
||||
eb.WithDescription("You cannot use 'Null' or 'Nil' (any case) as a Vanity UID. Please pick a different one.");
|
||||
eb.WithDescription("A Vanity UID must be between 5 and 15 characters long and only contain the letters A-Z, numbers 0-9, dashes (-) and underscores (_).");
|
||||
cb.WithButton("Cancel", "wizard-vanity", ButtonStyle.Secondary, emote: new Emoji("❌"));
|
||||
cb.WithButton("Pick Different UID", "wizard-vanity-uid-set:" + uid, ButtonStyle.Primary, new Emoji("💅"));
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public partial class LightlessWizardModule : InteractionModuleBase
|
||||
public string Title => "Set Vanity UID";
|
||||
|
||||
[InputLabel("Set your Vanity UID")]
|
||||
[ModalTextInput("vanity_uid", TextInputStyle.Short, "3-15 characters, underscore, dash", 3, 15)]
|
||||
[ModalTextInput("vanity_uid", TextInputStyle.Short, "5-15 characters, underscore, dash", 5, 15)]
|
||||
public string DesiredVanityUID { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ public class LightlessDbContext : DbContext
|
||||
public DbSet<CharaDataOriginalFile> CharaDataOriginalFiles { get; set; }
|
||||
public DbSet<CharaDataPose> CharaDataPoses { get; set; }
|
||||
public DbSet<CharaDataAllowance> CharaDataAllowances { get; set; }
|
||||
public DbSet<GroupProfile> GroupProfiles { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder mb)
|
||||
{
|
||||
@@ -71,14 +70,6 @@ public class LightlessDbContext : DbContext
|
||||
mb.Entity<BannedRegistrations>().ToTable("banned_registrations");
|
||||
mb.Entity<Group>().ToTable("groups");
|
||||
mb.Entity<Group>().HasIndex(c => c.OwnerUID);
|
||||
mb.Entity<Group>()
|
||||
.Property(g => g.CreatedDate)
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
mb.Entity<Group>()
|
||||
.HasOne(g => g.Profile)
|
||||
.WithOne(p => p.Group)
|
||||
.HasForeignKey<GroupProfile>(p => p.GroupGID)
|
||||
.IsRequired(false);
|
||||
mb.Entity<GroupPair>().ToTable("group_pairs");
|
||||
mb.Entity<GroupPair>().HasKey(u => new { u.GroupGID, u.GroupUserUID });
|
||||
mb.Entity<GroupPair>().HasIndex(c => c.GroupUserUID);
|
||||
@@ -87,9 +78,6 @@ public class LightlessDbContext : DbContext
|
||||
mb.Entity<GroupBan>().HasKey(u => new { u.GroupGID, u.BannedUserUID });
|
||||
mb.Entity<GroupBan>().HasIndex(c => c.BannedUserUID);
|
||||
mb.Entity<GroupBan>().HasIndex(c => c.GroupGID);
|
||||
mb.Entity<GroupProfile>().ToTable("group_profiles");
|
||||
mb.Entity<GroupProfile>().HasKey(u => u.GroupGID);
|
||||
mb.Entity<GroupProfile>().HasIndex(c => c.GroupGID);
|
||||
mb.Entity<GroupTempInvite>().ToTable("group_temp_invites");
|
||||
mb.Entity<GroupTempInvite>().HasKey(u => new { u.GroupGID, u.Invite });
|
||||
mb.Entity<GroupTempInvite>().HasIndex(c => c.GroupGID);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LightlessSyncServer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddGroupProfilesAndDates : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "created_date",
|
||||
table: "groups",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValueSql: "CURRENT_TIMESTAMP");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "from_finder",
|
||||
table: "group_pairs",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "joined_group_on",
|
||||
table: "group_pairs",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "group_profiles",
|
||||
columns: table => new
|
||||
{
|
||||
group_gid = table.Column<string>(type: "character varying(20)", nullable: false),
|
||||
description = table.Column<string>(type: "text", nullable: true),
|
||||
tags = table.Column<string>(type: "text", nullable: true),
|
||||
base64group_profile_image = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_group_profiles", x => x.group_gid);
|
||||
table.ForeignKey(
|
||||
name: "fk_group_profiles_groups_group_gid",
|
||||
column: x => x.group_gid,
|
||||
principalTable: "groups",
|
||||
principalColumn: "gid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_group_profiles_group_gid",
|
||||
table: "group_profiles",
|
||||
column: "group_gid");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "group_profiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "created_date",
|
||||
table: "groups");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "from_finder",
|
||||
table: "group_pairs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "joined_group_on",
|
||||
table: "group_pairs");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LightlessSyncServer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddProfilesToGroup : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_group_profiles_groups_group_gid",
|
||||
table: "group_profiles");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_group_profiles_groups_group_gid",
|
||||
table: "group_profiles",
|
||||
column: "group_gid",
|
||||
principalTable: "groups",
|
||||
principalColumn: "gid");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_group_profiles_groups_group_gid",
|
||||
table: "group_profiles");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_group_profiles_groups_group_gid",
|
||||
table: "group_profiles",
|
||||
column: "group_gid",
|
||||
principalTable: "groups",
|
||||
principalColumn: "gid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,12 +430,6 @@ namespace LightlessSyncServer.Migrations
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("alias");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_date")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("HashedPassword")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("hashed_password");
|
||||
@@ -516,10 +510,6 @@ namespace LightlessSyncServer.Migrations
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("group_user_uid");
|
||||
|
||||
b.Property<bool>("FromFinder")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("from_finder");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
@@ -528,10 +518,6 @@ namespace LightlessSyncServer.Migrations
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_pinned");
|
||||
|
||||
b.Property<DateTime?>("JoinedGroupOn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("joined_group_on");
|
||||
|
||||
b.HasKey("GroupGID", "GroupUserUID")
|
||||
.HasName("pk_group_pairs");
|
||||
|
||||
@@ -582,34 +568,6 @@ namespace LightlessSyncServer.Migrations
|
||||
b.ToTable("group_pair_preferred_permissions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LightlessSyncShared.Models.GroupProfile", b =>
|
||||
{
|
||||
b.Property<string>("GroupGID")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("group_gid");
|
||||
|
||||
b.Property<string>("Base64GroupProfileImage")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("base64group_profile_image");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<string>("Tags")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("tags");
|
||||
|
||||
b.HasKey("GroupGID")
|
||||
.HasName("pk_group_profiles");
|
||||
|
||||
b.HasIndex("GroupGID")
|
||||
.HasDatabaseName("ix_group_profiles_group_gid");
|
||||
|
||||
b.ToTable("group_profiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LightlessSyncShared.Models.GroupTempInvite", b =>
|
||||
{
|
||||
b.Property<string>("GroupGID")
|
||||
@@ -1052,16 +1010,6 @@ namespace LightlessSyncServer.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LightlessSyncShared.Models.GroupProfile", b =>
|
||||
{
|
||||
b.HasOne("LightlessSyncShared.Models.Group", "Group")
|
||||
.WithOne("Profile")
|
||||
.HasForeignKey("LightlessSyncShared.Models.GroupProfile", "GroupGID")
|
||||
.HasConstraintName("fk_group_profiles_groups_group_gid");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LightlessSyncShared.Models.GroupTempInvite", b =>
|
||||
{
|
||||
b.HasOne("LightlessSyncShared.Models.Group", "Group")
|
||||
@@ -1141,11 +1089,6 @@ namespace LightlessSyncServer.Migrations
|
||||
|
||||
b.Navigation("Poses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LightlessSyncShared.Models.Group", b =>
|
||||
{
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,9 @@ public class Group
|
||||
public User Owner { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string Alias { get; set; }
|
||||
public GroupProfile? Profile { get; set; }
|
||||
public bool InvitesEnabled { get; set; }
|
||||
public string HashedPassword { get; set; }
|
||||
public bool PreferDisableSounds { get; set; }
|
||||
public bool PreferDisableAnimations { get; set; }
|
||||
public bool PreferDisableVFX { get; set; }
|
||||
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,4 @@ public class GroupPair
|
||||
public User GroupUser { get; set; }
|
||||
public bool IsPinned { get; set; }
|
||||
public bool IsModerator { get; set; }
|
||||
public bool FromFinder { get; set; } = false;
|
||||
public DateTime? JoinedGroupOn { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LightlessSyncShared.Models;
|
||||
public class GroupProfile
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(20)]
|
||||
public string GroupGID { get; set; }
|
||||
public Group Group { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public string Base64GroupProfileImage { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user