public IActionResult GetServerInfo(bool forceReSync = false) { var result = _mediaServerService.GetServerInfo(forceReSync); var serverInfo = _mapper.Map <ServerInfoViewModel>(result); return(Ok(serverInfo)); }
public MemoryStream GetLogStream(string fileName, bool anonymous) { var dirs = _settingsService.GetAppSettings().Dirs; var logStream = new FileStream(Path.Combine(dirs.Config, dirs.Logs, fileName).GetLocalPath(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite); var newLogStream = new MemoryStream(); if (!anonymous) { logStream.CopyTo(newLogStream); return(newLogStream); } using (var reader = new StreamReader(logStream)) { var writer = new StreamWriter(newLogStream); var configuration = _settingsService.GetUserSettings(); var serverInfo = _mediaServerService.GetServerInfo(false); string line; while ((line = reader.ReadLine()) != null) { line = line.Replace(configuration.MediaServer.FullMediaServerAddress, "http://xxx.xxx.xxx.xxx:xxxx"); line = line.Replace(configuration.MediaServer.FullSocketAddress, "wss://xxx.xxx.xxx.xxx:xxxx"); line = line.Replace(configuration.Tvdb.ApiKey, "xxxxxxxxxxxxxx"); line = line.Replace(configuration.MediaServer.ApiKey, "xxxxxxxxxxxxxx"); line = line.Replace(serverInfo.Id, "xxxxxxxxxxxxxx"); writer.WriteLine(line); } writer.Flush(); } newLogStream.Seek(0, SeekOrigin.Begin); return(newLogStream); }