webapp: New --listen= option allows running the webapp on one computer and connecting to it from another.

Does not yet use HTTPS. I'd need to generate a certificate, and I'm not
sure what's the best way to do that.
This commit is contained in:
Joey Hess 2013-04-08 15:04:35 -04:00
parent c80968c3dd
commit 5e2e4347a3
10 changed files with 92 additions and 45 deletions

View file

@ -161,6 +161,7 @@ import Utility.ThreadScheduler
import qualified Build.SysConfig as SysConfig
import System.Log.Logger
import Network.Socket (HostName)
stopDaemon :: Annex ()
stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile
@ -170,8 +171,8 @@ stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile
-
- startbrowser is passed the url and html shim file, as well as the original
- stdout and stderr descriptors. -}
startDaemon :: Bool -> Bool -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex ()
startDaemon assistant foreground startbrowser = do
startDaemon :: Bool -> Bool -> Maybe HostName -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex ()
startDaemon assistant foreground listenhost startbrowser = do
pidfile <- fromRepo gitAnnexPidFile
logfile <- fromRepo gitAnnexLogFile
logfd <- liftIO $ openLog logfile
@ -218,7 +219,7 @@ startDaemon assistant foreground startbrowser = do
mapM_ (startthread urlrenderer)
[ watch $ commitThread
#ifdef WITH_WEBAPP
, assist $ webAppThread d urlrenderer False Nothing webappwaiter
, assist $ webAppThread d urlrenderer False listenhost Nothing webappwaiter
#ifdef WITH_PAIRING
, assist $ pairListenerThread urlrenderer
#endif