mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-31 09:18:38 +00:00
Photo retrieval semi-working (only on LBP1?)
This commit is contained in:
parent
87fed59229
commit
143fc96cf5
4 changed files with 32 additions and 1 deletions
|
@ -1,7 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -53,5 +55,15 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
return this.Ok();
|
||||
}
|
||||
|
||||
[HttpGet("photos/user/{id:int}")]
|
||||
public async Task<IActionResult> SlotPhotos(int id)
|
||||
{
|
||||
List<Photo> photos = await this.database.Photos.Take(50).ToListAsync();
|
||||
|
||||
string response = photos.Aggregate(string.Empty, (s, photo) => s + photo.Serialize(id));
|
||||
|
||||
return this.Ok(LbpSerializer.StringElement("photos", response));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,6 +42,9 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
return this.Ok(slot.Serialize());
|
||||
}
|
||||
|
||||
[HttpGet("slots/cool")]
|
||||
public IActionResult CoolSlots([FromQuery] int page) => NewestSlots(30 * page, 30);
|
||||
|
||||
[HttpGet("slots")]
|
||||
public IActionResult NewestSlots([FromQuery] int pageStart, [FromQuery] int pageSize)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,6 @@ Please do not make anything public for now, and keep in mind security isn't as t
|
|||
// ReSharper disable once UnreachableCode
|
||||
public const string PrivateInstanceNoticeOrBlank = ShowPrivateInstanceNotice ? PrivateInstanceNotice : "";
|
||||
|
||||
public const bool ShowPrivateInstanceNotice = true;
|
||||
public const bool ShowPrivateInstanceNotice = false;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types
|
||||
{
|
||||
|
@ -51,5 +52,20 @@ namespace LBPUnion.ProjectLighthouse.Types
|
|||
}
|
||||
|
||||
public string PhotoSubjectCollection { get; set; }
|
||||
|
||||
public string Serialize(int slotId)
|
||||
{
|
||||
string slot = LbpSerializer.TaggedStringElement("slot", LbpSerializer.StringElement("id", slotId), "type", "user");
|
||||
|
||||
string photo = LbpSerializer.StringElement("id", this.PhotoId) +
|
||||
LbpSerializer.StringElement("small", this.SmallHash) +
|
||||
LbpSerializer.StringElement("medium", this.MediumHash) +
|
||||
LbpSerializer.StringElement("large", this.LargeHash) +
|
||||
LbpSerializer.StringElement("plan", this.PlanHash) +
|
||||
LbpSerializer.StringElement("author", "a43243221") +
|
||||
slot;
|
||||
|
||||
return LbpSerializer.TaggedStringElement("photo", photo, "timestamp", Timestamp * 1000);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue