Fix violation of unmined license (distribution)
This commit is contained in:
@@ -4,13 +4,14 @@ from fastapi.responses import HTMLResponse
|
||||
|
||||
from .settings import settings
|
||||
from .user import user_auth
|
||||
from .map_tiles import map_tiles
|
||||
from .map_tiles import map_tiles, map_meta
|
||||
from .templates import j2env
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.mount("/user/", user_auth)
|
||||
app.mount("/map/", map_tiles)
|
||||
app.mount("/map/", map_meta)
|
||||
app.mount("/tiles/", map_tiles)
|
||||
|
||||
frontend = FastAPI()
|
||||
|
||||
|
||||
@@ -4,17 +4,23 @@ from fastapi.staticfiles import StaticFiles
|
||||
from .settings import settings
|
||||
from .templates import j2env
|
||||
|
||||
map_tiles = FastAPI()
|
||||
map_tiles = StaticFiles(directory=f"{settings.unmined_out_path}/tiles")
|
||||
|
||||
map_tiles.mount("/tiles/", StaticFiles(directory=f"{settings.unmined_out_path}/tiles"))
|
||||
map_meta = FastAPI()
|
||||
|
||||
|
||||
class MetadataJsResponse(Response):
|
||||
class JsResponse(Response):
|
||||
media_type = "text/javascript"
|
||||
|
||||
|
||||
MAP_PROPS_FILE = f"{settings.unmined_out_path}/unmined.map.properties.js"
|
||||
MAP_REGIONS_FILE = f"{settings.unmined_out_path}/unmined.map.regions.js"
|
||||
UNMINED_FILE = f"{settings.unmined_out_path}/unmined.openlayers.js"
|
||||
|
||||
with open(UNMINED_FILE, "r") as f:
|
||||
unmined_script = j2env.get_template("unmined.js").render(
|
||||
unmined_file=UNMINED_FILE, unmined_script=f.read()
|
||||
)
|
||||
|
||||
|
||||
def parse_metadata():
|
||||
@@ -31,7 +37,12 @@ def parse_metadata():
|
||||
)
|
||||
|
||||
|
||||
@map_tiles.get("/metadata.js", response_class=MetadataJsResponse)
|
||||
@map_meta.get("/unmined.js", response_class=JsResponse)
|
||||
async def get_unmined():
|
||||
return unmined_script
|
||||
|
||||
|
||||
@map_meta.get("/metadata.js", response_class=JsResponse)
|
||||
async def get_metadata():
|
||||
# TODO cache
|
||||
return parse_metadata()
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/* {{props_file}} */
|
||||
{{map_props}}
|
||||
/* {{ props_file }} */
|
||||
{{ map_props }}
|
||||
/* end of {{ props_file }} */
|
||||
|
||||
/* {{regions_file}} */
|
||||
/* {{ regions_file }} */
|
||||
{{map_regions}}
|
||||
/* end of {{ regions_file }} */
|
||||
|
||||
return {
|
||||
properties: UnminedMapProperties,
|
||||
|
||||
5
server/templates/unmined.js
Normal file
5
server/templates/unmined.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/* {{ unmined_file }} */
|
||||
{{ unmined_script }}
|
||||
/* end of {{ unmined_file }} */
|
||||
|
||||
return new Unmined();
|
||||
Reference in New Issue
Block a user