📝 Added version added info to all hooks
This commit is contained in:
1 parent
0d96f1b8ca
commit
d98b793705
1 file changed
+79
@@ -207,6 +207,8 @@ octoprint.access.permissions
|
||||
|
||||
.. py:function:: additional_permissions_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
Return a list of additional permissions to register in the system on behalf of the plugin. Use this
|
||||
to add granular permissions to your plugin which can be configured for users and user groups in the general
|
||||
access control settings of OctoPrint.
|
||||
@@ -261,6 +263,8 @@ octoprint.access.users.factory
|
||||
|
||||
.. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
Return a :class:`~octoprint.access.users.UserManager` instance to use as global user manager object. This will
|
||||
be called only once during initial server startup.
|
||||
|
||||
@@ -295,6 +299,8 @@ octoprint.accesscontrol.keyvalidator
|
||||
|
||||
.. py:function:: acl_keyvalidator_hook(apikey, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.6
|
||||
|
||||
Via this hook plugins may validate their own customized API keys to be used to access OctoPrint's API.
|
||||
|
||||
``apikey`` will be the API key as read from the request headers.
|
||||
@@ -326,6 +332,8 @@ octoprint.cli.commands
|
||||
|
||||
.. py:function:: cli_commands_hook(cli_group, pass_octoprint_ctx, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.0
|
||||
|
||||
By providing a handler for this hook plugins may register commands on OctoPrint's command line interface (CLI).
|
||||
|
||||
Handlers are expected to return a list of callables annotated as `Click commands <http://click.pocoo.org/5/>`_ to register with the
|
||||
@@ -449,6 +457,8 @@ octoprint.comm.protocol.firmware.info
|
||||
|
||||
.. py:function:: firmware_info_hook(comm_instance, firmware_name, firmware_data, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.9
|
||||
|
||||
Be notified of firmware information received from the printer following an ``M115``.
|
||||
|
||||
Hook handlers may use this to react/adjust behaviour based on reported firmware data. OctoPrint parses the received
|
||||
@@ -482,6 +492,8 @@ octoprint.comm.protocol.firmware.capabilities
|
||||
|
||||
.. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.9
|
||||
|
||||
Be notified of capability report entries received from the printer.
|
||||
|
||||
Hook handlers may use this to react to custom firmware capabilities. OctoPrint parses the received capability
|
||||
@@ -509,6 +521,8 @@ octoprint.comm.protocol.action
|
||||
|
||||
.. py:function:: protocol_action_hook(comm_instance, line, action, name='', params='', *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
React to a :ref:`action command <sec-features-action_commands>` received from the printer.
|
||||
|
||||
Hook handlers may use this to react to custom firmware messages. OctoPrint parses the received action
|
||||
@@ -553,6 +567,8 @@ This describes actually two hooks:
|
||||
|
||||
.. py:function:: protocol_atcommandphase_hook(comm_instance, phase, command, parameters, tags=None, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.7
|
||||
|
||||
Trigger on :ref:`@ commands <sec-features-atcommands>` as they progress through the ``queuing`` and ``sending``
|
||||
phases of the comm layer. See :ref:`the gcode phase hook <sec-plugins-hook-comm-protocol-gcode-phase>` for a
|
||||
detailed description of each of these phases.
|
||||
@@ -601,6 +617,8 @@ This actually describes four hooks:
|
||||
|
||||
.. py:function:: protocol_gcodephase_hook(comm_instance, phase, cmd, cmd_type, gcode, subcode=None, tags=None, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Pre- and postprocess commands as they progress through the various phases of being sent to the printer. The phases
|
||||
are the following:
|
||||
|
||||
@@ -754,6 +772,8 @@ octoprint.comm.protocol.gcode.received
|
||||
|
||||
.. py:function:: gcode_received_hook(comm_instance, line, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.0
|
||||
|
||||
Get the returned lines sent by the printer. Handlers should return the received line or in any case, the modified
|
||||
version of it. If the handler returns None, processing will be aborted and the communication layer will get an
|
||||
empty string as the received line. Note that Python functions will also automatically return ``None`` if an empty
|
||||
@@ -787,6 +807,8 @@ octoprint.comm.protocol.gcode.error
|
||||
|
||||
.. py:function:: gcode_error_hook(comm_instance, error_message, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.7
|
||||
|
||||
Get the messages of any errors messages sent by the printer, with the leading ``Error:`` or ``!!`` already
|
||||
stripped. Handlers should return True if they handled that error internally and it should not be processed by
|
||||
the system further. Normal processing of these kinds of errors - depending on the configuration of error
|
||||
@@ -824,6 +846,9 @@ octoprint.comm.protocol.scripts
|
||||
|
||||
.. py:function:: protocol_scripts_hook(comm_instance, script_type, script_name, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
.. versionchanged:: 1.3.7
|
||||
|
||||
Return a prefix to prepend, postfix to append, and optionally a dictionary of variables to provide to the script ``script_name`` of type ``type``. Handlers should
|
||||
make sure to only proceed with returning additional scripts if the ``script_type`` and ``script_name`` match
|
||||
handled scripts. If not, None should be returned directly.
|
||||
@@ -868,6 +893,8 @@ octoprint.comm.protocol.temperatures.received
|
||||
|
||||
.. py:function:: protocol_temperatures_received_hook(comm_instance, parsed_temperatures, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.6
|
||||
|
||||
Get the parsed temperatures returned by the printer, allowing handlers to modify them prior to handing them off
|
||||
to the system. Handlers are expected to either return ``parsed_temperatures`` as-is or a modified copy thereof.
|
||||
|
||||
@@ -901,6 +928,8 @@ octoprint.comm.transport.serial.additional_port_names
|
||||
|
||||
.. py:function:: additional_port_names_hook(candidates, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.4.1
|
||||
|
||||
Return additional port names (not glob patterns!) to use as a serial connection to the printer. Expected to be
|
||||
``list`` of ``string``s.
|
||||
|
||||
@@ -920,6 +949,8 @@ octoprint.comm.transport.serial.factory
|
||||
|
||||
.. py:function:: serial_factory_hook(comm_instance, port, baudrate, read_timeout, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Return a serial object to use as serial connection to the printer. If a handler cannot create a serial object
|
||||
for the specified ``port`` (and ``baudrate``), it should just return ``None``.
|
||||
|
||||
@@ -996,6 +1027,8 @@ octoprint.events.register_custom_events
|
||||
|
||||
.. py:function:: register_custom_events_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.11
|
||||
|
||||
Return a list of custom :ref:`events <sec-events>` to register in the system for your plugin.
|
||||
|
||||
Should return a list of strings which represent the custom events. Their name on the `octoprint.events.Events` object
|
||||
@@ -1024,6 +1057,8 @@ octoprint.filemanager.analysis.factory
|
||||
|
||||
.. py:function:: analysis_queue_factory_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.9
|
||||
|
||||
Return additional (or replacement) analysis queue factories used for analysing uploaded files.
|
||||
|
||||
Should return a dictionary to merge with the existing dictionary of factories, mapping from extension tree leaf
|
||||
@@ -1062,6 +1097,8 @@ octoprint.filemanager.extension_tree
|
||||
|
||||
.. py:function:: file_extension_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Return additional entries for the tree of accepted file extensions for uploading/handling by the file manager.
|
||||
|
||||
Should return a dictionary to merge with the existing extension tree, adding additional extension groups to
|
||||
@@ -1098,6 +1135,8 @@ octoprint.filemanager.preprocessor
|
||||
|
||||
.. py:function:: file_preprocessor_hook(path, file_object, links=None, printer_profile=None, allow_overwrite=False, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Replace the ``file_object`` used for saving added files to storage by calling :func:`~octoprint.filemanager.util.AbstractFileWrapper.save`.
|
||||
|
||||
``path`` will be the future path of the file on the storage. The file's name is accessible via
|
||||
@@ -1130,6 +1169,8 @@ octoprint.filemanager.preprocessor
|
||||
octoprint.plugin.backup.additional_excludes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.5.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-excludes>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-loginui-theming:
|
||||
@@ -1137,6 +1178,8 @@ See :ref:`here <sec-bundledplugins-backup-hooks-excludes>`.
|
||||
octoprint.plugin.loginui.theming
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-pluginmanager-reconnect:
|
||||
@@ -1144,6 +1187,8 @@ See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
|
||||
octoprint.plugin.pluginmanager.reconnect_hooks
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-pluginmanager-hooks-reconnect_hooks>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-softwareupdate-check_config:
|
||||
@@ -1151,6 +1196,8 @@ See :ref:`here <sec-bundledplugins-pluginmanager-hooks-reconnect_hooks>`.
|
||||
octoprint.plugin.softwareupdate.check_config
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-softwareupdate-hooks-check_config>`.
|
||||
|
||||
.. _sec-plugins-hooks-plugin-printer-additional_state_data
|
||||
@@ -1189,6 +1236,8 @@ octoprint.printer.factory
|
||||
|
||||
.. py:function:: printer_factory_hook(components, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.0
|
||||
|
||||
Return a :class:`~octoprint.printer.PrinterInstance` instance to use as global printer object. This will
|
||||
be called only once during initial server startup.
|
||||
|
||||
@@ -1220,6 +1269,8 @@ octoprint.printer.estimation.factory
|
||||
|
||||
.. py:function:: print_time_estimator_factory(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.9
|
||||
|
||||
Return a :class:`~octoprint.printer.estimation.PrintTimeEstimator` subclass (or factory) to use for print time
|
||||
estimation. This will be called on each start of a print or streaming job with a single parameter ``job_type``
|
||||
denoting the type of job that was just started: ``local`` meaning a print of a local file through the serial connection,
|
||||
@@ -1266,6 +1317,8 @@ octoprint.printer.sdcardupload
|
||||
|
||||
.. py:function:: sd_card_upload_hook(printer, filename, path, start_callback, success_callback, failure_callback, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.11
|
||||
|
||||
Via this hook plugins can change the way files are being uploaded to the sd card of the printer.
|
||||
|
||||
Implementations **must** call the provided ``start_callback`` on start of the file transfer and either the ``success_callback``
|
||||
@@ -1351,6 +1404,8 @@ octoprint.server.api.after_request
|
||||
|
||||
.. py:function:: after_request_handlers_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
||||
|
||||
Your plugin might need this to further restrict access to API methods.
|
||||
@@ -1366,6 +1421,8 @@ octoprint.server.api.before_request
|
||||
|
||||
.. py:function:: after_request_handlers_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
||||
|
||||
Your plugin might need this to further restrict access to API methods.
|
||||
@@ -1381,6 +1438,8 @@ octoprint.server.http.access_validator
|
||||
|
||||
.. py:function:: access_validator_hook(request, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows adding additional access validators to the default tornado routers.
|
||||
|
||||
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further.
|
||||
@@ -1396,6 +1455,8 @@ octoprint.server.http.bodysize
|
||||
|
||||
.. py:function:: server_bodysize_hook(current_max_body_sizes, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Allows extending the list of custom maximum body sizes on the web server per path and HTTP method with custom entries
|
||||
from plugins.
|
||||
|
||||
@@ -1438,6 +1499,8 @@ octoprint.server.http.routes
|
||||
|
||||
.. py:function:: server_route_hook(server_routes, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Allows extending the list of routes registered on the web server.
|
||||
|
||||
This is interesting for plugins which want to provide their own download URLs which will then be delivered statically
|
||||
@@ -1505,6 +1568,8 @@ octoprint.server.sockjs.authed
|
||||
|
||||
.. py:function:: socket_authed_hook(socket, user, *args, **kwargs):
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout).
|
||||
|
||||
:param object socket: the socket object which is about to be registered
|
||||
@@ -1517,6 +1582,8 @@ octoprint.server.sockjs.register
|
||||
|
||||
.. py:function:: socket_registration_hook(socket, user, *args, **kwargs):
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows plugins to prevent a new :ref:`push socket client <sec-api-push>` to be registered to the system.
|
||||
|
||||
Handlers should return either ``True`` or ``False``. ``True`` signals to proceed with normal registration. ``False``
|
||||
@@ -1536,6 +1603,8 @@ octoprint.server.sockjs.emit
|
||||
|
||||
.. py:function:: socket_emit_hook(socket, user, message, payload, *args, **kwargs):
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows plugins to prevent any messages to be emitted on an existing :ref:`push connection <sec-api-push>`.
|
||||
|
||||
Handlers should return either ``True`` to allow the message to be emitted, or ``False`` to prevent it.
|
||||
@@ -1556,6 +1625,8 @@ octoprint.timelapse.extensions
|
||||
|
||||
.. py:function:: timelapse_extension_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.3.10
|
||||
|
||||
Allows extending the set of supported file extensions for timelapse files. Handlers must return a list of
|
||||
additional file extensions.
|
||||
|
||||
@@ -1582,6 +1653,8 @@ octoprint.ui.web.templatetypes
|
||||
|
||||
.. py:function:: templatetype_hook(template_sorting, template_rules, *args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.2.0
|
||||
|
||||
Allows extending the set of supported template types in the web interface. This is interesting for plugins which want
|
||||
to offer other plugins to hook into their own offered UIs. Handlers must return a list of additional template
|
||||
specifications in form of 3-tuples.
|
||||
@@ -1700,6 +1773,8 @@ This actually describes two hooks:
|
||||
|
||||
.. py:function:: ui_theming_hook(*args, **kwargs)
|
||||
|
||||
.. versionadded:: 1.5.0
|
||||
|
||||
Support theming of the login or recovery dialog, just in case the core UI is themed as well. Use to return a list of additional
|
||||
CSS file URLs to inject into the dialog HTML.
|
||||
|
||||
@@ -1729,6 +1804,8 @@ octoprint.timelapse.capture.pre
|
||||
|
||||
.. py:function:: capture_pre_hook(filename)
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
Perform specific actions prior to capturing a timelapse frame.
|
||||
|
||||
``filename`` will be the future path of the frame to be saved.
|
||||
@@ -1744,6 +1821,8 @@ octoprint.timelapse.capture.post
|
||||
|
||||
.. py:function:: capture_post_hook(filename, success)
|
||||
|
||||
.. versionadded:: 1.4.0
|
||||
|
||||
Perform specific actions after capturing a timelapse frame.
|
||||
|
||||
``filename`` will be the path of the frame that should have been saved.
|
||||
|
||||
Reference in new issue
Block a user