Skip to content

Commit

Permalink
longer registration
Browse files Browse the repository at this point in the history
  • Loading branch information
iakat committed Oct 13, 2023
1 parent b558498 commit 7a7dca3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,26 @@ location /INSTANCE {
# -- https://adsb.lol/EHAM -> https://adsb.lol/?airport=EHAM --- if 4 a-z
# -- https://adsb.lol/AMS -> https://adsb.lol/?airport=AMS --- if 3 a-z
# -- https://adsb.lol/lat,lon -> https://adsb.lol/?lat=lat&lon=lon --- if , is found
# -- https://adsb.lol/KLM94G -> https://adsb.lol/?callsign=KLM94G --- if above not matched
# -- https://adsb.lol/KLM94G -> https://adsb.lol/?reg=KLM94G --- if above not matched
# regex woot woot!
# offload to @fallback on error_page 404 = @fallback;

location ~* "^/(?<airport>[a-zA-Z]{3,4})$" {
# /AMS, /EHAM, etc.
content_by_lua_block {
ngx.redirect("/?airport=" .. ngx.var.airport, ngx.HTTP_MOVED_TEMPORARILY)
}
}

location ~* "^/(?<icao>[0-9a-fA-F]{6}(?:,[0-9a-fA-F]{6})*)$" {
# /000000, /ffffff, etc
content_by_lua_block {
ngx.redirect("/?icao=" .. ngx.var.icao, ngx.HTTP_MOVED_TEMPORARILY)
}
}

location ~* "^/(?<lat>[0-9.-]+),(?<lon>[0-9.-]+)$" {
# 0,0 , 1,1 , -180,-180, etc.
content_by_lua_block {
ngx.log(ngx.ERR, "lat: " .. ngx.var.lat .. " lon: " .. ngx.var.lon)
}
Expand All @@ -187,7 +190,8 @@ location /INSTANCE {
}
}

location ~* "^/(?<reg>[a-zA-Z0-9-]{5,6}(?:,[a-zA-Z0-9-]{5,6})*)$" {
# registration
location ~* "^/(?<reg>[a-zA-Z0-9-]{5,12}(?:,[a-zA-Z0-9-]{5,12})*)$" {
content_by_lua_block {
ngx.var.reg = ngx.re.gsub(ngx.var.reg, "-", "")
ngx.redirect("/?reg=" .. ngx.var.reg, ngx.HTTP_MOVED_TEMPORARILY)
Expand Down

0 comments on commit 7a7dca3

Please sign in to comment.