Compare commits

...

9 Commits

Author SHA1 Message Date
defnotken
86fd24f756 clean up logging 2025-11-20 09:33:18 -06:00
defnotken
5ed802e37c move western canadians to eastern file shard 2025-11-20 09:15:15 -06:00
63211b2e8b Merge pull request 'Fix Fk' (#34) from fkfix into master
Reviewed-on: #34
2025-11-17 18:34:18 +01:00
defnotken
a1280d58bf Fix Fk 2025-11-17 09:34:33 -06:00
34f0223a85 revert revert regex 2025-11-13 15:50:19 +01:00
69f06f5868 Merge pull request 'revert regex' (#33) from revert-regex into master
Reviewed-on: #33
2025-11-13 15:22:20 +01:00
066f56e5a2 Merge branch 'master' into revert-regex 2025-11-13 15:22:05 +01:00
defnotken
287f72b6ad revert regex 2025-11-13 08:21:37 -06:00
ef13566b7a Merge pull request 'Fix chat stuff' (#32) from chat into master
Reviewed-on: #32
Reviewed-by: defnotken <defnotken@noreply.git.lightless-sync.org>
2025-11-12 01:53:11 +01:00
6 changed files with 1377 additions and 6 deletions

View File

@@ -44,12 +44,14 @@ public class GeoIPService : IHostedService
if (_dbReader!.TryCity(ip, out var response))
{
string? continent = response?.Continent.Code;
string? countryIso = response?.Country.IsoCode;
if (!string.IsNullOrEmpty(continent) &&
string.Equals(continent, "NA", StringComparison.Ordinal)
&& response?.Location.Longitude != null)
{
if (response.Location.Longitude < -102)
if (response.Location.Longitude < -102 &&
!string.Equals(countryIso, "CA", StringComparison.OrdinalIgnoreCase))
{
continent = "NA-W";
}
@@ -57,6 +59,8 @@ public class GeoIPService : IHostedService
{
continent = "NA-E";
}
_logger.LogDebug("Connecting {countryIso} to {continent}", countryIso, continent);
}
return continent ?? "*";

View File

@@ -329,7 +329,7 @@ public partial class LightlessWizardModule : InteractionModuleBase
private int? ParseCharacterIdFromLodestoneUrl(string lodestoneUrl)
{
var regex = new Regex(@"^https:\/\/(na|eu|de|fr|jp)\.finalfantasyxiv\.com\/lodestone\/character\/(\d{8})/?$");
var regex = new Regex(@"^https:\/\/(na|eu|de|fr|jp)\.finalfantasyxiv\.com\/lodestone\/character\/(\d+)/?$");
var matches = regex.Match(lodestoneUrl);
var isLodestoneUrl = matches.Success;
if (!isLodestoneUrl || matches.Groups.Count < 1) return null;

View File

@@ -91,6 +91,12 @@ public class LightlessDbContext : DbContext
mb.Entity<GroupProfile>().ToTable("group_profiles");
mb.Entity<GroupProfile>().HasKey(u => u.GroupGID);
mb.Entity<GroupProfile>().HasIndex(c => c.GroupGID);
mb.Entity<Group>()
.HasOne(g => g.Profile)
.WithOne(p => p.Group)
.HasForeignKey<GroupProfile>(p => p.GroupGID)
.IsRequired(false)
.OnDelete(DeleteBehavior.Cascade);
mb.Entity<GroupTempInvite>().ToTable("group_temp_invites");
mb.Entity<GroupTempInvite>().HasKey(u => new { u.GroupGID, u.Invite });
mb.Entity<GroupTempInvite>().HasIndex(c => c.GroupGID);

View File

@@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LightlessSyncServer.Migrations
{
/// <inheritdoc />
public partial class FixForeignKeyGroupProfiles : 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",
onDelete: ReferentialAction.Cascade);
}
/// <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");
}
}
}

View File

@@ -820,14 +820,14 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("character varying(15)")
.HasColumnName("alias");
b.Property<bool>("HasVanity")
.HasColumnType("boolean")
.HasColumnName("has_vanity");
b.Property<bool>("ChatBanned")
.HasColumnType("boolean")
.HasColumnName("chat_banned");
b.Property<bool>("HasVanity")
.HasColumnType("boolean")
.HasColumnName("has_vanity");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean")
.HasColumnName("is_admin");
@@ -1220,6 +1220,7 @@ namespace LightlessSyncServer.Migrations
b.HasOne("LightlessSyncShared.Models.Group", "Group")
.WithOne("Profile")
.HasForeignKey("LightlessSyncShared.Models.GroupProfile", "GroupGID")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_group_profiles_groups_group_gid");
b.Navigation("Group");