Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion checks/audio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import html
import re

from .vars import *
Expand Down Expand Up @@ -38,7 +39,7 @@ def checkAudioBuffering(lines):
if (len(lines) > index):
m = audiobuf_re.search(lines[index + 1].replace('\r', ''))
if m and m.group("source"):
append += "<br><br>Source affected (potential cause):<strong>" + m.group("source") + "</strong>"
append += "<br><br>Source affected (potential cause):<strong>" + html.escape(m.group("source")) + "</strong>"
break
return [LEVEL_INFO, "Max Audio Buffering",
"Audio buffering hit the maximum value. This can be an indicator of very high system load and may affect stream latency or cause individual audio sources to stop working. Keep an eye on CPU usage especially, and close background programs if needed. <br><br>Occasionally, this can be caused by incorrect device timestamps. Restart OBS to reset buffering." + append]
Expand Down
2 changes: 1 addition & 1 deletion checks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def checkSafeMode(lines):
for line in modulesNotLoaded:
found = re.search(r"'([^']+)'", line)
if found:
moduleNames.append(found.group(1))
moduleNames.append(html.escape(found.group(1)))

if moduleNames:
modulesNotLoadedString = "<br>\n<ul>\n<li>" + "</li>\n<li>".join(moduleNames) + "</li>\n</ul>"
Expand Down
16 changes: 13 additions & 3 deletions checks/linux.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import html

from .vars import *
from .utils.utils import *

Expand Down Expand Up @@ -42,7 +44,15 @@ def isX11(lines):
return True


def isUbuntu2004(line):
if any(distro in line for distro in ['"Ubuntu" "20.04"', html.escape('"Ubuntu" "20.04"')]):
return True
else:
return False


def checkDistro(lines):
"""The distro log line is escaped before adding to the returned list. Take care when comparing against this value."""
isDistroNix = search('Distribution:', lines)

if len(isDistroNix) <= 0:
Expand All @@ -59,7 +69,7 @@ def checkDistro(lines):
distroHelp = 'No distribution detected. This can lead to undefined behavior. Please consult your distribution\'s support channels on how to fix this.'
return [LEVEL_WARNING, distro, distroHelp]

return [LEVEL_INFO, distro, distroHelp]
return [LEVEL_INFO, html.escape(distro), distroHelp]
Comment thread
RytoEX marked this conversation as resolved.


def checkFlatpak(lines):
Expand Down Expand Up @@ -90,7 +100,7 @@ def checkWayland(lines):
return

isDistroNix = checkDistro(lines)
if isDistroNix and ('"Ubuntu" "20.04"' in isDistroNix[1]):
if isDistroNix and isUbuntu2004(isDistroNix[1]):
return [LEVEL_CRITICAL, "Ubuntu 20.04 under Wayland",
"Ubuntu 20.04 does not provide the needed dependencies for OBS to capture under Wayland.<br> Capture will only function under X11/Xorg."]

Expand Down Expand Up @@ -148,7 +158,7 @@ def checkDesktopEnvironment(lines):
desktopEnvironment = ''

if (len(desktopEnvironment) > 0):
return [LEVEL_INFO, desktopEnvironment, '']
return [LEVEL_INFO, html.escape(desktopEnvironment), '']


def checkMissingModules(lines):
Expand Down
6 changes: 4 additions & 2 deletions checks/plugins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import html

from .vars import *
from .utils.utils import *
from .core import *
Expand All @@ -14,7 +16,7 @@ def checkImports(lines):
if plugin:
notLoadedPlugins.append(plugin)

pluginString = "<br><li>".join(str(plugin) for plugin in notLoadedPlugins)
pluginString = "<br><li>".join(html.escape(plugin) for plugin in notLoadedPlugins)
if notLoadedPlugins:
pluginString = f"<br><br>Plugins affected:<br><ul><li>{pluginString}</ul>"
return [LEVEL_WARNING, f"Plugins Not Loaded ({len(notLoadedPlugins)})",
Expand Down Expand Up @@ -52,7 +54,7 @@ def checkPluginList(lines):
else:
thirdPartyPlugins = []

pluginString = "<br><li>".join(str(plugin) for plugin in thirdPartyPlugins)
pluginString = "<br><li>".join(html.escape(plugin) for plugin in thirdPartyPlugins)

if thirdPartyPlugins:
return [LEVEL_INFO, f"Third-Party Plugins ({len(thirdPartyPlugins)})",
Expand Down
5 changes: 3 additions & 2 deletions checks/utils/fetchers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import html
import requests
import re

Expand All @@ -23,7 +24,7 @@ def getLinesGist(gistObject):


def getDescriptionGist(gistObject):
desc = gistObject['description']
desc = html.escape(gistObject['description'])
Comment thread
RytoEX marked this conversation as resolved.
if (desc == "" or desc is None):
desc = gistObject['id']
return [0, "DESCRIPTION", desc]
Expand All @@ -49,7 +50,7 @@ def getLinesHaste(hasteObject):


def getDescription(lines):
return [0, "DESCRIPTION", lines[0]]
return [0, "DESCRIPTION", html.escape(lines[0])]


# obsproject.com
Expand Down
6 changes: 3 additions & 3 deletions checks/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def checkRefreshes(lines):
if len(r) > 1:
rfrshs = "<br>"
for output, hz in refreshes.items():
rfrshs += "<br>" + output + ": <strong>" + str(int(hz)) + "</strong>Hz"
rfrshs += "<br>" + html.escape(output) + ": <strong>" + str(int(hz)) + "</strong>Hz"
return [LEVEL_WARNING, "Mismatched Refresh Rates",
"The version of Windows you are running has a limitation which causes performance issues in hardware accelerated applications (such as games) if multiple monitors with different refresh rates are present. Your system's monitors have " + str(len(r)) + """ different refresh rates, so you are affected by this limitation. <br><br>To fix this issue, we recommend updating to the Windows 10 May 2020 Update. Follow <a href="https://blogs.windows.com/windowsexperience/2020/05/27/how-to-get-the-windows-10-may-2020-update/">these instructions</a> if you're not sure how to update.""" + rfrshs]
return
Expand Down Expand Up @@ -174,7 +174,7 @@ def checkWasapiSamples(lines):
if obsSample != "":
smpls += "<br>OBS Sample Rate: <strong>" + str(obsSample) + "</strong> Hz"
for d, hz in samples.items():
smpls += "<br>" + d + ": <strong>" + str(hz) + "</strong> Hz"
smpls += "<br>" + html.escape(d) + ": <strong>" + str(hz) + "</strong> Hz"
return [LEVEL_WARNING, "Mismatched Sample Rates",
"At least one of your audio devices has a sample rate that doesn't match the rest. This can result in audio drift over time or sound distortion. Check your audio devices in Windows settings (both Playback and Recording) and ensure the Default Format (under Advanced) is consistent. 48000 Hz is recommended." + smpls]

Expand Down Expand Up @@ -350,7 +350,7 @@ def checkGCAdmin(lines):
error_lines = search("could not open process:", lines)
gc_error_lines = search("game-capture", error_lines) # Makes sure the error comes from a game capture, in case.
if gc_error_lines:
exe_list = set([gc_admin_re.search(line).group("executable").strip() for line in gc_error_lines])
exe_list = set([html.escape(gc_admin_re.search(line).group("executable").strip()) for line in gc_error_lines])
return [LEVEL_INFO, "Game Capture Permissions",
"Game Capture was unable to capture the following applications. This may be solved by running OBS as an Administrator:<br>\n<ul>\n<li>"
+ "</li>\n<li>".join(exe_list)
Expand Down