external storage url variable
This commit is contained in:
parent
0a39ef2fe6
commit
eeb3a14ed3
@ -181,6 +181,7 @@
|
||||
"settings_variable_desc_auth_enabled": "Enable auth management",
|
||||
"settings_variable_desc_edition_auth_enabled": "Default user credentials will be %username%/%password%",
|
||||
"settings_variable_desc_external_url": "External url (i.e: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_external_storage_url": "External url for external storage (i.e: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Slide upload limit (in megabytes)",
|
||||
"settings_variable_desc_dark_mode": "Dark mode",
|
||||
"settings_variable_desc_intro_slide_duration": "Introduction slide duration (in seconds)",
|
||||
|
||||
@ -182,6 +182,7 @@
|
||||
"settings_variable_desc_auth_enabled": "Habilitar gestión de autenticación",
|
||||
"settings_variable_desc_edition_auth_enabled": "Las credenciales predeterminadas del usuario serán %username%/%password%",
|
||||
"settings_variable_desc_external_url": "URL externa (ej.: https://studio-01.company.com o http://10.10.3.100)",
|
||||
"settings_variable_desc_external_storage_url": "URL externa para almacenamiento externo(ej.: https://studio-01.company.com o http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Límite de carga de diapositivas (en megabytes)",
|
||||
"settings_variable_desc_dark_mode": "Modo oscuro",
|
||||
"settings_variable_desc_intro_slide_duration": "Duración de la diapositiva de introducción (en segundos)",
|
||||
|
||||
@ -183,6 +183,7 @@
|
||||
"settings_variable_desc_auth_enabled": "Activer la gestion de l'authentification",
|
||||
"settings_variable_desc_edition_auth_enabled": "Les identifiants de l'utilisateur par défaut seront %username%/%password%",
|
||||
"settings_variable_desc_external_url": "URL externe (i.e: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_external_storage_url": "URL externe pour le stockage externe (i.e: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Limite d'upload du fichier d'une slide (en mégaoctets)",
|
||||
"settings_variable_desc_dark_mode": "Mdoe sombre",
|
||||
"settings_variable_desc_intro_slide_duration": "Durée de la slide d'introduction (en secondes)",
|
||||
|
||||
@ -182,6 +182,7 @@
|
||||
"settings_variable_desc_auth_enabled": "Abilita la gestione autenticazione",
|
||||
"settings_variable_desc_edition_auth_enabled": "Le credenziali utente predefinite sono %username%/%password%",
|
||||
"settings_variable_desc_external_url": "Url esterno (esempio: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_external_storage_url": "Url esterno per l'archiviazione esterna (esempio: https://studio-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Limite upload slide (in megabytes)",
|
||||
"settings_variable_desc_dark_mode": "Modalità scura",
|
||||
"settings_variable_desc_intro_slide_duration": "Durata introduzione slide (in secondi)",
|
||||
|
||||
@ -14,6 +14,7 @@ from src.manager.UserManager import UserManager
|
||||
from src.manager.VariableManager import VariableManager
|
||||
from src.service.ModelManager import ModelManager
|
||||
from src.util.UtilFile import randomize_filename
|
||||
from src.util.UtilNetwork import get_preferred_ip_address
|
||||
|
||||
|
||||
class ContentManager(ModelManager):
|
||||
@ -224,8 +225,13 @@ class ContentManager(ModelManager):
|
||||
location = content.location
|
||||
|
||||
if content.type == ContentType.EXTERNAL_STORAGE:
|
||||
var_external_storage_url = self._variable_manager.get_one_by_name('external_url_storage').as_string().strip().strip('/')
|
||||
port_ex_st = self._config_manager.map().get('port_http_external_storage')
|
||||
location = "http://localhost:{}/{}".format(port_ex_st, content.location.strip('/'))
|
||||
location = "{}:{}/{}".format(
|
||||
var_external_storage_url if var_external_storage_url else 'http://{}'.format(get_preferred_ip_address()),
|
||||
port_ex_st,
|
||||
content.location.strip('/')
|
||||
)
|
||||
elif content.type == ContentType.YOUTUBE:
|
||||
location = "https://www.youtube.com/watch?v={}".format(content.location)
|
||||
elif len(var_external_url) > 0 and content.has_file():
|
||||
|
||||
@ -117,6 +117,7 @@ class VariableManager:
|
||||
### General
|
||||
{"name": "lang", "section": self.t(VariableSection.GENERAL), "value": "en", "type": VariableType.SELECT_SINGLE, "editable": True, "description": self.t('settings_variable_desc_lang'), "selectables": self.t(ApplicationLanguage), "refresh_player": False},
|
||||
{"name": "external_url", "section": self.t(VariableSection.GENERAL), "value": "", "type": VariableType.STRING, "editable": False if demo else True, "description": self.t('settings_variable_desc_external_url'), "refresh_player": False},
|
||||
{"name": "external_url_storage", "section": self.t(VariableSection.GENERAL), "value": "", "type": VariableType.STRING, "editable": False if demo else True, "description": self.t('settings_variable_desc_external_storage_url'), "refresh_player": False},
|
||||
{"name": "slide_upload_limit", "section": self.t(VariableSection.GENERAL), "value": 32, "unit": VariableUnit.MEGABYTE, "type": VariableType.INT, "editable": False if demo else True, "description": self.t('settings_variable_desc_slide_upload_limit'), "refresh_player": False},
|
||||
{"name": "dark_mode", "section": self.t(VariableSection.GENERAL), "value": True, "type": VariableType.BOOL, "editable": True, "description": self.t('settings_variable_desc_dark_mode'), "refresh_player": False},
|
||||
|
||||
|
||||
@ -8,6 +8,22 @@ from typing import Optional, List
|
||||
from src.service.Sysinfo import get_network_ipaddr, get_network_info
|
||||
|
||||
|
||||
def get_preferred_ip_address() -> str:
|
||||
network_interfaces = get_network_interfaces()
|
||||
interfaces = {iface['interface']: iface['ip_address'] for iface in network_interfaces}
|
||||
|
||||
if len(network_interfaces) == 0:
|
||||
return 'localhost'
|
||||
|
||||
if 'eth0' in interfaces:
|
||||
return interfaces['eth0']
|
||||
|
||||
if 'wlan0' in interfaces:
|
||||
return interfaces['wlan0']
|
||||
|
||||
return network_interfaces[0]['ip_address']
|
||||
|
||||
|
||||
def get_network_interfaces() -> List:
|
||||
return get_network_info(all=True)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user