Clean up Api call
This commit is contained in:
@@ -23,31 +23,7 @@ class WrenchApi extends BaseController
|
||||
return view('welcome_message',$data);
|
||||
}
|
||||
|
||||
public function apigate(){
|
||||
/*
|
||||
//$request = service('request');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
|
||||
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
|
||||
//header('Access-Control-Allow-Credentials: true ');
|
||||
//header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
|
||||
header('Content-type: application/json');
|
||||
*/
|
||||
// what is the endpoint
|
||||
$uri = urldecode(current_url(true));
|
||||
$findme = '?';
|
||||
$pos = strpos($uri, $findme);
|
||||
if ($pos > 5) {
|
||||
$uri = substr($uri, 0, $pos);
|
||||
}
|
||||
log_message('critical', "API-GATE URI -> ".$uri );
|
||||
|
||||
$pieces = explode('/', $uri);
|
||||
$psc = count($pieces);
|
||||
|
||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||
log_message('critical', "Enpoint-> ".$endpoint );
|
||||
private function endPointList(){
|
||||
|
||||
$endpoints = [
|
||||
'apigate' => ['POST'],
|
||||
@@ -89,6 +65,35 @@ class WrenchApi extends BaseController
|
||||
'disableaccount' => ['POST'],
|
||||
'myjobs' => ['POST']
|
||||
];
|
||||
return $endpoints;
|
||||
}
|
||||
public function apigate(){
|
||||
/*
|
||||
//$request = service('request');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
|
||||
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
|
||||
//header('Access-Control-Allow-Credentials: true ');
|
||||
//header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
|
||||
header('Content-type: application/json');
|
||||
*/
|
||||
// what is the endpoint
|
||||
$uri = urldecode(current_url(true));
|
||||
$findme = '?';
|
||||
$pos = strpos($uri, $findme);
|
||||
if ($pos > 5) {
|
||||
$uri = substr($uri, 0, $pos);
|
||||
}
|
||||
log_message('critical', "API-GATE URI -> ".$uri );
|
||||
|
||||
$pieces = explode('/', $uri);
|
||||
$psc = count($pieces);
|
||||
|
||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||
log_message('critical', "Enpoint-> ".$endpoint );
|
||||
|
||||
$endpoints = $this->endPointList();
|
||||
|
||||
$res1 = [];
|
||||
if (array_key_exists($endpoint, $endpoints)) {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"source": "https://github.com/bcit-ci/CodeIgniter"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"facebook/graph-sdk" : "^5.7",
|
||||
"firebase/php-jwt": "^6.2",
|
||||
"phpseclib/phpseclib": "^3.0",
|
||||
|
||||
Reference in New Issue
Block a user