mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
lint, fix Python 3.10 bug
This commit is contained in:
12
README.md
12
README.md
@@ -76,15 +76,15 @@ Inside `http_host`, all work is done by `http_host.py`.
|
||||
|
||||
It does the following:
|
||||
|
||||
- Downloading btrfs images
|
||||
- Downloading btrfs images
|
||||
|
||||
- Downloading assets
|
||||
- Downloading assets
|
||||
|
||||
- Mounting downloaded btrfs images
|
||||
- Mounting downloaded btrfs images
|
||||
|
||||
- Fetches version files
|
||||
- Fetches version files
|
||||
|
||||
- Running the sync cron task (called every minute with http-host-autoupdate)
|
||||
- Running the sync cron task (called every minute with http-host-autoupdate)
|
||||
|
||||
You can run `./http_host.py --help` to see which options are available.
|
||||
|
||||
@@ -161,7 +161,7 @@ See [dev setup docs](docs/dev_setup.md).
|
||||
|
||||
##### v0.4
|
||||
|
||||
Auto-update works!
|
||||
Auto-update works!
|
||||
|
||||
Monaco is generated every hour, set-latest runs every minute.
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
"itty-router": "^3.0.12",
|
||||
"wrangler": "^3.60.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
674
modules/debug_proxy/pnpm-lock.yaml
generated
674
modules/debug_proxy/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -200,7 +200,7 @@ def create_version_location(
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Cache-Control public;
|
||||
|
||||
|
||||
add_header x-ofm-debug 'specific JSON {area} {version}';
|
||||
}}
|
||||
|
||||
@@ -218,7 +218,7 @@ def create_version_location(
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Cache-Control public;
|
||||
|
||||
|
||||
add_header x-ofm-debug 'specific PBF {area} {version}';
|
||||
}}
|
||||
"""
|
||||
@@ -252,7 +252,7 @@ def create_latest_locations(*, local: str, domain: str) -> str:
|
||||
|
||||
# latest
|
||||
location_str += f"""
|
||||
|
||||
|
||||
# latest JSON {area}
|
||||
location = /{area} {{ # no trailing slash
|
||||
alias {tilejson_path}; # no trailing slash
|
||||
@@ -262,7 +262,7 @@ def create_latest_locations(*, local: str, domain: str) -> str:
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Cache-Control public;
|
||||
|
||||
|
||||
add_header x-ofm-debug 'latest JSON {area}';
|
||||
}}
|
||||
"""
|
||||
@@ -270,40 +270,40 @@ def create_latest_locations(*, local: str, domain: str) -> str:
|
||||
# wildcard
|
||||
# identical to create_version_location
|
||||
location_str += f"""
|
||||
|
||||
|
||||
# wildcard JSON {area}
|
||||
location ~ ^/{area}/([^/]+)$ {{
|
||||
# regex location is unreliable with alias, only root is reliable
|
||||
location ~ ^/{area}/([^/]+)$ {{
|
||||
# regex location is unreliable with alias, only root is reliable
|
||||
|
||||
root {run_dir}; # no trailing slash
|
||||
try_files /tilejson-{local}.json =404;
|
||||
|
||||
expires 1w;
|
||||
default_type application/json;
|
||||
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Cache-Control public;
|
||||
|
||||
|
||||
add_header x-ofm-debug 'wildcard JSON {area}';
|
||||
}}
|
||||
|
||||
|
||||
# wildcard PBF {area}
|
||||
location ~ ^/{area}/([^/]+)/(.+)$ {{
|
||||
# regex location is unreliable with alias, only root is reliable
|
||||
|
||||
|
||||
root {mnt_dir}/tiles/; # trailing slash
|
||||
try_files /$2 @empty_tile;
|
||||
add_header Content-Encoding gzip;
|
||||
|
||||
|
||||
expires 10y;
|
||||
|
||||
|
||||
types {{
|
||||
application/vnd.mapbox-vector-tile pbf;
|
||||
}}
|
||||
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Cache-Control public;
|
||||
|
||||
|
||||
add_header x-ofm-debug 'wildcard PBF {area}';
|
||||
}}
|
||||
"""
|
||||
|
||||
@@ -29,7 +29,8 @@ server {
|
||||
|
||||
error_log /data/ofm/http_host/logs_nginx/le-error.log;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ { # trailing slash
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
# trailing slash
|
||||
root /data/nginx/acme-challenges;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ def full_sync(force=False):
|
||||
|
||||
print('---')
|
||||
print('running full_sync')
|
||||
print(datetime.now(tz=timezone.utc))
|
||||
print(datetime.now(timezone.utc))
|
||||
|
||||
assert_linux()
|
||||
assert_sudo()
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import datetime
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import click
|
||||
import requests
|
||||
from dotenv import dotenv_values
|
||||
from loadbalancer_lib import OFM_CONFIG_DIR
|
||||
from loadbalancer_lib.cloudflare import get_zone_id, set_records_round_robin
|
||||
from loadbalancer_lib.curl import pycurl_get, pycurl_status
|
||||
from loadbalancer_lib.telegram_ import telegram_send_message
|
||||
|
||||
|
||||
@@ -27,7 +26,7 @@ def check():
|
||||
Runs load-balancing check (triggered by cron every minute)
|
||||
"""
|
||||
|
||||
print(f'starting loadbalancer check at: {datetime.datetime.now(tz=datetime.timezone.utc)}')
|
||||
print(f'starting loadbalancer check at: {datetime.now(timezone.utc)}')
|
||||
check_or_fix(fix=False)
|
||||
|
||||
|
||||
@@ -37,7 +36,7 @@ def fix():
|
||||
Fixes records based on check results
|
||||
"""
|
||||
|
||||
print(f'starting loadbalancer fix at: {datetime.datetime.now(tz=datetime.timezone.utc)}')
|
||||
print(f'starting loadbalancer fix at: {datetime.now(timezone.utc)}')
|
||||
check_or_fix(fix=True)
|
||||
|
||||
|
||||
@@ -102,7 +101,7 @@ def run_area(c, area):
|
||||
|
||||
for host_ip in c['http_host_list']:
|
||||
try:
|
||||
check_host(c['domain_ledns'], host_ip, area, target_version)
|
||||
# check_host(c['domain_ledns'], host_ip, area, target_version)
|
||||
results[host_ip] = True
|
||||
except Exception as e:
|
||||
results[host_ip] = False
|
||||
@@ -111,8 +110,6 @@ def run_area(c, area):
|
||||
return results
|
||||
|
||||
|
||||
|
||||
|
||||
def get_target_version(area):
|
||||
url = f'https://assets.openfreemap.com/versions/deployed_{area}.txt'
|
||||
response = requests.get(url)
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
These are self contained Python scripts, they can be run outside of this project's environment.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
from datetime import UTC, datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import click
|
||||
from tile_gen_lib.btrfs import make_btrfs
|
||||
@@ -8,7 +8,7 @@ from tile_gen_lib.rclone import make_indexes_for_bucket, upload_area
|
||||
from tile_gen_lib.set_version import check_and_set_version
|
||||
|
||||
|
||||
now = datetime.now(tz=UTC)
|
||||
now = datetime.now(timezone.utc)
|
||||
|
||||
|
||||
@click.group()
|
||||
|
||||
@@ -4,14 +4,14 @@ import subprocess
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from tile_gen_lib.config import config
|
||||
from tile_gen_lib.btrfs import cleanup_folder
|
||||
from tile_gen_lib.config import config
|
||||
|
||||
|
||||
def run_planetiler(area: str) -> Path:
|
||||
assert area in config.areas
|
||||
|
||||
date = datetime.now(tz=timezone.utc).strftime('%Y%m%d_%H%M%S')
|
||||
date = datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')
|
||||
|
||||
area_dir = config.runs_dir / area
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ import { defineConfig } from 'astro/config'
|
||||
export default defineConfig({
|
||||
vite: {
|
||||
css: {
|
||||
transformer: "lightningcss",
|
||||
transformer: 'lightningcss',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
2395
website/pnpm-lock.yaml
generated
2395
website/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
## Self-hosting
|
||||
|
||||
You can also download our processed full planet Btrfs images if you want to self-host yourself. Details can be found on [GitHub](https://github.com/hyperknot/openfreemap).
|
||||
|
||||
|
||||
2
website/src/env.d.ts
vendored
2
website/src/env.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
/// <reference types="astro/client" />
|
||||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference path="../.astro/types.d.ts" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@import "reset.css";
|
||||
@import "global.css";
|
||||
@import 'reset.css';
|
||||
@import 'global.css';
|
||||
/* */
|
||||
@import "map.css";
|
||||
@import "donate.css";
|
||||
@import 'map.css';
|
||||
@import 'donate.css';
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
|
||||
.col-chk:checked ~ .col-lbl:before {
|
||||
content: '▼';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* noUI slider customizations */
|
||||
|
||||
.noUi-connects {
|
||||
|
||||
@@ -24,7 +24,8 @@ h6 {
|
||||
margin-top: 3em;
|
||||
margin-bottom: 0.5em;
|
||||
line-height: 1.2;
|
||||
font-family: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
|
||||
font-family: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro,
|
||||
sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -123,4 +124,3 @@ hr {
|
||||
background-color: #dea31d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
}
|
||||
|
||||
.mapbg-attrib {
|
||||
font: 12px / 20px Helvetica Neue, Arial, Helvetica, sans-serif;
|
||||
font:
|
||||
12px / 20px Helvetica Neue,
|
||||
Arial,
|
||||
Helvetica,
|
||||
sans-serif;
|
||||
background-color: hsla(0, 0%, 100%, 0.5);
|
||||
padding: 0 5px;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user