fixed xss && fixed configjs

This commit is contained in:
Adolfo Gómez García 2020-05-11 13:35:28 +02:00
parent c69512bf8b
commit 65bb91c449
2 changed files with 14 additions and 2 deletions

View File

@ -100,7 +100,7 @@ def getIdleDuration() -> float:
xss.XScreenSaverQueryInfo(display, xlib.XDefaultRootWindow(display), xssInfo)
# Centos seems to set state to 1?? (weird, but it's happening don't know why... will try this way)
# States: 0 = off, 1 = On, 2 = Cycle, 3 = Disabled, ...?
if xssInfo.contents.state == 1: # state = 1 means "active", so idle is not a valid state
return 3600 * 100 * 1000 # If screen saver is active, return a high enough value

View File

@ -45,7 +45,7 @@ from uds.REST.methods.client import CLIENT_VERSION
from uds.core.managers import downloadsManager
from uds.core.util.config import GlobalConfig
from uds.core import VERSION, VERSION_STAMP
from uds.models import Authenticator, Image
from uds.models import Authenticator, Image, Network, Transport
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
@ -136,6 +136,17 @@ def udsJs(request: 'HttpRequest') -> str:
}
}
if request.user and request.user.isStaff():
info = {
'networks': [n.name for n in Network.networksFor(request.ip)],
'transports': [t.name for t in Transport.objects.all() if t.validForIp(request.ip)],
'ip': request.ip,
'ip_proxy': request.ip_proxy
}
else:
info = None
# all plugins are under url clients...
plugins = [
{
@ -176,6 +187,7 @@ def udsJs(request: 'HttpRequest') -> str:
uds = {
'profile': profile,
'config': config,
'info': info,
'plugins': plugins,
'actors': actors,
'errors': errors,