source: TFP-WebServer/WebServer/src/WebConnection.cs@ 475

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

Added permission management APIs

File size: 1.6 KB
Line 
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
17 public string Username { get; }
18 public PlatformUserIdentifierAbs UserId { get; }
19 public PlatformUserIdentifierAbs CrossplatformUserId { get; }
20
21 public TimeSpan Age => DateTime.Now - lastAction;
22
23 public WebConnection (string _sessionId, IPAddress _endpoint, string _username, PlatformUserIdentifierAbs _userId, PlatformUserIdentifierAbs _crossUserId = null) {
24 SessionID = _sessionId;
25 Endpoint = _endpoint;
26 Username = _username;
27 UserId = _userId;
28 CrossplatformUserId = _crossUserId;
29 login = DateTime.Now;
30 lastAction = login;
31 conDescription = $"WebPanel from {Endpoint}";
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.