fpw / avitab

X-Plane plugin that displays a tablet to aid VR usage
GNU Affero General Public License v3.0
299 stars 58 forks source link

Add support for optional user defined comms protocol in mapconfig.json #169

Closed cyberang3l closed 10 months ago

cyberang3l commented 10 months ago

Add a new protocol configuration option in the map definitions in mapconfig.json. This defines the communication protocol that is spoken by the tile servers. The protocol config option is optional, and if skipped, https is assumed by default. The only accepted values are https and http.

Most of the public servers nowadays speak HTTPS, but still some use HTTP (without the S). Moreover, when using a local test tile server, setting up a valid SSL certificate can be a pain, so adding support for HTTP servers compliments the "custom online slippy tiles" feature nicely.

cyberang3l commented 10 months ago

Supporting HTTP alongside HTTPS helps me use a config like this and serve tiles from a custom local proxy:

{
        "name": "OpenFlightMaps",
        "servers": [
            "localhost:8080"
        ],
        "copyright": "Test local proxy",
        "url": "openflightmaps/{z}/{x}/{y}",
        "min_zoom_level": 7,
        "max_zoom_level": 12,
        "tile_width_px": 512,
        "tile_height_px": 512,
        "protocol": "http",
        "enabled": true
    },
    {
        "name": "Norway aeronautical maps",
        "servers": [
            "localhost:8080"
        ],
        "copyright": "Test local proxy",
        "url": "norway_vfr/{z}/{x}/{y}",
        "min_zoom_level": 2,
        "max_zoom_level": 12,
        "tile_width_px": 256,
        "tile_height_px": 256,
        "protocol": "http",
        "enabled": true
    }

Tried this out with the https://github.com/cyberang3l/slippy-tile-proxy-server script running locally on my machine, and I could serve the Norway Aeronautical chart ICAO 500.000 as well as the OpenFlightMaps with the latest base and aero layers merged on the fly.