aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/routes/github.js
diff options
context:
space:
mode:
Diffstat (limited to 'api/routes/github.js')
-rw-r--r--api/routes/github.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/api/routes/github.js b/api/routes/github.js
index 241b40f..640a8ca 100644
--- a/api/routes/github.js
+++ b/api/routes/github.js
@@ -15,7 +15,7 @@ const {
InvalidRepoError,
} = require('../services/github')
const { createInstallationToken } = require('../services/github/auth')
-const { MissingRepoFile } = require('../services/github/files')
+const { MissingRepoFile, findCodeKeymap } = require('../services/github/files')
const { parseKeymap, validateKeymapJson, KeymapValidationError } = require('../services/zmk/keymap')
const { validateInfoJson, InfoValidationError } = require('../services/zmk/layout')
@@ -103,11 +103,14 @@ const getKeyboardFiles = async (req, res, next) => {
const { branch } = req.query
try {
- const keyboardFiles = await fetchKeyboardFiles(installationId, repository, branch)
- validateInfoJson(keyboardFiles.info)
- validateKeymapJson(keyboardFiles.keymap)
- keyboardFiles.keymap = parseKeymap(keyboardFiles.keymap)
- res.json(keyboardFiles)
+ const { info, keymap } = await fetchKeyboardFiles(installationId, repository, branch)
+ validateInfoJson(info)
+ validateKeymapJson(keymap)
+
+ res.json({
+ info,
+ keymap: parseKeymap(keymap)
+ })
} catch (err) {
if (err instanceof MissingRepoFile) {
return res.status(400).json({