diff --git a/src/backend/app/Exceptions/InvalidBingApiKeyException.php b/src/backend/app/Exceptions/InvalidBingApiKeyException.php deleted file mode 100644 index 76a1e6db7..000000000 --- a/src/backend/app/Exceptions/InvalidBingApiKeyException.php +++ /dev/null @@ -1,5 +0,0 @@ -bingMapApiService = $bingMapApiService; - } + public function __construct() {} public function index(): ApiResource { return new ApiResource(MapSettings::all()); @@ -27,20 +21,14 @@ public function update($id): ApiResource { 'latitude' => request('latitude'), 'longitude' => request('longitude'), 'provider' => request('provider'), - 'bingMapApiKey' => request('bingMapApiKey'), ] ); return new ApiResource([$mapSettings->fresh()]); } + // TODO: remove this method and associated route references when docs can be updated public function checkBingApiKey($key): ApiResource { - try { - $apiAuthentication = $this->bingMapApiService->checkAuthenticationKey($key); - } catch (InvalidBingApiKeyException $exception) { - $apiAuthentication = false; - } - - return ApiResource::make(['authentication' => $apiAuthentication]); + return ApiResource::make(['authentication' => '']); } } diff --git a/src/backend/app/Services/BingMapApiService.php b/src/backend/app/Services/BingMapApiService.php deleted file mode 100644 index b850b9505..000000000 --- a/src/backend/app/Services/BingMapApiService.php +++ /dev/null @@ -1,39 +0,0 @@ -httpClient = $httpClient; - } - - /** - * @throws InvalidBingApiKeyException - */ - public function checkAuthenticationKey($key): bool { - try { - $response = $this->httpClient->get(config('services.bingMapApi.url').$key)->getBody()->getContents(); - } catch (GuzzleException $e) { - throw new InvalidBingApiKeyException($e->getMessage()); - } - - return $this->isRequestAuthenticated($response); - } - - private function isRequestAuthenticated($body): bool { - try { - $jsonBody = json_decode($body, true, 512, JSON_THROW_ON_ERROR); - $authenticated = $jsonBody['statusDescription'] === 'OK'; - } catch (\JsonException $exception) { - $authenticated = false; - } - - return $authenticated; - } -} diff --git a/src/backend/database/migrations/micropowermanager/2020_12_23_165814_create_map_settings_table.php b/src/backend/database/migrations/micropowermanager/2020_12_23_165814_create_map_settings_table.php index e4ef06f47..c2a2f3893 100644 --- a/src/backend/database/migrations/micropowermanager/2020_12_23_165814_create_map_settings_table.php +++ b/src/backend/database/migrations/micropowermanager/2020_12_23_165814_create_map_settings_table.php @@ -19,7 +19,6 @@ public function up() { $table->double('latitude', 10); $table->double('longitude', 10); $table->string('provider')->nullable(); - $table->string('bingMapApiKey')->nullable(); $table->timestamps(); }); diff --git a/src/frontend/src/mixins/mapSharing.js b/src/frontend/src/mixins/mapSharing.js index b1a325072..2ed9267a3 100644 --- a/src/frontend/src/mixins/mapSharing.js +++ b/src/frontend/src/mixins/mapSharing.js @@ -132,19 +132,10 @@ export const sharedMap = { this.nonEditableLayer = new L.FeatureGroup() }, setTileLayer() { - if (this.mapProvider) { - L.tileLayer - .bing(this.bingMapApiKey, { - maxZoom: this.maxZoom, - attribution: this.osmAttrib, - }) - .addTo(this.map) - } else { - L.tileLayer(this.osmUrl, { - maxZoom: this.maxZoom, - attribution: this.osmAttrib, - }).addTo(this.map) - } + L.tileLayer(this.osmUrl, { + maxZoom: this.maxZoom, + attribution: this.osmAttrib, + }).addTo(this.map) }, reGenerateMap(mutatingCenter) { this.map.flyTo(mutatingCenter, this.zoom, this.drawingOptions) @@ -182,9 +173,6 @@ export const sharedMap = { mapProvider() { return store.getters["settings/getMapSettings"].provider === "Bing Maps" }, - bingMapApiKey() { - return store.getters["settings/getMapSettings"].bingMapApiKey - }, }, watch: { mutatingCenter() { diff --git a/src/frontend/src/modules/Settings/MapSettings.vue b/src/frontend/src/modules/Settings/MapSettings.vue index 79f01c561..e1fc90f3f 100644 --- a/src/frontend/src/modules/Settings/MapSettings.vue +++ b/src/frontend/src/modules/Settings/MapSettings.vue @@ -36,29 +36,6 @@ -