Skip to content

Commit 86b7e06

Browse files
author
Tom Hobson
committed
first commit
0 parents  commit 86b7e06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+39863
-0
lines changed

.dockerignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.vs
6+
**/.vscode
7+
**/*.*proj.user
8+
**/azds.yaml
9+
**/charts
10+
**/bin
11+
**/obj
12+
**/Dockerfile
13+
**/Dockerfile.develop
14+
**/docker-compose.yml
15+
**/docker-compose.*.yml
16+
**/*.dbmdl
17+
**/*.jfm
18+
**/secrets.dev.yaml
19+
**/values.dev.yaml
20+
**/.toolstarget

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vs
2+
bin
3+
obj

8inServant.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29025.244
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "8inServant", "8inServant\8inServant.csproj", "{23D0B442-29FD-4D93-AC7C-2A8A9FD4B687}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{23D0B442-29FD-4D93-AC7C-2A8A9FD4B687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{23D0B442-29FD-4D93-AC7C-2A8A9FD4B687}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{23D0B442-29FD-4D93-AC7C-2A8A9FD4B687}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{23D0B442-29FD-4D93-AC7C-2A8A9FD4B687}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {2C0F7387-9967-44A8-9E56-CC82286A9C58}
24+
EndGlobalSection
25+
EndGlobal

8inServant/8inServant.csproj

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6+
<RootNamespace>_8inServant</RootNamespace>
7+
<UserSecretsId>f96cb332-a3f0-45b5-83ec-3ec039b36f12</UserSecretsId>
8+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
</PropertyGroup>
10+
11+
12+
<ItemGroup>
13+
<PackageReference Include="Discord.Net" Version="2.1.1" />
14+
<PackageReference Include="Microsoft.AspNetCore.App" />
15+
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
16+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.9" />
17+
</ItemGroup>
18+
19+
</Project>

8inServant/8inServant.csproj.user

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>IIS Express</ActiveDebugProfile>
5+
</PropertyGroup>
6+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
7+
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
8+
</PropertyGroup>
9+
</Project>

8inServant/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
2+
WORKDIR /app
3+
EXPOSE 80
4+
EXPOSE 443
5+
6+
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
7+
WORKDIR /src
8+
COPY ["8inServant/8inServant.csproj", "8inServant/"]
9+
RUN dotnet restore "8inServant/8inServant.csproj"
10+
COPY . .
11+
WORKDIR "/src/8inServant"
12+
RUN dotnet build "8inServant.csproj" -c Release -o /app
13+
14+
FROM build AS publish
15+
RUN dotnet publish "8inServant.csproj" -c Release -o /app
16+
17+
FROM base AS final
18+
WORKDIR /app
19+
COPY --from=publish /app .
20+
ENTRYPOINT ["dotnet", "8inServant.dll"]

8inServant/Pages/Error.cshtml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>

8inServant/Pages/Error.cshtml.cs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Mvc.RazorPages;
8+
9+
namespace _8inServant.Pages
10+
{
11+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12+
public class ErrorModel : PageModel
13+
{
14+
public string RequestId { get; set; }
15+
16+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17+
18+
public void OnGet()
19+
{
20+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21+
}
22+
}
23+
}

8inServant/Pages/Index.cshtml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Welcome</h1>
9+
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10+
</div>

8inServant/Pages/Index.cshtml.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using _8inServant.Services;
6+
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Mvc.RazorPages;
8+
9+
namespace _8inServant.Pages
10+
{
11+
public class IndexModel : PageModel
12+
{
13+
14+
public void OnGet()
15+
{
16+
17+
}
18+
}
19+
}

8inServant/Pages/Privacy.cshtml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>

8inServant/Pages/Privacy.cshtml.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.AspNetCore.Mvc.RazorPages;
7+
8+
namespace _8inServant.Pages
9+
{
10+
public class PrivacyModel : PageModel
11+
{
12+
public void OnGet()
13+
{
14+
}
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@using Microsoft.AspNetCore.Http.Features
2+
3+
@{
4+
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
5+
var showBanner = !consentFeature?.CanTrack ?? false;
6+
var cookieString = consentFeature?.CreateConsentCookie();
7+
}
8+
9+
@if (showBanner)
10+
{
11+
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
12+
Use this space to summarize your privacy and cookie use policy. <a asp-page="/Privacy">Learn More</a>.
13+
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
14+
<span aria-hidden="true">Accept</span>
15+
</button>
16+
</div>
17+
<script>
18+
(function () {
19+
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
20+
button.addEventListener("click", function (event) {
21+
document.cookie = button.dataset.cookieString;
22+
}, false);
23+
})();
24+
</script>
25+
}
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - _8inServant</title>
7+
8+
<environment include="Development">
9+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
10+
</environment>
11+
<environment exclude="Development">
12+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
13+
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
14+
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
15+
crossorigin="anonymous"
16+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"/>
17+
</environment>
18+
<link rel="stylesheet" href="~/css/site.css" />
19+
</head>
20+
<body>
21+
<header>
22+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
23+
<div class="container">
24+
<a class="navbar-brand" asp-area="" asp-page="/Index">_8inServant</a>
25+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
26+
aria-expanded="false" aria-label="Toggle navigation">
27+
<span class="navbar-toggler-icon"></span>
28+
</button>
29+
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
30+
<ul class="navbar-nav flex-grow-1">
31+
<li class="nav-item">
32+
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
33+
</li>
34+
<li class="nav-item">
35+
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
36+
</li>
37+
</ul>
38+
</div>
39+
</div>
40+
</nav>
41+
</header>
42+
<div class="container">
43+
<partial name="_CookieConsentPartial" />
44+
<main role="main" class="pb-3">
45+
@RenderBody()
46+
</main>
47+
</div>
48+
49+
<footer class="border-top footer text-muted">
50+
<div class="container">
51+
&copy; 2019 - _8inServant - <a asp-area="" asp-page="/Privacy">Privacy</a>
52+
</div>
53+
</footer>
54+
55+
<environment include="Development">
56+
<script src="~/lib/jquery/dist/jquery.js"></script>
57+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
58+
</environment>
59+
<environment exclude="Development">
60+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
61+
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
62+
asp-fallback-test="window.jQuery"
63+
crossorigin="anonymous"
64+
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
65+
</script>
66+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"
67+
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
68+
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
69+
crossorigin="anonymous"
70+
integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o">
71+
</script>
72+
</environment>
73+
<script src="~/js/site.js" asp-append-version="true"></script>
74+
75+
@RenderSection("Scripts", required: false)
76+
</body>
77+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<environment include="Development">
2+
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
3+
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
4+
</environment>
5+
<environment exclude="Development">
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"
7+
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
8+
asp-fallback-test="window.jQuery && window.jQuery.validator"
9+
crossorigin="anonymous"
10+
integrity="sha256-F6h55Qw6sweK+t7SiOJX+2bpSAa3b/fnlrVCJvmEj1A=">
11+
</script>
12+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"
13+
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
14+
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
15+
crossorigin="anonymous"
16+
integrity="sha256-9GycpJnliUjJDVDqP0UEu/bsm9U+3dnQUH8+3W10vkY=">
17+
</script>
18+
</environment>

8inServant/Pages/_ViewImports.cshtml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@using _8inServant
2+
@namespace _8inServant.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

8inServant/Pages/_ViewStart.cshtml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@{
2+
Layout = "_Layout";
3+
}

8inServant/Program.cs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore;
7+
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.Extensions.Configuration;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace _8inServant
12+
{
13+
public class Program
14+
{
15+
public static void Main(string[] args)
16+
{
17+
CreateWebHostBuilder(args)
18+
.ConfigureAppConfiguration(config => config.AddJsonFile("appsettings.json"))
19+
.Build().Run();
20+
}
21+
22+
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
23+
WebHost.CreateDefaultBuilder(args)
24+
.UseStartup<Startup>();
25+
}
26+
}

0 commit comments

Comments
 (0)