You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I'm missing something, I don't think there is a simple way to use a custom CSS file. I suspect most people will want to do this. Also it may be useful to make it easy to replace the default index.html.
I know you can run websocketApp but that seems like a lot of work just to get a CSS.
If you are happy with the approach I will submit a PR that is working nicely locally. What I've done is the following
The chage is that app is passed a handler that can intercept and respond to requests. In backupApp
concur-replica: Run.hs
runCustom :: (W.Request -> IO (Maybe W.Response)) -> Int -> T.Text -> ConnectionOptions -> Widget HTML a -> IO ()
runCustom handler port title connectionOptions widget
= W.run port
$ R.app handler (TE.encodeUtf8 title) connectionOptions (step widget) stepWidget
runDefault then passes a const $ pure Nothing as the handler
Using it looks like this
main :: IO ()
main = Cr.runCustom handler 8080 "test1" Wsc.defaultConnectionOptions $ do
myWidget
where
handler req = do
case W.rawPathInfo req of
"/" -> pure . Just $ indexHtml
"/site.css" -> pure . Just $ siteCss
_ -> pure . Just $ indexHtml
indexHtml = W.responseLBS status200 [("content-type", "text/html")] "index.html with /site.css and clientDriver"
siteCss = W.responseLBS status200 [("content-type", "text/css")] "blablabla"
I think it makes sense for the handler to be IO... so that the user could load the file of disk etc
Let me know if you are interested and I'll submit a PR to both projects
The text was updated successfully, but these errors were encountered:
Unless I'm missing something, I don't think there is a simple way to use a custom CSS file. I suspect most people will want to do this. Also it may be useful to make it easy to replace the default index.html.
I know you can run
websocketApp
but that seems like a lot of work just to get a CSS.If you are happy with the approach I will submit a PR that is working nicely locally. What I've done is the following
Replica: replica.hs
The chage is that
app
is passed a handler that can intercept and respond to requests. InbackupApp
concur-replica: Run.hs
runDefault
then passes aconst $ pure Nothing
as the handlerUsing it looks like this
I think it makes sense for the handler to be
IO...
so that the user could load the file of disk etcLet me know if you are interested and I'll submit a PR to both projects
The text was updated successfully, but these errors were encountered: