public async Task <IActionResult> Process() { if (!_blogConfig.AdvancedSettings.EnablePingBackReceive) { _logger.LogInformation("Pingback receive is disabled"); return(Forbid()); } var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); var requestBody = await new StreamReader(HttpContext.Request.Body, Encoding.Default).ReadToEndAsync(); var response = await _pingbackService.ReceivePingAsync(requestBody, ip, history => { var payload = new PingPayload( history.TargetPostTitle, history.PingTimeUtc, history.Domain, history.SourceIp, history.SourceUrl, history.SourceTitle); _notificationClient.NotifyPingbackAsync(payload); }); _logger.LogInformation($"Pingback Processor Response: {response}"); return(new PingbackResult(response)); }
public async Task <IActionResult> Index() { if (!_blogConfig.AdvancedSettings.EnablePingBackReceive) { Logger.LogInformation("Pingback receive is disabled"); return(Forbid()); } var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); var requestBody = await new StreamReader(HttpContext.Request.Body, Encoding.Default).ReadToEndAsync(); var response = await _pingbackService.ReceivePingAsync(requestBody, ip, history => _notificationClient.NotifyPingbackAsync(history)); Logger.LogInformation($"Pingback Processor Response: {response}"); return(new PingbackResult(response)); }