Fix JSON keymap URLs generated by the API (#22618)

This commit is contained in:
Ryan 2023-12-06 15:55:35 +11:00 committed by GitHub
parent c7eb952198
commit f1043e3a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import json
from milc import cli from milc import cli
import qmk.path
from qmk.datetime import current_datetime from qmk.datetime import current_datetime
from qmk.info import info_json from qmk.info import info_json
from qmk.json_schema import json_load from qmk.json_schema import json_load
@ -126,9 +127,10 @@ def generate_api(cli):
# Populate the list of JSON keymaps # Populate the list of JSON keymaps
for keymap in list_keymaps(keyboard_name, c=False, fullpath=True): for keymap in list_keymaps(keyboard_name, c=False, fullpath=True):
keymap_rel = qmk.path.under_qmk_firmware(keymap)
kb_json['keymaps'][keymap.name] = { kb_json['keymaps'][keymap.name] = {
# TODO: deprecate 'url' as consumer needs to know its potentially hjson # TODO: deprecate 'url' as consumer needs to know its potentially hjson
'url': f'https://raw.githubusercontent.com/qmk/qmk_firmware/master/{keymap}/keymap.json', 'url': f'https://raw.githubusercontent.com/qmk/qmk_firmware/master/{keymap_rel}/keymap.json',
# Instead consumer should grab from API and not repo directly # Instead consumer should grab from API and not repo directly
'path': (keymap / 'keymap.json').as_posix(), 'path': (keymap / 'keymap.json').as_posix(),