Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions net5/net5.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "receiver", "receiver\receiver.csproj", "{3C5977DA-6187-49AA-97CF-E713C2A8AF31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3C5977DA-6187-49AA-97CF-E713C2A8AF31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C5977DA-6187-49AA-97CF-E713C2A8AF31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C5977DA-6187-49AA-97CF-E713C2A8AF31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C5977DA-6187-49AA-97CF-E713C2A8AF31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E0910EE0-6323-4191-9902-37105554765C}
EndGlobalSection
EndGlobal
43 changes: 43 additions & 0 deletions net5/receiver/Controllers/WebhookListenerController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;

namespace receiver.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class WebhookListenerController : Controller
{
private readonly IWebHostEnvironment _hostEnvironment;
public WebhookListenerController(IWebHostEnvironment hostEnvironment)
{
_hostEnvironment = hostEnvironment;
}
[HttpPost]
public void Receiver([FromBody] dynamic payload)
{
string directoryPath = Path.Combine(_hostEnvironment.ContentRootPath, "WebhookLogs");
string filePath = Path.Combine(directoryPath, "webhook.txt");
if (!Directory.Exists(Path.Combine(_hostEnvironment.ContentRootPath, "WebhookLogs")))
{
Directory.CreateDirectory(Path.Combine(_hostEnvironment.ContentRootPath, "WebhookLogs"));
}
string webHookMessage = JsonSerializer.Serialize(payload);

using (StreamWriter sw = System.IO.File.AppendText(filePath))
{
sw.WriteLine(webHookMessage);
}
}
[HttpGet]
public string Reader()
{
return System.IO.File.ReadAllText(Path.Combine(_hostEnvironment.ContentRootPath, "WebhookLogs", "webhook.txt"));
}
}
}
9 changes: 9 additions & 0 deletions net5/receiver/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
10 changes: 10 additions & 0 deletions net5/receiver/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Binary file added net5/receiver/obj/Debug/net5.0/apphost.exe
Binary file not shown.
23 changes: 23 additions & 0 deletions net5/receiver/obj/Debug/net5.0/receiver.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("receiver")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("receiver")]
[assembly: System.Reflection.AssemblyTitleAttribute("receiver")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7969be0edacb058732d7a27e5dda15840699ae9e
Binary file not shown.