1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00

deprecate [wheelmap] service (#10538)

* deprecate [wheelmap] service

* remove app.json
This commit is contained in:
chris48s 2024-09-15 16:20:22 +01:00 committed by GitHub
parent 8cd2718525
commit 9eaa2ed507
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 17 additions and 249 deletions

View File

@ -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
@ -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

View File

@ -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

View File

@ -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

View File

@ -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 }}

View File

@ -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)

View File

@ -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)

View File

@ -1,56 +0,0 @@
{
"name": "Shields",
"description": "Concise, consistent, and legible badges in SVG and raster format.",
"keywords": ["badge", "github", "svg", "status"],
"website": "https://shields.io/",
"repository": "https://github.com/badges/shields",
"logo": "https://shields.io/favicon.png",
"env": {
"CYPRESS_INSTALL_BINARY": {
"description": "Disable the cypress binary installation",
"value": "0",
"required": false
},
"HUSKY_SKIP_INSTALL": {
"description": "Skip the husky git hook setup",
"value": "1",
"required": false
},
"WHEELMAP_TOKEN": {
"description": "Configure the token to be used for the Wheelmap service.",
"required": false
},
"GH_TOKEN": {
"description": "Configure the token to be used for the GitHub services.",
"required": false
},
"TWITCH_CLIENT_ID": {
"description": "Configure the client id to be used for the Twitch service.",
"required": false
},
"TWITCH_CLIENT_SECRET": {
"description": "Configure the client secret to be used for the Twitch service.",
"required": false
},
"WEBLATE_API_KEY": {
"description": "Configure the API key to be used for the Weblate service.",
"required": false
},
"METRICS_INFLUX_ENABLED": {
"description": "Disable influx metrics",
"value": "false",
"required": false
},
"REQUIRE_CLOUDFLARE": {
"description": "Allow direct traffic",
"value": "false",
"required": false
}
},
"formation": {
"web": {
"quantity": 1,
"size": "free"
}
}
}

View File

@ -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'

View File

@ -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(),

View File

@ -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 |

View File

@ -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`)

View File

@ -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'),
})

View File

@ -1,59 +0,0 @@
import { expect } from 'chai'
import nock from 'nock'
import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js'
import Wheelmap from './wheelmap.service.js'
describe('Wheelmap', function () {
cleanUpNockAfterEach()
const token = 'abc123'
const config = { private: { wheelmap_token: token } }
function createMock({ nodeId, wheelchair }) {
const scope = nock('https://wheelmap.org')
.get(`/api/nodes/${nodeId}`)
.query({ api_key: token })
if (wheelchair) {
return scope.reply(200, { node: { wheelchair } })
} else {
return scope.reply(404)
}
}
it('node with accessibility', async function () {
const nodeId = '26699541'
const scope = createMock({ nodeId, wheelchair: 'yes' })
expect(
await Wheelmap.invoke(defaultContext, config, { nodeId }),
).to.deep.equal({ message: 'yes', color: 'brightgreen' })
scope.done()
})
it('node with limited accessibility', async function () {
const nodeId = '2034868974'
const scope = createMock({ nodeId, wheelchair: 'limited' })
expect(
await Wheelmap.invoke(defaultContext, config, { nodeId }),
).to.deep.equal({ message: 'limited', color: 'yellow' })
scope.done()
})
it('node without accessibility', async function () {
const nodeId = '-147495158'
const scope = createMock({ nodeId, wheelchair: 'no' })
expect(
await Wheelmap.invoke(defaultContext, config, { nodeId }),
).to.deep.equal({ message: 'no', color: 'red' })
scope.done()
})
it('node not found', async function () {
const nodeId = '0'
const scope = createMock({ nodeId })
expect(
await Wheelmap.invoke(defaultContext, config, { nodeId }),
).to.deep.equal({ message: 'node not found', color: 'red', isError: true })
scope.done()
})
})

View File

@ -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)
import { ServiceTester } from '../tester.js'
export const t = new ServiceTester({
id: 'Wheelmap',
title: 'Wheelmap',
pathPrefix: '/wheelmap/a',
})
t.create('node with accessibility')
.skipWhen(noWheelmapToken)
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' })