Skip to content

Commit

Permalink
Merge pull request #98 from cp6/main
Browse files Browse the repository at this point in the history
Dev up to Main
  • Loading branch information
cp6 authored Sep 19, 2023
2 parents 6f8d8ce + d4b75b2 commit 95c77a5
Show file tree
Hide file tree
Showing 86 changed files with 92,325 additions and 27,153 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,4 @@ fabric.properties
# .idea/misc.xml
# *.ipr
storage/clockwork/
#public/css/
#public/js/
#public/fonts/
#public/webfonts/
!public/
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,34 @@ Despite what the name infers this self hosted web app isn't just for storing idl
a [YABS](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with
GeekBench 5 scores to do easier comparing and sorting.

[![Generic badge](https://img.shields.io/badge/version-2.1.9-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/)
[![Generic badge](https://img.shields.io/badge/version-2.3.1-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-10.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.2-pink.svg)](https://shields.io/)

<img src="https://raw.githubusercontent.com/cp6/my-idlers/main/public/My%20Idlers%20logo.jpg" width="128" height="128" />

[Demo site](https://demo.myidlers.com/)
[View demo site](https://demo.myidlers.com/)

**Note:** Create, Update and Delete are disabled on demo site.

## Project sponsor

Currently seeking a project sponsor

## 2.1.9 changes (2nd December 2022):
## 2.3.1 changes (17th August 2023):

* Updated resource files
* Updated composer.json
* Updated packages.json
* Fixed dashboard price summary including non active services

#### Please run the following if updating from existing install:

```shell
composer update
php artisan migrate
php artisan route:cache
php artisan cache:clear
```

* Added & implemented NPM webpack
* Added compiled assets
* Added notes (Servers, shared, reseller, domains, DNS and IPs)
* Fixed create views default provider is no longer the former sponsor

## Requires

* PHP 8.1
Expand Down Expand Up @@ -76,6 +77,7 @@ If you already have at least version 2.0 installed:

* Run `git clone https://github.com/cp6/my-idlers.git`
* Run `composer install`
* Run `composer update`
* Run `php artisan migrate`
* Run `php artisan route:cache`
* Run `php artisan cache:clear`
Expand Down Expand Up @@ -112,6 +114,10 @@ Example yabs.sh call to POST the result:

`curl -sL yabs.sh | bash -s -- -s "https://yourdomain.com/api/yabs/SERVERID/USERAPIKEYISHERE"`

## TODO

Add Geekbench 6 single and multi-core scores

## API endpoints

For GET requests the header must have `Accept: application/json` and your API token (found at `/account`)
Expand Down
40 changes: 19 additions & 21 deletions app/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Controllers;

use App\Models\DiskSpeed;
use App\Models\Domains;
use App\Models\IPs;
use App\Models\Labels;
Expand All @@ -17,7 +16,6 @@
use App\Models\Shared;
use App\Models\User;
use App\Models\Yabs;
use App\Process;
use DataTables;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
Expand Down Expand Up @@ -60,7 +58,7 @@ protected function getAllNetworkSpeeds()

protected function getNetworkSpeeds($id)
{
$ns = NetworkSpeed::where('server_id', '=', $id)
$ns = NetworkSpeed::where('server_id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($ns, 200);
}
Expand All @@ -73,7 +71,7 @@ protected function getAllLabels()

protected function getLabel($id)
{
$label = Labels::where('id', '=', $id)
$label = Labels::where('id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($label, 200);
}
Expand Down Expand Up @@ -148,7 +146,7 @@ protected function getAllDns()
protected function getDns($id)
{
$dns = DB::table('d_n_s')
->where('id', '=', $id)
->where('id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($dns, 200);
}
Expand All @@ -163,7 +161,7 @@ protected function getAllLocations()
protected function getLocation($id)
{
$location = DB::table('locations')
->where('id', '=', $id)
->where('id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($location, 200);
}
Expand All @@ -178,7 +176,7 @@ protected function getAllProviders()
protected function getProvider($id)
{
$providers = DB::table('providers')
->where('id', '=', $id)
->where('id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($providers, 200);
}
Expand All @@ -199,7 +197,7 @@ protected function getAllOs()
protected function getOs($id)
{
$os = DB::table('os as o')
->where('o.id', '=', $id)
->where('o.id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($os, 200);
}
Expand All @@ -213,7 +211,7 @@ protected function getAllIPs()
protected function getIP($id)
{
$ip = DB::table('ips as i')
->where('i.id', '=', $id)
->where('i.id', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($ip, 200);
}
Expand Down Expand Up @@ -264,7 +262,7 @@ protected function getIpForDomain(string $domainname, string $type)

protected function storeServer(Request $request)
{
$rules = array(
$rules = [
'hostname' => 'min:3',
'server_type' => 'required|integer',
'os_id' => 'required|integer',
Expand All @@ -289,9 +287,9 @@ protected function storeServer(Request $request)
'price' => 'required|numeric',
'payment_term' => 'required|integer',
'next_due_date' => 'date',
);
];

$messages = array(
$messages = [
'required' => ':attribute is required',
'min' => ':attribute must be longer than 3',
'integer' => ':attribute must be an integer',
Expand All @@ -300,7 +298,7 @@ protected function storeServer(Request $request)
'numeric' => ':attribute must be a float',
'ip' => ':attribute must be a valid IP address',
'date' => ':attribute must be a date Y-m-d',
);
];

$validator = Validator::make($request->all(), $rules, $messages);

Expand Down Expand Up @@ -375,7 +373,7 @@ public function destroyServer(Request $request)

public function updateServer(Request $request)
{
$rules = array(
$rules = [
'hostname' => 'string|min:3',
'server_type' => 'integer',
'os_id' => 'integer',
Expand All @@ -398,17 +396,17 @@ public function updateServer(Request $request)
'price' => 'numeric',
'payment_term' => 'integer',
'next_due_date' => 'date',
);
];

$messages = array(
$messages = [
'required' => ':attribute is required',
'min' => ':attribute must be longer than 3',
'integer' => ':attribute must be an integer',
'string' => ':attribute must be a string',
'size' => ':attribute must be exactly :size characters',
'numeric' => ':attribute must be a float',
'date' => ':attribute must be a date Y-m-d',
);
];

$validator = Validator::make($request->all(), $rules, $messages);

Expand All @@ -430,22 +428,22 @@ public function updateServer(Request $request)

public function updatePricing(Request $request)
{
$rules = array(
$rules = [
'price' => 'required|numeric',
'currency' => 'required|string|size:3',
'term' => 'required|integer',
'active' => 'integer',
'next_due_date' => 'date',
);
];

$messages = array(
$messages = [
'required' => ':attribute is required',
'integer' => ':attribute must be an integer',
'string' => ':attribute must be a string',
'size' => ':attribute must be exactly :size characters',
'numeric' => ':attribute must be a float',
'date' => ':attribute must be a date Y-m-d',
);
];

$validator = Validator::make($request->all(), $rules, $messages);

Expand Down
13 changes: 6 additions & 7 deletions app/Http/Controllers/DNSController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use App\Models\Server;
use App\Models\Domains;
use App\Models\Shared;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
Expand Down Expand Up @@ -69,8 +68,8 @@ public function show(DNS $dn)
$dns = DNS::findOrFail($dn->id);

$labels = DB::table('labels_assigned as l')
->join('labels', 'l.label_id', '=', 'labels.id')
->where('l.service_id', '=', $dn->id)
->join('labels', 'l.label_id', 'labels.id')
->where('l.service_id', $dn->id)
->get(['labels.label']);

return view('dns.show', compact(['dn', 'dns', 'labels']));
Expand All @@ -84,14 +83,14 @@ public function edit(DNS $dn)
$Resellers = Reseller::all();
$dn = DNS::findOrFail($dn->id);
$labels = DB::table('labels_assigned as l')
->join('labels', 'l.label_id', '=', 'labels.id')
->where('l.service_id', '=', $dn->id)
->join('labels', 'l.label_id', 'labels.id')
->where('l.service_id', $dn->id)
->get(['labels.id']);

return view('dns.edit', compact(['dn', 'labels', 'Servers', 'Domains', 'Shareds', 'Resellers']));
}

public function update(Request $request, DNS $dn)
public function update(Request $request, DNS $dn): \Illuminate\Http\RedirectResponse
{
$request->validate([
'hostname' => 'required|string|min:2',
Expand Down Expand Up @@ -121,7 +120,7 @@ public function update(Request $request, DNS $dn)
->with('success', 'DNS updated Successfully.');
}

public function destroy(DNS $dn)
public function destroy(DNS $dn): \Illuminate\Http\RedirectResponse
{
if ( $dn->delete()){
Cache::forget('dns_count');
Expand Down
9 changes: 3 additions & 6 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use App\Models\Labels;
use App\Models\Pricing;
use App\Models\Settings;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use App\Process;
use Illuminate\Support\Facades\Session;

Expand Down Expand Up @@ -47,7 +44,7 @@ public function index()

$p->stopTimer();

$information = array(
$information = [
'servers' => $service_count['servers'],
'domains' => $service_count['domains'],
'shared' => $service_count['shared'],
Expand All @@ -59,15 +56,15 @@ public function index()
'total_services' => $service_count['total'],
'total_inactive' => $pricing_breakdown['inactive_count'],
'total_cost_weekly' => number_format($pricing_breakdown['total_cost_weekly'], 2),
'total_cost_monthly' => number_format($pricing_breakdown['total_cost_montly'], 2),
'total_cost_monthly' => number_format($pricing_breakdown['total_cost_monthly'], 2),
'total_cost_yearly' => number_format($pricing_breakdown['total_cost_yearly'], 2),
'total_cost_2_yearly' => number_format(($pricing_breakdown['total_cost_yearly'] * 2), 2),
'due_soon' => $due_soon,
'newest' => $recently_added,
'execution_time' => number_format($p->getTimeTaken(), 2),
'servers_summary' => $server_summary,
'currency' => Session::get('dashboard_currency')
);
];

return view('home', compact('information'));
}
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Controllers/IPsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace App\Http\Controllers;

use App\Models\DNS;
use App\Models\IPs;
use App\Models\Reseller;
use App\Models\SeedBoxes;
use App\Models\Server;
use App\Models\Shared;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class IPsController extends Controller
Expand Down
17 changes: 6 additions & 11 deletions app/Http/Controllers/LabelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,17 @@ public function store(Request $request)
public function show(Labels $label)
{
$labels = DB::table('labels_assigned as las')
->leftJoin('pricings as p', 'las.service_id', '=', 'p.service_id')
->leftJoin('servers as s', 'las.service_id', '=', 's.id')
->leftJoin('shared_hosting as sh', 'las.service_id', '=', 'sh.id')
->leftJoin('reseller_hosting as r', 'las.service_id', '=', 'r.id')
->leftJoin('domains as d', 'las.service_id', '=', 'd.id')
->where('las.label_id', '=', $label->id)
->leftJoin('pricings as p', 'las.service_id', 'p.service_id')
->leftJoin('servers as s', 'las.service_id', 's.id')
->leftJoin('shared_hosting as sh', 'las.service_id', 'sh.id')
->leftJoin('reseller_hosting as r', 'las.service_id', 'r.id')
->leftJoin('domains as d', 'las.service_id', 'd.id')
->where('las.label_id', $label->id)
->get(['p.service_type', 'p.service_id', 's.hostname', 'sh.main_domain as shared', 'r.main_domain as reseller', 'd.domain', 'd.extension']);

return view('labels.show', compact(['label', 'labels']));
}

public function edit(Labels $label)
{
abort(404);
}

public function destroy(Labels $label)
{
if ($label->delete()) {
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ public function store(Request $request)
public function show(Locations $location)
{
$servers = DB::table('servers as s')
->where('s.location_id', '=', $location->id)
->where('s.location_id', $location->id)
->get(['s.id', 's.hostname'])
->toArray();

$shared = DB::table('shared_hosting as s')
->where('s.location_id', '=', $location->id)
->where('s.location_id', $location->id)
->get(['s.id', 's.main_domain as main_domain_shared'])
->toArray();

$reseller = DB::table('reseller_hosting as r')
->where('r.location_id', '=', $location->id)
->where('r.location_id', $location->id)
->get(['r.id', 'r.main_domain as main_domain_reseller'])
->toArray();

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/MiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Models\Pricing;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class MiscController extends Controller
Expand Down
Loading

0 comments on commit 95c77a5

Please sign in to comment.