mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-24 14:11:29 +00:00
Cleanup code
This commit is contained in:
parent
fcd1f25084
commit
a41f4516cb
16 changed files with 15 additions and 20 deletions
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using ProjectLighthouse.Types.Files;
|
||||
using Xunit;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace ProjectLighthouse.Controllers {
|
|||
public IActionResult PrivacySettings() {
|
||||
PrivacySettings ps = new() {
|
||||
LevelVisibility = "all",
|
||||
ProfileVisibility = "all"
|
||||
ProfileVisibility = "all",
|
||||
};
|
||||
|
||||
return this.Ok(ps.Serialize());
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace ProjectLighthouse.Controllers {
|
|||
#region Hearted Levels
|
||||
|
||||
[HttpGet("favouriteSlots/{username}")]
|
||||
public async Task<IActionResult> GetFavouriteSlots(string username) {
|
||||
public IActionResult GetFavouriteSlots(string username) {
|
||||
IEnumerable<HeartedLevel> heartedLevels = new Database().HeartedLevels
|
||||
.Include(q => q.User)
|
||||
.Include(q => q.Slot)
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace ProjectLighthouse.Controllers {
|
|||
|
||||
return this.Ok(new LoginResult {
|
||||
AuthTicket = "MM_AUTH=" + token.UserToken,
|
||||
LbpEnvVer = ServerSettings.ServerName
|
||||
LbpEnvVer = ServerSettings.ServerName,
|
||||
}.Serialize());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@ namespace ProjectLighthouse.Controllers {
|
|||
Summary = "test summary",
|
||||
Image = new NewsImage {
|
||||
Hash = "4947269c5f7061b27225611ee58a9a91a8031bbe",
|
||||
Alignment = "right"
|
||||
Alignment = "right",
|
||||
},
|
||||
Id = 1,
|
||||
Title = "Test Title",
|
||||
Text = "Test Text",
|
||||
Date = 1348755214000
|
||||
Date = 1348755214000,
|
||||
}.Serialize());
|
||||
|
||||
return this.Ok(LbpSerializer.StringElement("news", newsEntry));
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace ProjectLighthouse.Controllers {
|
|||
if(user == null) return this.StatusCode(403, "");
|
||||
|
||||
XmlReaderSettings settings = new() {
|
||||
Async = true // this is apparently not default
|
||||
Async = true, // this is apparently not default
|
||||
};
|
||||
|
||||
bool locationChanged = false;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace ProjectLighthouse {
|
|||
|
||||
Token token = new() {
|
||||
UserToken = HashHelper.GenerateAuthToken(),
|
||||
UserId = user.UserId
|
||||
UserId = user.UserId,
|
||||
};
|
||||
|
||||
this.Tokens.Add(token);
|
||||
|
@ -54,8 +54,6 @@ namespace ProjectLighthouse {
|
|||
return token;
|
||||
}
|
||||
|
||||
public async Task<bool> IsUserAuthenticated(string authToken) => await this.UserFromAuthToken(authToken) != null;
|
||||
|
||||
public async Task<User?> UserFromAuthToken(string authToken) {
|
||||
Token? token = await Tokens.FirstOrDefaultAsync(t => t.UserToken == authToken);
|
||||
if(token == null) return null;
|
||||
|
|
|
@ -3,12 +3,10 @@ using System.IO;
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using ProjectLighthouse.Serialization;
|
||||
using ProjectLighthouse.Types;
|
||||
|
||||
namespace ProjectLighthouse {
|
||||
public class Startup {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using ProjectLighthouse.Serialization;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System.IO;
|
||||
using ProjectLighthouse.Helpers;
|
||||
|
||||
namespace ProjectLighthouse.Types.Files {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
||||
namespace ProjectLighthouse.Types {
|
||||
public class HeartedLevel {
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
[Key] public int HeartedLevelId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
|
|
@ -82,6 +82,6 @@ namespace ProjectLighthouse.Types {
|
|||
Spikes,
|
||||
Collectables,
|
||||
Vertical,
|
||||
Balancing
|
||||
Balancing,
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
||||
namespace ProjectLighthouse.Types {
|
||||
public class QueuedLevel {
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
[Key] public int QueuedLevelId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using ProjectLighthouse.Serialization;
|
||||
|
||||
namespace ProjectLighthouse.Types {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ProjectLighthouse.Types {
|
||||
public class Token {
|
||||
public int TokenId { get; set; }
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
[Key] public int TokenId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string UserToken { get; set; }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using ProjectLighthouse.Serialization;
|
||||
|
||||
namespace ProjectLighthouse.Types {
|
||||
|
@ -60,7 +59,7 @@ namespace ProjectLighthouse.Types {
|
|||
// "lbp1",
|
||||
"lbp2",
|
||||
"lbp3",
|
||||
"crossControl"
|
||||
"crossControl",
|
||||
};
|
||||
|
||||
private string SerializeSlots() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue