mirror of https://github.com/voidlizard/hbs2
added man entry for repo:init
This commit is contained in:
parent
71679e5b65
commit
0786150ef4
|
@ -10,7 +10,6 @@ import HBS2.Git3.Export
|
|||
|
||||
import HBS2.System.Dir
|
||||
|
||||
import HBS2.CLI.Run.MetaData
|
||||
import HBS2.Net.Auth.Credentials
|
||||
import HBS2.Net.Auth.GroupKeySymm
|
||||
|
||||
|
@ -19,11 +18,8 @@ import HBS2.KeyMan.Keys.Direct
|
|||
import Data.Config.Suckless.Script
|
||||
import Data.Config.Suckless.Almost.RPC
|
||||
|
||||
import Data.ByteString.Lazy.Char8 qualified as LBS8
|
||||
import Data.Word
|
||||
import Data.Maybe
|
||||
import Data.Text qualified as Text
|
||||
import Data.HashMap.Strict qualified as HM
|
||||
import Lens.Micro.Platform
|
||||
|
||||
import System.Random hiding (next)
|
||||
|
|
|
@ -560,13 +560,57 @@ compression ; prints compression level
|
|||
liftIO $ for_ keys $ \k -> do
|
||||
liftIO $ print $ pretty k
|
||||
|
||||
|
||||
let initExamples = [qc|
|
||||
; just init a new repository
|
||||
|
||||
hbs2-git init --new
|
||||
|
||||
; init encrypted repository
|
||||
|
||||
; create new group key:
|
||||
; your real keys will be different
|
||||
; all hashes/keys appear in exampels/logs a PUBLIC information,
|
||||
; so no secrets disclosures.
|
||||
|
||||
hbs2-cli hbs2:groupkey:store [hbs2:groupkey:create 67CRxnoQWasQsY9iidjJDYXSTKEZkpSVgDQYweWuhfd3]
|
||||
39baH7SqqsAGgCSr3k9RJgY4nTwiMRXrgZUmKPFndzn8
|
||||
|
||||
|
||||
hbs2-git init --new --encrypted 39baH7SqqsAGgCSr3k9RJgY4nTwiMRXrgZUmKPFndzn8
|
||||
|
||||
added git remote laundry-worry hbs23://7F1D7QGVVwJFJ649dsSHgrDUuqHYti3nkFx<censored>
|
||||
updateRepoKey 7F1D7QGVVwJFJ649dsSHgrDUuqHYti3nkFx<censored>
|
||||
|
||||
git remote
|
||||
|
||||
laundry-worry
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
This is the git remote for the new repo. Rename it if you want.
|
||||
|
||||
hbs2-git3 repo:remotes
|
||||
7F1D7QGVVwJFJ649dsSHgrDUuqHYti3nkFx<censored> laundry-worry
|
||||
|
||||
|
||||
|]
|
||||
let initMan = brief "initializes a new repository"
|
||||
. args [ arg "new repository flag" "--new"
|
||||
, arg "group key hash for encrypted repository" "<--encrypted group-key>"
|
||||
]
|
||||
. examples initExamples
|
||||
|
||||
initMan $
|
||||
entry $ bindMatch "repo:init" $ nil_ $ \syn -> lift $ connectedDo do
|
||||
Repo.initRepo syn
|
||||
|
||||
initMan $ entry $
|
||||
bindAlias "init" "repo:init"
|
||||
|
||||
entry $ bindMatch "repo:relay-only" $ nil_ $ \case
|
||||
[ SignPubKeyLike repo ] -> lift $ connectedDo do
|
||||
setGitRepoKey repo
|
||||
waitRepo (Just 3) =<< getGitRepoKeyThrow
|
||||
waitRepo (Just 10) =<< getGitRepoKeyThrow
|
||||
|
||||
_ -> throwIO (BadFormException @C nil)
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ waitRepo timeout repoKey = do
|
|||
|
||||
notice "wait for peer"
|
||||
|
||||
lift (callRpcWaitMay @RpcPollAdd (TimeoutSec 1) peerAPI (repoKey, "lwwref", 31))
|
||||
lift (callRpcWaitMay @RpcPollAdd (TimeoutSec 2) peerAPI (repoKey, "lwwref", 31))
|
||||
>>= maybe (wait 1 forPeer ()) (const none)
|
||||
|
||||
pFetch <- ContT $ withAsync $ forever do
|
||||
|
|
Loading…
Reference in New Issue