[251] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
[332] | 3 | using System.Net;
|
---|
[251] | 4 | using UnityEngine;
|
---|
| 5 |
|
---|
[325] | 6 | namespace 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 |
|
---|
[332] | 13 | public WebConnection (string _sessionId, IPAddress _endpoint, ulong _steamId) {
|
---|
[325] | 14 | SessionID = _sessionId;
|
---|
| 15 | Endpoint = _endpoint;
|
---|
| 16 | SteamID = _steamId;
|
---|
| 17 | login = DateTime.Now;
|
---|
| 18 | lastAction = login;
|
---|
| 19 | conDescription = "WebPanel from " + Endpoint;
|
---|
[251] | 20 | }
|
---|
| 21 |
|
---|
[325] | 22 | public string SessionID { get; private set; }
|
---|
[251] | 23 |
|
---|
[332] | 24 | public IPAddress Endpoint { get; private set; }
|
---|
[251] | 25 |
|
---|
[325] | 26 | public ulong SteamID { get; private set; }
|
---|
| 27 |
|
---|
[251] | 28 | public TimeSpan Age {
|
---|
| 29 | get { return DateTime.Now - lastAction; }
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[325] | 32 | public static bool CanViewAllPlayers (int _permissionLevel) {
|
---|
[332] | 33 | return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallplayers", _permissionLevel);
|
---|
[325] | 34 | }
|
---|
[251] | 35 |
|
---|
[325] | 36 | public static bool CanViewAllClaims (int _permissionLevel) {
|
---|
[332] | 37 | return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallclaims", _permissionLevel);
|
---|
[251] | 38 | }
|
---|
| 39 |
|
---|
| 40 | public void UpdateUsage () {
|
---|
[325] | 41 | lastAction = DateTime.Now;
|
---|
[251] | 42 | }
|
---|
| 43 |
|
---|
| 44 | public override string GetDescription () {
|
---|
[325] | 45 | return conDescription;
|
---|
[251] | 46 | }
|
---|
| 47 |
|
---|
| 48 | public override void SendLine (string _text) {
|
---|
[326] | 49 | // outputLines.Add (_text);
|
---|
[251] | 50 | }
|
---|
| 51 |
|
---|
| 52 | public override void SendLines (List<string> _output) {
|
---|
[326] | 53 | // outputLines.AddRange (_output);
|
---|
[251] | 54 | }
|
---|
| 55 |
|
---|
| 56 | public override void SendLog (string _msg, string _trace, LogType _type) {
|
---|
| 57 | // Do nothing, handled by LogBuffer
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
[325] | 60 | }
|
---|