handle reverse proxys
This commit is contained in:
parent
4ee1f6229f
commit
35bca0c0f7
@ -90,7 +90,7 @@ class PlayerController(ObController):
|
|||||||
def _get_dynamic_playlist_id(self, playlist_slug_or_id: Optional[str]) -> str:
|
def _get_dynamic_playlist_id(self, playlist_slug_or_id: Optional[str]) -> str:
|
||||||
if not playlist_slug_or_id and self._model_store.variable().get_one_by_name('fleet_player_enabled'):
|
if not playlist_slug_or_id and self._model_store.variable().get_one_by_name('fleet_player_enabled'):
|
||||||
node_player = self._model_store.node_player().get_one_by("host = '{}' and enabled = {}".format(
|
node_player = self._model_store.node_player().get_one_by("host = '{}' and enabled = {}".format(
|
||||||
get_safe_remote_addr(request.remote_addr),
|
get_safe_remote_addr(self.get_remote_addr()),
|
||||||
True
|
True
|
||||||
))
|
))
|
||||||
|
|
||||||
@ -99,3 +99,9 @@ class PlayerController(ObController):
|
|||||||
playlist_slug_or_id = node_player_group.playlist_id
|
playlist_slug_or_id = node_player_group.playlist_id
|
||||||
return playlist_slug_or_id
|
return playlist_slug_or_id
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_remote_addr() -> str:
|
||||||
|
if request.headers.get('X-Forwarded-For'):
|
||||||
|
return request.headers['X-Forwarded-For'].split(',')[0].strip()
|
||||||
|
else:
|
||||||
|
return request.remote_addr
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user