92 | Access JSON API at:
/api
93 | API can be used to get status of the miner, information about GPUs, Connections, Config.
94 | API can also SET current stratum connection and config options.
95 | API DOCS:
https://grinpro.io/api.html
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/src/GrinProMInerAPI/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using GrinProMiner.Models;
6 | using Microsoft.AspNetCore.Http;
7 | using Microsoft.AspNetCore.Mvc;
8 | using Mozkomor.GrinGoldMiner;
9 |
10 | namespace GrinProMiner.Controllers
11 | {
12 | [Route("")]
13 | [Controller]
14 | public class HomeController : Controller
15 | {
16 | [Route("api")]
17 | public string Get()
18 | {
19 | return "You can use GET METHODS: /api/status, /api/workers, /api/workers/{id}, /api/connections, /api/connections/active /api/config and POST METHODS: /api/connections/active, /api/config. API DOCS: https://grinpro.io/api.html";
20 | }
21 |
22 | [Route("")]
23 | public IActionResult GetHome()
24 | {
25 | var lastJob = WorkerManager.lastJob.ToString("yyyy-MM-ddTHH:mm:ssK");
26 |
27 | var conn = ConnectionManager.GetCurrConn();
28 |
29 | if (conn == null)
30 | return StatusCode(404, "No Straturm Connection active.");
31 |
32 |
33 | var lastSHare = conn.lastShare;
34 | var totalShares = conn.totalShares;
35 | var accepted = conn.sharesAccepted;
36 | var rejected = conn.sharesRejected;
37 | var tooLate = conn.sharesTooLate;
38 | ///TODO do WorkerManagera dat SolutionsFound (kolik dohromady ze vsech karet) a
39 | /// SolutionsSubmitted (to bude az co projde pres diff)
40 |
41 | SimpleStatus status = new SimpleStatus();
42 |
43 | status.LastShare = lastSHare.ToString("yyyy-MM-ddTHH:mm:ssK");
44 | status.LastJob = lastJob;
45 |
46 | List