Skip to content

Commit

Permalink
deprecate [wheelmap] service (badges#10538)
Browse files Browse the repository at this point in the history
* deprecate [wheelmap] service

* remove app.json
  • Loading branch information
chris48s authored Sep 15, 2024
1 parent 8cd2718 commit 9eaa2ed
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 250 deletions.
5 changes: 0 additions & 5 deletions .github/actions/service-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ inputs:
description: 'The SERVICETESTS_TWITCH_CLIENT_SECRET secret'
required: false
default: ''
wheelmap-token:
description: 'The SERVICETESTS_WHEELMAP_TOKEN secret'
required: false
default: ''
youtube-api-key:
description: 'The SERVICETESTS_YOUTUBE_API_KEY secret'
required: false
Expand Down Expand Up @@ -75,7 +71,6 @@ runs:
SL_INSIGHT_API_TOKEN: '${{ inputs.sl-insight-api-token }}'
TWITCH_CLIENT_ID: '${{ inputs.twitch-client-id }}'
TWITCH_CLIENT_SECRET: '${{ inputs.twitch-client-secret }}'
WHEELMAP_TOKEN: '${{ inputs.wheelmap-token }}'
YOUTUBE_API_KEY: '${{ inputs.youtube-api-key }}'

- name: Write Markdown Summary
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/coveralls-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
SL_INSIGHT_API_TOKEN: '${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}'
TWITCH_CLIENT_ID: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}'
TWITCH_CLIENT_SECRET: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}'
WHEELMAP_TOKEN: '${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}'
YOUTUBE_API_KEY: '${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}'
shell: bash

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/daily-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:
SL_INSIGHT_API_TOKEN: '${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}'
TWITCH_CLIENT_ID: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}'
TWITCH_CLIENT_SECRET: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}'
WHEELMAP_TOKEN: '${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}'
YOUTUBE_API_KEY: '${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}'

- name: Write Service Tests Markdown Summary
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ jobs:
SL_INSIGHT_USER_UUID=${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}
TWITCH_CLIENT_ID=${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}
TWITCH_CLIENT_SECRET=${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}
WHEELMAP_TOKEN=${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}
YOUTUBE_API_KEY=${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}
1 change: 0 additions & 1 deletion .github/workflows/test-services-22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
sl-insight-api-token: '${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}'
twitch-client-id: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}'
twitch-client-secret: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}'
wheelmap-token: '${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}'
youtube-api-key: '${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}'

- name: Service tests (triggered from fork)
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
sl-insight-api-token: '${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}'
twitch-client-id: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}'
twitch-client-secret: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}'
wheelmap-token: '${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}'
youtube-api-key: '${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}'

- name: Service tests (triggered from fork)
Expand Down
56 changes: 0 additions & 56 deletions app.json

This file was deleted.

1 change: 0 additions & 1 deletion config/custom-environment-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ private:
teamcity_pass: 'TEAMCITY_PASS'
twitch_client_id: 'TWITCH_CLIENT_ID'
twitch_client_secret: 'TWITCH_CLIENT_SECRET'
wheelmap_token: 'WHEELMAP_TOKEN'
influx_username: 'INFLUX_USERNAME'
influx_password: 'INFLUX_PASSWORD'
weblate_api_key: 'WEBLATE_API_KEY'
Expand Down
1 change: 0 additions & 1 deletion core/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ const privateConfigSchema = Joi.object({
teamcity_pass: Joi.string(),
twitch_client_id: Joi.string(),
twitch_client_secret: Joi.string(),
wheelmap_token: Joi.string(),
influx_username: Joi.string(),
influx_password: Joi.string(),
weblate_api_key: Joi.string(),
Expand Down
1 change: 0 additions & 1 deletion doc/production-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Production hosting is managed by the Shields ops team:
| YouTube | Account owner | @PyvesB |
| GitLab | Account owner | @calebcartwright |
| GitLab | Account access | @calebcartwright, @chris48s, @paulmelnikow, @PyvesB |
| OpenStreetMap (for Wheelmap) | Account owner | @paulmelnikow |
| DNS | Account owner | @olivierlacan |
| DNS | Read-only account access | @espadrine, @paulmelnikow, @chris48s |
| Sentry | Error reports | @espadrine, @paulmelnikow |
Expand Down
10 changes: 0 additions & 10 deletions doc/server-secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,6 @@ You can find your Weblate API key in your profile under
[weblate authentication]: https://docs.weblate.org/en/latest/api.html#authentication-and-generic-parameters
[weblate api key location]: https://hosted.weblate.org/accounts/profile/#api

### Wheelmap

- `WHEELMAP_TOKEN` (yml: `private.wheelmap_token`)

The wheelmap API requires authentication. To obtain a token,
Create an account, [sign in][wheelmap token] and use the _Authentication Token_
displayed on your profile page.

[wheelmap token]: http://classic.wheelmap.org/en/users/sign_in

### YouTube

- `YOUTUBE_API_KEY` (yml: `private.youtube_api_key`)
Expand Down
78 changes: 9 additions & 69 deletions services/wheelmap/wheelmap.service.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,11 @@
import Joi from 'joi'
import { BaseJsonService, pathParams } from '../index.js'
import { deprecatedService } from '../index.js'

const schema = Joi.object({
node: Joi.object({
wheelchair: Joi.string().required(),
}).required(),
}).required()

export default class Wheelmap extends BaseJsonService {
static category = 'other'

static route = {
export const Wheelmap = deprecatedService({
category: 'other',
route: {
base: 'wheelmap/a',
pattern: ':nodeId(-?[0-9]+)',
}

static auth = {
passKey: 'wheelmap_token',
authorizedOrigins: ['https://wheelmap.org'],
isRequired: true,
}

static openApi = {
'/wheelmap/a/{nodeId}': {
get: {
summary: 'Wheelmap',
parameters: pathParams({
name: 'nodeId',
example: '26699541',
}),
},
},
}

static defaultBadgeData = { label: 'accessibility' }

static render({ accessibility }) {
let color
if (accessibility === 'yes') {
color = 'brightgreen'
} else if (accessibility === 'limited') {
color = 'yellow'
} else if (accessibility === 'no') {
color = 'red'
}
return { message: accessibility, color }
}

async fetch({ nodeId }) {
return this._requestJson(
this.authHelper.withQueryStringAuth(
{ passKey: 'api_key' },
{
schema,
url: `https://wheelmap.org/api/nodes/${nodeId}`,
httpErrors: {
401: 'invalid token',
404: 'node not found',
},
},
),
)
}

async handle({ nodeId }) {
const json = await this.fetch({ nodeId })
const accessibility = json.node.wheelchair
return this.constructor.render({ accessibility })
}
}
pattern: ':nodeId',
},
label: 'wheelmap',
dateAdded: new Date('2024-09-14'),
})
59 changes: 0 additions & 59 deletions services/wheelmap/wheelmap.spec.js

This file was deleted.

52 changes: 9 additions & 43 deletions services/wheelmap/wheelmap.tester.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,10 @@
import { createServiceTester } from '../tester.js'
import { noToken } from '../test-helpers.js'
import _noWheelmapToken from './wheelmap.service.js'
export const t = await createServiceTester()
const noWheelmapToken = noToken(_noWheelmapToken)

t.create('node with accessibility')
.skipWhen(noWheelmapToken)
import { ServiceTester } from '../tester.js'
export const t = new ServiceTester({
id: 'Wheelmap',
title: 'Wheelmap',
pathPrefix: '/wheelmap/a',
})

t.create('wheelmap (deprecated)')
.get('/26699541.json')
.timeout(7500)
.expectBadge({
label: 'accessibility',
message: 'yes',
color: 'brightgreen',
})

t.create('node with limited accessibility')
.skipWhen(noWheelmapToken)
.get('/2034868974.json')
.timeout(7500)
.expectBadge({
label: 'accessibility',
message: 'limited',
color: 'yellow',
})

t.create('node without accessibility')
.skipWhen(noWheelmapToken)
.get('/-147495158.json')
.timeout(7500)
.expectBadge({
label: 'accessibility',
message: 'no',
color: 'red',
})

t.create('node not found')
.skipWhen(noWheelmapToken)
.get('/0.json')
.timeout(7500)
.expectBadge({
label: 'accessibility',
message: 'node not found',
})
.expectBadge({ label: 'wheelmap', message: 'no longer available' })

0 comments on commit 9eaa2ed

Please sign in to comment.