feat: added images for ban screen, added reportscreen, added reportsscreen for mods & admins
|
@ -9,7 +9,7 @@
|
|||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<h3>404</h3>
|
||||
<div class="Error404">
|
||||
<img src="img/static/err/1.jpeg" alt="noimageFound"/>
|
||||
<img src="img/static/err/2.png" alt="noimageFound"/>
|
||||
<p role="alert">Sorry, nothing found. Please go back to the main page. Or watch the tree and find the hidden Cat..</p>
|
||||
</div>
|
||||
</LayoutView>
|
||||
|
|
|
@ -37,6 +37,5 @@ public class ReportData
|
|||
public string ReportReason { get; set; }
|
||||
|
||||
public string ReportExlaination { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -38,8 +38,8 @@ public static class ImagesRepository
|
|||
|
||||
public static async Task<bool> deleteImageAsync(int imageId)
|
||||
{
|
||||
await using var db = new AppDBContext();
|
||||
ImageData imageToDelete = await getImageByIdAsync(imageId);
|
||||
await using var db = new AppDBContext();
|
||||
db.Remove(imageToDelete);
|
||||
return await db.SaveChangesAsync() >= 1;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,15 @@ public static class ReportsRepository
|
|||
public static async Task<List<ReportData>> getReportsAsync()
|
||||
{
|
||||
await using var db = new AppDBContext();
|
||||
return await db.Reports.ToListAsync();
|
||||
return await db.Reports
|
||||
.Include(report => report.ReportedPost)
|
||||
.Include(report => report.ReportedPost.Image)
|
||||
.Include(report => report.ReportedPost.Comments)
|
||||
.Include(report => report.ReportedComment)
|
||||
.Include(report => report.ReportedComment.Image)
|
||||
.Include(report => report.UserReported)
|
||||
.Include(report => report.UserReporter)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public static async Task<ReportData> getReportByIdAsync(int reportId)
|
||||
|
|
13
ImageBoardServerApp/Data/Rules/Rules.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace ImageBoardServerApp.Data;
|
||||
|
||||
public enum Rules
|
||||
{
|
||||
AGAINSTLAW,
|
||||
NSFW_NSFL,
|
||||
POLITICAL_CONTENT,
|
||||
RAIDS,
|
||||
UNDERAGE,
|
||||
VPN_PROXY_TOR,
|
||||
OFF_TOPIC,
|
||||
OTHER,
|
||||
}
|
28
ImageBoardServerApp/Data/Rules/RulesConv.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
namespace ImageBoardServerApp.Data;
|
||||
|
||||
public class RulesConv
|
||||
{
|
||||
public static Dictionary<Rules, string> dict = new Dictionary<Rules, string>()
|
||||
{
|
||||
{ Rules.AGAINSTLAW, "You may not post stuff that would get us into trouble with the feds." },
|
||||
{ Rules.NSFW_NSFL, "You may not post NSFW / NSFL on this platform." },
|
||||
{ Rules.POLITICAL_CONTENT, "You may not post political content on this platform." },
|
||||
{ Rules.RAIDS, "You may not plan or participate in \"raids\" on this platform." },
|
||||
{ Rules.UNDERAGE, "You have to be atleast 18 years old to post." },
|
||||
{ Rules.VPN_PROXY_TOR, "You may not post through VPNs, Proxies or the TOR network."},
|
||||
{ Rules.OFF_TOPIC, "You may not post posts, which are not of the same topic as the target board."},
|
||||
{ Rules.OTHER, "Other (Please specify)"}
|
||||
};
|
||||
|
||||
public static Dictionary<string, Rules> dict2 = new Dictionary<string, Rules>()
|
||||
{
|
||||
{ "AGAINSTLAW", Rules.AGAINSTLAW },
|
||||
{ "NSFW_NSFL", Rules.NSFW_NSFL },
|
||||
{ "POLITICAL_CONTENT", Rules.POLITICAL_CONTENT },
|
||||
{ "RAIDS", Rules.RAIDS },
|
||||
{ "UNDERAGE", Rules.UNDERAGE },
|
||||
{ "VPN_PROXY_TOR", Rules.VPN_PROXY_TOR },
|
||||
{ "OFF_TOPIC", Rules.OFF_TOPIC },
|
||||
{ "OTHER", Rules.OTHER }
|
||||
};
|
||||
}
|
|
@ -19,8 +19,15 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Data\Migrations" />
|
||||
<Folder Include="wwwroot\img\dynamic\comment\art" />
|
||||
<Folder Include="wwwroot\img\dynamic\comment\m" />
|
||||
<Folder Include="wwwroot\img\dynamic\comment\tec" />
|
||||
<Folder Include="wwwroot\img\dynamic\comment\vg" />
|
||||
<Folder Include="wwwroot\img\dynamic\op\art" />
|
||||
<Folder Include="wwwroot\img\dynamic\op\m" />
|
||||
<Folder Include="wwwroot\img\dynamic\op\tec" />
|
||||
<Folder Include="wwwroot\img\dynamic\op\vg" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
14
ImageBoardServerApp/Pages/Accounts/Banned.razor
Normal 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";
|
||||
}
|
||||
}
|
6
ImageBoardServerApp/Pages/Accounts/Banned.razor.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
.image{
|
||||
margin: 6px;
|
||||
max-width: 500px;
|
||||
max-height: 500px;
|
||||
padding: 5px;
|
||||
}
|
|
@ -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; }
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await UsersRepository.createUserAsync(userToCreate);
|
||||
Console.WriteLine("loggin you in...");
|
||||
var user = await UsersRepository.getUserByEmailAsync(Email);
|
||||
if (user == null)
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
15
ImageBoardServerApp/Pages/Boards/Art.razor
Normal 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"
|
||||
};
|
||||
}
|
7
ImageBoardServerApp/Pages/Boards/Art.razor.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.banner{
|
||||
justify-content: center;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
}
|
|
@ -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"/>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
.banner{
|
||||
justify-content: center;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
}
|
15
ImageBoardServerApp/Pages/Boards/Tec.razor
Normal 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"
|
||||
};
|
||||
}
|
7
ImageBoardServerApp/Pages/Boards/Tec.razor.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.banner{
|
||||
justify-content: center;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
}
|
15
ImageBoardServerApp/Pages/Boards/Vg.razor
Normal 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"
|
||||
};
|
||||
}
|
7
ImageBoardServerApp/Pages/Boards/Vg.razor.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.banner{
|
||||
justify-content: center;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
13
ImageBoardServerApp/Pages/Components/ReportPage.razor.css
Normal file
|
@ -0,0 +1,13 @@
|
|||
.centered {
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pd {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.marg{
|
||||
margin: 2px
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -10,8 +10,6 @@
|
|||
<PageFooter/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
@ -28,11 +26,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
<!--Admin -->
|
||||
<!--Moderator -->
|
||||
<!--Janitor -->
|
||||
|
||||
@code {
|
||||
|
||||
private List<PostData> posts;
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<ul class="notesInfo">
|
||||
<li>The max. image size is 2MiB.</li>
|
||||
<li>Supported file types are: jpeg, png & gif</li>
|
||||
<li>Read the rules before posting</li>
|
||||
</ul>
|
||||
<div class="notesInfo">
|
||||
<span>The max. image size is 2MiB.</span>
|
||||
<br/>
|
||||
<span>Supported file types are: jpeg, png & gif</span>
|
||||
<br/>
|
||||
<div>
|
||||
<span>Read the </span>
|
||||
<a href="/rules">rules</a>
|
||||
<span> and </span>
|
||||
<a href="/faq">faq</a>
|
||||
<span> before posting</span>
|
||||
</div>
|
||||
</div>
|
47
ImageBoardServerApp/Shared/Components/Report.razor
Normal file
|
@ -0,0 +1,47 @@
|
|||
@using System.ComponentModel.DataAnnotations
|
||||
<div>
|
||||
@if (report.Type == "op")
|
||||
{
|
||||
<span> /@report.ReportedPost.Board/ </span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> /@report.ReportedComment/ </span>
|
||||
}
|
||||
<span>#@report.ReportID</span>
|
||||
<span>@report.Type</span>
|
||||
<br/>
|
||||
<span>Reason: @report.ReportReason</span>
|
||||
<br/>
|
||||
<span>Explaination: @report.ReportExlaination</span>
|
||||
<br/>
|
||||
<a @onclick="@banTarget" href="javascript:void(0)">Ban Reported User</a>
|
||||
<br/>
|
||||
<a @onclick="@banReporter" href="javascript:void(0)" >Ban Reporter</a>
|
||||
<br/>
|
||||
@if (report.Type == "op")
|
||||
{
|
||||
<Post post="report.ReportedPost" showOpenThread="true"></Post>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Comment comment="report.ReportedComment"></Comment>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[Required]
|
||||
public ReportData report { get; set; }
|
||||
|
||||
|
||||
private async Task banTarget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async Task banReporter()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<h3>Reports</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
|
@ -15,15 +15,6 @@
|
|||
<div class="top-row px-4">
|
||||
<a href="/faq">[FAQ]</a>
|
||||
<a href="/rules">[Rules]</a>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<a @onclick="logout" href="javascript:void(0)">[Logout @mail]</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="/register">[Register]</a>
|
||||
<a href="/login">[Login]</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
|
||||
<article class="content px-4">
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
@using ImageBoardServerApp.Auth
|
||||
@inject AuthenticationStateProvider authStateProvider
|
||||
@inject NavigationManager navManager
|
||||
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">ImageBoard</a>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<a class="navbar-brand" @onclick="logout" href="javascript:void(0)">[Logout]</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a class="navbar-brand" href="/login">[Login]</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
@ -19,6 +31,21 @@
|
|||
<span class="oi oi-list-rich" aria-hidden="true"></span> /m/ - Main
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="tec">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> /tec/ - Technology
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="art">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> /art/ - Art
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="vg">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> /vg/ - Video Games
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
@ -31,5 +58,12 @@
|
|||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
private async Task logout()
|
||||
{
|
||||
var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider;
|
||||
await customAuthStateProvider.UpdateAuthenticationStateAsync(null);
|
||||
navManager.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
}
|
BIN
ImageBoardServerApp/wwwroot/img/static/banned/1.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/10.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/2.png
Normal file
After Width: | Height: | Size: 145 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/3.png
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/4.png
Normal file
After Width: | Height: | Size: 678 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/5.png
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/6.png
Normal file
After Width: | Height: | Size: 246 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/7.png
Normal file
After Width: | Height: | Size: 370 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/8.png
Normal file
After Width: | Height: | Size: 179 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/banned/9.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 54 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/err/1.png
Normal file
After Width: | Height: | Size: 521 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/err/2.png
Normal file
After Width: | Height: | Size: 486 KiB |
BIN
ImageBoardServerApp/wwwroot/img/static/err/3.png
Normal file
After Width: | Height: | Size: 1.1 MiB |