Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
833186af
Commit
833186af
authored
2 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
cwality-maps: change routes
otherwise workadventure & the deployment got confused
parent
72760b0f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cwality-maps/Main.hs
+9
-7
9 additions, 7 deletions
cwality-maps/Main.hs
with
9 additions
and
7 deletions
cwality-maps/Main.hs
+
9
−
7
View file @
833186af
...
@@ -78,10 +78,11 @@ instance FromHttpApiData MapParams where
...
@@ -78,10 +78,11 @@ instance FromHttpApiData MapParams where
-- | actual set of routes: api for json & html + static pages from disk
-- | actual set of routes: api for json & html + static pages from disk
type
Routes
=
type
Routes
=
Capture
"map.json"
JsonFilename
:>
Capture
"params"
MapParams
:>
Get
'
[
JSON
]
Tiledmap
"generate"
:>
Capture
"params"
MapParams
:>
-- explicitly capture broken json to return 400 instead of looking for files
(
Capture
"map.json"
JsonFilename
:>
Get
'
[
JSON
]
Tiledmap
:<|>
Capture
"map.json"
JsonFilename
:>
CaptureAll
"rest"
Text
:>
Get
'
[
JSON
]
Void
-- explicitly capture broken json to return 400 instead of looking for files
:<|>
Raw
:<|>
Capture
"map.json"
JsonFilename
:>
CaptureAll
"rest"
Text
:>
Get
'
[
JSON
]
Void
:<|>
Raw
)
...
@@ -90,8 +91,8 @@ mkMap :: Config True -> Tiledmap -> MapParams -> ([SubstitutionError], Tiledmap)
...
@@ -90,8 +91,8 @@ mkMap :: Config True -> Tiledmap -> MapParams -> ([SubstitutionError], Tiledmap)
mkMap
_config
basemap
params
=
mkMap
_config
basemap
params
=
substitute
basemap
(
substs
params
)
substitute
basemap
(
substs
params
)
mapHandler
::
Config
True
->
JsonFilename
->
MapParams
->
Handler
Tiledmap
mapHandler
::
MapParams
->
Config
True
->
JsonFilename
->
Handler
Tiledmap
mapHandler
config
(
JsonFilename
mapname
)
params
=
mapHandler
params
config
(
JsonFilename
mapname
)
=
case
M
.
lookup
mapname
(
snd
$
view
template
config
)
of
case
M
.
lookup
mapname
(
snd
$
view
template
config
)
of
Just
basemap
->
runStdoutLoggingT
$
Just
basemap
->
runStdoutLoggingT
$
logWarnN
(
pretty
errors
)
>>
pure
tiledmap
logWarnN
(
pretty
errors
)
>>
pure
tiledmap
...
@@ -103,7 +104,8 @@ mapHandler config (JsonFilename mapname) params =
...
@@ -103,7 +104,8 @@ mapHandler config (JsonFilename mapname) params =
-- | Complete set of routes: API + HTML sites
-- | Complete set of routes: API + HTML sites
server
::
Config
True
->
Server
Routes
server
::
Config
True
->
Server
Routes
server
config
=
mapHandler
config
server
config
params
=
mapHandler
params
config
:<|>
(
\
_
_
->
throwError
err400
)
:<|>
(
\
_
_
->
throwError
err400
)
:<|>
serveDirectoryWebApp
(
fst
.
view
template
$
config
)
:<|>
serveDirectoryWebApp
(
fst
.
view
template
$
config
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment