mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 19:15:53 +08:00
Correctly set User-Agent header
This commit is contained in:
parent
dea95cb0ea
commit
8a8123a021
@ -43,6 +43,8 @@ class PluginBrowser(QObject, Extension):
|
|||||||
|
|
||||||
self._is_downloading = False
|
self._is_downloading = False
|
||||||
|
|
||||||
|
self._request_header = [b"User-Agent", str.encode("%s - %s" % (Application.getInstance().getApplicationName(), Application.getInstance().getVersion()))]
|
||||||
|
|
||||||
# Installed plugins are really installed after reboot. In order to prevent the user from downloading the
|
# Installed plugins are really installed after reboot. In order to prevent the user from downloading the
|
||||||
# same file over and over again, we keep track of the upgraded plugins.
|
# same file over and over again, we keep track of the upgraded plugins.
|
||||||
self._newly_installed_plugin_ids = []
|
self._newly_installed_plugin_ids = []
|
||||||
@ -67,6 +69,7 @@ class PluginBrowser(QObject, Extension):
|
|||||||
def requestPluginList(self):
|
def requestPluginList(self):
|
||||||
url = QUrl(self._api_url + "plugins")
|
url = QUrl(self._api_url + "plugins")
|
||||||
self._plugin_list_request = QNetworkRequest(url)
|
self._plugin_list_request = QNetworkRequest(url)
|
||||||
|
self._plugin_list_request.setRawHeader(*self._request_header)
|
||||||
self._network_manager.get(self._plugin_list_request)
|
self._network_manager.get(self._plugin_list_request)
|
||||||
|
|
||||||
def _createDialog(self):
|
def _createDialog(self):
|
||||||
@ -119,6 +122,7 @@ class PluginBrowser(QObject, Extension):
|
|||||||
Logger.log("i", "Attempting to download & install plugin from %s", url)
|
Logger.log("i", "Attempting to download & install plugin from %s", url)
|
||||||
url = QUrl(url)
|
url = QUrl(url)
|
||||||
self._download_plugin_request = QNetworkRequest(url)
|
self._download_plugin_request = QNetworkRequest(url)
|
||||||
|
self._download_plugin_request.setRawHeader(*self._request_header)
|
||||||
self._download_plugin_reply = self._network_manager.get(self._download_plugin_request)
|
self._download_plugin_reply = self._network_manager.get(self._download_plugin_request)
|
||||||
self._download_progress = 0
|
self._download_progress = 0
|
||||||
self.setIsDownloading(True)
|
self.setIsDownloading(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user