diff --git a/Controllers/ConfigAndAssetsController.cs b/Controllers/ConfigAndAssetsController.cs index 6a6e7c3..9b7ac0b 100644 --- a/Controllers/ConfigAndAssetsController.cs +++ b/Controllers/ConfigAndAssetsController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using NotPogo.Model; using System.IO.Compression; using System.Net; using System.Reflection.Metadata.Ecma335; @@ -16,17 +17,39 @@ namespace NotPogo.Controllers // might aswell provide a minimal way to play the games supported [HttpGet] [Route("/play-game")] - public IActionResult GetGamePage(string game) + public IActionResult GamePage(string? name, + string game, + string appletClass, + string site, + string locale, + string hostedGameClass) { - var path = Path.Combine(AppContext.BaseDirectory, "StaticFiles", "GameAssets", game, "index.html"); - - _logger.LogInformation("Attempting To Serve Game Applet At {Path}", path); - return new ContentResult + var gamePage = new GamePage { - Content = System.IO.File.Exists(path) ? System.IO.File.ReadAllText(path) : $"Game Not Found - {game}", - ContentType = "text/html", - StatusCode = (int)HttpStatusCode.OK + GameName = name ?? game, + InternalName = game, + JavaAppletClass = appletClass, + JavaAppletParameters = new() + { + { "name", game }, + { "hosted.game.class", hostedGameClass }, + { "standalone", "false" }, + { "type", game }, + { "config", $"client-props.jsp?game={game}" }, + { "locale", locale }, + { "site", site }, + { "rkey", "" }, + { "unid", "" }, + { "sourceid", "" }, + { "launchPage", "" }, + { "lkey", "" }, + { "cnid", "" }, + { "isSingleApplet", "true" }, + { "browserInfo", "" } + } }; + + return View(gamePage); } [HttpGet] diff --git a/Model/GamePage.cs b/Model/GamePage.cs new file mode 100644 index 0000000..6b5a1bd --- /dev/null +++ b/Model/GamePage.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace NotPogo.Model +{ + public class GamePage : PageModel + { + public string GameName { get; set; } = string.Empty; + public string InternalName { get; set; } = string.Empty; + public string JavaAppletClass { get; set; } = string.Empty; + public Dictionary JavaAppletParameters { get; set; } = []; + } +} diff --git a/Views/Shared/GamePage.cshtml b/Views/Shared/GamePage.cshtml new file mode 100644 index 0000000..0bb3d99 --- /dev/null +++ b/Views/Shared/GamePage.cshtml @@ -0,0 +1,22 @@ +@model NotPogo.Model.GamePage + + + + + @($"Not Pogo - {Model.GameName}") + + + + + + @foreach (var kv in Model.JavaAppletParameters) + { + + } + Unfortunately, In Order To Use Not Pogo, You Need To Use A Browser That Still Supports Java Applets + + +