diff --git a/CashPilot/CashPilot.php b/CashPilot/CashPilot.php new file mode 100644 index 0000000000..7f61b660f2 --- /dev/null +++ b/CashPilot/CashPilot.php @@ -0,0 +1,58 @@ +url('api/earnings/summary'), $this->attrs()); + echo $test->status; + } + + public function livestats() + { + $status = 'inactive'; + $data = []; + + $res = parent::execute($this->url('api/earnings/summary'), $this->attrs()); + $details = json_decode($res->getBody()); + + if ($details) { + $status = 'active'; + + // CashPilot separates "nothing has been read yet" from "read, and it + // is zero". has_readings is false on a fresh install and on one whose + // collection has stopped, so a figure there would state a + // measurement that was never taken. + $data['earnings'] = (isset($details->has_readings) && $details->has_readings) + ? '$' . number_format((float) ($details->total_adjusted ?? 0), 2) + : '—'; + + // active_services is null when the count could not be taken. Showing + // 0 would read as "nothing is running" while containers are running. + $data['running'] = (isset($details->active_services) && $details->active_services !== null) + ? $details->active_services + : '—'; + } + + return parent::getLiveStats($status, $data); + } + + public function url($endpoint) + { + return parent::normaliseurl($this->config->url) . $endpoint; + } + + public function attrs() + { + return [ + 'headers' => [ + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . $this->config->access_token, + ], + ]; + } +} diff --git a/CashPilot/app.json b/CashPilot/app.json new file mode 100644 index 0000000000..b439e74f2b --- /dev/null +++ b/CashPilot/app.json @@ -0,0 +1,10 @@ +{ + "appid": "5b7c085bf60518c8e7261473688a98200e60847b", + "name": "CashPilot", + "website": "https://github.com/GeiserX/CashPilot", + "license": "GNU General Public License v3.0 only", + "description": "Self-hosted passive income orchestrator. Deploy, manage and monitor bandwidth-sharing, DePIN, storage and GPU compute containers from a single web dashboard, with earnings tracked across 49 services.", + "enhanced": true, + "tile_background": "dark", + "icon": "cashpilot.svg" +} diff --git a/CashPilot/cashpilot.svg b/CashPilot/cashpilot.svg new file mode 100644 index 0000000000..17a7bb7967 --- /dev/null +++ b/CashPilot/cashpilot.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CashPilot/config.blade.php b/CashPilot/config.blade.php new file mode 100644 index 0000000000..4f5a6c9c70 --- /dev/null +++ b/CashPilot/config.blade.php @@ -0,0 +1,14 @@ +

{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')

+
+
+ + {!! Form::text('config[override_url]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!} +
+
+ + {!! Form::text('config[access_token]', null, array('placeholder' => __('app.apps.apikey'), 'data-config' => 'access_token', 'class' => 'form-control config-item')) !!} +
+
+ +
+
diff --git a/CashPilot/livestats.blade.php b/CashPilot/livestats.blade.php new file mode 100644 index 0000000000..e1f2f0488a --- /dev/null +++ b/CashPilot/livestats.blade.php @@ -0,0 +1,10 @@ +