mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-21 17:42:33 +02:00
Added UI as submodule and as static in production, changed endpoint to /api/graphql
This commit is contained in:
parent
ea3ba51219
commit
bdecda99ba
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "apolloui"]
|
||||
path = apolloui
|
||||
url = https://github.com/CryptofyCH/apolloui
|
1
apolloui
Submodule
1
apolloui
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 95ae5ac443284b49fd81d94a396de340d8d7280f
|
1
config/production.json
Normal file
1
config/production.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
@ -1,180 +1,190 @@
|
||||
'use strict';
|
||||
|
||||
const sampleData = {
|
||||
"summary": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 11,
|
||||
"Msg": "Summary",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"SUMMARY": [
|
||||
{
|
||||
"Elapsed": 847,
|
||||
"MHS av": 3.364,
|
||||
"MHS 20s": 3.324,
|
||||
"Found Blocks": 0,
|
||||
"Getworks": 30,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Hardware Errors": 2,
|
||||
"Utility": 11.9,
|
||||
"Discarded": 78,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Local Work": 138,
|
||||
"Remote Failures": 0,
|
||||
"Network Blocks": 5,
|
||||
"Total MH": 2849.3488,
|
||||
"Diff1 Work": 0.67822266,
|
||||
"Work Utility": 0.048,
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Best Share": 1.03726997,
|
||||
"Device Hardware%": 0.1438,
|
||||
"Device Rejected%": 0,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0,
|
||||
"Last getwork": 1541144888
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"devs": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 9,
|
||||
"Msg": "1 PGA(s)",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"DEVS": [
|
||||
{
|
||||
"PGA": 0,
|
||||
"Name": "MLD",
|
||||
"ID": 0,
|
||||
"Enabled": "Y",
|
||||
"Status": "Alive",
|
||||
"Device Elapsed": 847,
|
||||
"MHS av": 3.363,
|
||||
"MHS 20s": 3.373,
|
||||
"MHS rolling": 3.373,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Hardware Errors": 2,
|
||||
"Utility": 11.897,
|
||||
"Stale": 0,
|
||||
"Last Share Pool": 1,
|
||||
"Last Share Time": 1541144887,
|
||||
"Total MH": 2849.3488,
|
||||
"Diff1 Work": 0.67822266,
|
||||
"Work Utility": 0.048,
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0.00390625,
|
||||
"Last Valid Work": 1541144891,
|
||||
"Device Hardware%": 0.1438,
|
||||
"Device Rejected%": 0
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"pools": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 7,
|
||||
"Msg": "2 Pool(s)",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"POOLS": [
|
||||
{
|
||||
"POOL": 0,
|
||||
"URL": "stratum+tcp://us.litecoinpool.org:3333",
|
||||
"Status": "Alive",
|
||||
"Priority": 1,
|
||||
"Quota": 1,
|
||||
"Mining Goal": "default",
|
||||
"Long Poll": "N",
|
||||
"Getworks": 3,
|
||||
"Accepted": 0,
|
||||
"Rejected": 0,
|
||||
"Works": 0,
|
||||
"Discarded": 0,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Remote Failures": 0,
|
||||
"User": "jstefanop.1",
|
||||
"Last Share Time": 0,
|
||||
"Diff1 Shares": 0,
|
||||
"Proxy": "",
|
||||
"Difficulty Accepted": 0,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0,
|
||||
"Has Stratum": true,
|
||||
"Stratum Active": false,
|
||||
"Stratum URL": "",
|
||||
"Best Share": 0,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0
|
||||
},
|
||||
{
|
||||
"POOL": 1,
|
||||
"URL": "stratum+tcp://us.litecoinpool.org:3333",
|
||||
"Status": "Alive",
|
||||
"Priority": 0,
|
||||
"Quota": 1,
|
||||
"Mining Goal": "default",
|
||||
"Long Poll": "N",
|
||||
"Getworks": 27,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Works": 30,
|
||||
"Discarded": 78,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Remote Failures": 0,
|
||||
"User": "jstefanop.1",
|
||||
"Last Share Time": 1541144887,
|
||||
"Diff1 Shares": 0.67822266,
|
||||
"Proxy": "",
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0.00390625,
|
||||
"Has Stratum": true,
|
||||
"Stratum Active": true,
|
||||
"Stratum URL": "us.litecoinpool.org",
|
||||
"Best Share": 1.03726997,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
function getData() {
|
||||
return {
|
||||
"summary": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 11,
|
||||
"Msg": "Summary",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"SUMMARY": [
|
||||
{
|
||||
"Elapsed": 847,
|
||||
"MHS av": getRandomFloat(3.00, 4.00),
|
||||
"MHS 20s": 3.324,
|
||||
"Found Blocks": 0,
|
||||
"Getworks": 30,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Hardware Errors": 2,
|
||||
"Utility": 11.9,
|
||||
"Discarded": 78,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Local Work": 138,
|
||||
"Remote Failures": 0,
|
||||
"Network Blocks": 5,
|
||||
"Total MH": 2849.3488,
|
||||
"Diff1 Work": 0.67822266,
|
||||
"Work Utility": 0.048,
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Best Share": 1.03726997,
|
||||
"Device Hardware%": 0.1438,
|
||||
"Device Rejected%": 0,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0,
|
||||
"Last getwork": 1541144888
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"devs": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 9,
|
||||
"Msg": "1 PGA(s)",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"DEVS": [
|
||||
{
|
||||
"PGA": 0,
|
||||
"Name": "MLD",
|
||||
"ID": 0,
|
||||
"Enabled": "Y",
|
||||
"Status": "Alive",
|
||||
"Device Elapsed": 847,
|
||||
"MHS av": 3.363,
|
||||
"MHS 20s": 3.373,
|
||||
"MHS rolling": 3.373,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Hardware Errors": 2,
|
||||
"Utility": 11.897,
|
||||
"Stale": 0,
|
||||
"Last Share Pool": 1,
|
||||
"Last Share Time": 1541144887,
|
||||
"Total MH": 2849.3488,
|
||||
"Diff1 Work": 0.67822266,
|
||||
"Work Utility": 0.048,
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0.00390625,
|
||||
"Last Valid Work": 1541144891,
|
||||
"Device Hardware%": 0.1438,
|
||||
"Device Rejected%": 0
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"pools": [
|
||||
{
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1541144892,
|
||||
"Code": 7,
|
||||
"Msg": "2 Pool(s)",
|
||||
"Description": "bfgminer 5.4.2"
|
||||
}
|
||||
],
|
||||
"POOLS": [
|
||||
{
|
||||
"POOL": 0,
|
||||
"URL": "stratum+tcp://us.litecoinpool.org:3333",
|
||||
"Status": "Alive",
|
||||
"Priority": 1,
|
||||
"Quota": 1,
|
||||
"Mining Goal": "default",
|
||||
"Long Poll": "N",
|
||||
"Getworks": 3,
|
||||
"Accepted": 0,
|
||||
"Rejected": 0,
|
||||
"Works": 0,
|
||||
"Discarded": 0,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Remote Failures": 0,
|
||||
"User": "jstefanop.1",
|
||||
"Last Share Time": 0,
|
||||
"Diff1 Shares": 0,
|
||||
"Proxy": "",
|
||||
"Difficulty Accepted": 0,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0,
|
||||
"Has Stratum": true,
|
||||
"Stratum Active": false,
|
||||
"Stratum URL": "",
|
||||
"Best Share": 0,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0
|
||||
},
|
||||
{
|
||||
"POOL": 1,
|
||||
"URL": "stratum+tcp://us.litecoinpool.org:3333",
|
||||
"Status": "Alive",
|
||||
"Priority": 0,
|
||||
"Quota": 1,
|
||||
"Mining Goal": "default",
|
||||
"Long Poll": "N",
|
||||
"Getworks": 27,
|
||||
"Accepted": 168,
|
||||
"Rejected": 0,
|
||||
"Works": 30,
|
||||
"Discarded": 78,
|
||||
"Stale": 0,
|
||||
"Get Failures": 0,
|
||||
"Remote Failures": 0,
|
||||
"User": "jstefanop.1",
|
||||
"Last Share Time": 1541144887,
|
||||
"Diff1 Shares": 0.67822266,
|
||||
"Proxy": "",
|
||||
"Difficulty Accepted": 0.65625,
|
||||
"Difficulty Rejected": 0,
|
||||
"Difficulty Stale": 0,
|
||||
"Last Share Difficulty": 0.00390625,
|
||||
"Has Stratum": true,
|
||||
"Stratum Active": true,
|
||||
"Stratum URL": "us.litecoinpool.org",
|
||||
"Best Share": 1.03726997,
|
||||
"Pool Rejected%": 0,
|
||||
"Pool Stale%": 0
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
|
||||
const net = require('net');
|
||||
const PORT = 4028;
|
||||
const HOST = 'localhost';
|
||||
|
||||
function getRandomArbitrary(min, max) {
|
||||
return Math.random() * (max - min) + min;
|
||||
}
|
||||
|
||||
function getRandomFloat(min, max) {
|
||||
return parseFloat(Math.random() * (max - min) + min);
|
||||
}
|
||||
|
||||
class Server {
|
||||
constructor(port, address) {
|
||||
this.port = port || PORT;
|
||||
@ -193,7 +203,7 @@ class Server {
|
||||
|
||||
sock.on('data', (data) => {
|
||||
console.log(`${clientName} Says: ${data}`);
|
||||
sock.write(JSON.stringify(sampleData));
|
||||
sock.write(JSON.stringify(getData()));
|
||||
// sock.write('exit');
|
||||
});
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
const path = require('path')
|
||||
const express = require('express')
|
||||
const config = require('config')
|
||||
const graphqlApp = require('./graphqlApp')
|
||||
const buildPath = path.join(__dirname, '../../apolloui/build');
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use('/graphql', graphqlApp)
|
||||
app.use('/api/graphql', graphqlApp)
|
||||
|
||||
if (process.env.NODE_ENV === 'production') app.use(express.static(buildPath));
|
||||
|
||||
module.exports = app
|
||||
|
Loading…
Reference in New Issue
Block a user