diff options
Diffstat (limited to 'Command/EnableTor.hs')
-rw-r--r-- | Command/EnableTor.hs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Command/EnableTor.hs b/Command/EnableTor.hs index 8d9dd6f0a..1a54c6c5d 100644 --- a/Command/EnableTor.hs +++ b/Command/EnableTor.hs @@ -10,19 +10,25 @@ module Command.EnableTor where import Command import Utility.Tor +-- This runs as root, so avoid making any commits or initializing +-- git-annex, as that would create root-owned files. cmd :: Command cmd = noCommit $ dontCheck repoExists $ command "enable-tor" SectionPlumbing "" - paramNumber (withParams seek) + "userid uuid" (withParams seek) seek :: CmdParams -> CommandSeek seek = withWords start start :: CmdParams -> CommandStart -start (localport:[]) = case readish localport of - Nothing -> error "Bad localport" - Just lp -> do - (onionaddr, onionport) <- liftIO $ addHiddenService lp - liftIO $ putStrLn (onionaddr ++ ":" ++ show onionport) +start (suserid:uuid:[]) = case readish suserid of + Nothing -> error "Bad userid" + Just userid -> do + (onionaddr, onionport, onionsocket) <- liftIO $ + addHiddenService userid uuid + liftIO $ putStrLn $ + onionaddr ++ ":" ++ + show onionport ++ " " ++ + show onionsocket stop -start _ = error "Need 1 localport parameter" +start _ = error "Bad params" |