diff --git a/.gitignore b/.gitignore
index 40af839..1619c13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,3 +56,4 @@ fabric.properties
# modules.xml
# .idea/misc.xml
# *.ipr
+storage/clockwork/
diff --git a/README.md b/README.md
index ceb7f37..36625f5 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ 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.
-[](https://shields.io/) [](https://shields.io/) [](https://shields.io/) [](https://shields.io/)
+[](https://shields.io/) [](https://shields.io/) [](https://shields.io/) [](https://shields.io/)
@@ -19,25 +19,16 @@ GeekBench 5 scores to do easier comparing and sorting.
[Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation.
-## 2.1.0 changes:
+## 2.1.1 changes (19th June 2022):
-* Added Seedbox CRUD
-* Added dark mode (settings option. Bootstrap-Night https://vinorodrigues.github.io/bootstrap-dark-5/)
-* Added some foreign keys for certain tables
-* Added functions for IP and label assignments
-* Added functions to forget (clear) cache, preventing chunks of duplicate code
-* Added VMware to server virt select dropdown options
-* Added Kharkiv and Sao Paulo to locations seeder
-* Updated Controllers with DB calls and logic moved to relevant Model
-* Updated YABs inserts for version v2022-05-06
-* Updated DB calls to use caching
-* Updated Home blade info cards to be col-6 instead of 12 when on mobile
-* Updated home page view links on recently added
-* Fixed YABs insert error not displaying
+* Added compatability for YABs version v2022-06-11
+* Added Create, Update and Delete servers with API
+* Added Update pricing with API
+* Updated YABs compatible versions check
## Requires
-* PHP 8 (8.1 recommended)
+* PHP 8.1
## Features
@@ -162,6 +153,103 @@ All API requests must be appended with `api/` e.g `mydomain.com/api/servers/gYk8
`shared/{id}`
+**POST requests**
+
+Create a server
+
+`/servers`
+
+Body content template
+
+```json
+{
+"active": 1,
+"show_public": 0,
+"hostname": "test.domain.com",
+"ns1": "ns1",
+"ns2": "ns2",
+"server_type": 1,
+"os_id": 2,
+"provider_id": 10,
+"location_id": 15,
+"ssh_port": 22,
+"bandwidth": 2000,
+"ram": 2024,
+"ram_type": "MB",
+"ram_as_mb": 2024,
+"disk": 30,
+"disk_type": "GB",
+"disk_as_gb": 30,
+"cpu": 2,
+"has_yabs": 0,
+"was_promo": 1,
+"ip1": "127.0.0.1",
+"ip2": null,
+"owned_since": "2022-01-01",
+"currency": "USD",
+"price": 4.00,
+"payment_term": 1,
+"as_usd": 4.00,
+"usd_per_month": 4.00,
+"next_due_date": "2022-02-01"
+}
+```
+
+**PUT requests**
+
+Update a server
+
+`/servers/ID`
+
+Body content template
+
+```json
+{
+"active": 1,
+"show_public": 0,
+"hostname": "test.domain.com",
+"ns1": "ns1",
+"ns2": "ns2",
+"server_type": 1,
+"os_id": 2,
+"provider_id": 10,
+"location_id": 15,
+"ssh_port": 22,
+"bandwidth": 2000,
+"ram": 2024,
+"ram_type": "MB",
+"ram_as_mb": 2024,
+"disk": 30,
+"disk_type": "GB",
+"disk_as_gb": 30,
+"cpu": 2,
+"has_yabs": 0,
+"was_promo": 1,
+"owned_since": "2022-01-01"
+}
+```
+
+Update pricing
+
+`/pricing/ID`
+
+Body content template
+
+```json
+{
+ "price": 10.50,
+ "currency": "USD",
+ "term" : 1
+}
+```
+
+**DELETE requests**
+
+Delete a server
+
+`/servers/ID`
+
+
## Notes
**Public viewable listings**
diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php
index ced080c..53662a0 100644
--- a/app/Http/Controllers/ApiController.php
+++ b/app/Http/Controllers/ApiController.php
@@ -12,7 +12,10 @@ use App\Models\Server;
use App\Models\Shared;
use DataTables;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\Support\Str;
class ApiController extends Controller
{
@@ -23,7 +26,7 @@ class ApiController extends Controller
->join('providers as pr', 's.provider_id', '=', 'pr.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
- ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os'])->toJson(JSON_PRETTY_PRINT);
+ ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os'])->toJson(JSON_PRETTY_PRINT);
return response($servers, 200);
}
@@ -36,7 +39,7 @@ class ApiController extends Controller
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.id', '=', $id)
- ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os']);
+ ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os']);
$yabs = DB::table('yabs')
->where('yabs.server_id', '=', $id)
@@ -316,4 +319,216 @@ class ApiController extends Controller
return response(array('ip' => null), 200);
}
+ protected function storeServer(Request $request)
+ {
+ $rules = array(
+ 'hostname' => 'min:3',
+ 'server_type' => 'required|integer',
+ 'os_id' => 'required|integer',
+ 'provider_id' => 'required|integer',
+ 'location_id' => 'required|integer',
+ 'ssh_port' => 'required|integer',
+ 'ram' => 'required|integer',
+ 'ram_as_mb' => 'required|integer',
+ 'disk' => 'required|integer',
+ 'disk_as_gb' => 'required|integer',
+ 'cpu' => 'required|integer',
+ 'bandwidth' => 'required|integer',
+ 'was_promo' => 'required|integer',
+ 'active' => 'required|integer',
+ 'show_public' => 'required|integer',
+ 'ip1' => 'ip',
+ 'ip2' => 'ip',
+ 'owned_since' => 'required|date',
+ 'ram_type' => 'required|string|size:2',
+ 'disk_type' => 'required|string|size:2',
+ 'currency' => 'required|string|size:3',
+ 'price' => 'required|numeric',
+ 'payment_term' => 'required|integer',
+ 'next_due_date' => 'date',
+ );
+
+ $messages = array(
+ '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',
+ 'ip' => ':attribute must be a valid IP address',
+ 'date' => ':attribute must be a date Y-m-d',
+ );
+
+ $validator = Validator::make($request->all(), $rules, $messages);
+
+ if ($validator->fails()) {
+ return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
+ }
+
+ $server_id = Str::random(8);
+
+ $pricing = new Pricing();
+
+ $as_usd = $pricing->convertToUSD($request->price, $request->currency);
+
+ $pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+
+ if (!is_null($request->ip1)) {
+ IPs::insertIP($server_id, $request->ip1);
+ }
+
+ if (!is_null($request->ip2)) {
+ IPs::insertIP($server_id, $request->ip2);
+ }
+
+ $insert = Server::create([
+ 'id' => $server_id,
+ 'hostname' => $request->hostname,
+ 'server_type' => $request->server_type,
+ 'os_id' => $request->os_id,
+ 'ssh_port' => $request->ssh_port,
+ 'provider_id' => $request->provider_id,
+ 'location_id' => $request->location_id,
+ 'ram' => $request->ram,
+ 'ram_type' => $request->ram_type,
+ 'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
+ 'disk' => $request->disk,
+ 'disk_type' => $request->disk_type,
+ 'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
+ 'owned_since' => $request->owned_since,
+ 'ns1' => $request->ns1,
+ 'ns2' => $request->ns2,
+ 'bandwidth' => $request->bandwidth,
+ 'cpu' => $request->cpu,
+ 'was_promo' => $request->was_promo,
+ 'show_public' => (isset($request->show_public)) ? 1 : 0
+ ]);
+
+ Server::serverRelatedCacheForget();
+
+ if ($insert) {
+ return response()->json(array('result' => 'success', 'server_id' => $server_id), 200);
+ }
+
+ return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
+ }
+
+ public function destroyServer(Request $request)
+ {
+ $items = Server::find($request->id);
+
+ (!is_null($items)) ? $result = $items->delete() : $result = false;
+
+ $p = new Pricing();
+ $p->deletePricing($request->id);
+
+ Labels::deleteLabelsAssignedTo($request->id);
+ IPs::deleteIPsAssignedTo($request->id);
+ Server::serverRelatedCacheForget();
+
+ if ($result) {
+ return response()->json(array('result' => 'success'), 200);
+ }
+
+ return response()->json(array('result' => 'fail'), 500);
+ }
+
+ public function updateServer(Request $request)
+ {
+ $rules = array(
+ 'hostname' => 'string|min:3',
+ 'server_type' => 'integer',
+ 'os_id' => 'integer',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
+ 'ssh_port' => 'integer',
+ 'ram' => 'integer',
+ 'ram_as_mb' => 'integer',
+ 'disk' => 'integer',
+ 'disk_as_gb' => 'integer',
+ 'cpu' => 'integer',
+ 'bandwidth' => 'integer',
+ 'was_promo' => 'integer',
+ 'active' => 'integer',
+ 'show_public' => 'integer',
+ 'owned_since' => 'date',
+ 'ram_type' => 'string|size:2',
+ 'disk_type' => 'string|size:2',
+ 'currency' => 'string|size:3',
+ 'price' => 'numeric',
+ 'payment_term' => 'integer',
+ 'next_due_date' => 'date',
+ );
+
+ $messages = array(
+ '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);
+
+ if ($validator->fails()) {
+ return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
+ }
+
+ $server_update = Server::where('id', $request->id)->update(request()->all());
+
+ Server::serverRelatedCacheForget();
+ Server::serverSpecificCacheForget($request->id);
+
+ if ($server_update) {
+ return response()->json(array('result' => 'success', 'server_id' => $request->id), 200);
+ }
+
+ return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
+ }
+
+ public function updatePricing(Request $request)
+ {
+ $rules = array(
+ 'price' => 'required|numeric',
+ 'currency' => 'required|string|size:3',
+ 'term' => 'required|integer',
+ 'active' => 'integer',
+ 'next_due_date' => 'date',
+ );
+
+ $messages = array(
+ '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);
+
+ if ($validator->fails()) {
+ return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
+ }
+
+ $pricing = new Pricing();
+
+ $request->as_usd = $pricing->convertToUSD($request->price, $request->currency);
+
+ $request->usd_per_month = $pricing->costAsPerMonth($request->as_usd, $request->term);
+
+ $price_update = Pricing::where('id', $request->id)->update(request()->all());
+
+ Cache::forget("all_pricing");
+ Server::serverRelatedCacheForget();
+
+ if ($price_update) {
+ return response()->json(array('result' => 'success', 'server_id' => $request->id), 200);
+ }
+
+ return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
+ }
+
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index a1f0ce9..d5d5bfc 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -65,7 +65,8 @@ class HomeController extends Controller
'due_soon' => $due_soon,
'newest' => $recently_added,
'execution_time' => number_format($p->getTimeTaken(), 2),
- 'servers_summary' => $server_summary
+ 'servers_summary' => $server_summary,
+ 'currency' => Session::get('dashboard_currency')
);
return view('home', compact('information'));
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 6bc444c..c474492 100644
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -33,7 +33,8 @@ class SettingsController extends Controller
'default_currency' => 'required',
'default_server_os' => 'required',
'due_soon_amount' => 'required|integer|between:0,12',
- 'recently_added_amount' => 'required|integer|between:0,12'
+ 'recently_added_amount' => 'required|integer|between:0,12',
+ 'currency' => 'required|string|size:3'
]);
DB::table('settings')
@@ -51,13 +52,15 @@ class SettingsController extends Controller
'default_currency' => $request->default_currency,
'default_server_os' => $request->default_server_os,
'due_soon_amount' => $request->due_soon_amount,
- 'recently_added_amount' => $request->recently_added_amount
+ 'recently_added_amount' => $request->recently_added_amount,
+ 'dashboard_currency' => $request->currency,
]);
Settings::setSettingsToSession($settings);
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
+ Cache::forget('pricing_breakdown');//Main page pricing breakdown
Cache::forget('settings');//Main page settings cache
diff --git a/app/Models/Home.php b/app/Models/Home.php
index 30586ce..f530cf4 100644
--- a/app/Models/Home.php
+++ b/app/Models/Home.php
@@ -19,6 +19,8 @@ class Home extends Model
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_pricing');//All the pricing
+ Cache::forget('services_count_all');
+ Cache::forget('pricing_breakdown');
}
public static function servicesCount()
@@ -116,74 +118,83 @@ class Home extends Model
{
$pricing = json_decode($all_pricing, true);
- $total_cost_weekly = $total_cost_pm = $inactive_count = 0;
- foreach ($pricing as $price) {
- if ($price['active'] === 1) {
- if ($price['term'] === 1) {//1 month
- $total_cost_weekly += ($price['as_usd'] / 4);
- $total_cost_pm += $price['as_usd'];
- } elseif ($price['term'] === 2) {//3 months
- $total_cost_weekly += ($price['as_usd'] / 12);
- $total_cost_pm += ($price['as_usd'] / 3);
- } elseif ($price['term'] === 3) {// 6 month
- $total_cost_weekly += ($price['as_usd'] / 24);
- $total_cost_pm += ($price['as_usd'] / 6);
- } elseif ($price['term'] === 4) {// 1 year
- $total_cost_weekly += ($price['as_usd'] / 48);
- $total_cost_pm += ($price['as_usd'] / 12);
- } elseif ($price['term'] === 5) {//2 years
- $total_cost_weekly += ($price['as_usd'] / 96);
- $total_cost_pm += ($price['as_usd'] / 24);
- } elseif ($price['term'] === 6) {//3 years
- $total_cost_weekly += ($price['as_usd'] / 144);
- $total_cost_pm += ($price['as_usd'] / 36);
+ return Cache::remember('pricing_breakdown', now()->addWeek(1), function () use ($pricing) {
+ $total_cost_weekly = $total_cost_pm = $inactive_count = 0;
+ foreach ($pricing as $price) {
+ if ($price['active'] === 1) {
+ if (Session::get('dashboard_currency') !== 'USD') {
+ $the_price = Pricing::convertFromUSD($price['as_usd'], Session::get('dashboard_currency'));
+ } else {
+ $the_price = $price['as_usd'];
+ }
+ if ($price['term'] === 1) {//1 month
+ $total_cost_weekly += ($the_price / 4);
+ $total_cost_pm += $the_price;
+ } elseif ($price['term'] === 2) {//3 months
+ $total_cost_weekly += ($the_price / 12);
+ $total_cost_pm += ($the_price / 3);
+ } elseif ($price['term'] === 3) {// 6 month
+ $total_cost_weekly += ($the_price / 24);
+ $total_cost_pm += ($the_price / 6);
+ } elseif ($price['term'] === 4) {// 1 year
+ $total_cost_weekly += ($the_price / 48);
+ $total_cost_pm += ($the_price / 12);
+ } elseif ($price['term'] === 5) {//2 years
+ $total_cost_weekly += ($the_price / 96);
+ $total_cost_pm += ($the_price / 24);
+ } elseif ($price['term'] === 6) {//3 years
+ $total_cost_weekly += ($the_price / 144);
+ $total_cost_pm += ($the_price / 36);
+ }
+ } else {
+ $inactive_count++;
}
- } else {
- $inactive_count++;
}
- }
- $total_cost_yearly = ($total_cost_pm * 12);
+ $total_cost_yearly = ($total_cost_pm * 12);
- return array(
- 'total_cost_weekly' => $total_cost_weekly,
- 'total_cost_montly' => $total_cost_pm,
- 'total_cost_yearly' => $total_cost_yearly,
- 'inactive_count' => $inactive_count,
- );
+ return array(
+ 'total_cost_weekly' => $total_cost_weekly,
+ 'total_cost_montly' => $total_cost_pm,
+ 'total_cost_yearly' => $total_cost_yearly,
+ 'inactive_count' => $inactive_count,
+ );
+ });
}
public static function doServicesCount($services_count): array
{
- $servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
-
$services_count = json_decode($services_count, true);
- foreach ($services_count as $sc) {
- $total_services += $sc['amount'];
- if ($sc['service_type'] === 1) {
- $servers_count = $sc['amount'];
- } else if ($sc['service_type'] === 2) {
- $shared_count = $sc['amount'];
- } else if ($sc['service_type'] === 3) {
- $reseller_count = $sc['amount'];
- } else if ($sc['service_type'] === 4) {
- $domains_count = $sc['amount'];
- } else if ($sc['service_type'] === 5) {
- $other_count = $sc['amount'];
- } else if ($sc['service_type'] === 6) {
- $seedbox_count = $sc['amount'];
+ return Cache::remember('services_count_all', now()->addWeek(1), function () use ($services_count) {
+ $servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
+ foreach ($services_count as $sc) {
+ $total_services += $sc['amount'];
+ if ($sc['service_type'] === 1) {
+ $servers_count = $sc['amount'];
+ } else if ($sc['service_type'] === 2) {
+ $shared_count = $sc['amount'];
+ } else if ($sc['service_type'] === 3) {
+ $reseller_count = $sc['amount'];
+ } else if ($sc['service_type'] === 4) {
+ $domains_count = $sc['amount'];
+ } else if ($sc['service_type'] === 5) {
+ $other_count = $sc['amount'];
+ } else if ($sc['service_type'] === 6) {
+ $seedbox_count = $sc['amount'];
+ }
}
- }
- return array(
- 'servers' => $servers_count,
- 'shared' => $shared_count,
- 'reseller' => $reseller_count,
- 'domains' => $domains_count,
- 'other' => $other_count,
- 'seedbox' => $seedbox_count,
- 'total' => $total_services
- );
+ return array(
+ 'servers' => $servers_count,
+ 'shared' => $shared_count,
+ 'reseller' => $reseller_count,
+ 'domains' => $domains_count,
+ 'other' => $other_count,
+ 'seedbox' => $seedbox_count,
+ 'total' => $total_services
+ );
+ });
+
}
diff --git a/app/Models/Pricing.php b/app/Models/Pricing.php
index e021362..0a99d9c 100644
--- a/app/Models/Pricing.php
+++ b/app/Models/Pricing.php
@@ -14,6 +14,27 @@ class Pricing extends Model
protected $fillable = ['service_id', 'service_type', 'currency', 'price', 'term', 'as_usd', 'usd_per_month', 'next_due_date'];
+ public static function convertFromUSD(string $amount, string $convert_to): float
+ {//Code rates update from an API??
+ if ($convert_to === 'AUD') {
+ return (1.39 * $amount);
+ } elseif ($convert_to === "USD") {
+ return $amount;
+ } elseif ($convert_to === "GBP") {
+ return (0.79 * $amount);
+ } elseif ($convert_to === "EUR") {
+ return (0.93 * $amount);
+ } elseif ($convert_to === "NZD") {
+ return (1.53 * $amount);
+ } elseif ($convert_to === "JPY") {
+ return (127.12 * $amount);
+ } elseif ($convert_to === "CAD") {
+ return (1.27 * $amount);
+ } else {
+ return $amount;
+ }
+ }
+
public function convertToUSD(string $amount, string $convert_from): float
{
if ($convert_from === 'AUD') {
diff --git a/app/Models/Server.php b/app/Models/Server.php
index d807bd5..4e4bc11 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -164,6 +164,8 @@ class Server extends Model
Cache::forget('servers_summary');//servers summary cache
Cache::forget('public_server_data');//public servers
Cache::forget('all_pricing');//All pricing
+ Cache::forget('services_count_all');
+ Cache::forget('pricing_breakdown');
}
public static function serverSpecificCacheForget(string $server_id): void
diff --git a/app/Models/Settings.php b/app/Models/Settings.php
index 1f584b4..300f66b 100644
--- a/app/Models/Settings.php
+++ b/app/Models/Settings.php
@@ -18,7 +18,7 @@ class Settings extends Model
public static function getSettings()
{
- return Cache::remember('settings', now()->addMinute(1), function () {
+ return Cache::remember('settings', now()->addWeek(1), function () {
return DB::table('settings')
->where('id', '=', 1)
->get();
@@ -40,6 +40,7 @@ class Settings extends Model
Session::put('default_server_os', $settings[0]->default_server_os ?? 1);
Session::put('due_soon_amount', $settings[0]->due_soon_amount ?? 6);
Session::put('recently_added_amount', $settings[0]->recently_added_amount ?? 6);
+ Session::put('dashboard_currency', $settings[0]->dashboard_currency ?? 'USD');
Session::save();
}
diff --git a/app/Process.php b/app/Process.php
index c0b6706..9b040e5 100644
--- a/app/Process.php
+++ b/app/Process.php
@@ -171,6 +171,8 @@ class Process
{
$file_name = 'tempYabs.txt';
+ $allowed_versions = ['v2021-12-28', 'v2022-02-18', 'v2022-04-30', 'v2022-05-06', 'v2022-06-11'];
+
Storage::disk('local')->put($file_name, $data_from_form);
$file = Storage::disk('local')->get($file_name);
@@ -192,8 +194,8 @@ class Process
}
$version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2])));
- if ($version_array[1] === 'v2021-12-28' || $version_array[1] === 'v2022-02-18' || $version_array[1] === 'v2022-04-30' || $version_array[1] === 'v2022-05-06') {//YABs version
- if ($version_array[1] === 'v2022-05-06') {
+ if (in_array($version_array[1], $allowed_versions, true)) {//YABs version is allowed
+ if ($version_array[1] === 'v2022-05-06' || $version_array[1] === 'v2022-06-11') {//These versions added in more responses
$cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[11], ': ')));
$cpu_spec = explode(' ', strstr($array[12], ': '));//: 2 @ 3792.872 MHz
$ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': ')));
@@ -250,7 +252,7 @@ class Process
);
if (isset($array[40])) {
- if ($version_array[1] === 'v2022-05-06') {
+ if ($version_array[1] === 'v2022-05-06' || $version_array[1] === 'v2022-06-11') {
if ($array[43] === "Geekbench 5 Benchmark Test:\r") {
//No ipv6
//Has short ipv4 network speed testing (-r)
diff --git a/database/migrations/2022_05_29_105255_add_dash_currency_setting.php b/database/migrations/2022_05_29_105255_add_dash_currency_setting.php
new file mode 100644
index 0000000..866a498
--- /dev/null
+++ b/database/migrations/2022_05_29_105255_add_dash_currency_setting.php
@@ -0,0 +1,19 @@
+char('dashboard_currency', 3)->default('USD');
+ });
+ }
+
+ public function down()
+ {
+ }
+}
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index 5f21cf3..a772331 100644
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -71,7 +71,7 @@
Weekly cost
Monthly cost
Yearly cost
2 yearly cost
Only if show_servers_public is YES do these apply:
+Only if Show servers to public is YES do these apply: