diff --git a/docs/plugins/controlproperties.rst b/docs/plugins/controlproperties.rst index b5905fa07..48fdd5b52 100644 --- a/docs/plugins/controlproperties.rst +++ b/docs/plugins/controlproperties.rst @@ -53,6 +53,11 @@ The following properties are recognized: ``__plugin_license__`` License of your plugin, optional, overrides the license specified in ``setup.py`` if provided. +.. _sec-plugins-controlproperties-plugin_privacypolicy: + +``__plugin_privacypolicy__`` + URL of the privacy policy of your plugin, optional. + .. _sec-plugins-controlproperties-plugin_pythoncompat: ``__plugin_pythoncompat__`` diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index 411ea6004..0d8fe2246 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -177,6 +177,9 @@ class ControlProperties: attr_license = "__plugin_license__" """ Module attribute from which to retrieve the plugin's license. """ + attr_privacypolicy = "__plugin_privacypolicy__" + """ Module attribute from which to retrieve the plugin's privacy policy URL, if any. """ + attr_pythoncompat = "__plugin_pythoncompat__" """ Module attribute from which to retrieve the plugin's python compatibility string. @@ -617,6 +620,19 @@ class PluginInfo: ControlProperties.attr_license, default=self._license, incl_metadata=True ) + @property + def privacypolicy(self): + """ + Privacy Policy URL of the plugin. Will be taken from the privacy policy attribute of the plugin module + as defined in :attr:`attr_privacypolicy` if available. May be None. + + Returns: + str or None: Privacy Policy URL of the plugin. + """ + return self._get_instance_attribute( + ControlProperties.attr_privacypolicy, default=None, incl_metadata=True + ) + @property def pythoncompat(self): """ diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 9a0dae841..757bc2d6e 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -1998,6 +1998,7 @@ class PluginManagerPlugin( "version": plugin.version, "url": plugin.url, "license": plugin.license, + "privacypolicy": plugin.privacypolicy, "python": plugin.pythoncompat, "bundled": plugin.bundled, "managable": plugin.managable, diff --git a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 index aaea76ef1..f4572dc67 100644 --- a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 +++ b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 @@ -149,12 +149,13 @@
()
{{ _('Homepage') }} + {{ _('Privacy Policy') }}
 
- + Python  
@@ -278,11 +279,12 @@
 {{ _('Details') }}  {{ _('Homepage') }} +  {{ _('Privacy Policy') }}
 
- +