Skip to content

Commit 46da936

Browse files
authored
add pagename to config (#451)
1 parent 9aec277 commit 46da936

File tree

6 files changed

+11
-1
lines changed

6 files changed

+11
-1
lines changed

app/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func ParseConfig(filename string) (*Config, error) {
128128
MapObjects: &mapobjs,
129129
MapBlockAccessorCfg: &mapblockaccessor,
130130
DefaultOverlays: defaultoverlays,
131+
PageName: "Minetest Mapserver",
131132
Skins: &skins,
132133
WorldPath: "./",
133134
DataPath: "./",

app/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Config struct {
2121
MapObjects *MapObjectConfig `json:"mapobjects"`
2222
MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"`
2323
DefaultOverlays []string `json:"defaultoverlays"`
24+
PageName string `json:"pagename"`
2425
Skins *SkinsConfig `json:"skins"`
2526
WorldPath string `json:"worldpath"`
2627
DataPath string `json:"datapath"`

dev/mapserver.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@
7474
"mapserver_label",
7575
"mapserver_player"
7676
],
77+
"pagename": "Minetest Mapserver",
7778
"skins": {
7879
"enableskinsdb": false,
7980
"skinspath": ""
8081
},
8182
"worldpath": "./",
8283
"datapath": "./",
8384
"colorstxtpath": "./"
84-
}
85+
}

doc/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Hide travelnets and missions by pattern "(P)"
99
* Added benchmark
1010
* Minor speed improvements
11+
* Configurable page name
1112

1213
## 3.0.0
1314

public/js/map/MapFactory.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export function createMap(node, layerId, zoom, lat, lon){
1515

1616
const cfg = config.get();
1717

18+
if (cfg.pagename) {
19+
document.title = cfg.pagename;
20+
}
21+
1822
const map = L.map(node, {
1923
minZoom: 2,
2024
maxZoom: 12,

web/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type PublicConfig struct {
1313
Layers []*types.Layer `json:"layers"`
1414
MapObjects *app.MapObjectConfig `json:"mapobjects"`
1515
DefaultOverlays []string `json:"defaultoverlays"`
16+
PageName string `json:"pagename"`
1617
EnableSearch bool `json:"enablesearch"`
1718
}
1819

@@ -24,6 +25,7 @@ func (api *Api) GetConfig(resp http.ResponseWriter, req *http.Request) {
2425
webcfg.MapObjects = api.Context.Config.MapObjects
2526
webcfg.Version = app.Version
2627
webcfg.DefaultOverlays = api.Context.Config.DefaultOverlays
28+
webcfg.PageName = api.Context.Config.PageName
2729
webcfg.EnableSearch = api.Context.Config.EnableSearch
2830

2931
json.NewEncoder(resp).Encode(webcfg)

0 commit comments

Comments
 (0)