mirror of
https://github.com/CannedNet/CannedNet.git
synced 2026-10-25 15:09:23 -07:00
req logging + we got past title screen errors
we're still not fully loading into rooms yet though, theres something blocking it and it may be photon??? dunno, need to test more
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"AnnouncementId": 1,
|
||||
"AnnouncementType": 1,
|
||||
"Title": ":3",
|
||||
"Body": "im gayyyy",
|
||||
"ImageName": "b9m6myjuaz0zc9dtxquedem06.png",
|
||||
"LinkType": 3,
|
||||
"LinkName": "hello",
|
||||
"LinkUri": "https://lapis.codes",
|
||||
"Platform": -1,
|
||||
"CreatedAt": "2025-12-11T23:19:12.5806215"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"FeaturedPlayer": {
|
||||
"Id": 1,
|
||||
"TitleOverride": "GAY SEX!",
|
||||
"UrlOverride": null
|
||||
},
|
||||
"FeaturedRoomGroup": {
|
||||
"FeaturedRoomGroupId": 2,
|
||||
"Name": "Featured Rooms",
|
||||
"Rooms": [
|
||||
|
||||
]
|
||||
},
|
||||
"CurrentAnnouncement": {
|
||||
"Message": "CannedNet :3",
|
||||
"MoreInfoUrl": "https://lapis.codes/"
|
||||
},
|
||||
"InstagramImages": [
|
||||
{
|
||||
"ImageName": "bfv2n2pm1qck4rba5j8qbrvgrbhlgu.jpg",
|
||||
"ImageUrl": "https://epicquest.live/photo/152846"
|
||||
}
|
||||
],
|
||||
"Videos": [
|
||||
{
|
||||
"BlobName": "facq8grasrhep777er7bhxjz0.mp4",
|
||||
"Title": "AbyssalFrostTrailer",
|
||||
"Description": "AbyssalFrost\\nBy\\n@Snox\\n@Rick\\n@Jessica\\n@Fandorn",
|
||||
"ThumbnailBlobName": "kk2abhn2pb699uld3ygbqnznj.jpg",
|
||||
"SourceUrl": "https://www.youtube.com/watch?v=-eUGRKyYA0w"
|
||||
},
|
||||
{
|
||||
"BlobName": "nan5xp4xmqu5izjdxoc7tq9h1.mp4",
|
||||
"Title": "How To Get Items & XP in Radium! [5-Stars] [Tokens] [XP]",
|
||||
"Description": "Today ill be teaching the Radium Players on how to get xp and cool items using basic in game rooms. Feel free to look at my other links below.\n\nguns.lol/cge\nhaunt.gg/or\nhaunt.gg/gr\nrec.net/user/rud\nepicquest.live/user/skid",
|
||||
"ThumbnailBlobName": "16y6ak5kyc048ooy6bm5ergqg.png",
|
||||
"SourceUrl": "https://www.youtube.com/watch?v=emiEDPz4Va4"
|
||||
},
|
||||
{
|
||||
"BlobName": "iy3n1k9am3zc87j0mgei6831u.mp4",
|
||||
"Title": "Extreme quest Recap | Radium",
|
||||
"Description": "I tried more extreme quets, are they as hard as they look? find out!\n\nthumbnail maker: @ThatFellaRR\n\nRadium is a 2021 build of rec room which is community hosted. This is in no way meant to create any revenue.\nto learn more join discord.gg/Radium-rr/\nalso check out speedrun.com/radium_",
|
||||
"ThumbnailBlobName": "fgfe5mrki1hbxbwsu09n028px.png",
|
||||
"SourceUrl": "https://www.youtube.com/watch?v=zQZ0idzAIrA"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"Objectives":[{"Index":2,"Group":0,"Progress":0,"VisualProgress":0,"IsCompleted":false,"HasClaimedReward":false}],"ObjectiveGroups":[{"Group":0,"IsCompleted":false,"ClearedAt":"2026-03-31T01:26:32.5904766"}]}
|
||||
@@ -0,0 +1,58 @@
|
||||
[
|
||||
{
|
||||
"reason": "Discriminatory language",
|
||||
"reportCategory": 102
|
||||
},
|
||||
{
|
||||
"reason": "Discriminatory behavior",
|
||||
"reportCategory": 102
|
||||
},
|
||||
{
|
||||
"reason": "Threats or encouraging suicide",
|
||||
"reportCategory": 102
|
||||
},
|
||||
{
|
||||
"reason": "Toxic behavior",
|
||||
"reportCategory": 102
|
||||
},
|
||||
{
|
||||
"reason": "Sexual behavior in public",
|
||||
"reportCategory": 101
|
||||
},
|
||||
{
|
||||
"reason": "Sexual language in public",
|
||||
"reportCategory": 101
|
||||
},
|
||||
{
|
||||
"reason": "Non-consensual sexual behavior",
|
||||
"reportCategory": 101
|
||||
},
|
||||
{
|
||||
"reason": "Player in walls or floor",
|
||||
"reportCategory": 103
|
||||
},
|
||||
{
|
||||
"reason": "Friendly fire",
|
||||
"reportCategory": 103
|
||||
},
|
||||
{
|
||||
"reason": "Microphone spam",
|
||||
"reportCategory": 103
|
||||
},
|
||||
{
|
||||
"reason": "Abusing bugs or exploits",
|
||||
"reportCategory": 103
|
||||
},
|
||||
{
|
||||
"reason": "Spawn camping",
|
||||
"reportCategory": 103
|
||||
},
|
||||
{
|
||||
"reason": "Inactive in games (AFK)",
|
||||
"reportCategory": 6
|
||||
},
|
||||
{
|
||||
"reason": "Not following game rules",
|
||||
"reportCategory": 6
|
||||
}
|
||||
]
|
||||
@@ -8,6 +8,12 @@ foreach (var service in Services.All)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
builder.Services.AddLogging(logging =>
|
||||
{
|
||||
logging.AddConsole();
|
||||
logging.SetMinimumLevel(LogLevel.Debug);
|
||||
});
|
||||
|
||||
service.ConfigureBuilder(builder);
|
||||
builder.WebHost.UseUrls($"http://*:{service.Port}");
|
||||
builder.Configuration.AddJsonFile($"AppConfigs/appsettings.{service.Name}.json", optional: true, reloadOnChange: true);
|
||||
@@ -20,6 +26,9 @@ scope.ServiceProvider.GetRequiredService<CannedNet.Data.AppDbContext>().Database
|
||||
var jwtService = scope.ServiceProvider.GetRequiredService<JwtTokenService>();
|
||||
|
||||
foreach (var (app, service) in apps)
|
||||
{
|
||||
service.MapEndpoints(app, jwtService);
|
||||
app.UseRequestLogging();
|
||||
}
|
||||
|
||||
await Task.WhenAll(apps.Select(t => t.App.RunAsync()));
|
||||
|
||||
@@ -198,6 +198,12 @@ public class APIService
|
||||
|
||||
app.MapGet("/api/PlayerReporting/v1/moderationBlockDetails", () =>
|
||||
Results.Content("{\"ReportCategory\":0,\"Duration\":0,\"GameSessionId\":0,\"IsHostKick\":false,\"Message\":\"\",\"PlayerIdReporter\":null,\"IsBan\":false}", "application/json"));
|
||||
|
||||
app.MapGet("/api/PlayerReporting/v1/voteToKickReasons", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
var json = File.ReadAllText("JSON/vtkreasons.json");
|
||||
return Results.Content(json, "application/json");
|
||||
});
|
||||
|
||||
app.MapGet("/api/settings/v2" +
|
||||
"", async (HttpRequest request, AppDbContext db) =>
|
||||
@@ -256,14 +262,18 @@ public class APIService
|
||||
if (single != null) settings.Add(single);
|
||||
}
|
||||
|
||||
settings = settings.Where(s => !string.IsNullOrEmpty(s.Key)).ToList();
|
||||
|
||||
if (!settings.Any())
|
||||
return Results.BadRequest("No settings provided");
|
||||
return Results.Ok();
|
||||
|
||||
db.PlayerSettings.RemoveRange(db.PlayerSettings.Where(s => s.PlayerId == id));
|
||||
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
setting.PlayerId = id;
|
||||
setting.Key = setting.Key ?? "";
|
||||
setting.Value = setting.Value ?? "";
|
||||
db.PlayerSettings.Add(setting);
|
||||
}
|
||||
|
||||
@@ -281,5 +291,55 @@ public class APIService
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[]";
|
||||
});
|
||||
app.MapGet("/api/objectives/v1/myprogress", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
var json = File.ReadAllText("JSON/tempmyprogress.json");
|
||||
return Results.Content(json, "application/json");
|
||||
});
|
||||
app.MapGet("/api/avatar/v2/gifts", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[]";
|
||||
});
|
||||
app.MapGet("/api/gamerewards/v1/pending", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[]";
|
||||
});
|
||||
app.MapGet("/api/communityboard/v2/current", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
var json = File.ReadAllText("JSON/communityboard.json");
|
||||
return Results.Content(json, "application/json");
|
||||
});
|
||||
app.MapGet("/api/playerevents/v1/all", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[]";
|
||||
});
|
||||
app.MapPost("/api/CampusCard/v1/UpdateAndGetSubscription", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "{\"subscription\":null,\"platformAccountSubscribedPlayerId\":null}";
|
||||
});
|
||||
app.MapGet("/api/storefronts/v4/balance/2", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[{\"Balance\":99999,\"CurrencyType\":2,\"BalanceType\":-1,\"Platform\":-1}]";
|
||||
});
|
||||
app.MapGet("/api/storefronts/v1/p2p/betaEnabled", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
return "true";
|
||||
});
|
||||
app.MapGet("/api/announcement/v1/get", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
var json = File.ReadAllText("JSON/announcements.json");
|
||||
return Results.Content(json, "application/json");
|
||||
});
|
||||
app.MapGet("/api/roomkeys/v1/mine", async (HttpRequest request, AppDbContext db) =>
|
||||
{
|
||||
// TODO ADD FUNCTIONALITY
|
||||
return "[]";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CannedNet.Services;
|
||||
|
||||
public class MatchmakingService
|
||||
@@ -60,5 +63,91 @@ public class MatchmakingService
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.MapPost("/player/heartbeat", async (HttpRequest request) =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class HeartbeatRequest
|
||||
{
|
||||
[JsonPropertyName("playerId")]
|
||||
public int playerId { get; set; }
|
||||
|
||||
[JsonPropertyName("statusVisibility")]
|
||||
public int statusVisibility { get; set; }
|
||||
|
||||
[JsonPropertyName("deviceClass")]
|
||||
public int deviceClass { get; set; }
|
||||
|
||||
[JsonPropertyName("vrMovementMode")]
|
||||
public int vrMovementMode { get; set; }
|
||||
|
||||
[JsonPropertyName("roomInstance")]
|
||||
public RoomInstanceInfo? roomInstance { get; set; }
|
||||
|
||||
[JsonPropertyName("isOnline")]
|
||||
public bool isOnline { get; set; }
|
||||
|
||||
[JsonPropertyName("appVersion")]
|
||||
public string? appVersion { get; set; }
|
||||
|
||||
[JsonPropertyName("platform")]
|
||||
public int platform { get; set; }
|
||||
}
|
||||
|
||||
public class RoomInstanceInfo
|
||||
{
|
||||
[JsonPropertyName("roomInstanceId")]
|
||||
public int roomInstanceId { get; set; }
|
||||
|
||||
[JsonPropertyName("roomId")]
|
||||
public int roomId { get; set; }
|
||||
|
||||
[JsonPropertyName("subRoomId")]
|
||||
public int subRoomId { get; set; }
|
||||
|
||||
[JsonPropertyName("roomInstanceType")]
|
||||
public int roomInstanceType { get; set; }
|
||||
|
||||
[JsonPropertyName("location")]
|
||||
public string? location { get; set; }
|
||||
|
||||
[JsonPropertyName("dataBlob")]
|
||||
public string? dataBlob { get; set; }
|
||||
|
||||
[JsonPropertyName("eventId")]
|
||||
public int eventId { get; set; }
|
||||
|
||||
[JsonPropertyName("clubId")]
|
||||
public int clubId { get; set; }
|
||||
|
||||
[JsonPropertyName("roomCode")]
|
||||
public string? roomCode { get; set; }
|
||||
|
||||
[JsonPropertyName("photonRegionId")]
|
||||
public string? photonRegionId { get; set; }
|
||||
|
||||
[JsonPropertyName("photonRoomId")]
|
||||
public string? photonRoomId { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string? name { get; set; }
|
||||
|
||||
[JsonPropertyName("maxCapacity")]
|
||||
public int maxCapacity { get; set; }
|
||||
|
||||
[JsonPropertyName("isFull")]
|
||||
public bool isFull { get; set; }
|
||||
|
||||
[JsonPropertyName("isPrivate")]
|
||||
public bool isPrivate { get; set; }
|
||||
|
||||
[JsonPropertyName("isInProgress")]
|
||||
public bool isInProgress { get; set; }
|
||||
|
||||
[JsonPropertyName("EncryptVoiceChat")]
|
||||
public bool EncryptVoiceChat { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using System.Text;
|
||||
|
||||
namespace CannedNet.Services;
|
||||
|
||||
public class RequestLoggingMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly ILogger<RequestLoggingMiddleware> _logger;
|
||||
|
||||
public RequestLoggingMiddleware(RequestDelegate next, ILogger<RequestLoggingMiddleware> logger)
|
||||
{
|
||||
_next = next;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
var request = context.Request;
|
||||
var requestId = context.TraceIdentifier;
|
||||
|
||||
_logger.LogInformation("[{RequestId}] {Method} {Path}{QueryString}",
|
||||
requestId, request.Method, request.Path, request.QueryString);
|
||||
|
||||
foreach (var header in request.Headers)
|
||||
{
|
||||
if (IsSensitiveHeader(header.Key))
|
||||
_logger.LogInformation(" [{RequestId}] {Header}: [REDACTED]", requestId, header.Key);
|
||||
else
|
||||
_logger.LogInformation(" [{RequestId}] {Header}: {Value}", requestId, header.Key, header.Value.ToString());
|
||||
}
|
||||
|
||||
if (request.ContentLength > 0 && request.ContentLength < 10000)
|
||||
{
|
||||
request.EnableBuffering();
|
||||
using var reader = new StreamReader(request.Body, Encoding.UTF8, leaveOpen: true);
|
||||
var body = await reader.ReadToEndAsync();
|
||||
request.Body.Position = 0;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(body))
|
||||
_logger.LogInformation(" [{RequestId}] Body: {Body}", requestId, body);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
finally
|
||||
{
|
||||
sw.Stop();
|
||||
_logger.LogInformation("[{RequestId}] -> {StatusCode} ({ElapsedMs}ms)",
|
||||
requestId, context.Response.StatusCode, sw.ElapsedMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSensitiveHeader(string headerName)
|
||||
{
|
||||
var sensitiveHeaders = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"Authorization",
|
||||
"Cookie",
|
||||
"Set-Cookie",
|
||||
"X-Auth-Token",
|
||||
"X-Csrf-Token"
|
||||
};
|
||||
return sensitiveHeaders.Contains(headerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static class RequestLoggingExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseRequestLogging(this IApplicationBuilder app)
|
||||
{
|
||||
return app.UseMiddleware<RequestLoggingMiddleware>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user