Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions MySpeed/MySpeed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace App\SupportedApps\MySpeed;

class MySpeed extends \App\SupportedApps implements \App\EnhancedApps
{
public $config;

public function __construct() {

}

public function test()
{
$test = parent::appTest($this->url('api/info/version'));
echo $test->status;
}

public function livestats()
{
$status = 'inactive';
$res = parent::execute($this->url('api/speedtests/statistics'));
$details = json_decode($res->getBody());

$data = [];

if ($details) {
$status = 'active';
$data = [
'avg_down' => floor($details->download->avg),
'avg_up' => floor($details->upload->avg)

];
}

return parent::getLiveStats($status, $data);
}

public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
return $api_url;
}
}
10 changes: 10 additions & 0 deletions MySpeed/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appid": "ac2f9c8aee6a960204b0fb387d33185679217db2",
"name": "MySpeed",
"website": "https://myspeed.dev",
"license": "MIT License",
"description": "MySpeed is a speed test analysis software that records your internet speed for up to 30 days.",
"enhanced": true,
"tile_background": "dark",
"icon": "myspeed.png"
}
11 changes: 11 additions & 0 deletions MySpeed/config.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
<div class="items">
<div class="input">
<label>{{ strtoupper(__('app.url')) }}</label>
{!! Form::text('config[override_url]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
</div>
<div class="input">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div>

10 changes: 10 additions & 0 deletions MySpeed/livestats.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ul class="livestats">
<li>
<span class="title">Down</span>
<strong>{!! $avg_down . 'Mbps' !!}</strong>
</li>
<li>
<span class="title">Up</span>
<strong>{!! $avg_up . 'Mbps' !!}</strong>
</li>
</ul>
Binary file added MySpeed/myspeed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading