forked from tangled.org/core
this repo has no description

repoguard: allow repo parameter formats like /handle/repo

closes #42 by stripping one leading slash from the repo parameter.

also fixes a minor issue with the nix develop shellhook.

this kinda hacky fix is tested with the following commands:

```
nix build .#repoguard
SSH_ORIGINAL_COMMAND="git-upload-pack '/soopy.moe/test-repo'" ./result/bin/repoguard -log-path /tmp/ASDUJBIf-repoguard.log -user git
SSH_ORIGINAL_COMMAND="git-upload-pack 'soopy.moe/test-repo'" ./result/bin/repoguard -log-path /tmp/ASDUJBIf-repoguard.log -user git
```

Tangled a7da1394 78e76184

Changed files
+5 -3
cmd
repoguard
+4 -3
cmd/repoguard/main.go
···
gitCommand := cmdParts[0]
// did:foo/repo-name or
-
// handle/repo-name
+
// handle/repo-name or
+
// any of the above with a leading slash (/)
-
components := strings.Split(strings.Trim(cmdParts[1], "'"), "/")
+
components := strings.Split(strings.TrimPrefix(strings.Trim(cmdParts[1], "'"), "/"), "/")
logEvent("Command components", map[string]interface{}{
"components": components,
})
if len(components) != 2 {
-
exitWithLog("invalid repo format, needs <user>/<repo>")
+
exitWithLog("invalid repo format, needs <user>/<repo> or /<user>/<repo>")
}
didOrHandle := components[0]
+1
flake.nix
···
shellHook = ''
cp -f ${htmx-src} appview/pages/static/htmx.min.js
cp -f ${lucide-src} appview/pages/static/lucide.min.js
+
mkdir -p appview/pages/static/fonts/
cp -f ${ia-fonts-src}/"iA Writer Quattro"/Static/*.ttf appview/pages/static/fonts/
cp -f ${ia-fonts-src}/"iA Writer Mono"/Static/*.ttf appview/pages/static/fonts/
'';