add deny people not in range
This commit is contained in:
parent
a8d6279ef7
commit
adc362562e
1 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,7 @@ from .room import Room
|
|||
from .song import Song, init_db, get_song_by_title_artist, add_song_in_db, get_song_by_uuid
|
||||
from .song_fetch import query_search, yt_get_audio_url, yt_search_song
|
||||
from .qrcode_gen import generate_qr
|
||||
from .gps import is_within_range
|
||||
|
||||
|
||||
dotenv.load_dotenv()
|
||||
|
@ -74,6 +75,7 @@ def on_leave(data):
|
|||
def join():
|
||||
room_id = request.args.get("room")
|
||||
code = request.args.get("code")
|
||||
user_location = request.args.get("location")
|
||||
|
||||
if room_id is None:
|
||||
return error("Missing room id")
|
||||
|
@ -84,6 +86,9 @@ def join():
|
|||
if room.pin is not None and room.pin != code:
|
||||
return error("Invalid code")
|
||||
|
||||
if is_within_range(user_location, room.coord, room.range_size) is False:
|
||||
return error("You are not within the room range")
|
||||
|
||||
return {"success": True, "ws": f"/ws/{room_id}"}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue