Skip to content
Snippets Groups Projects
Commit 1db21885 authored by stuebinm's avatar stuebinm
Browse files

server: fix map paths in api

parent dea6636b
No related branches found
No related tags found
No related merge requests found
...@@ -31,8 +31,8 @@ import Network.WebSockets (PendingConnection, acceptRequest, ...@@ -31,8 +31,8 @@ import Network.WebSockets (PendingConnection, acceptRequest,
import Servant (Handler, err404, throwError) import Servant (Handler, err404, throwError)
import Server (JobStatus (..), Org (orgUrl), import Server (JobStatus (..), Org (orgUrl),
RemoteRef (reponame), ServerState, RemoteRef (reponame), ServerState,
Sha1, adjustedPath, getJobStatus, Sha1, getJobStatus,
unState) unState, adjustedWebPath)
import Worker (Job (Job)) import Worker (Job (Job))
...@@ -60,7 +60,7 @@ instance ToJSON MapService where ...@@ -60,7 +60,7 @@ instance ToJSON MapService where
mapInfo rev mappath MapResult { .. } = A.object mapInfo rev mappath MapResult { .. } = A.object
[ "badges" .= mapresultBadges [ "badges" .= mapresultBadges
-- TODO: type-safe url library for adding the slash? -- TODO: type-safe url library for adding the slash?
, "url" .= (orgUrl org <> adjustedPath rev org <> "/" <> toText mappath) ] , "url" .= (orgUrl org <> adjustedWebPath rev org <> "/" <> toText mappath) ]
......
...@@ -30,7 +30,7 @@ module Server ( loadConfig ...@@ -30,7 +30,7 @@ module Server ( loadConfig
, ServerState, emptyState, unState , ServerState, emptyState, unState
, JobStatus(..) , JobStatus(..)
, prettySha,getJobStatus,overJobStatus , prettySha,getJobStatus,overJobStatus
, adjustedPath,RealtimeMsg(..),newRealtimeChannel) where , adjustedPath,RealtimeMsg(..),newRealtimeChannel,adjustedWebPath) where
import Universum import Universum
...@@ -269,9 +269,12 @@ getJobStatus mvar orgslug sha = withMVar mvar $ \state -> pure $ do ...@@ -269,9 +269,12 @@ getJobStatus mvar orgslug sha = withMVar mvar $ \state -> pure $ do
-- | the path (relative to a baseurl / webdir) where an adjusted -- | the path (relative to a baseurl / webdir) where an adjusted
-- map should go -- map should go
adjustedPath :: Text -> Org True -> Text -- TODO: filepath library using Text? adjustedPath :: Text -> Org True -> Text -- TODO: filepath library using Text?
adjustedPath rev Org {..} = adjustedPath rev org@Org {..} =
orgWebdir <> "/" <> (rev <> show orgGeneration) orgWebdir <> "/" <> adjustedWebPath rev org
adjustedWebPath :: Text -> Org True -> Text
adjustedWebPath rev Org {..} =
rev <> show orgGeneration
newRealtimeChannel :: IO RealtimeChannel newRealtimeChannel :: IO RealtimeChannel
newRealtimeChannel = atomically newBroadcastTChan newRealtimeChannel = atomically newBroadcastTChan
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment