public IActionResult Status() { var statusResponse = Json(new { version = _versionProvider.GetVersion() }); statusResponse.StatusCode = 200; return(statusResponse); }
public Task Invoke(HttpContext httpContext) { var version = _versionProvider.GetVersion(); var versionJson = JsonSerializer.Serialize(version); httpContext.Response.ContentType = "application/json"; return(httpContext.Response.WriteAsync(versionJson)); }
public IResponse Execute(IRequest request) { Hashtable velocityContext = new Hashtable(); IResponse decoratedActionResponse = decoratedAction.Execute(request); if (decoratedActionResponse is HtmlFragmentResponse) { velocityContext["breadcrumbs"] = (TopControlsViewBuilder.Execute()).ResponseFragment; velocityContext["sidebar"] = (SideBarViewBuilder.Execute(cruiseRequest)).ResponseFragment; velocityContext["mainContent"] = ((HtmlFragmentResponse)decoratedActionResponse).ResponseFragment; velocityContext["dashboardversion"] = versionProvider.GetVersion(); if (request.ApplicationPath == "/") { velocityContext["applicationPath"] = string.Empty; } else { velocityContext["applicationPath"] = request.ApplicationPath; } velocityContext["renderedAt"] = DateUtil.FormatDate(DateTime.Now); velocityContext["loginView"] = LoginViewBuilder.Execute().ResponseFragment; // set to no refresh if refresh interval lower than 5 seconds Int32 refreshIntervalInSeconds = Int32.MaxValue; if (request.RefreshInterval >= 5) { refreshIntervalInSeconds = request.RefreshInterval; } velocityContext["refreshinterval"] = refreshIntervalInSeconds; string headerSuffix = string.Empty; if (!string.IsNullOrEmpty(loginViewBuilder.BuildServerName)) { headerSuffix = LoginViewBuilder.BuildServerName; } if (!string.IsNullOrEmpty(LoginViewBuilder.ProjectName)) { headerSuffix = string.Concat(headerSuffix, " - ", loginViewBuilder.ProjectName); } velocityContext["headersuffix"] = headerSuffix; GeneratejQueryLinks(velocityContext); return(velocityViewGenerator.GenerateView(TEMPLATE_NAME, velocityContext)); } else { return(decoratedActionResponse); } }
private async Task <bool> DifferentVersion() { var version = _versionProvider.GetVersion(); Version cacheVersion; if (!Version.TryParse(await _storage.GetString(VersionEntryName), out cacheVersion)) { cacheVersion = new Version(0, 0); } var result = version != cacheVersion; await _storage.Write(VersionEntryName, version.ToString()); return(result); }
public ConnectionManager(IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, Network network, INetworkPeerFactory networkPeerFactory, NodeSettings nodeSettings, INodeLifetime nodeLifetime, NetworkPeerConnectionParameters parameters, IPeerAddressManager peerAddressManager, IEnumerable <IPeerConnector> peerConnectors, IPeerDiscovery peerDiscovery, ISelfEndpointTracker selfEndpointTracker, ConnectionManagerSettings connectionSettings, IVersionProvider versionProvider, INodeStats nodeStats, IAsyncProvider asyncProvider) { this.connectedPeers = new NetworkPeerCollection(); this.dateTimeProvider = dateTimeProvider; this.loggerFactory = loggerFactory; this.logger = loggerFactory.CreateLogger(GetType().FullName); this.Network = network; this.NetworkPeerFactory = networkPeerFactory; this.NodeSettings = nodeSettings; this.nodeLifetime = nodeLifetime; this.asyncProvider = asyncProvider; this.peerAddressManager = peerAddressManager; this.PeerConnectors = peerConnectors; this.peerDiscovery = peerDiscovery; this.ConnectionSettings = connectionSettings; this.networkPeerDisposer = new NetworkPeerDisposer(this.loggerFactory, this.asyncProvider); this.Servers = new List <NetworkPeerServer>(); this.Parameters = parameters; this.Parameters.ConnectCancellation = this.nodeLifetime.ApplicationStopping; this.selfEndpointTracker = selfEndpointTracker; this.versionProvider = versionProvider; this.ipRangeFilteringEndpointExclusions = new List <IPEndPoint>(); this.connectedPeersQueue = asyncProvider.CreateAndRunAsyncDelegateDequeuer <INetworkPeer>( $"{nameof(ConnectionManager)}-{nameof(this.connectedPeersQueue)}", OnPeerAdded); this.disconnectedPerfCounter = new PerformanceCounter(); this.Parameters.UserAgent = $"{this.ConnectionSettings.Agent}:{versionProvider.GetVersion()} ({(int) this.NodeSettings.ProtocolVersion})"; this.Parameters.Version = this.NodeSettings.ProtocolVersion; nodeStats.RegisterStats(AddComponentStats, StatsType.Component, GetType().Name, 1100); }
public Task Invoke(HttpContext context) { var version = _versionProvider.GetVersion(); context.Response.OnStarting(() => { if (!context.Response.Headers.ContainsKey(_options.Header)) { context.Response.Headers.Add(_options.Header, new[] { version }); } return(Task.CompletedTask); }); return(_next(context)); }
public ConnectionManager(IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, Network network, INetworkPeerFactory networkPeerFactory, NodeSettings nodeSettings, INodeLifetime nodeLifetime, NetworkPeerConnectionParameters parameters, IPeerAddressManager peerAddressManager, IEnumerable <IPeerConnector> peerConnectors, IPeerDiscovery peerDiscovery, ISelfEndpointTracker selfEndpointTracker, ConnectionManagerSettings connectionSettings, IVersionProvider versionProvider, INodeStats nodeStats) { this.connectedPeers = new NetworkPeerCollection(); this.dateTimeProvider = dateTimeProvider; this.loggerFactory = loggerFactory; this.logger = loggerFactory.CreateLogger("Impleum.Bitcoin.FullNode"); this.Network = network; this.NetworkPeerFactory = networkPeerFactory; this.NodeSettings = nodeSettings; this.nodeLifetime = nodeLifetime; this.peerAddressManager = peerAddressManager; this.PeerConnectors = peerConnectors; this.peerDiscovery = peerDiscovery; this.ConnectionSettings = connectionSettings; this.networkPeerDisposer = new NetworkPeerDisposer(this.loggerFactory); this.Servers = new List <NetworkPeerServer>(); this.Parameters = parameters; this.Parameters.ConnectCancellation = this.nodeLifetime.ApplicationStopping; this.selfEndpointTracker = selfEndpointTracker; this.versionProvider = versionProvider; this.connectedPeersQueue = new AsyncQueue <INetworkPeer>(this.OnPeerAdded); this.disconnectedPerfCounter = new PerformanceCounter(); this.Parameters.UserAgent = $"{this.ConnectionSettings.Agent}:{versionProvider.GetVersion()} ({(int)this.NodeSettings.ProtocolVersion})"; this.Parameters.Version = this.NodeSettings.ProtocolVersion; nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, 1100); }
public SettingsWindow( [NotNull] ILogger logger, [NotNull] ISettingsManager manager, [NotNull] IVersionProvider provider) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(manager, nameof(manager)); Guard.ArgumentNotNull(provider, nameof(provider)); _logger = logger; _manager = manager; InitializeComponent( ); LabelVersion.Content = provider.GetVersion( ); Task.Run(Initialize); }
public ConnectionManager(IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, Network network, INetworkPeerFactory networkPeerFactory, NodeSettings nodeSettings, INodeLifetime nodeLifetime, NetworkPeerConnectionParameters parameters, IPeerAddressManager peerAddressManager, IEnumerable <IPeerConnector> peerConnectors, IPeerDiscovery peerDiscovery, ISelfEndpointTracker selfEndpointTracker, ConnectionManagerSettings connectionSettings, IVersionProvider versionProvider) { this.connectedPeers = new NetworkPeerCollection(); this.dateTimeProvider = dateTimeProvider; this.loggerFactory = loggerFactory; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.Network = network; this.NetworkPeerFactory = networkPeerFactory; this.NodeSettings = nodeSettings; this.nodeLifetime = nodeLifetime; this.peerAddressManager = peerAddressManager; this.PeerConnectors = peerConnectors; this.peerDiscovery = peerDiscovery; this.ConnectionSettings = connectionSettings; this.networkPeerDisposer = new NetworkPeerDisposer(this.loggerFactory); this.Servers = new List <NetworkPeerServer>(); this.Parameters = parameters; this.Parameters.ConnectCancellation = this.nodeLifetime.ApplicationStopping; this.selfEndpointTracker = selfEndpointTracker; this.versionProvider = versionProvider; this.Parameters.UserAgent = $"{this.NodeSettings.Agent}:{versionProvider.GetVersion()}"; this.Parameters.Version = this.NodeSettings.ProtocolVersion; this.downloads = new Dictionary <INetworkPeer, PerformanceSnapshot>(); }
public ConditionalGetFingerprint BuildFromDate(DateTime date) { return(new ConditionalGetFingerprint(date, "\"" + versionProvider.GetVersion() + "\"")); }
public VersionModule(IVersionProvider versionProvider) { Get["/version"] = _ => versionProvider.GetVersion(); }