source: binary-improvements2/MapRendering/Web/WebConnection.cs@ 382

Last change on this file since 382 was 382, checked in by alloc, 2 years ago

Switched to use SpaceWizards.HttpListener

File size: 1.7 KB
RevLine 
[251]1using System;
2using System.Collections.Generic;
[332]3using System.Net;
[251]4using UnityEngine;
5
[325]6namespace AllocsFixes.NetConnections.Servers.Web {
[251]7 public class WebConnection : ConsoleConnectionAbstract {
[325]8 private readonly DateTime login;
[326]9// private readonly List<string> outputLines = new List<string> ();
[251]10 private DateTime lastAction;
[325]11 private readonly string conDescription;
[251]12
[382]13 public string SessionID { get; }
14
15 public IPAddress Endpoint { get; }
16
17 public PlatformUserIdentifierAbs UserId { get; }
18
19 public TimeSpan Age => DateTime.Now - lastAction;
20
[369]21 public WebConnection (string _sessionId, IPAddress _endpoint, PlatformUserIdentifierAbs _userId) {
[325]22 SessionID = _sessionId;
23 Endpoint = _endpoint;
[369]24 UserId = _userId;
[325]25 login = DateTime.Now;
26 lastAction = login;
27 conDescription = "WebPanel from " + Endpoint;
[251]28 }
29
[325]30 public static bool CanViewAllPlayers (int _permissionLevel) {
[332]31 return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallplayers", _permissionLevel);
[325]32 }
[251]33
[325]34 public static bool CanViewAllClaims (int _permissionLevel) {
[332]35 return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallclaims", _permissionLevel);
[251]36 }
37
38 public void UpdateUsage () {
[325]39 lastAction = DateTime.Now;
[251]40 }
41
42 public override string GetDescription () {
[325]43 return conDescription;
[251]44 }
45
46 public override void SendLine (string _text) {
[326]47// outputLines.Add (_text);
[251]48 }
49
50 public override void SendLines (List<string> _output) {
[326]51// outputLines.AddRange (_output);
[251]52 }
53
[369]54 public override void SendLog (string _formattedMsg, string _plainMsg, string _trace, LogType _type, DateTime _timestamp, long _uptime) {
[251]55 // Do nothing, handled by LogBuffer
56 }
57 }
[325]58}
Note: See TracBrowser for help on using the repository browser.