Skip to content

Commit

Permalink
Time zones are now localized & relative now, fixes #582.
Browse files Browse the repository at this point in the history
Added feed support to config.json so that frontend can now render latest news from the supplied feed.
Implemented /help/faq page.
Moved terms of service page to /tos.
Removed social-icons section from config.json, social icons can now just rendered by editing navbar.cshtml - fixes #572.
Improved error handling for NetworkInfo.cs:DetectSubmitBlockSupport().
Pool pages do now render an error message when daemon connection is un-healthy.
Fixed #580.
Improved pools list & per-pool pages, they do now show the date of the last found block.
  • Loading branch information
bonesoul committed Oct 17, 2014
1 parent a5ca4e8 commit 0f1398e
Show file tree
Hide file tree
Showing 23 changed files with 609 additions and 77 deletions.
16 changes: 11 additions & 5 deletions src/CoiniumServ/CoiniumServ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<Compile Include="Coin\Config\CoinOptions.cs" />
<Compile Include="Coin\Config\IBlockExplorerOptions.cs" />
<Compile Include="Coin\Config\ICoinOptions.cs" />
<Compile Include="Server\Web\Modules\TosModule.cs" />
<Compile Include="Utils\Helpers\Humanize.cs" />
<Compile Include="Configuration\IJsonConfigReader.cs" />
<Compile Include="Daemon\Converters\DifficultyConverter.cs" />
Expand Down Expand Up @@ -527,6 +528,8 @@
<None Include="web\default\views\algorithm\algorithm.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\views\help\faq.cshtml" />
<None Include="web\default\views\tos\tos.cshtml" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down Expand Up @@ -799,7 +802,10 @@
<None Include="web\default\views\help\gettingstarted\pool.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\views\help\miningsoftware\index.cshtml">
<None Include="web\default\views\help\miningsoftware.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\views\layout\news.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\views\layout\header.cshtml">
Expand Down Expand Up @@ -958,9 +964,6 @@
<None Include="web\default\views\pool\workers.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\views\help\termsofservice.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\deps\csredis\CSRedis\CSRedis.csproj">
Expand All @@ -977,7 +980,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Coinium.ico" />
<None Include="web\default\Content\js\interface.js">
<Content Include="web\default\Content\js\jquery.timeago.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="web\default\Content\js\frontend.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="web\default\Content\img\coins\icon\21.png">
Expand Down
28 changes: 20 additions & 8 deletions src/CoiniumServ/Pools/NetworkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void Recache()
}
catch (RpcException e)
{
_logger.Error("Can not read mininginfo() - the coin may not support the request: {0:l}", e.Message);
_logger.Error("Can not read mininginfo(): {0:l}", e.Message);
Hashrate = 0;
Difficulty = 0;
Round = -1;
Expand Down Expand Up @@ -141,14 +141,26 @@ private void DetectSubmitBlockSupport()
{
var response = _daemonClient.SubmitBlock(string.Empty);
}
catch (RpcErrorException e)
catch(RpcException e)
{
if (e.Code == (int)RpcErrorCode.RPC_METHOD_NOT_FOUND) // 'Method not found' error.
_poolConfig.Coin.Options.SubmitBlockSupported = false; // the coin doesn't support submitblock().
else if (e.Code == (int)RpcErrorCode.RPC_DESERIALIZATION_ERROR) // 'Block decode failed' error.
_poolConfig.Coin.Options.SubmitBlockSupported = true; // the coin supports submitblock().
else // we shouldn't be really recieving any other errors.
_logger.Error("Recieved an unexpected response for DetectSubmitBlockSupport() - {0}, {1:l}", e.Code, e.Message);
if (e is RpcErrorException)
{
var error = e as RpcErrorException;
switch (error.Code)
{
case (int)RpcErrorCode.RPC_METHOD_NOT_FOUND:
_poolConfig.Coin.Options.SubmitBlockSupported = false; // the coin doesn't support submitblock().
break;
case (int)RpcErrorCode.RPC_DESERIALIZATION_ERROR:
_poolConfig.Coin.Options.SubmitBlockSupported = true; // the coin supports submitblock().
break;
default:
_logger.Error("Recieved an unexpected response for DetectSubmitBlockSupport() - {0}, {1:l}", error.Code, e.Message);
break;
}
}
else
_logger.Error("Can not probe submitblock() support: {0:l}", e.Message);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/CoiniumServ/Server/Web/Config/IWebServerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public interface IWebServerConfig : IServerConfig
{
string Template { get; }

string Feed { get; }

IBackendConfig Backend { get; }
}
}
3 changes: 3 additions & 0 deletions src/CoiniumServ/Server/Web/Config/WebServerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class WebServerConfig : IWebServerConfig

public string Template { get; private set; }

public string Feed { get; private set; }

public IBackendConfig Backend { get; private set; }

public bool Valid { get; private set; }
Expand All @@ -49,6 +51,7 @@ public WebServerConfig(dynamic config)
BindInterface = string.IsNullOrEmpty(config.bind) ? "localhost" : config.bind;
Port = config.port == 0 ? 80 : config.port;
Template = string.IsNullOrEmpty(config.template) ? "default" : config.template;
Feed = string.IsNullOrEmpty(config.feed) ? "" : config.feed;
Backend = new BackendConfig(config.backend);
Valid = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/CoiniumServ/Server/Web/Modules/HelpModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class HelpModule:NancyModule
public HelpModule(IPoolManager poolManager, IConfigManager configManager, ISoftwareRepository softwareRepository)
:base("/help")
{
Get["/termsofservice"] = _ =>
Get["/faq"] = _ =>
{
ViewBag.Header = "Terms of Service";
ViewBag.Header = "Frequently Asked Questions";
return View["termsofservice"];
return View["faq"];
};

Get["/gettingstarted/"] = _ =>
Expand Down Expand Up @@ -77,7 +77,7 @@ public HelpModule(IPoolManager poolManager, IConfigManager configManager, ISoftw

Get["/miningsoftware/"] = _ =>
{
return View["miningsoftware/index", softwareRepository];
return View["miningsoftware", softwareRepository];
};
}
}
Expand Down
43 changes: 43 additions & 0 deletions src/CoiniumServ/Server/Web/Modules/TosModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#region License
//
// CoiniumServ - Crypto Currency Mining Pool Server Software
// Copyright (C) 2013 - 2014, CoiniumServ Project - http://www.coinium.org
// http://www.coiniumserv.com - https://github.com/CoiniumServ/CoiniumServ
//
// This software is dual-licensed: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// For the terms of this license, see licenses/gpl_v3.txt.
//
// Alternatively, you can license this software under a commercial
// license or white-label it as set out in licenses/commercial.txt.
//
#endregion

using Nancy;

namespace CoiniumServ.Server.Web.Modules
{
public class TosModule : NancyModule
{
public TosModule()
: base("/tos")
{
Get["/"] = _ =>
{
// include common data required by layout.
ViewBag.Header = "Terms of Service";
// return our view
return View["tos"];
};
}
}
}
1 change: 1 addition & 0 deletions src/CoiniumServ/Server/Web/NancyBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected override void ApplicationStartup(TinyIoCContainer container, IPipeline
ctx.ViewBag.SubHeading = "";
ctx.ViewBag.Pools = _poolManager;
ctx.ViewBag.Feed = _configManager.WebServerConfig.Feed;
ctx.ViewBag.LastUpdate = _statisticsManager.LastUpdate.ToString("HH:mm:ss tt zz"); // last statistics update.
};

Expand Down
1 change: 1 addition & 0 deletions src/CoiniumServ/config/config-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"bind": "",
"port": 80,
"template": "default",
"feed": "",
"backend": {
"metrics": {
"enabled": false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$(function() {
$(function () {
// process the search boxes
$('#block-search').submit(function () {
var height = $("#block-height").val();
$("#block-search").attr("action", $(location).attr('pathname') + 'block/' + height);
Expand All @@ -7,4 +8,6 @@
var address = $("#address").val();
$("#address-search").attr("action", $(location).attr('pathname') + 'account/address/' + address);
});

$('time.timeago').timeago(); // parse date & time's as time-ago texts.
});

0 comments on commit 0f1398e

Please sign in to comment.