mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
233 lines
41 KiB
HTML
233 lines
41 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.9.8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>tgstation-server: src/Tgstation.Server.Host/Controllers/BridgeController.cs Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">tgstation-server<span id="projectnumber"> 6.19.3</span>
|
|
</div>
|
|
<div id="projectbrief">The /tg/station 13 server suite</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.8 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_codefold(0); });
|
|
/* @license-end */
|
|
</script>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<div id="MSearchResults">
|
|
<div class="SRPage">
|
|
<div id="SRIndex">
|
|
<div id="SRResults"></div>
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_38cec1532eaed7aa1de0b599a76e3e80.html">Controllers</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle"><div class="title">BridgeController.cs</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="_bridge_controller_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
|
|
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.Net;</div>
|
|
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Net.Mime;</div>
|
|
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">using </span>System.Threading;</div>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>System.Threading.Tasks;</div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
|
|
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">using </span>Microsoft.AspNetCore.Authorization;</div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">using </span>Microsoft.AspNetCore.Mvc;</div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="keyword">using </span>Microsoft.Extensions.Hosting;</div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="keyword">using </span>Microsoft.Extensions.Logging;</div>
|
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
|
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">using </span>Newtonsoft.Json;</div>
|
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">using </span>Serilog.Context;</div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
|
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_api.html">Tgstation.Server.Api</a>;</div>
|
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop.html">Tgstation.Server.Host.Components.Interop</a>;</div>
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge.html">Tgstation.Server.Host.Components.Interop.Bridge</a>;</div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_utils.html">Tgstation.Server.Host.Utils</a>;</div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_controllers.html">Tgstation.Server.Host.Controllers</a></div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>{</div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> [Route(<span class="stringliteral">"/"</span> + RouteExtension)] <span class="comment">// obsolete route, but BYOND can't handle a simple fucking 301</span></div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> [Route(<a class="code hl_class" href="class_tgstation_1_1_server_1_1_api_1_1_routes.html">Routes</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_api_1_1_routes.html#a8c6219903a85b89432912919b1762e49">ApiRoot</a> + RouteExtension)]</div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> [ApiExplorerSettings(IgnoreApi = <span class="keyword">true</span>)]</div>
|
|
<div class="foldopen" id="foldopen00029" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html"> 29</a></span> <span class="keyword">public</span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html">BridgeController</a> : <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_api_controller_base.html">ApiControllerBase</a></div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> {</div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#abc7f0733e6de2d62937141087d8d20bf"> 34</a></span> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#abc7f0733e6de2d62937141087d8d20bf">RouteExtension</a> = <span class="stringliteral">"Bridge"</span>;</div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027"> 39</a></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">LogContent</a> => <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c">logContentDisableCounter</a> == 0;</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c"> 44</a></span> <span class="keyword">static</span> uint <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c">logContentDisableCounter</a>;</div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0d4ca33235052b49fd927c9df33ae7f3"> 49</a></span> <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0d4ca33235052b49fd927c9df33ae7f3">requestsProcessed</a>;</div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03"> 54</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher.html">IBridgeDispatcher</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">bridgeDispatcher</a>;</div>
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> </div>
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11"> 59</a></span> readonly ILogger<BridgeController> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>;</div>
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keyword">internal</span> <span class="keyword">static</span> <span class="keywordtype">void</span> TemporarilyDisableContentLogging() => Interlocked.Increment(ref <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c">logContentDisableCounter</a>);</div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">internal</span> <span class="keyword">static</span> <span class="keywordtype">void</span> ReenableContentLogging() => Interlocked.Decrement(ref <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c">logContentDisableCounter</a>);</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
|
|
<div class="foldopen" id="foldopen00077" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0a1273e6fe2a3c56413909df260b51b7"> 77</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0a1273e6fe2a3c56413909df260b51b7">BridgeController</a>(<a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher.html">IBridgeDispatcher</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">bridgeDispatcher</a>, IHostApplicationLifetime applicationLifetime, ILogger<BridgeController> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>)</div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> {</div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> this.bridgeDispatcher = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">bridgeDispatcher</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">bridgeDispatcher</a>));</div>
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> ArgumentNullException.ThrowIfNull(applicationLifetime);</div>
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> this.logger = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>));</div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> applicationLifetime.ApplicationStopped.Register(() => <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0d4ca33235052b49fd927c9df33ae7f3">requestsProcessed</a> = 0);</div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> [HttpGet]</div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> [AllowAnonymous]</div>
|
|
<div class="foldopen" id="foldopen00095" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#ae2967e31eb38ce5eb75e6328f939463f"> 95</a></span> <span class="keyword">public</span> async ValueTask<IActionResult> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#ae2967e31eb38ce5eb75e6328f939463f">Process</a>([FromQuery] <span class="keywordtype">string</span> data, CancellationToken cancellationToken)</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> {</div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keyword">using</span> (LogContext.PushProperty(<a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper.html">SerilogContextHelper</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper.html#a7d76a86fe6ccb812e4e75a56b5d3b879">BridgeRequestIterationContextProperty</a>, Interlocked.Increment(ref <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0d4ca33235052b49fd927c9df33ae7f3">requestsProcessed</a>)))</div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> {</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// Nothing to see here</span></div>
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> var remoteIP = Request.HttpContext.Connection.RemoteIpAddress;</div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">if</span> (remoteIP == <span class="keyword">null</span> || !IPAddress.IsLoopback(remoteIP))</div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> {</div>
|
|
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogTrace(<span class="stringliteral">"Rejecting remote bridge request from {remoteIP}"</span>, remoteIP);</div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">return</span> Forbid();</div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> }</div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_bridge_parameters.html">BridgeParameters</a>? request;</div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">try</span></div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> {</div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> request = JsonConvert.DeserializeObject<<a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_bridge_parameters.html">BridgeParameters</a>>(data, <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html">DMApiConstants</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html#a38c0e12f070e67fbdedfce3854c58d42">SerializerSettings</a>);</div>
|
|
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
|
|
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">catch</span> (<a class="code hl_class" href="class_exception.html">Exception</a> ex)</div>
|
|
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> {</div>
|
|
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">if</span> (<a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">LogContent</a>)</div>
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogWarning(ex, <span class="stringliteral">"Error deserializing bridge request: {badJson}"</span>, data);</div>
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordflow">else</span></div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogWarning(ex, <span class="stringliteral">"Error deserializing bridge request!"</span>);</div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordflow">return</span> BadRequest();</div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> </div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">if</span> (request == <span class="keyword">null</span>)</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> {</div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">if</span> (<a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">LogContent</a>)</div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogWarning(<span class="stringliteral">"Error deserializing bridge request: {badJson}"</span>, data);</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">else</span></div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogWarning(<span class="stringliteral">"Error deserializing bridge request!"</span>);</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordflow">return</span> BadRequest();</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> }</div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
|
|
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">if</span> (<a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">LogContent</a>)</div>
|
|
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogTrace(<span class="stringliteral">"Bridge Request: {json}"</span>, data);</div>
|
|
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="keywordflow">else</span></div>
|
|
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogTrace(<span class="stringliteral">"Bridge Request"</span>);</div>
|
|
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
|
|
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> var response = await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">bridgeDispatcher</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher.html#a90328b9e6ef2235d53add3132f64f7a5">ProcessBridgeRequest</a>(request, cancellationToken);</div>
|
|
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keywordflow">if</span> (response == <span class="keyword">null</span>)</div>
|
|
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <span class="keywordflow">return</span> Unauthorized();</div>
|
|
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
|
|
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> var responseJson = JsonConvert.SerializeObject(response, <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html">DMApiConstants</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html#a38c0e12f070e67fbdedfce3854c58d42">SerializerSettings</a>);</div>
|
|
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> </div>
|
|
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="keywordflow">if</span> (<a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">LogContent</a>)</div>
|
|
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">logger</a>.LogTrace(<span class="stringliteral">"Bridge Response: {json}"</span>, responseJson);</div>
|
|
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <span class="keywordflow">return</span> Content(responseJson, MediaTypeNames.Application.Json);</div>
|
|
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> }</div>
|
|
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>}</div>
|
|
<div class="ttc" id="aclass_exception_html"><div class="ttname"><a href="class_exception.html">Exception</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_routes_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_routes.html">Tgstation.Server.Api.Routes</a></div><div class="ttdoc">Routes to a server actions.</div><div class="ttdef"><b>Definition</b> <a href="_routes_8cs_source.html#l00008">Routes.cs:9</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_routes_html_a8c6219903a85b89432912919b1762e49"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_routes.html#a8c6219903a85b89432912919b1762e49">Tgstation.Server.Api.Routes.ApiRoot</a></div><div class="ttdeci">const string ApiRoot</div><div class="ttdoc">The root of API methods.</div><div class="ttdef"><b>Definition</b> <a href="_routes_8cs_source.html#l00013">Routes.cs:13</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_bridge_parameters_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_bridge_parameters.html">Tgstation.Server.Host.Components.Interop.Bridge.BridgeParameters</a></div><div class="ttdoc">Parameters for a bridge request.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_parameters_8cs_source.html#l00012">BridgeParameters.cs:13</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html">Tgstation.Server.Host.Components.Interop.DMApiConstants</a></div><div class="ttdoc">Constants used for communication with the DMAPI.</div><div class="ttdef"><b>Definition</b> <a href="_d_m_api_constants_8cs_source.html#l00015">DMApiConstants.cs:16</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants_html_a38c0e12f070e67fbdedfce3854c58d42"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_d_m_api_constants.html#a38c0e12f070e67fbdedfce3854c58d42">Tgstation.Server.Host.Components.Interop.DMApiConstants.SerializerSettings</a></div><div class="ttdeci">static readonly JsonSerializerSettings SerializerSettings</div><div class="ttdoc">JsonSerializerSettings for use when communicating with the DMAPI.</div><div class="ttdef"><b>Definition</b> <a href="_d_m_api_constants_8cs_source.html#l00061">DMApiConstants.cs:61</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_api_controller_base_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_api_controller_base.html">Tgstation.Server.Host.Controllers.ApiControllerBase</a></div><div class="ttdoc">Base class for all API style controllers.</div><div class="ttdef"><b>Definition</b> <a href="_api_controller_base_8cs_source.html#l00018">ApiControllerBase.cs:19</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html">Tgstation.Server.Host.Controllers.BridgeController</a></div><div class="ttdoc">Controller for receiving DMAPI requests from DreamDaemon.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00029">BridgeController.cs:30</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_a0a1273e6fe2a3c56413909df260b51b7"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0a1273e6fe2a3c56413909df260b51b7">Tgstation.Server.Host.Controllers.BridgeController.BridgeController</a></div><div class="ttdeci">BridgeController(IBridgeDispatcher bridgeDispatcher, IHostApplicationLifetime applicationLifetime, ILogger< BridgeController > logger)</div><div class="ttdoc">Initializes a new instance of the BridgeController class.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00077">BridgeController.cs:77</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_a0d4ca33235052b49fd927c9df33ae7f3"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a0d4ca33235052b49fd927c9df33ae7f3">Tgstation.Server.Host.Controllers.BridgeController.requestsProcessed</a></div><div class="ttdeci">static long requestsProcessed</div><div class="ttdoc">Static counter for the number of requests processed.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00049">BridgeController.cs:49</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_a6fbf849cb3a51ef6cc1daeca36766027"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a6fbf849cb3a51ef6cc1daeca36766027">Tgstation.Server.Host.Controllers.BridgeController.LogContent</a></div><div class="ttdeci">static bool LogContent</div><div class="ttdoc">If the content of bridge requests and responses should be logged.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00039">BridgeController.cs:39</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_a9891743d5f16fcef93d55fc828b8dd11"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#a9891743d5f16fcef93d55fc828b8dd11">Tgstation.Server.Host.Controllers.BridgeController.logger</a></div><div class="ttdeci">readonly ILogger< BridgeController > logger</div><div class="ttdoc">The ILogger for the BridgeController.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00059">BridgeController.cs:59</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_aa84c6939b6616c3cd2febf5e9deb9d03"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#aa84c6939b6616c3cd2febf5e9deb9d03">Tgstation.Server.Host.Controllers.BridgeController.bridgeDispatcher</a></div><div class="ttdeci">readonly IBridgeDispatcher bridgeDispatcher</div><div class="ttdoc">The IBridgeDispatcher for the BridgeController.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00054">BridgeController.cs:54</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_abc7f0733e6de2d62937141087d8d20bf"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#abc7f0733e6de2d62937141087d8d20bf">Tgstation.Server.Host.Controllers.BridgeController.RouteExtension</a></div><div class="ttdeci">const string RouteExtension</div><div class="ttdoc">The route to the BridgeController.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00034">BridgeController.cs:34</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_ae2967e31eb38ce5eb75e6328f939463f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#ae2967e31eb38ce5eb75e6328f939463f">Tgstation.Server.Host.Controllers.BridgeController.Process</a></div><div class="ttdeci">async ValueTask< IActionResult > Process([FromQuery] string data, CancellationToken cancellationToken)</div><div class="ttdoc">Processes a bridge request.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00095">BridgeController.cs:95</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller_html_af8463638aa07640429a65f2787e72b9c"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_controllers_1_1_bridge_controller.html#af8463638aa07640429a65f2787e72b9c">Tgstation.Server.Host.Controllers.BridgeController.logContentDisableCounter</a></div><div class="ttdeci">static uint logContentDisableCounter</div><div class="ttdoc">Counter which, if not zero, indicates content logging should be disabled.</div><div class="ttdef"><b>Definition</b> <a href="_bridge_controller_8cs_source.html#l00044">BridgeController.cs:44</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper.html">Tgstation.Server.Host.Utils.SerilogContextHelper</a></div><div class="ttdoc">Helpers for manipulating the Serilog.Context.LogContext.</div><div class="ttdef"><b>Definition</b> <a href="_serilog_context_helper_8cs_source.html#l00006">SerilogContextHelper.cs:7</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper_html_a7d76a86fe6ccb812e4e75a56b5d3b879"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_serilog_context_helper.html#a7d76a86fe6ccb812e4e75a56b5d3b879">Tgstation.Server.Host.Utils.SerilogContextHelper.BridgeRequestIterationContextProperty</a></div><div class="ttdeci">const string BridgeRequestIterationContextProperty</div><div class="ttdoc">The Serilog.Context.LogContext property name for the ID of the bridge request currently being process...</div><div class="ttdef"><b>Definition</b> <a href="_serilog_context_helper_8cs_source.html#l00036">SerilogContextHelper.cs:36</a></div></div>
|
|
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher.html">Tgstation.Server.Host.Components.Interop.Bridge.IBridgeDispatcher</a></div><div class="ttdoc">Handler for BridgeParameters.</div><div class="ttdef"><b>Definition</b> <a href="_i_bridge_dispatcher_8cs_source.html#l00009">IBridgeDispatcher.cs:10</a></div></div>
|
|
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher_html_a90328b9e6ef2235d53add3132f64f7a5"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_1_1_i_bridge_dispatcher.html#a90328b9e6ef2235d53add3132f64f7a5">Tgstation.Server.Host.Components.Interop.Bridge.IBridgeDispatcher.ProcessBridgeRequest</a></div><div class="ttdeci">ValueTask< BridgeResponse?> ProcessBridgeRequest(BridgeParameters parameters, CancellationToken cancellationToken)</div><div class="ttdoc">Handle a set of bridge parameters .</div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_api_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_api.html">Tgstation.Server.Api</a></div><div class="ttdef"><b>Definition</b> <a href="_api_headers_8cs_source.html#l00019">ApiHeaders.cs:20</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_1_1_bridge.html">Tgstation.Server.Host.Components.Interop.Bridge</a></div><div class="ttdef"><b>Definition</b> <a href="_bridge_command_type_8cs_source.html#l00001">BridgeCommandType.cs:2</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_interop.html">Tgstation.Server.Host.Components.Interop</a></div><div class="ttdef"><b>Definition</b> <a href="_bridge_command_type_8cs_source.html#l00001">BridgeCommandType.cs:2</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_controllers_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_controllers.html">Tgstation.Server.Host.Controllers</a></div><div class="ttdef"><b>Definition</b> <a href="_administration_controller_8cs_source.html#l00026">AdministrationController.cs:27</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_utils_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_utils.html">Tgstation.Server.Host.Utils</a></div><div class="ttdef"><b>Definition</b> <a href="_graph_q_l_git_lab_client_8cs_source.html#l00006">GraphQLGitLabClient.cs:7</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
|
|
</small></address>
|
|
</body>
|
|
</html>
|