From e87c0a3225350fabaa8aafe78d5447a22ec4d761 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 15 Mar 2024 10:52:16 +0100 Subject: [PATCH] removed unused importsd --- IHP/ApplicationContext.hs | 1 - IHP/Controller/RequestContext.hs | 2 -- IHP/Controller/Response.hs | 5 ++--- IHP/ControllerSupport.hs | 3 +-- IHP/EnvVar.hs | 1 - IHP/IDE/FileWatcher.hs | 1 - IHP/IDE/ToolServer.hs | 8 +++----- IHP/Server.hs | 7 ++----- 8 files changed, 8 insertions(+), 20 deletions(-) diff --git a/IHP/ApplicationContext.hs b/IHP/ApplicationContext.hs index 9174e71e3..97c16dc04 100644 --- a/IHP/ApplicationContext.hs +++ b/IHP/ApplicationContext.hs @@ -1,7 +1,6 @@ module IHP.ApplicationContext where import IHP.Prelude -import Network.Wai.Session (Session) import IHP.AutoRefresh.Types (AutoRefreshServer) import IHP.FrameworkConfig (FrameworkConfig) import IHP.PGListener (PGListener) diff --git a/IHP/Controller/RequestContext.hs b/IHP/Controller/RequestContext.hs index fffc93b66..5bac8c508 100644 --- a/IHP/Controller/RequestContext.hs +++ b/IHP/Controller/RequestContext.hs @@ -8,8 +8,6 @@ import ClassyPrelude import qualified Data.ByteString.Lazy as LBS import Network.Wai (Request, Response, ResponseReceived) import Network.Wai.Parse (File, Param) -import qualified Data.Vault.Lazy as Vault -import Network.Wai.Session (Session) import IHP.FrameworkConfig import qualified Data.Aeson as Aeson diff --git a/IHP/Controller/Response.hs b/IHP/Controller/Response.hs index 5a79af936..4dddf3f70 100644 --- a/IHP/Controller/Response.hs +++ b/IHP/Controller/Response.hs @@ -9,12 +9,11 @@ where import ClassyPrelude import Network.HTTP.Types.Header import qualified IHP.Controller.Context as Context -import IHP.Controller.Context (ControllerContext(ControllerContext)) import qualified Network.Wai import Network.Wai (Response) import qualified Control.Exception as Exception -respondAndExit :: (?context::ControllerContext) => Response -> IO () +respondAndExit :: (?context :: Context.ControllerContext) => Response -> IO () respondAndExit response = do responseWithHeaders <- addResponseHeadersFromContext response Exception.throwIO (ResponseException responseWithHeaders) @@ -35,7 +34,7 @@ addResponseHeaders headers = Network.Wai.mapResponseHeaders (\hs -> headers <> h -- > addResponseHeadersFromContext response -- You probabaly want `setHeader` -- -addResponseHeadersFromContext :: (?context :: ControllerContext) => Response -> IO Response +addResponseHeadersFromContext :: (?context :: Context.ControllerContext) => Response -> IO Response addResponseHeadersFromContext response = do maybeHeaders <- Context.maybeFromContext @[Header] let headers = fromMaybe [] maybeHeaders diff --git a/IHP/ControllerSupport.hs b/IHP/ControllerSupport.hs index 197958203..900d66695 100644 --- a/IHP/ControllerSupport.hs +++ b/IHP/ControllerSupport.hs @@ -29,7 +29,7 @@ module IHP.ControllerSupport import ClassyPrelude import IHP.HaskellSupport -import Network.Wai (Response, Request, ResponseReceived, responseLBS, requestHeaders) +import Network.Wai (Request, ResponseReceived, responseLBS, requestHeaders) import qualified Network.HTTP.Types as HTTP import qualified Network.Wai import IHP.ModelSupport @@ -39,7 +39,6 @@ import qualified Data.ByteString.Lazy import qualified IHP.Controller.RequestContext as RequestContext import IHP.Controller.RequestContext (RequestContext, Respond) import qualified Data.CaseInsensitive -import qualified Control.Exception as Exception import qualified IHP.ErrorController as ErrorController import qualified Data.Typeable as Typeable import IHP.FrameworkConfig (FrameworkConfig (..), ConfigProvider(..)) diff --git a/IHP/EnvVar.hs b/IHP/EnvVar.hs index a2e164bb8..0ae52926f 100644 --- a/IHP/EnvVar.hs +++ b/IHP/EnvVar.hs @@ -11,7 +11,6 @@ import IHP.Prelude import Data.String.Interpolate.IsString (i) import qualified System.Posix.Env.ByteString as Posix import Network.Socket (PortNumber) -import Data.Word (Word16) import IHP.Mail.Types import IHP.Environment diff --git a/IHP/IDE/FileWatcher.hs b/IHP/IDE/FileWatcher.hs index 7713e50d1..d380eb9d2 100644 --- a/IHP/IDE/FileWatcher.hs +++ b/IHP/IDE/FileWatcher.hs @@ -9,7 +9,6 @@ import System.Directory (listDirectory, doesDirectoryExist) import qualified Data.Map as Map import qualified System.FSNotify as FS import IHP.IDE.Types -import qualified Data.Time.Clock as Clock import qualified Data.List as List import IHP.IDE.LiveReloadNotificationServer (notifyAssetChange) import qualified Control.Debounce as Debounce diff --git a/IHP/IDE/ToolServer.hs b/IHP/IDE/ToolServer.hs index efddb8d21..2f7d09747 100644 --- a/IHP/IDE/ToolServer.hs +++ b/IHP/IDE/ToolServer.hs @@ -6,13 +6,11 @@ import qualified Network.Wai.Handler.Warp as Warp import IHP.IDE.Types import IHP.IDE.PortConfig import qualified IHP.ControllerSupport as ControllerSupport -import qualified IHP.ErrorController as ErrorController import IHP.ApplicationContext import IHP.ModelSupport import IHP.RouterSupport hiding (get) import Network.Wai.Session.ClientSession (clientsessionStore) import qualified Web.ClientSession as ClientSession -import qualified Data.Vault.Lazy as Vault import Network.Wai.Middleware.MethodOverridePost (methodOverridePost) import Network.Wai.Session (withSession) import qualified Network.WebSockets as Websocket @@ -49,6 +47,7 @@ import qualified IHP.PGListener as PGListener import qualified Network.Wai.Application.Static as Static import qualified WaiAppStatic.Types as Static import IHP.Controller.NotFound (handleNotFound) +import IHP.Controller.Session (sessionVaultKey) withToolServer :: (?context :: Context) => IO () -> IO () withToolServer inner = withAsyncBound async (\_ -> inner) @@ -72,15 +71,14 @@ startToolServer' port isDebugMode = do Just baseUrl -> Config.option $ Config.BaseUrl baseUrl Nothing -> pure () - session <- Vault.newKey store <- fmap clientsessionStore (ClientSession.getKey "Config/client_session_key.aes") - let sessionMiddleware :: Wai.Middleware = withSession store "SESSION" (frameworkConfig.sessionCookie) session + let sessionMiddleware :: Wai.Middleware = withSession store "SESSION" (frameworkConfig.sessionCookie) sessionVaultKey let modelContext = notConnectedModelContext undefined pgListener <- PGListener.init modelContext autoRefreshServer <- newIORef (AutoRefresh.newAutoRefreshServer pgListener) staticApp <- initStaticApp - let applicationContext = ApplicationContext { modelContext, session, autoRefreshServer, frameworkConfig, pgListener } + let applicationContext = ApplicationContext { modelContext, autoRefreshServer, frameworkConfig, pgListener } let toolServerApplication = ToolServerApplication { devServerContext = ?context } let application :: Wai.Application = \request respond -> do let ?applicationContext = applicationContext diff --git a/IHP/Server.hs b/IHP/Server.hs index 0157da068..3899c4a5a 100644 --- a/IHP/Server.hs +++ b/IHP/Server.hs @@ -5,19 +5,16 @@ import IHP.Prelude import qualified Network.Wai.Handler.Warp as Warp import Network.Wai import Network.Wai.Middleware.MethodOverridePost (methodOverridePost) -import Network.Wai.Session (withSession, Session) +import Network.Wai.Session (withSession) import Network.Wai.Session.ClientSession (clientsessionStore) import qualified Web.ClientSession as ClientSession import IHP.Controller.Session (sessionVaultKey) -import qualified Data.Vault.Lazy as Vault import IHP.ApplicationContext -import qualified IHP.ControllerSupport as ControllerSupport import qualified IHP.Environment as Env import qualified IHP.PGListener as PGListener import IHP.FrameworkConfig -import IHP.RouterSupport (frontControllerToWAIApp, FrontController, webSocketApp, webSocketAppWithCustomPath) -import IHP.ErrorController +import IHP.RouterSupport (frontControllerToWAIApp, FrontController) import qualified IHP.AutoRefresh as AutoRefresh import qualified IHP.AutoRefresh.Types as AutoRefresh import IHP.LibDir