Add basic stadia maps test
This commit is contained in:
parent
a82231859d
commit
b5395afe74
3 changed files with 65 additions and 0 deletions
48
html/template/sync/stadia.html
Normal file
48
html/template/sync/stadia.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{{ template "sync/layout/authenticated.html" . }}
|
||||
|
||||
{{ define "title" }}Stadia{{ end }}
|
||||
{{ define "extraheader" }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="//unpkg.com/maplibre-gl@5.0.1/dist/maplibre-gl.js"
|
||||
></script>
|
||||
<link
|
||||
href="//unpkg.com/maplibre-gl@5.0.1/dist/maplibre-gl.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#map {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
{{ define "content" }}
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<script type="text/javascript">
|
||||
var map = new maplibregl.Map({
|
||||
container: "map",
|
||||
style: "https://tiles.stadiamaps.com/styles/alidade_smooth.json", // Style URL; see our documentation for more options
|
||||
center: [12, 53], // Initial focus coordinate
|
||||
zoom: 4,
|
||||
});
|
||||
|
||||
// MapLibre GL JS does not handle RTL text by default,
|
||||
// so we recommend adding this dependency to fully support RTL rendering if your style includes RTL text
|
||||
maplibregl.setRTLTextPlugin(
|
||||
"https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js",
|
||||
);
|
||||
|
||||
// Add zoom and rotation controls to the map.
|
||||
map.addControl(new maplibregl.NavigationControl());
|
||||
</script>
|
||||
</body>
|
||||
{{ end }}
|
||||
16
sync/dash.go
16
sync/dash.go
|
|
@ -162,6 +162,22 @@ func getSource(w http.ResponseWriter, r *http.Request, u *models.User) {
|
|||
source(w, r, u, globalid)
|
||||
}
|
||||
|
||||
func getStadia(w http.ResponseWriter, r *http.Request, u *models.User) {
|
||||
userContent, err := contentForUser(r.Context(), u)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to get user content", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
data := ContentDashboard{
|
||||
MapData: ComponentMap{
|
||||
MapboxToken: config.MapboxToken,
|
||||
},
|
||||
URL: newContentURL(),
|
||||
User: userContent,
|
||||
}
|
||||
html.RenderOrError(w, "sync/stadia.html", data)
|
||||
|
||||
}
|
||||
func getTemplateTest(w http.ResponseWriter, r *http.Request) {
|
||||
html.RenderOrError(w, "sync/template-test.html", nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ func Router() chi.Router {
|
|||
r.Method("GET", "/setting", auth.NewEnsureAuth(getSettings))
|
||||
r.Method("GET", "/signout", auth.NewEnsureAuth(getSignout))
|
||||
r.Method("GET", "/source/{globalid}", auth.NewEnsureAuth(getSource))
|
||||
r.Method("GET", "/stadia", auth.NewEnsureAuth(getStadia))
|
||||
r.Method("GET", "/trap/{globalid}", auth.NewEnsureAuth(getTrap))
|
||||
r.Method("GET", "/text/{destination}", auth.NewEnsureAuth(getTextMessages))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue