source: binary-improvements2/WebServer/src/WebConnection.cs@ 435

Last change on this file since 435 was 434, checked in by alloc, 18 months ago

Added permission management APIs

File size: 1.6 KB
RevLine 
[391]1using System;
2using System.Collections.Generic;
3using System.Net;
4using UnityEngine;
5
6namespace Webserver {
7 public class WebConnection : ConsoleConnectionAbstract {
8 private readonly DateTime login;
9// private readonly List<string> outputLines = new List<string> ();
10 private DateTime lastAction;
11 private readonly string conDescription;
12
13 public string SessionID { get; }
14
15 public IPAddress Endpoint { get; }
16
[404]17 public string Username { get; }
[391]18 public PlatformUserIdentifierAbs UserId { get; }
[404]19 public PlatformUserIdentifierAbs CrossplatformUserId { get; }
[391]20
21 public TimeSpan Age => DateTime.Now - lastAction;
22
[404]23 public WebConnection (string _sessionId, IPAddress _endpoint, string _username, PlatformUserIdentifierAbs _userId, PlatformUserIdentifierAbs _crossUserId = null) {
[391]24 SessionID = _sessionId;
25 Endpoint = _endpoint;
[404]26 Username = _username;
[391]27 UserId = _userId;
[404]28 CrossplatformUserId = _crossUserId;
[391]29 login = DateTime.Now;
30 lastAction = login;
[402]31 conDescription = $"WebPanel from {Endpoint}";
[391]32 }
33
34 public void UpdateUsage () {
35 lastAction = DateTime.Now;
36 }
37
38 public override string GetDescription () {
39 return conDescription;
40 }
41
42 public override void SendLine (string _text) {
43// outputLines.Add (_text);
44 }
45
46 public override void SendLines (List<string> _output) {
47// outputLines.AddRange (_output);
48 }
49
50 public override void SendLog (string _formattedMsg, string _plainMsg, string _trace, LogType _type, DateTime _timestamp, long _uptime) {
51 // Do nothing, handled by LogBuffer
52 }
53 }
54}
Note: See TracBrowser for help on using the repository browser.