fixed api token
This commit is contained in:
parent
d67b5e7746
commit
dfac921e97
@ -57,4 +57,18 @@ class Controller extends BaseController
|
||||
|
||||
return $counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for api token and redirect if empty.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function checkApiToken()
|
||||
{
|
||||
if (setting('general.api_token')) {
|
||||
return;
|
||||
}
|
||||
|
||||
redirect('apps/token/create')->send();
|
||||
}
|
||||
}
|
||||
|
@ -10,20 +10,6 @@ class Home extends Controller
|
||||
{
|
||||
use Modules;
|
||||
|
||||
/**
|
||||
* Instantiate a new controller instance.
|
||||
*
|
||||
* @param Route $route
|
||||
*/
|
||||
public function __construct(Route $route)
|
||||
{
|
||||
if (!setting('general.api_token')) {
|
||||
return redirect('apps/token/create')->send();
|
||||
}
|
||||
|
||||
parent::__construct($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@ -31,6 +17,8 @@ class Home extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$paid = $this->getPaidModules();
|
||||
$new = $this->getNewModules();
|
||||
$free = $this->getFreeModules();
|
||||
|
@ -15,20 +15,6 @@ class Item extends Controller
|
||||
{
|
||||
use Modules;
|
||||
|
||||
/**
|
||||
* Instantiate a new controller instance.
|
||||
*
|
||||
* @param Route $route
|
||||
*/
|
||||
public function __construct(Route $route)
|
||||
{
|
||||
if (!setting('general.api_token')) {
|
||||
return redirect('apps/token/create')->send();
|
||||
}
|
||||
|
||||
parent::__construct($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
@ -38,6 +24,8 @@ class Item extends Controller
|
||||
*/
|
||||
public function show($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$installed = false;
|
||||
$enable = false;
|
||||
|
||||
@ -59,12 +47,14 @@ class Item extends Controller
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @param $path
|
||||
* @param $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function steps(Request $request)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$json = array();
|
||||
$json['step'] = array();
|
||||
|
||||
@ -95,12 +85,14 @@ class Item extends Controller
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @param $path
|
||||
* @param $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function download(Request $request)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$path = $request['path'];
|
||||
|
||||
$version = $request['version'];
|
||||
@ -115,12 +107,14 @@ class Item extends Controller
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @param $path
|
||||
* @param $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function unzip(Request $request)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$path = $request['path'];
|
||||
|
||||
$json = $this->unzipModule($path);
|
||||
@ -137,6 +131,8 @@ class Item extends Controller
|
||||
*/
|
||||
public function install(Request $request)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$path = $request['path'];
|
||||
|
||||
$json = $this->installModule($path);
|
||||
@ -154,6 +150,8 @@ class Item extends Controller
|
||||
|
||||
public function uninstall($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$json = $this->uninstallModule($alias);
|
||||
|
||||
$module = Module::where('alias', $alias)->first();
|
||||
@ -179,6 +177,8 @@ class Item extends Controller
|
||||
|
||||
public function update($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$json = $this->updateModule($alias);
|
||||
|
||||
$module = Module::where('alias', $alias)->first();
|
||||
@ -202,6 +202,8 @@ class Item extends Controller
|
||||
|
||||
public function enable($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$json = $this->enableModule($alias);
|
||||
|
||||
$module = Module::where('alias', $alias)->first();
|
||||
@ -229,6 +231,8 @@ class Item extends Controller
|
||||
|
||||
public function disable($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$json = $this->disableModule($alias);
|
||||
|
||||
$module = Module::where('alias', $alias)->first();
|
||||
|
@ -10,20 +10,6 @@ class Tiles extends Controller
|
||||
{
|
||||
use Modules;
|
||||
|
||||
/**
|
||||
* Instantiate a new controller instance.
|
||||
*
|
||||
* @param Route $route
|
||||
*/
|
||||
public function __construct(Route $route)
|
||||
{
|
||||
if (!setting('general.api_token')) {
|
||||
return redirect('apps/token/create')->send();
|
||||
}
|
||||
|
||||
parent::__construct($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
@ -33,6 +19,8 @@ class Tiles extends Controller
|
||||
*/
|
||||
public function category($alias)
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$data = $this->getModulesByCategory($alias);
|
||||
|
||||
$title = $data->category->name;
|
||||
@ -48,6 +36,8 @@ class Tiles extends Controller
|
||||
*/
|
||||
public function paid()
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$title = trans('modules.top_paid');
|
||||
$modules = $this->getPaidModules();
|
||||
|
||||
@ -61,6 +51,8 @@ class Tiles extends Controller
|
||||
*/
|
||||
public function new()
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$title = trans('modules.new');
|
||||
$modules = $this->getNewModules();
|
||||
|
||||
@ -74,6 +66,8 @@ class Tiles extends Controller
|
||||
*/
|
||||
public function free()
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$title = trans('modules.top_free');
|
||||
$modules = $this->getFreeModules();
|
||||
|
||||
|
@ -23,6 +23,7 @@ class LoadSettings
|
||||
|
||||
// Set the active company settings
|
||||
setting()->setExtraColumns(['company_id' => $company_id]);
|
||||
setting()->load(true);
|
||||
|
||||
// Timezone
|
||||
config(['app.timezone' => setting('general.timezone', 'UTC')]);
|
||||
|
@ -25,8 +25,12 @@ class Modules
|
||||
return collect($this->getCategories())->pluck('name', 'slug')
|
||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
|
||||
});
|
||||
|
||||
$view->with(['categories' => $categories]);
|
||||
} else {
|
||||
$categories = collect([
|
||||
'' => trans('general.all_type', ['type' => trans_choice('general.categories', 2)]),
|
||||
]);
|
||||
}
|
||||
|
||||
$view->with(['categories' => $categories]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user