diff options
Diffstat (limited to 'application/components/initialize.vue')
-rw-r--r-- | application/components/initialize.vue | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/application/components/initialize.vue b/application/components/initialize.vue index 1021c0f..7795fcd 100644 --- a/application/components/initialize.vue +++ b/application/components/initialize.vue @@ -1,12 +1,9 @@ <script> import keyBy from 'lodash/keyBy' -import * as config from '../config' import * as github from '../github' import { healthcheck, loadBehaviours } from '../api' -import { loadLayout } from '../layout.js' -import { loadKeymap } from '../keymap.js' import { loadKeycodes } from '../keycodes' import Loader from './loader.vue' @@ -41,7 +38,6 @@ export default { async doReadyCheck() { await healthcheck() await this.loadAppData() - await this.loadKeyboardData() }, async loadAppData () { await github.init() @@ -54,46 +50,6 @@ export default { this.behaviours.splice(0, this.behaviours.length, ...behaviours) Object.assign(this.indexedKeycodes, keyBy(this.keycodes, 'code')) Object.assign(this.indexedBehaviours, keyBy(this.behaviours, 'code')) - }, - async loadKeyboardData() { - const loadKeyboardData = async () => { - if (config.enableGitHub && github.isGitHubAuthorized()) { - if (github.repositories.length > 1) { - this.tooManyRepos = true - console.log('too many') - return { layout: [], keymap: { layers: [] } } - } - - const response = await github.fetchLayoutAndKeymap() - if (response.error) { - this.loadKeyboardError = response.error - console.log('repo error') - return { layout: [], keymap: { layers: [] } } - } - - return response - } else if (config.enableLocal) { - const [layout, keymap] = await Promise.all([ - loadLayout(), - loadKeymap() - ]) - return { layout, keymap } - } else { - return { layout: [], keymap: { layers: [] } } - } - } - - const { layout, keymap } = await loadKeyboardData() - - this.layout.splice(0, this.layout.length, ...layout.map(key => ( - { ...key, u: key.u || key.w || 1, h: key.h || 1 } - ))) - - const layerNames = keymap.layer_names || keymap.layers.map((_, i) => `Layer ${i}`) - Object.assign(this.layers, keymap.layers) - Object.assign(this.keymap, keymap, { - layer_names: layerNames - }) } } } @@ -102,11 +58,8 @@ export default { <template> <loader :load="doReadyCheck"> <slot - :keymap="keymap" - :layers="layers" - :layout="layout" :tooManyRepos="tooManyRepos" :loadKeyboardError="loadKeyboardError" /> </loader> -</template>
\ No newline at end of file +</template> |