Skip to content

Commit

Permalink
NewRelease 1.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MinerGreggy committed Jan 28, 2022
1 parent 9c15b32 commit 6e3319a
Show file tree
Hide file tree
Showing 10 changed files with 310 additions and 237 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See https://help.github.com/articles/about-codeowners/ for more info

* @MinerGreggy
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@

name: Release-Build-Publish

on:
push
push:
tags:
- '**'

jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
node-version: [ 12.x ]
node-version: [ 16.x ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

runs-on: ${{ matrix.os }}
Expand All @@ -32,15 +33,54 @@ jobs:
name: release-archive-${{ matrix.os }}
path: build/*.zip

build-and-push-image:
if: "contains(github.event.head_commit.message, 'NewRelease')"
name: Build and push image
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

release-npm:
if: "contains(github.event.head_commit.message, 'NewRelease')"
runs-on: ubuntu-latest
needs: build
if: "contains(github.event.head_commit.message, 'NewRelease')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Publish To NPM
env:
Expand Down Expand Up @@ -73,7 +113,3 @@ jobs:
files: 'release-archive-*/*.zip'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ steps.is-published.outputs.version }}




3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ typings/
# next.js build output
.next

main.js

.idea

build
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

1.13.0 / 2022-01-22
==================

* Update dependencies.
* Increase sync interval.
* Remove unused fields from request bodies.

1.12.7 / 2021-11-06
==================

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:16-alpine

RUN apk update && apk add --no-cache bash
WORKDIR /app
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ skynet-dashboard-satellite
npm update -g skynet-dashboard-satellite
```

## Docker Image of satellite

Docker image are also available on ghcr.
Pull

```bash
docker pull ghcr.io/minergreggy/skynet-dashboard-satellite:latest
```

OR

Just add into the docker run or docker-compose

```bash
ghcr.io/minergreggy/skynet-dashboard-satellite:latest
```

## Donate

Forked From Felixbruckers Hard Work I CopyPasta Modded This All Hard Work Still Done By Felix His Address Are Below:
- BHD: 33fKEwAHxVwnrhisREFdSNmZkguo76a2ML
- BURST: BURST-BVUD-7VWE-HD7F-6RX4P
- ETH: 0xfEc6F48633A7c557b4ac5c37B4519C55CD701BEF
- BTC: 14rbdLr2YXDkguVaqRKnPftTPX52tnv2x2
Forked From Felixbruckers (foxypool) Hard Work I CopyPasta Modded This All Hard Work Still Done By Felix His Address Are Below:

- CHIA: xch1063ymlv3saaxkh87h287nc3laelnxss0897xdw6g8zj6yvaa4elslg0xfa
- PP: https://www.paypal.me/felixbrucker

## Changelog
Expand Down
53 changes: 24 additions & 29 deletions lib/service/stats-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ class StatsCollection {
this.updateStatsThrottled = throttle(async partialStats => {
this.partialStats = {};
await chiaDashboardUpdater.updateStats(partialStats);
}, 15 * 1000, { leading: true, trailing: true });
}, 30 * 1000, { leading: true, trailing: true });
allServices.forEach(service => {
this.stats.set(service, {});
this.isServiceRunning.set(service, false);
});
this.enabledServices = allServices;
this.partialStats[plotterService] = null;
this.walletIsLoggedIn = false;
this.farmingInfos = [];
}

async init() {
Expand All @@ -63,13 +64,12 @@ class StatsCollection {
const daemonAddress = config.chiaDaemonAddress || chiaConfig.daemonAddress;
const daemonSslCertFile = await chiaConfig.getDaemonSslCertFile();
const daemonSslKeyFile = await chiaConfig.getDaemonSslKeyFile();

this.connection = new Connection(daemonAddress, {
cert: daemonSslCertFile,
key: daemonSslKeyFile,
timeoutInSeconds: 20,
coin: 'skynet'
});

this.connection.addService(constants.SERVICE('skynet').walletUi);
this.connection.addService(`${this.connection.coin} plots create`); // Add the legacy plotter service to receive its events as well
this.connection.onError(err => logger.log({level: 'error', msg: `Stats Collection | ${err}`}));
Expand Down Expand Up @@ -110,11 +110,8 @@ class StatsCollection {
if (this.isServiceEnabled(farmerService)) {
this.farmerApiClient.onNewSignagePoint(async (newSignagePoint) => {
const farmerStats = this.stats.has(farmerService) ? this.stats.get(farmerService) : {};
if (!farmerStats.farmingInfos) {
farmerStats.farmingInfos = [];
}
const relevantSignagePointData = this.getRelevantSignagePointData(newSignagePoint);
let matchingFarmingInfo = farmerStats.farmingInfos.find(farmingInfo =>
let matchingFarmingInfo = this.farmingInfos.find(farmingInfo =>
farmingInfo.challenge === relevantSignagePointData.challenge && farmingInfo.signagePoint === relevantSignagePointData.signagePoint
);
let isNewlyCreated = false;
Expand All @@ -129,25 +126,23 @@ class StatsCollection {
matchingFarmingInfo.receivedAt = relevantSignagePointData.receivedAt;
matchingFarmingInfo.proofs = 0;
matchingFarmingInfo.passedFilter = 0;
matchingFarmingInfo.totalPlots = 0;
matchingFarmingInfo.lastUpdated = new Date();

if (isNewlyCreated) {
farmerStats.farmingInfos.unshift(matchingFarmingInfo);
this.farmingInfos.unshift(matchingFarmingInfo);
}
this.sortFarmingInfos(farmerStats.farmingInfos);
this.sortFarmingInfos(this.farmingInfos);

farmerStats.farmingInfos = this.getFarmingInfosForApi();

this.setStatsForServiceWithoutUpdate(farmerService, farmerStats);
});

let harvesterResponseTimes = [];
this.farmerApiClient.onNewFarmingInfo(async (newFarmingInfo) => {
const farmerStats = this.stats.has(farmerService) ? this.stats.get(farmerService) : {};
if (!farmerStats.farmingInfos) {
farmerStats.farmingInfos = [];
}
const relevantFarmingInfo = this.getRelevantFarmingInfoData(newFarmingInfo);
let matchingFarmingInfo = farmerStats.farmingInfos.find(farmingInfo =>
let matchingFarmingInfo = this.farmingInfos.find(farmingInfo =>
farmingInfo.challenge === relevantFarmingInfo.challenge && farmingInfo.signagePoint === relevantFarmingInfo.signagePoint
);
let isNewlyCreated = false;
Expand All @@ -159,18 +154,16 @@ class StatsCollection {
receivedAt: new Date(),
proofs: 0,
passedFilter: 0,
totalPlots: 0,
lastUpdated: new Date(),
};
farmerStats.farmingInfos.unshift(matchingFarmingInfo);
this.farmingInfos.unshift(matchingFarmingInfo);
}
matchingFarmingInfo.proofs += relevantFarmingInfo.proofs;
matchingFarmingInfo.passedFilter += relevantFarmingInfo.passedFilter;
matchingFarmingInfo.totalPlots += relevantFarmingInfo.totalPlots;
matchingFarmingInfo.lastUpdated = new Date();

farmerStats.farmingInfos = farmerStats.farmingInfos.slice(0, 20);
this.sortFarmingInfos(farmerStats.farmingInfos);
this.farmingInfos = this.farmingInfos.slice(0, 20);
this.sortFarmingInfos(this.farmingInfos);

if (!isNewlyCreated) {
harvesterResponseTimes.unshift(moment().diff(matchingFarmingInfo.receivedAt, 'milliseconds'));
Expand All @@ -188,14 +181,15 @@ class StatsCollection {
farmerStats.averageHarvesterResponseTime = null;
farmerStats.worstHarvesterResponseTime = null;
}
farmerStats.farmingInfos = this.getFarmingInfosForApi();

await this.setStatsForService(farmerService, farmerStats);
});
}
if (this.isServiceEnabled(plotterService)) {
const jobLogs = new Map();
this.plotterApiClient.onNewPlottingQueueStats(async queue => {
if (!queue) {
if (!queue) {
return;
}
const plotterStats = this.stats.has(plotterService) ? this.stats.get(plotterService) : {};
Expand Down Expand Up @@ -324,14 +318,21 @@ class StatsCollection {
this.updateStatsThrottled(this.partialStats);
}

getFarmingInfosForApi() {
return this.farmingInfos.map(farmingInfo => ({
proofs: farmingInfo.proofs,
passedFilter: farmingInfo.passedFilter,
receivedAt: farmingInfo.receivedAt,
lastUpdated: farmingInfo.lastUpdated,
}));
}

getRelevantFarmingInfoData(farmingInfo) {
return {
challenge: farmingInfo.challenge_hash,
signagePoint: farmingInfo.signage_point,
proofs: farmingInfo.proofs,
passedFilter: farmingInfo.passed_filter,
totalPlots: farmingInfo.total_plots,
plotScanCompletedAt: moment.unix(farmingInfo.timestamp).toDate(),
};
}

Expand Down Expand Up @@ -379,8 +380,6 @@ class StatsCollection {
name: wallet.name,
type: wallet.type,
balance: {
confirmed: ChiaAmount.fromRaw(balance.confirmed_wallet_balance).toString(),
spendable: ChiaAmount.fromRaw(balance.spendable_balance).toString(),
unconfirmed: ChiaAmount.fromRaw(balance.unconfirmed_wallet_balance).toString(),
},
};
Expand All @@ -394,10 +393,6 @@ class StatsCollection {
};
const farmedAmount = await this.walletApiClient.getFarmedAmount();
walletStats.farmedAmount = {
farmedAmount: ChiaAmount.fromRaw(farmedAmount.farmed_amount).toString(),
poolRewardAmount: ChiaAmount.fromRaw(farmedAmount.pool_reward_amount).toString(),
farmerRewardAmount: ChiaAmount.fromRaw(farmedAmount.farmer_reward_amount).toString(),
feeAmount: ChiaAmount.fromRaw(farmedAmount.fee_amount).toString(),
lastHeightFarmed: farmedAmount.last_height_farmed,
};
walletStats.fingerprint = await this.walletApiClient.getPublicKey();
Expand Down Expand Up @@ -512,4 +507,4 @@ class StatsCollection {
}
}

module.exports = new StatsCollection();
module.exports = new StatsCollection();
2 changes: 1 addition & 1 deletion index.js → main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const version = require('./lib/version');
await statsCollection.closeDaemonConnection();
process.exit();
});
})();
})();
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"name": "skynet-dashboard-satellite",
"version": "1.12.7",
"version": "1.13.2",
"repository": "https://github.com/MinerGreggy/skynet-dashboard-satellite.git",
"bugs": "https://github.com/MinerGreggy/skynet-dashboard-satellite/issues",
"license": "GPL-3.0",
"dependencies": {
"axios": "^0.21.1",
"bignumber.js": "^9.0.1",
"chia-api": "^3.0.0",
"axios": "^0.25.0",
"bignumber.js": "^9.0.2",
"chia-api": "^3.1.2",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"mkdirp": "^1.0.4",
"moment": "^2.29.1",
"prompts": "^2.4.1",
"prompts": "^2.4.2",
"uuid": "^8.3.2"
},
"devDependencies": {
"archiver": "^5.3.0",
"pkg": "^5.3.1"
"pkg": "^5.5.2"
},
"bin": {
"skynet-dashboard-satellite": "./index.js"
"skynet-dashboard-satellite": "./main.js"
},
"scripts": {
"start": "node index.js",
"start": "node main.js",
"package": "node bin/build-package.js"
},
"main": "index.js",
"main": "main.js",
"engines": {
"node": ">=12.0.0"
},
Expand Down
Loading

0 comments on commit 6e3319a

Please sign in to comment.