Skip to content

Commit

Permalink
Do server tag infer on hub server.
Browse files Browse the repository at this point in the history
So I can use the tags from the website without re-implementing it in JS.
  • Loading branch information
PJB3005 committed Mar 31, 2024
1 parent b18a36b commit 987089f
Show file tree
Hide file tree
Showing 8 changed files with 530 additions and 5 deletions.
5 changes: 5 additions & 0 deletions SS14.ServerHub.Shared/Data/AdvertisedServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ public sealed class AdvertisedServer
/// IP address of the client doing the advertise request. Not actually related to the advertised data.
/// </summary>
[Column(TypeName = "inet")] public IPAddress? AdvertiserAddress { get; set; }

/// <summary>
/// Extra tags inferred from the server information.
/// </summary>
public string[] InferredTags { get; set; } = Array.Empty<string>();
}
5 changes: 5 additions & 0 deletions SS14.ServerHub.Shared/Data/ServerStatusArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public sealed class ServerStatusArchive
public IPAddress? AdvertiserAddress { get; set; }

public AdvertisedServer AdvertisedServer { get; set; } = default!;

/// <summary>
/// Corresponds to <see cref="Data.AdvertisedServer.InferredTags"/>.
/// </summary>
public string[] InferredTags { get; set; } = Array.Empty<string>();
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions SS14.ServerHub.Shared/Migrations/20240331202957_InferredTags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SS14.ServerHub.Shared.Migrations
{
public partial class InferredTags : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string[]>(
name: "InferredTags",
table: "ServerStatusArchive",
type: "text[]",
nullable: false,
defaultValue: new string[0]);

migrationBuilder.AddColumn<string[]>(
name: "InferredTags",
table: "AdvertisedServer",
type: "text[]",
nullable: false,
defaultValue: new string[0]);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "InferredTags",
table: "ServerStatusArchive");

migrationBuilder.DropColumn(
name: "InferredTags",
table: "AdvertisedServer");
}
}
}
Loading

0 comments on commit 987089f

Please sign in to comment.