This commit is contained in:
Exodus4D
2016-06-12 16:58:05 +02:00
parent 2a73bb3018
commit 184e0518c1
5 changed files with 73 additions and 44 deletions

View File

@@ -478,7 +478,7 @@ class Sso extends Api\User{
*/
protected function getEndpoints($accessToken = '', $additionalOptions = []){
$crestUrl = self::getCrestEndpoint();
$additionalOptions['accept'] = 'application/vnd.ccp.eve.Api-v3+json';
$additionalOptions['accept'] = 'application/vnd.ccp.eve.Api-v5+json';
$endpoint = $this->getEndpoint($crestUrl, $accessToken, $additionalOptions);
return $endpoint;
@@ -677,48 +677,63 @@ class Sso extends Api\User{
$waypointData = [];
if( $crestUrlParts ){
$endpointUrl = self::getCrestEndpoint() . '/characters/' . $character->_id . '/navigation/waypoints/';
$systemEndpoint = self::getCrestEndpoint() . '/solarsystems/' . $systemId . '/';
$accessToken = $character->getAccessToken();
$endpoints = $this->getEndpoints($accessToken);
// request body
$content = [
'clearOtherWaypoints' => (bool)$options['clearOtherWaypoints'],
'first' => (bool)$options['first'],
'solarSystem' => [
'href' => $systemEndpoint,
'id' => (int)$systemId
]
];
// get endpoint list for "ui" endpoints
$uiEndpoints = $endpoint = $this->walkEndpoint($endpoints, $accessToken, [
'decode',
'character',
'ui'
]);
$requestOptions = [
'timeout' => self::CREST_TIMEOUT,
'method' => 'POST',
'user_agent' => $this->getUserAgent(),
'header' => [
'Scope: characterNavigationWrite',
'Authorization: Bearer ' . $character->getAccessToken(),
'Host: ' . $crestUrlParts['host'],
'Content-Type: application/vnd.ccp.eve.PostWaypoint-v1+json;charset=utf-8',
],
'content' => json_encode($content, JSON_UNESCAPED_SLASHES)
];
if(
isset($uiEndpoints['setWaypoints']) &&
isset($uiEndpoints['setWaypoints']['href'])
){
$endpointUrl = $uiEndpoints['setWaypoints']['href'];
$systemEndpoint = self::getCrestEndpoint() . '/solarsystems/' . $systemId . '/';
$apiResponse = Lib\Web::instance()->request($endpointUrl, $requestOptions);
// request body
$content = [
'clearOtherWaypoints' => (bool)$options['clearOtherWaypoints'],
'first' => (bool)$options['first'],
'solarSystem' => [
'href' => $systemEndpoint,
'id' => (int)$systemId
]
];
if( isset($apiResponse['body']) ){
$responseData = json_decode($apiResponse['body']);
$requestOptions = [
'timeout' => self::CREST_TIMEOUT,
'method' => 'POST',
'user_agent' => $this->getUserAgent(),
'header' => [
'Scope: characterNavigationWrite',
'Authorization: Bearer ' . $character->getAccessToken(),
'Host: ' . $crestUrlParts['host'],
'Content-Type: application/vnd.ccp.eve.PostWaypoint-v1+json;charset=utf-8',
],
'content' => json_encode($content, JSON_UNESCAPED_SLASHES)
];
if( empty($responseData) ){
$waypointData['systemId'] = (int)$systemId;
}elseif(
isset($responseData->message) &&
isset($responseData->key)
){
// waypoint could not be set...
$error = (object) [];
$error->type = 'error';
$error->message = $responseData->key;
$waypointData['error'] = $error;
$apiResponse = Lib\Web::instance()->request($endpointUrl, $requestOptions);
if( isset($apiResponse['body']) ){
$responseData = json_decode($apiResponse['body']);
if( empty($responseData) ){
$waypointData['systemId'] = (int)$systemId;
}elseif(
isset($responseData->message) &&
isset($responseData->key)
){
// waypoint could not be set...
$error = (object) [];
$error->type = 'error';
$error->message = $responseData->key;
$waypointData['error'] = $error;
}
}
}
}

View File

@@ -30,7 +30,7 @@ requirejs.config({
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com
farahey: 'lib/farahey-0.5', // v0.5 jsPlumb "magnetizing" extension - https://github.com/jsplumb/farahey
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
customScrollbar: 'lib/jquery.mCustomScrollbar.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net
//datatablesBootstrap: 'lib/datatables/dataTables.bootstrap', // DataTables - not used (bootstrap style)
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive

File diff suppressed because one or more lines are too long

View File

@@ -30,7 +30,7 @@ requirejs.config({
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com
farahey: 'lib/farahey-0.5', // v0.5 jsPlumb "magnetizing" extension - https://github.com/jsplumb/farahey
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
customScrollbar: 'lib/jquery.mCustomScrollbar.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net
//datatablesBootstrap: 'lib/datatables/dataTables.bootstrap', // DataTables - not used (bootstrap style)
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive