mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 00:18:39 +00:00
Implement read-only mode (#1001)
* Implement read-only mode * Use localized string under default language for announce text * Redirect to user page rather than returning blank 400 * Protect call to `ParseBase64Image` * Add protections to SlotSettingsPage and nitpick format * Display the latest announcement (if any) on the landing page * Fix a kokoism Accidentally tried to use markdown within the landing page... I'm rather smart aren't I * Prevent possible XSS * Separate truncated announcement text and link with "..." * Apply suggestion from code review * Add read-only check to /postComment in slot page controller * Fix inconsistent tabbing
This commit is contained in:
parent
975fcab100
commit
0ee8970c64
20 changed files with 176 additions and 18 deletions
|
@ -37,6 +37,9 @@ public class PhotosController : ControllerBase
|
|||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
// Deny request if in read-only mode
|
||||
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.BadRequest();
|
||||
|
||||
int photoCount = await this.database.Photos.CountAsync(p => p.CreatorId == token.UserId);
|
||||
if (photoCount >= ServerConfiguration.Instance.UserGeneratedContentLimits.PhotosQuota) return this.BadRequest();
|
||||
|
||||
|
@ -90,7 +93,7 @@ public class PhotosController : ControllerBase
|
|||
case SlotType.Developer:
|
||||
{
|
||||
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.Type == photoSlot.SlotType && s.InternalSlotId == photoSlot.SlotId);
|
||||
if (slot != null)
|
||||
if (slot != null)
|
||||
photoSlot.SlotId = slot.SlotId;
|
||||
else
|
||||
photoSlot.SlotId = await SlotHelper.GetPlaceholderSlotId(this.database, photoSlot.SlotId, photoSlot.SlotType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue