summaryrefslogtreecommitdiff
path: root/qutebrowser/commands
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-12-18 22:32:59 +0100
committerFlorian Bruhin <me@the-compiler.org>2019-12-20 16:53:17 +0100
commit4151680e9388f5266677e77596f9989867a48fbd (patch)
tree681b7347c36bf30846693e03d130b6531a0cbdb9 /qutebrowser/commands
parent7330eb57be46a8fcb37366719069ef0e0b68899c (diff)
downloadqutebrowser-4151680e9388f5266677e77596f9989867a48fbd.tar.gz
qutebrowser-4151680e9388f5266677e77596f9989867a48fbd.zip
Refactor user agent handling
We now use a format string for the user_agent setting and parse both backend's default user agents to get the needed information. Fixes #513
Diffstat (limited to 'qutebrowser/commands')
-rw-r--r--qutebrowser/commands/userscripts.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py
index 439af695c..8ff19c7d8 100644
--- a/qutebrowser/commands/userscripts.py
+++ b/qutebrowser/commands/userscripts.py
@@ -28,7 +28,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QSocketNotifier
from qutebrowser.utils import message, log, objreg, standarddir, utils
from qutebrowser.commands import runners
-from qutebrowser.config import config
+from qutebrowser.config import websettings
from qutebrowser.misc import guiprocess
from qutebrowser.browser import downloads
@@ -429,10 +429,8 @@ def run_async(tab, cmd, *args, win_id, env, verbose=False):
lambda cmd:
log.commands.debug("Got userscript command: {}".format(cmd)))
runner.got_cmd.connect(commandrunner.run_safely)
- user_agent = config.val.content.headers.user_agent
- if user_agent is not None:
- env['QUTE_USER_AGENT'] = user_agent
+ env['QUTE_USER_AGENT'] = websettings.user_agent()
env['QUTE_CONFIG_DIR'] = standarddir.config()
env['QUTE_DATA_DIR'] = standarddir.data()
env['QUTE_DOWNLOAD_DIR'] = downloads.download_dir()