mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2025-07-01 09:39:44 -04:00
Compare commits
12 Commits
54a05537c4
...
master
Author | SHA1 | Date | |
---|---|---|---|
ff325cf5f6 | |||
484d12463a | |||
0a89b6ade1 | |||
967518dc71 | |||
1dc7194888 | |||
84548585ac | |||
f1a5ddd98c | |||
6cb43fcaa3 | |||
27a5d20888 | |||
b0ed4a50de | |||
8c72940c23 | |||
4605ac5fef |
@ -7,6 +7,7 @@ using Minecraft_Realms_Emulator.Shared.Data;
|
|||||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Modes.External
|
namespace Minecraft_Realms_Emulator.Modes.External
|
||||||
{
|
{
|
||||||
@ -72,8 +73,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -116,7 +117,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -157,8 +158,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.Minigame).Include(w => w.ParentWorld).ToListAsync();
|
||||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||||
|
|
||||||
List<WorldResponse> allWorlds = [];
|
List<WorldResponse> allWorlds = [];
|
||||||
|
|
||||||
@ -176,8 +177,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -233,7 +234,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -287,8 +288,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).Include(w => w.Minigame).ToListAsync();
|
||||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||||
|
|
||||||
List<WorldResponse> allWorlds = [];
|
List<WorldResponse> allWorlds = [];
|
||||||
|
|
||||||
@ -332,8 +333,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -378,7 +379,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -418,7 +419,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
string cookie = Request.Headers.Cookie;
|
string cookie = Request.Headers.Cookie;
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).FirstOrDefaultAsync(w => w.Id == wId);
|
var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).Include(w => w.Minigame).FirstOrDefaultAsync(w => w.Id == wId);
|
||||||
|
|
||||||
if (world.State == nameof(StateEnum.UNINITIALIZED))
|
if (world.State == nameof(StateEnum.UNINITIALIZED))
|
||||||
{
|
{
|
||||||
@ -443,26 +444,26 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options =
|
Options = JsonConvert.SerializeObject(new
|
||||||
{
|
{
|
||||||
SlotName = slot.SlotName,
|
slotName = slot.SlotName,
|
||||||
GameMode = slot.GameMode,
|
gameMode = slot.GameMode,
|
||||||
Hardcore = slot.GameMode == 3,
|
hardcore = slot.Difficulty == 3,
|
||||||
Difficulty = slot.Difficulty,
|
difficulty = slot.Difficulty,
|
||||||
SpawnProtection = slot.SpawnProtection,
|
spawnProection = slot.SpawnProtection,
|
||||||
ForceGameMode = slot.ForceGameMode,
|
forceGameMode = slot.ForceGameMode,
|
||||||
Pvp = slot.Pvp,
|
pvp = slot.Pvp,
|
||||||
SpawnAnimals = slot.SpawnAnimals,
|
spawnAnimals = slot.SpawnAnimals,
|
||||||
SpawnMonsters = slot.SpawnMonsters,
|
spawnMonsters = slot.SpawnMonsters,
|
||||||
SpawnNPCs = slot.SpawnNPCs,
|
spawnNPCs = slot.SpawnNPCs,
|
||||||
CommandBlocks = slot.CommandBlocks,
|
commandBlocks = slot.CommandBlocks,
|
||||||
Version = slot.Version,
|
version = slot.Version,
|
||||||
Compatibility = compatibility
|
compatibility
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||||
|
|
||||||
if (world.ParentWorld != null)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -477,7 +478,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.GameMode == 3,
|
IsHardcore = activeSlot.GameMode == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -609,15 +610,6 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
return Ok(world);
|
return Ok(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("{wId}/reset")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public ActionResult<bool> Reset(int wId)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Resetting world {wId}");
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("{wId}/open")]
|
[HttpPut("{wId}/open")]
|
||||||
[CheckForWorld]
|
[CheckForWorld]
|
||||||
[CheckRealmOwner]
|
[CheckRealmOwner]
|
||||||
@ -689,126 +681,6 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("{wId}/slot/{sId}")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateSlot(int wId, int sId, SlotOptionsRequest body)
|
|
||||||
{
|
|
||||||
if (body.SlotName.Length > 10)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Slot name cannot exceed 10 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
|
||||||
var slot = slots.Find(s => s.SlotId == sId);
|
|
||||||
|
|
||||||
slot.SlotName = body.SlotName;
|
|
||||||
slot.GameMode = body.GameMode;
|
|
||||||
slot.Difficulty = body.Difficulty;
|
|
||||||
slot.SpawnProtection = body.SpawnProtection;
|
|
||||||
slot.ForceGameMode = body.ForceGameMode;
|
|
||||||
slot.Pvp = body.Pvp;
|
|
||||||
slot.SpawnAnimals = body.SpawnAnimals;
|
|
||||||
slot.SpawnMonsters = body.SpawnMonsters;
|
|
||||||
slot.SpawnNPCs = body.SpawnNPCs;
|
|
||||||
slot.CommandBlocks = body.CommandBlocks;
|
|
||||||
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("{wId}/slot/{sId}")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public ActionResult<bool> SwitchSlot(int wId, int sId)
|
|
||||||
{
|
|
||||||
var world = _context.Worlds.Include(w => w.Minigame).FirstOrDefault(w => w.Id == wId);
|
|
||||||
var slot = _context.Slots.Where(s => s.World.Id == wId).Where(s => s.SlotId == sId).Any();
|
|
||||||
|
|
||||||
if (!slot)
|
|
||||||
{
|
|
||||||
string cookie = Request.Headers.Cookie;
|
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
|
||||||
|
|
||||||
_context.Slots.Add(new()
|
|
||||||
{
|
|
||||||
World = world,
|
|
||||||
SlotId = sId,
|
|
||||||
SlotName = "",
|
|
||||||
Version = gameVersion,
|
|
||||||
GameMode = 0,
|
|
||||||
Difficulty = 2,
|
|
||||||
SpawnProtection = 0,
|
|
||||||
ForceGameMode = false,
|
|
||||||
Pvp = true,
|
|
||||||
SpawnAnimals = true,
|
|
||||||
SpawnMonsters = true,
|
|
||||||
SpawnNPCs = true,
|
|
||||||
CommandBlocks = false
|
|
||||||
});
|
|
||||||
|
|
||||||
_context.SaveChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
world.ActiveSlot = sId;
|
|
||||||
world.Minigame = null;
|
|
||||||
world.WorldType = nameof(WorldTypeEnum.NORMAL);
|
|
||||||
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("{wId}/backups")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public async Task<ActionResult<BackupsResponse>> GetBackups(int wId)
|
|
||||||
{
|
|
||||||
var backups = await _context.Backups.Where(b => b.Slot.World.Id == wId).ToListAsync();
|
|
||||||
|
|
||||||
BackupsResponse worldBackups = new()
|
|
||||||
{
|
|
||||||
Backups = backups
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(worldBackups);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("{wId}/slot/{sId}/download")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public ActionResult<BackupDownloadResponse> GetBackup(int wId, int sId)
|
|
||||||
{
|
|
||||||
Backup backup = _context.Backups.Include(b => b.Slot).FirstOrDefault(b => b.Slot.World.Id == wId && b.Slot.Id == sId);
|
|
||||||
|
|
||||||
if (backup == null)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 404,
|
|
||||||
ErrorMsg = "No backup found"
|
|
||||||
};
|
|
||||||
|
|
||||||
return NotFound(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
BackupDownloadResponse backupDownloadResponse = new()
|
|
||||||
{
|
|
||||||
DownloadLink = backup.DownloadUrl,
|
|
||||||
ResourcePackUrl = backup.ResourcePackUrl,
|
|
||||||
ResourcePackHash = backup.ResourcePackHash,
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(backupDownloadResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("v1/{wId}/join/pc")]
|
[HttpGet("v1/{wId}/join/pc")]
|
||||||
public ActionResult<Connection> Join(int wId)
|
public ActionResult<Connection> Join(int wId)
|
||||||
{
|
{
|
||||||
@ -846,38 +718,5 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("templates/{type}")]
|
|
||||||
public ActionResult<TemplatesResponse> GetWorldTemplates(string type, int page, int pageSize)
|
|
||||||
{
|
|
||||||
var totalTemplates = _context.Templates.Where(t => t.Type == type).Count();
|
|
||||||
var templates = _context.Templates.Where(t => t.Type == type).Skip((page - 1) * pageSize).Take(pageSize).ToList();
|
|
||||||
|
|
||||||
TemplatesResponse templatesResponse = new()
|
|
||||||
{
|
|
||||||
Page = page,
|
|
||||||
Size = pageSize,
|
|
||||||
Total = totalTemplates,
|
|
||||||
Templates = templates
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(templatesResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("minigames/{mId}/{wId}")]
|
|
||||||
[CheckForWorld]
|
|
||||||
[CheckRealmOwner]
|
|
||||||
public ActionResult<bool> SwitchToMinigame(int mId, int wId)
|
|
||||||
{
|
|
||||||
var world = _context.Worlds.Find(wId);
|
|
||||||
var minigame = _context.Templates.FirstOrDefault(t => t.Type == nameof(WorldTemplateTypeEnum.MINIGAME) && t.Id == mId);
|
|
||||||
|
|
||||||
world.Minigame = minigame;
|
|
||||||
world.WorldType = nameof(WorldTypeEnum.MINIGAME);
|
|
||||||
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using Minecraft_Realms_Emulator.Shared.Requests;
|
|||||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||||
{
|
{
|
||||||
@ -75,8 +76,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -119,7 +120,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -160,8 +161,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.Minigame).Include(w => w.ParentWorld).ToListAsync();
|
||||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||||
|
|
||||||
List<WorldResponse> allWorlds = [];
|
List<WorldResponse> allWorlds = [];
|
||||||
|
|
||||||
@ -179,8 +180,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -236,7 +237,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -290,8 +291,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).Include(w => w.Minigame).ToListAsync();
|
||||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||||
|
|
||||||
List<WorldResponse> allWorlds = [];
|
List<WorldResponse> allWorlds = [];
|
||||||
|
|
||||||
@ -335,8 +336,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot?.GameMode ?? 0,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot?.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -381,7 +382,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -446,26 +447,26 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options =
|
Options = JsonConvert.SerializeObject(new
|
||||||
{
|
{
|
||||||
SlotName = slot.SlotName,
|
slotName = slot.SlotName,
|
||||||
GameMode = slot.GameMode,
|
gameMode = slot.GameMode,
|
||||||
Hardcore = slot.Difficulty == 3,
|
hardcore = slot.Difficulty == 3,
|
||||||
Difficulty = slot.Difficulty,
|
difficulty = slot.Difficulty,
|
||||||
SpawnProtection = slot.SpawnProtection,
|
spawnProection = slot.SpawnProtection,
|
||||||
ForceGameMode = slot.ForceGameMode,
|
forceGameMode = slot.ForceGameMode,
|
||||||
Pvp = slot.Pvp,
|
pvp = slot.Pvp,
|
||||||
SpawnAnimals = slot.SpawnAnimals,
|
spawnAnimals = slot.SpawnAnimals,
|
||||||
SpawnMonsters = slot.SpawnMonsters,
|
spawnMonsters = slot.SpawnMonsters,
|
||||||
SpawnNPCs = slot.SpawnNPCs,
|
spawnNPCs = slot.SpawnNPCs,
|
||||||
CommandBlocks = slot.CommandBlocks,
|
commandBlocks = slot.CommandBlocks,
|
||||||
Version = slot.Version,
|
version = slot.Version,
|
||||||
Compatibility = compatibility
|
compatibility
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||||
|
|
||||||
if (world.ParentWorld != null)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -480,7 +481,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -686,6 +687,15 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
|
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
var connection = _context.Connections.FirstOrDefault(c => c.World.Id == wId);
|
||||||
|
var query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
|
|
||||||
|
while (query != null)
|
||||||
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
|
query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +902,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
[HttpGet("v1/{wId}/join/pc")]
|
[HttpGet("v1/{wId}/join/pc")]
|
||||||
public async Task<ActionResult<Connection>> Join(int wId)
|
public async Task<ActionResult<Connection>> Join(int wId)
|
||||||
{
|
{
|
||||||
var connection = _context.Connections.Include(c => c.World).FirstOrDefault(x => x.World.Id == wId);
|
var connection = _context.Connections.Include(c => c.World).Include(c => c.World.Slots).FirstOrDefault(x => x.World.Id == wId);
|
||||||
|
|
||||||
var isRunning = new DockerHelper(connection.World).IsRunning();
|
var isRunning = new DockerHelper(connection.World).IsRunning();
|
||||||
var query = new MinecraftServerQuery().Query(connection.Address);
|
var query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
@ -908,7 +918,17 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
query = new MinecraftServerQuery().Query(connection.Address);
|
query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Slot activeSlot = connection.World.Slots.Find(s => s.SlotId == connection.World.ActiveSlot);
|
||||||
|
|
||||||
string cookie = Request.Headers.Cookie;
|
string cookie = Request.Headers.Cookie;
|
||||||
|
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
|
if (new MinecraftVersionParser.MinecraftVersion(activeSlot.Version).CompareTo(new MinecraftVersionParser.MinecraftVersion(gameVersion)) < 0 && new DockerHelper(connection.World).RunCommand("! test -f .no-update") == 0)
|
||||||
|
{
|
||||||
|
activeSlot.Version = gameVersion;
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
string playerUUID = cookie.Split(";")[0].Split(":")[2];
|
string playerUUID = cookie.Split(";")[0].Split(":")[2];
|
||||||
|
|
||||||
if (connection.World.OwnerUUID == playerUUID)
|
if (connection.World.OwnerUUID == playerUUID)
|
||||||
|
@ -68,7 +68,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
|||||||
ProcessStartInfo serverProcessInfo = new();
|
ProcessStartInfo serverProcessInfo = new();
|
||||||
|
|
||||||
serverProcessInfo.FileName = "docker";
|
serverProcessInfo.FileName = "docker";
|
||||||
serverProcessInfo.Arguments = $"container rm realm-server-{world.Id}";
|
serverProcessInfo.Arguments = $"container rm -f realm-server-{world.Id}";
|
||||||
|
|
||||||
Process serverProcess = new();
|
Process serverProcess = new();
|
||||||
serverProcess.StartInfo = serverProcessInfo;
|
serverProcess.StartInfo = serverProcessInfo;
|
||||||
@ -116,7 +116,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
|||||||
commandProcess.Start();
|
commandProcess.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunCommand(string command)
|
public int RunCommand(string command)
|
||||||
{
|
{
|
||||||
ProcessStartInfo commandProcessInfo = new();
|
ProcessStartInfo commandProcessInfo = new();
|
||||||
|
|
||||||
@ -127,6 +127,9 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
|||||||
commandProcess.StartInfo = commandProcessInfo;
|
commandProcess.StartInfo = commandProcessInfo;
|
||||||
|
|
||||||
commandProcess.Start();
|
commandProcess.Start();
|
||||||
|
commandProcess.WaitForExit();
|
||||||
|
|
||||||
|
return commandProcess.ExitCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,6 +33,14 @@ builder.Services.AddDbContext<DataContext>(options =>
|
|||||||
options.UseNpgsql(dataSource);
|
options.UseNpgsql(dataSource);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddDefaultPolicy(policy =>
|
||||||
|
{
|
||||||
|
policy.WithOrigins("http://localhost:5192");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Initialize database
|
// Initialize database
|
||||||
@ -48,10 +56,10 @@ if (app.Environment.IsDevelopment())
|
|||||||
var scope = app.Services.CreateScope();
|
var scope = app.Services.CreateScope();
|
||||||
var db = scope.ServiceProvider.GetRequiredService<DataContext>();
|
var db = scope.ServiceProvider.GetRequiredService<DataContext>();
|
||||||
|
|
||||||
|
app.UseCors();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
var config = new ConfigHelper(db);
|
var mode = Environment.GetEnvironmentVariable("WORKMODE");
|
||||||
var mode = config.GetSetting(nameof(SettingsEnum.WorkMode));
|
|
||||||
|
|
||||||
if (mode == null)
|
if (mode == null)
|
||||||
{
|
{
|
||||||
@ -59,13 +67,13 @@ if (mode == null)
|
|||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Enum.IsDefined(typeof(WorkModeEnum), mode.Value))
|
if (!Enum.IsDefined(typeof(WorkModeEnum), mode))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Invalid server work mode, exiting");
|
Console.WriteLine("Invalid server work mode, exiting");
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.Value == nameof(WorkModeEnum.REALMS))
|
if (mode == nameof(WorkModeEnum.REALMS))
|
||||||
{
|
{
|
||||||
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
|
|
||||||
@ -117,7 +125,7 @@ if (mode.Value == nameof(WorkModeEnum.REALMS))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode.Value}/$1", true);
|
var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode}/$1", true);
|
||||||
app.UseRewriter(rewriteOptions);
|
app.UseRewriter(rewriteOptions);
|
||||||
|
|
||||||
app.UseMiddleware<MinecraftCookieMiddleware>();
|
app.UseMiddleware<MinecraftCookieMiddleware>();
|
||||||
@ -127,5 +135,5 @@ app.UseMiddleware<AdminKeyMiddleware>();
|
|||||||
app.UseMiddleware<CheckForWorldMiddleware>();
|
app.UseMiddleware<CheckForWorldMiddleware>();
|
||||||
app.UseMiddleware<RouteLoggingMiddleware>();
|
app.UseMiddleware<RouteLoggingMiddleware>();
|
||||||
|
|
||||||
Console.WriteLine($"Running in {mode.Value} mode");
|
Console.WriteLine($"Running in {mode} mode");
|
||||||
app.Run();
|
app.Run();
|
||||||
|
@ -3,7 +3,7 @@ FROM eclipse-temurin:21-jre-alpine
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apk upgrade
|
RUN apk upgrade
|
||||||
RUN apk add openssl
|
RUN apk add openssl curl jq
|
||||||
|
|
||||||
RUN wget -O rcon-cli.tar.gz https://github.com/itzg/rcon-cli/releases/download/1.6.7/rcon-cli_1.6.7_linux_amd64.tar.gz
|
RUN wget -O rcon-cli.tar.gz https://github.com/itzg/rcon-cli/releases/download/1.6.7/rcon-cli_1.6.7_linux_amd64.tar.gz
|
||||||
RUN tar xzf rcon-cli.tar.gz
|
RUN tar xzf rcon-cli.tar.gz
|
||||||
@ -12,7 +12,6 @@ RUN rm rcon-cli.tar.gz
|
|||||||
RUN mv rcon-cli /bin/rcon-cli
|
RUN mv rcon-cli /bin/rcon-cli
|
||||||
|
|
||||||
WORKDIR mc
|
WORKDIR mc
|
||||||
RUN wget -O server.jar https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar
|
|
||||||
|
|
||||||
EXPOSE 25565
|
EXPOSE 25565
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint"]
|
ENTRYPOINT ["/entrypoint"]
|
@ -11,4 +11,12 @@ if [ ! -f server.properties ]; then
|
|||||||
echo "level-name=slot-1" >> server.properties
|
echo "level-name=slot-1" >> server.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Download latest server.jar
|
||||||
|
if [ ! -f .no-update ]; then
|
||||||
|
VERSION_URL=$(curl https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.release as $latest | .versions | to_entries[] | select(.value.id == $latest) | .value.url')
|
||||||
|
SERVER_URL=$(curl $VERSION_URL | jq -r .downloads.server.url)
|
||||||
|
|
||||||
|
wget -O server.jar $SERVER_URL
|
||||||
|
fi
|
||||||
|
|
||||||
java -jar server.jar
|
java -jar server.jar
|
@ -5,7 +5,6 @@
|
|||||||
NewsLink,
|
NewsLink,
|
||||||
DefaultServerAddress,
|
DefaultServerAddress,
|
||||||
TrialMode,
|
TrialMode,
|
||||||
WorkMode,
|
|
||||||
OnlineMode,
|
OnlineMode,
|
||||||
AutomaticRealmsCreation
|
AutomaticRealmsCreation
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
namespace Minecraft_Realms_Emulator.Shared.Helpers.Config
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Shared.Helpers.Config
|
|
||||||
{
|
{
|
||||||
public class Settings
|
public class Settings
|
||||||
{
|
{
|
||||||
public string DefaultServerAddress { get; set; } = "127.0.0.1";
|
public string DefaultServerAddress { get; set; } = "127.0.0.1";
|
||||||
public string NewsLink { get; set; } = "https://github.com/CyberL1/Minecraft-Realms-Emulator";
|
public string NewsLink { get; set; } = "https://github.com/CyberL1/Minecraft-Realms-Emulator";
|
||||||
public bool TrialMode { get; set; } = true;
|
public bool TrialMode { get; set; } = true;
|
||||||
public string WorkMode { get; set; } = nameof(WorkModeEnum.EXTERNAL);
|
|
||||||
public bool OnlineMode { get; set; } = false;
|
public bool OnlineMode { get; set; } = false;
|
||||||
public bool AutomaticRealmsCreation { get; set; } = true;
|
public bool AutomaticRealmsCreation { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
public class SlotResponse
|
public class SlotResponse
|
||||||
{
|
{
|
||||||
public int SlotId { get; set; }
|
public int SlotId { get; set; }
|
||||||
public SlotOptionsResponse Options { get; set; } = null!;
|
public SlotSettingsResponse Settings { get; set; } = null!;
|
||||||
|
public string Options { get; set; } = null!;
|
||||||
|
|
||||||
public SlotResponse()
|
public SlotResponse()
|
||||||
{
|
{
|
||||||
Options = new SlotOptionsResponse();
|
Settings = new SlotSettingsResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||||
|
{
|
||||||
|
public class SlotSettingsResponse
|
||||||
|
{
|
||||||
|
public bool Hardcore { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -5,11 +5,12 @@ namespace Minecraft_Realms_Emulator.Shared.Responses
|
|||||||
public class WorldResponse : World
|
public class WorldResponse : World
|
||||||
{
|
{
|
||||||
public string RemoteSubscriptionId { get; set; } = new Guid().ToString();
|
public string RemoteSubscriptionId { get; set; } = new Guid().ToString();
|
||||||
public bool Hardcore { get; set; }
|
public bool IsHardcore { get; set; } = false;
|
||||||
public int GameMode { get; set; }
|
public int GameMode { get; set; }
|
||||||
public int DaysLeft { get; set; } = 30;
|
public int DaysLeft { get; set; } = 30;
|
||||||
public bool Expired { get; set; } = false;
|
public bool Expired { get; set; } = false;
|
||||||
public bool ExpiredTrial { get; set; } = false;
|
public bool ExpiredTrial { get; set; } = false;
|
||||||
|
public bool GracePeriod { get; set; } = false;
|
||||||
public string Compatibility { get; set; } = null!;
|
public string Compatibility { get; set; } = null!;
|
||||||
public List<SlotResponse> Slots { get; set; } = null!;
|
public List<SlotResponse> Slots { get; set; } = null!;
|
||||||
public string ActiveVersion { get; set; } = null!;
|
public string ActiveVersion { get; set; } = null!;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
logs: "x",
|
logs: "x",
|
||||||
|
|
||||||
start: (dotNetObject, serverId) => {
|
start: (dotNetObject, serverId) => {
|
||||||
logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`, { withCredentials: true });
|
logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`);
|
||||||
|
|
||||||
logs.onmessage = event => {
|
logs.onmessage = event => {
|
||||||
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
|
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
|
||||||
|
Reference in New Issue
Block a user