diff options
-rw-r--r-- | BuildFlags.hs | 3 | ||||
-rw-r--r-- | Utility/WebApp.hs | 10 | ||||
-rw-r--r-- | git-annex.cabal | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/BuildFlags.hs b/BuildFlags.hs index e5d389d28..d5c98aa4e 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -22,6 +22,9 @@ buildFlags = filter (not . null) #else #warning Building without the webapp. You probably need to install Yesod.. #endif +#ifdef WITH_WEBAPP_HTTPS + , "Webapp-https" +#endif #ifdef WITH_PAIRING , "Pairing" #else diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index c9cb32106..31d3711f1 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -74,11 +74,15 @@ browserProc url = proc "xdg-open" [url] runWebApp :: Maybe TLSSettings -> Maybe HostName -> Wai.Application -> (SockAddr -> IO ()) -> IO () runWebApp tlssettings h app observer = withSocketsDo $ do sock <- getSocket h - void $ forkIO $ - (maybe runSettingsSocket (\ts -> runTLSSocket ts) tlssettings) - webAppSettings sock app + void $ forkIO $ run webAppSettings sock app sockaddr <- fixSockAddr <$> getSocketName sock observer sockaddr + where +#ifdef WITH_WEBAPP_HTTPS + run = (maybe runSettingsSocket (\ts -> runTLSSocket ts) tlssettings) +#else + run = runSettingsSocket +#endif fixSockAddr :: SockAddr -> SockAddr #ifdef __ANDROID__ diff --git a/git-annex.cabal b/git-annex.cabal index 2f3b7a2eb..a98e3e34a 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -43,6 +43,9 @@ Flag Assistant Flag Webapp Description: Enable git-annex webapp +Flag Webapp-https + Description: Enable git-annex webapp https + Flag Pairing Description: Enable pairing @@ -180,6 +183,9 @@ Executable git-annex blaze-builder, crypto-api, hamlet, clientsession, template-haskell, data-default, aeson, network-conduit CPP-Options: -DWITH_WEBAPP + if flag(Webapp) && flag (Webapp-https) + Build-Depends: warp-tls (>= 1.4) + CPP-Options: -DWITH_WEBAPP_HTTPS if flag(Pairing) Build-Depends: network-multicast, network-info |