feat: added images for ban screen, added reportscreen, added reportsscreen for mods & admins

This commit is contained in:
limited_dev 2023-02-11 23:04:02 +01:00
parent 75d75a2c84
commit cb7ca62590
43 changed files with 358 additions and 46 deletions

View file

@ -0,0 +1,14 @@
@page "/banned"
<h3>Banned</h3>
<img class="image" src="img/static/banned/@i"/>
@code {
private Random rndm = new Random();
private string i = "";
protected override async Task OnInitializedAsync()
{
i = rndm.Next(1, 10) + ".png";
}
}

View file

@ -0,0 +1,6 @@
.image{
margin: 6px;
max-width: 500px;
max-height: 500px;
padding: 5px;
}

View file

@ -18,8 +18,9 @@
</div>
<a @onclick="login" href="javascript:void(0)">[Login]</a>
</form>
</div>
<Register></Register>
@code {
private string Email { get; set; }
private string Password { get; set; }

View file

@ -41,8 +41,8 @@
{
return;
}
await UsersRepository.createUserAsync(userToCreate);
Console.WriteLine("loggin you in...");
var user = await UsersRepository.getUserByEmailAsync(Email);
if (user == null)
{

View file

@ -3,13 +3,10 @@
<h3>Rules</h3>
</div>
<ul type="1" class="rules_list">
<li>You may not post stuff that would get us into trouble with the feds.</li>
<li>You may not post NSFW / NSFL on this platform.</li>
<li>You may not post political content on this platform.</li>
<li>You may not plan or participate in "raids" on this platform.</li>
<li>You have to be atleast 18 years old to post.</li>
<li>You may not post through VPNs, Proxies or the TOR network.</li>
<li>You may not post posts, which are not of the same topic as the target board.</li>
@foreach (var r in RulesConv.dict.Keys)
{
<li>@RulesConv.dict[r]</li>
}
</ul>

View file

@ -0,0 +1,15 @@
@page "/art/"
<img class="banner" src="img/static/banner/mban.png" alt="No Banner found"/>
<Board board="@m"/>
@code {
private BoardData m { get; set; } = new()
{
BoardID = 0,
maxThreads = 10,
Tag = "art",
Topic = "Art"
};
}

View file

@ -0,0 +1,7 @@
.banner{
justify-content: center;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}

View file

@ -1,6 +1,4 @@
@page "/m/"
@using System.ComponentModel.DataAnnotations
@using ImageBoardServerApp.Data
<img class="banner" src="img/static/banner/mban.png" alt="No Banner found"/>
<Board board="@m"/>

View file

@ -1,3 +1,7 @@
.banner{
justify-content: center;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}

View file

@ -0,0 +1,15 @@
@page "/tec/"
<img class="banner" src="img/static/banner/mban.png" alt="No Banner found"/>
<Board board="@m"/>
@code {
private BoardData m { get; set; } = new()
{
BoardID = 0,
maxThreads = 10,
Tag = "tec",
Topic = "Technology"
};
}

View file

@ -0,0 +1,7 @@
.banner{
justify-content: center;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}

View file

@ -0,0 +1,15 @@
@page "/vg/"
<img class="banner" src="img/static/banner/mban.png" alt="No Banner found"/>
<Board board="@m"/>
@code {
private BoardData m { get; set; } = new()
{
BoardID = 0,
maxThreads = 10,
Tag = "vg",
Topic = "Video Games"
};
}

View file

@ -0,0 +1,7 @@
.banner{
justify-content: center;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}

View file

@ -1,8 +1,41 @@
@page "/report/{type}/{board}/{id}"
@using System.ComponentModel.DataAnnotations
<h3>Report</h3>
@using System.Data
@using ImageBoardServerApp.Auth
@using ImageBoardServerApp.Data.Repository
@inject AuthenticationStateProvider authStateProvider
@inject IJSRuntime js
<AuthorizeView>
<Authorized>
<h3>Report @type#@id on /@board/</h3>
<div>
<select name="rule" id="rule" @bind="@selectedItem">
<option value="none">Select</option>
@foreach (var r in RulesConv.dict.Keys)
{
<option value="@r">@RulesConv.dict[r]</option>
}
</select>
</div>
<span>@selectedItem</span>
<span>Explain further (optional)</span>
<div class="pd centered marg">
<RadzenTextArea Placeholder="Specify..." @bind-Value="@explaination" Cols="30" Rows="6" Class="w-100"/>
</div>
<RadzenButton class="pd" Click="@onReportClick" Text="Report"></RadzenButton>
</Authorized>
<NotAuthorized>
<span>Please login to report</span>
</NotAuthorized>
</AuthorizeView>
@code {
private IEnumerable<Rule> rules;
private string selectedItem;
private string explaination;
[Parameter]
[Required]
public string type { get; set; }
@ -14,4 +47,49 @@
[Parameter]
[Required]
public string id { get; set; }
private async Task onReportClick()
{
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
if (foundusr == null)
{
return;
}
if (foundusr.TimeBanned != -1)
{
return;
}
foundusr.lastActionTimeStamp = DateTimeOffset.UnixEpoch.ToUnixTimeMilliseconds();
await UsersRepository.updateUserAsync(foundusr);
int targetID = 0;
if (type == "op")
{
var post = await PostsRepository.getPostByIdAsync(Int32.Parse(id));
targetID = post.User.UserID;
}
else
{
var comment = await CommentsRepository.getCommentByIdAsync(Int32.Parse(id));
targetID = comment.User.UserID;
}
ReportData reportData = new ReportData()
{
Type = type,
ReportedCommentID = type == "op" ? null : Int32.Parse(id),
ReportedPostID = type == "op" ? Int32.Parse(id) : null,
UserReporterID = foundusr.UserID,
UserReportedID = targetID,
ReportReason = RulesConv.dict[RulesConv.dict2[selectedItem]],
ReportExlaination = explaination
};
var reportID = await ReportsRepository.createReportAsync(reportData);
js.InvokeVoidAsync("window.close");
}
}

View file

@ -0,0 +1,13 @@
.centered {
text-align: center;
justify-content: center;
align-items: center;
}
.pd {
padding: 5px;
}
.marg{
margin: 2px
}

View file

@ -1,5 +1,17 @@
@page "/modmenu/reports"
<Reports />
@using ImageBoardServerApp.Data.Repository
<h3>Reports</h3>
@foreach (var r in reports)
{
<Report report="r"/>
<hr/>
}
@code {
private List<ReportData> reports;
protected override async Task OnInitializedAsync()
{
reports = await ReportsRepository.getReportsAsync();
Console.WriteLine("Opened Reports");
}
}