Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
390de8e5
Commit
390de8e5
authored
Oct 18, 2018
by
Clint Mourlevat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vanity generation working
parent
153252bb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
26 deletions
+43
-26
HomeController.cs
Controllers/HomeController.cs
+6
-3
Ask.cs
Modules/Ask.cs
+3
-3
Program.cs
Program.cs
+1
-0
TickerService.cs
Services/TickerService.cs
+4
-2
VanityService.cs
Services/VanityService.cs
+23
-14
Startup.cs
Startup.cs
+2
-3
Stratis.Guru.csproj
Stratis.Guru.csproj
+2
-0
Vanity.cshtml
Views/Home/Vanity.cshtml
+2
-1
No files found.
Controllers/HomeController.cs
View file @
390de8e5
...
@@ -20,7 +20,7 @@ namespace Stratis.Guru.Controllers
...
@@ -20,7 +20,7 @@ namespace Stratis.Guru.Controllers
public
class
HomeController
:
Controller
public
class
HomeController
:
Controller
{
{
private
readonly
IMemoryCache
_memoryCache
;
private
readonly
IMemoryCache
_memoryCache
;
private
IAsk
_ask
;
private
readonly
IAsk
_ask
;
public
HomeController
(
IMemoryCache
memoryCache
,
IAsk
ask
)
public
HomeController
(
IMemoryCache
memoryCache
,
IAsk
ask
)
{
{
...
@@ -66,8 +66,11 @@ namespace Stratis.Guru.Controllers
...
@@ -66,8 +66,11 @@ namespace Stratis.Guru.Controllers
[
Route
(
"vanity"
)]
[
Route
(
"vanity"
)]
public
IActionResult
Vanity
(
Vanity
vanity
)
public
IActionResult
Vanity
(
Vanity
vanity
)
{
{
_ask
.
NewVanity
(
vanity
);
if
(
ModelState
.
IsValid
)
ViewBag
.
Succeed
=
true
;
{
_ask
.
NewVanity
(
vanity
);
ViewBag
.
Succeed
=
true
;
}
return
View
();
return
View
();
}
}
...
...
Modules/Ask.cs
View file @
390de8e5
...
@@ -5,16 +5,16 @@ namespace Stratis.Guru.Modules
...
@@ -5,16 +5,16 @@ namespace Stratis.Guru.Modules
{
{
public
class
Ask
:
IAsk
public
class
Ask
:
IAsk
{
{
private
Queue
<
Vanity
>
VanityAsking
=
new
Queue
<
Vanity
>();
private
readonly
Queue
<
Vanity
>
_vanities
=
new
Queue
<
Vanity
>();
public
void
NewVanity
(
Vanity
vanity
)
public
void
NewVanity
(
Vanity
vanity
)
{
{
VanityAsking
.
Enqueue
(
vanity
);
_vanities
.
Enqueue
(
vanity
);
}
}
public
Queue
<
Vanity
>
GetVanities
()
public
Queue
<
Vanity
>
GetVanities
()
{
{
return
VanityAsking
;
return
_vanities
;
}
}
}
}
}
}
\ No newline at end of file
Program.cs
View file @
390de8e5
...
@@ -19,6 +19,7 @@ namespace Stratis.Guru
...
@@ -19,6 +19,7 @@ namespace Stratis.Guru
public
static
IWebHostBuilder
CreateWebHostBuilder
(
string
[]
args
)
=>
public
static
IWebHostBuilder
CreateWebHostBuilder
(
string
[]
args
)
=>
WebHost
.
CreateDefaultBuilder
(
args
)
WebHost
.
CreateDefaultBuilder
(
args
)
.
UseUrls
(
"http://localhost:1989"
)
.
UseStartup
<
Startup
>();
.
UseStartup
<
Startup
>();
}
}
}
}
\ No newline at end of file
Services/TickerService.cs
View file @
390de8e5
...
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
...
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Hosting
;
using
Newtonsoft.Json
;
using
RestSharp
;
using
RestSharp
;
using
Stratis.Guru.Hubs
;
using
Stratis.Guru.Hubs
;
...
@@ -15,17 +14,18 @@ namespace Stratis.Guru.Services
...
@@ -15,17 +14,18 @@ namespace Stratis.Guru.Services
private
readonly
IMemoryCache
_memoryCache
;
private
readonly
IMemoryCache
_memoryCache
;
private
readonly
IHubContext
<
UpdateHub
>
_hubContext
;
private
readonly
IHubContext
<
UpdateHub
>
_hubContext
;
private
readonly
UpdateHub
_hub
;
private
readonly
UpdateHub
_hub
;
private
readonly
System
.
Timers
.
Timer
updateTimer
;
public
TickerService
(
IMemoryCache
memoryCache
,
UpdateHub
hub
,
IHubContext
<
UpdateHub
>
hubContext
)
public
TickerService
(
IMemoryCache
memoryCache
,
UpdateHub
hub
,
IHubContext
<
UpdateHub
>
hubContext
)
{
{
_memoryCache
=
memoryCache
;
_memoryCache
=
memoryCache
;
_hub
=
hub
;
_hub
=
hub
;
_hubContext
=
hubContext
;
_hubContext
=
hubContext
;
updateTimer
=
new
System
.
Timers
.
Timer
();
}
}
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
{
{
var
updateTimer
=
new
System
.
Timers
.
Timer
();
updateTimer
.
Interval
=
10
;
updateTimer
.
Interval
=
10
;
updateTimer
.
Enabled
=
true
;
updateTimer
.
Enabled
=
true
;
updateTimer
.
Elapsed
+=
async
(
sender
,
args
)
=>
updateTimer
.
Elapsed
+=
async
(
sender
,
args
)
=>
...
@@ -48,6 +48,8 @@ namespace Stratis.Guru.Services
...
@@ -48,6 +48,8 @@ namespace Stratis.Guru.Services
public
void
Dispose
()
public
void
Dispose
()
{
{
updateTimer
?.
Stop
();
updateTimer
?.
Dispose
();;
}
}
}
}
}
}
\ No newline at end of file
Services/VanityService.cs
View file @
390de8e5
...
@@ -10,28 +10,38 @@ namespace Stratis.Guru.Services
...
@@ -10,28 +10,38 @@ namespace Stratis.Guru.Services
{
{
public
class
VanityService
:
IHostedService
,
IDisposable
public
class
VanityService
:
IHostedService
,
IDisposable
{
{
private
IMemoryCache
_memoryCache
;
private
readonly
IAsk
_ask
;
private
IAsk
_ask
;
public
VanityService
(
I
MemoryCache
memoryCache
,
I
Ask
ask
)
public
VanityService
(
IAsk
ask
)
{
{
_memoryCache
=
memoryCache
;
_ask
=
ask
;
_ask
=
ask
;
}
}
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
{
{
/*while (true)
Task
.
Run
(()
=>
{
{
var stratisKey = new Key();
while
(
true
)
var stratisAddress = stratisKey.GetWif(Network.StratisMain).PubKey.GetAddress(Network.StratisMain).ToString();
if (stratisAddress.ToLower().StartsWith("stra"))
{
{
Console.WriteLine(stratisAddress);
if
(
_ask
.
GetVanities
().
Count
>
0
)
}
{
var
getVanity
=
_ask
.
GetVanities
().
Dequeue
();
while
(
true
)
{
var
stratisKey
=
new
Key
();
var
stratisAddress
=
stratisKey
.
GetWif
(
Network
.
StratisMain
).
PubKey
.
GetAddress
(
Network
.
StratisMain
).
ToString
();
//Thread.Sleep((int) TimeSpan.FromSeconds(10).TotalMilliseconds);
if
(
stratisAddress
.
ToLower
().
StartsWith
(
string
.
Concat
(
"s"
,
getVanity
.
Prefix
)))
}*/
{
Console
.
WriteLine
(
stratisAddress
+
" - "
+
getVanity
.
Email
);
break
;
}
}
}
Thread
.
Sleep
((
int
)
TimeSpan
.
FromSeconds
(
10
).
TotalMilliseconds
);
}
},
cancellationToken
);
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
}
}
...
@@ -42,7 +52,6 @@ namespace Stratis.Guru.Services
...
@@ -42,7 +52,6 @@ namespace Stratis.Guru.Services
public
void
Dispose
()
public
void
Dispose
()
{
{
}
}
}
}
}
}
\ No newline at end of file
Startup.cs
View file @
390de8e5
...
@@ -43,11 +43,10 @@ namespace Stratis.Guru
...
@@ -43,11 +43,10 @@ namespace Stratis.Guru
services
.
AddMemoryCache
();
services
.
AddMemoryCache
();
services
.
AddTransient
<
UpdateHub
>();
services
.
AddTransient
<
IAsk
,
Ask
>();
services
.
AddHostedService
<
TickerService
>();
services
.
AddHostedService
<
TickerService
>();
services
.
AddHostedService
<
VanityService
>();
services
.
AddHostedService
<
VanityService
>();
services
.
AddTransient
<
UpdateHub
>();
services
.
AddSingleton
<
IAsk
,
Ask
>();
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_2_1
);
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_2_1
);
...
...
Stratis.Guru.csproj
View file @
390de8e5
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
...
...
Views/Home/Vanity.cshtml
View file @
390de8e5
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
{
{
<i class="fa fa-check text-success fa-5x"></i>
<i class="fa fa-check text-success fa-5x"></i>
<h1>Process Started</h1>
<h1>Process Started</h1>
<p>The process has been taken in hand by our vanity service !</p>
<p class="m-2">The process has been taken in hand by our vanity service !</p>
<p class="small text-muted extra">You can leave, you will informed by email, please don't refresh the page.</p>
}
}
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment