#!/usr/bin/env sh # Moonlander Layout # # Copyright (C) 2024 Benedikt Peetz # SPDX-License-Identifier: AGPL-3.0-or-later # # This file is part of Moonlander Layout. # # You should have received a copy of the License along with this program. # If not, see . LAYOUT_ID="KWBYA" LAYOUT_GEOMETRY="moonlander" data="$(mktemp)" echo cat << EOF > "$data" { "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}} EOF response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')" hash_id="$(echo "${response}" | jq -r '.[0]')" firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')") change_description=$(echo "${response}" | jq -r '.[2]') if [ -z "${change_description}" ]; then change_description="latest layout modification made with Oryx" fi curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip echo "firmware_version=${firmware_version}" echo "change_description=${change_description}"