Add fake update
This commit is contained in:
@@ -36,6 +36,8 @@ public static class Configs
|
||||
|
||||
public const string INCOM_SERVICE_BASE_ROUTE = "/service/incom";
|
||||
|
||||
public const string UPDATE_SERVICE_BASE_ROUTE = "/update/cgi";
|
||||
|
||||
public const string RANK_BASE_ROUTE = "/ranking";
|
||||
|
||||
public const string ALIVE_BASE_ROUTE = "/alive";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using EmbedIO;
|
||||
using EmbedIO.Routing;
|
||||
using EmbedIO.WebApi;
|
||||
using Swan.Logging;
|
||||
|
||||
namespace GCLocalServerRewrite.controllers
|
||||
{
|
||||
// TODO: Add proper update check response
|
||||
public class UpdateController : WebApiController
|
||||
{
|
||||
[Route(HttpVerbs.Get, "/check.php")]
|
||||
public string CheckUpdate()
|
||||
{
|
||||
var parameters = HttpContext.GetRequestQueryData();
|
||||
foreach (var key in parameters.AllKeys)
|
||||
{
|
||||
$"Key {key}: {parameters[key]}".Info();
|
||||
}
|
||||
|
||||
HttpContext.Response.StatusCode = 404;
|
||||
return "Not found";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ public class Server
|
||||
module => module.WithController<ServerController>())
|
||||
.WithWebApi(Configs.RANK_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
module => module.WithController<RankController>())
|
||||
.WithWebApi(Configs.UPDATE_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
module => module.WithController<UpdateController>())
|
||||
.WithStaticFolder(Configs.STATIC_BASE_ROUTE, PathHelper.HtmlRootPath, true, m => m
|
||||
.WithContentCaching(Configs.USE_FILE_CACHE))
|
||||
// Add static files after other modules to avoid conflicts
|
||||
@@ -62,7 +64,8 @@ public class Server
|
||||
switch (exception.StatusCode)
|
||||
{
|
||||
case 404:
|
||||
await context.SendStringAsync("404 NOT FOUND!", "text/html", new UTF8Encoding(false));
|
||||
var htmlContents = await File.ReadAllTextAsync(Path.Combine(PathHelper.HtmlRootPath, "index.html"));
|
||||
await context.SendStringAsync(htmlContents, "text/html", Encoding.UTF8);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user