diff --git a/scripts/upload.sh b/scripts/upload.sh deleted file mode 100755 index 3101253..0000000 --- a/scripts/upload.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -set -e - -# Check for dependencies -which curl > /dev/null -which jq > /dev/null - -# Assert required variables -if [ -z "$TALON_KEY" ]; then echo "TALON_KEY unset"; exit 1; fi -if [ -z "$TALON_URL" ]; then echo "TALON_URL unset"; exit 1; fi -if [ -z "$SUBDOMAIN" ]; then echo "SUBDOMAIN unset"; exit 1; fi - -API_URL="$TALON_URL/api" -API_KEY_H="x-api-key: $TALON_KEY" - -# Check if the website already exists -WEBSITE_STATUS=$(curl --head -o /dev/null -s -w "%{http_code}" "$API_URL/website/$SUBDOMAIN") -if [ "$WEBSITE_STATUS" = "200" ]; then - echo "Website '$SUBDOMAIN' found" -else - # Create the website if it does not exist - if [ -z "$WEBSITE_NAME" ]; then echo "WEBSITE_NAME unset"; exit 1; fi - - CREATE_BODY=$(jq -c --null-input --arg name "$WEBSITE_NAME" --arg color "$WEBSITE_COLOR" \ - --arg visibility "$WEBSITE_VISIBILITY" --arg source_url "$WEBSITE_SOURCE_URL" \ - --arg source_icon "$WEBSITE_SOURCE_ICON" \ - '{"name": $name, "color": $color, "visibility": $visibility, "source_url": $source_url, "source_icon": $source_icon} | delpaths([path(.[]| select(.==""))])') - echo "Creating website '$SUBDOMAIN': $CREATE_BODY" - - curl -Ss --fail -X "PUT" -H "$API_KEY_H" -H "content-type: application/json" --data "$CREATE_BODY" "$API_URL/website/$SUBDOMAIN" -fi - -# Check the upload directory -if [ ! -d "$1" ]; then echo "Upload directory does not exist"; exit 1; fi -if [ ! -f "$1/index.html" ]; then echo "Upload directory does not contain index.html"; exit 1; fi - -# Validate fallback page param -if [ "$FALLBACK" ] && [ ! -f "$1/$FALLBACK" ]; then echo "fallback page $FALLBACK does not exist"; exit 1; fi - -# Automatically detect fallback pages -if [ -z "$SPA" ] && [ -z "$FALLBACK" ]; then - if [ -f "$1/404.html" ]; then FALLBACK="404.html"; fi - if [ -f "$1/200.html" ]; then SPA=true; FALLBACK="200.html"; fi -fi - -push_arg() { - if [ "$UPLOAD_ARGS" ]; then UPLOAD_ARGS="$UPLOAD_ARGS&"; fi - UPLOAD_ARGS="$UPLOAD_ARGS$1" -} - -if [ "$FALLBACK" ]; then push_arg "fallback=$FALLBACK"; fi -if [ "$SPA" = "true" ]; then push_arg "spa=true"; fi - -if [ "$UPLOAD_ARGS" ]; then UPLOAD_ARGS="?$UPLOAD_ARGS"; fi - -if GIT_COMMIT=$(git rev-parse HEAD 2> /dev/null); then - echo "Git commit: $GIT_COMMIT"; - push_arg "commit=$GIT_COMMIT" -fi - -# Compress website -ARCHIVE=$(mktemp) -tar -cz --directory "$1" --file "$ARCHIVE" . - -# Upload website -echo "Version params: $UPLOAD_ARGS" -echo "Uploading..." -curl --fail -X "POST" -H "$API_KEY_H" -H "content-type: application/octet-stream" --data-binary "@$ARCHIVE" "$API_URL/website/$SUBDOMAIN/upload$UPLOAD_ARGS" - -rm "$ARCHIVE" - -echo "Website uploaded ;-)" diff --git a/ui/menu/src/components/Menu.svelte b/ui/menu/src/components/Menu.svelte index c29bc92..727d6fe 100644 --- a/ui/menu/src/components/Menu.svelte +++ b/ui/menu/src/components/Menu.svelte @@ -49,7 +49,7 @@ closeSearch(); } - function searchKeyup(e: KeyboardEvent) { + function searchKeypress(e: KeyboardEvent) { switch (e.key) { case "Enter": if (!searchText) { @@ -96,7 +96,7 @@ active={searchOpen || Boolean(searchText).valueOf()} on:click={openSearch} on:focusout={closeSearch} - on:keyup={searchKeyup} + on:keyup={searchKeypress} bind:input={searchInput} bind:text={searchText} /> diff --git a/ui/menu/src/components/MenuItemInput.svelte b/ui/menu/src/components/MenuItemInput.svelte index 6d8a7f2..0a80adf 100644 --- a/ui/menu/src/components/MenuItemInput.svelte +++ b/ui/menu/src/components/MenuItemInput.svelte @@ -26,9 +26,7 @@ bind:this={inputElm} bind:value={text} on:focusout - on:keypress|stopPropagation - on:keydown|stopPropagation - on:keyup|stopPropagation + on:keyup use:selectTextOnFocus />