diff --git a/Readme.md b/Readme.md index b8d92b0..bd83449 100644 --- a/Readme.md +++ b/Readme.md @@ -1,20 +1,7 @@ # Client -Adds to global config: -``` -[http "https:////repo"] - extraHeader = "Authorization: Nostr $(./create_nostr_auth_header.sh)" - -``` - -TODO: -- [ ] add signing for header generation -- [ ] add id for header generation -- [ ] add base64 encofing for header generation -- [ ] add key retrieval mechanism -- [ ] add script for extendign config file for speicific urls +1. add `./nga` to you `$PATH` +2. run `nga` and follow instructions # Sever -TODO: -- [ ] Appache config to intercept and verify header (also for ACL) -- [ ] script for auto setup with bare repo and ACL +TODO diff --git a/create_nostr_auth_header.sh b/create_nostr_auth_header.sh deleted file mode 100644 index 0c819f9..0000000 --- a/create_nostr_auth_header.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -set -e - -command=($BASH_COMMAND) - -if [[ command[0] -eq 'clone']] ; then - echo "base64 of the following json:" -# { -# "id": "", -# "pubkey": "", -# "content": "", -# "kind": 27235, -# "created_at": $(date +%s), -# "tags": [ -# ["u", $command[1]], -# ["method", $command[0]], -# ], -# "sig": "" -# } - -elif [[ command[0] -eq 'push' ]]; then - commit=$(git rev-parse HEAD) - echo "base64 of the following json:" -# { -# "id": "", -# "pubkey": "", -# "content": "", -# "kind": 27235, -# "created_at": $(date +%s), -# "tags": [ -# ["u", $command[1]], -# ["method", $command[0]], -# ["payload", $commit], -# ], -# "sig": "" -# } -else - echo "Error: command not supported" >&2 - exit 1 -fi diff --git a/nga.sh b/nga.sh new file mode 100755 index 0000000..cf45689 --- /dev/null +++ b/nga.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -e + +HOOK=`cat <<'EOF' +#!/bin/sh\n +\n +url="$2"\n +zero=$(git hash-object --stdin $SK_PATH +fi + +read -p "Provide path to git repository or press \"Enter\" to use curent directory:" GIT_REPO +GIT_REPO=${GIT_REPO:-.} + +if [ ! -d $GIT_REPO ]; then + echo "$GIT_REPO is not a directory. Exiting..." + exit 1 +fi + +if [ ! -d "$GIT_REPO/.git" ]; then + echo "$GIT_REPO is not a directory. Exiting..." + exit 1 +fi + +echo "Installing git hooks..." +if [ -f "$GIT_REPO/.git/hooks/pre-push" ]; then + echo "pre-push hook already exists. Skipping..." +else + echo "Installing pre-push hook..." + echo -e $HOOK >> $GIT_REPO/.git/hooks/pre-push + chmod +x $GIT_REPO/.git/hooks/pre-push +fi + +echo "Done!" +