285 lines
8.5 KiB
Plaintext
285 lines
8.5 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
|
# Copyright (C) 2023, The Funkwhale Collective
|
|
# This file is distributed under the same license as the funkwhale package.
|
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
#, fuzzy
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: funkwhale 1.2.10\n"
|
|
"Report-Msgid-Bugs-To: \n"
|
|
"POT-Creation-Date: 2023-03-24 18:14+0100\n"
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#: ../../developer/plugins/create.md:1
|
|
msgid "Write a plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:3
|
|
msgid "You can write plugins to extend the features of your Funkwhale pod. Follow the instructions in this guide to get started with your first plugin."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:10
|
|
msgid "Before you begin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:12
|
|
msgid "Before you start writing your plugin, you need to understand the following core concepts:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:19
|
|
msgid "We'll explain each of these concepts in the next few sections"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:21
|
|
msgid "Scopes"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:23
|
|
msgid "Plugins fall into two different **scopes**:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:25
|
|
msgid "User-level plugins that are configured by end-users for their own use"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:26
|
|
msgid "Pod-level plugins that are configured by pod admins and are not connected to a particular user"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:28
|
|
msgid "User-level plugins can also be used to import files from a third-party service, such as cloud storage or FTP."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:30
|
|
msgid "Hooks"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:32
|
|
msgid "**Hooks** are entrypoints that allow your plugin to listen to changes. You can create hooks to react to different events that occur in the Funkwhale application."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:34
|
|
msgid "An example of this can be seen in our Scrobbler plugin. We register a `LISTENING_CREATED` hook to notify any registered callback function when a listening is recorded. When a user listens to a track, the `notfy_lastfm` function fires."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:45
|
|
msgid "Available hooks"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.LISTENING_CREATED:1
|
|
msgid "Called when a track is being listened"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:51
|
|
msgid "Filters"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:53
|
|
msgid "**Filters** are entrypoints that allow you to modify or add information. When you use the `register_filter` decorator, your function should return a value to be used by the server."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:55
|
|
msgid "In this example, the `PLUGINS_DEPENDENCIES` filter is used to install additional dependencies required by your plugin. The `dependencies` function returns the additional dependency `django_prometheus` to request the dependency be installed by the server."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:68
|
|
msgid "Available filters"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.PLUGINS_DEPENDENCIES:1
|
|
msgid "Called with an empty list, use this filter to append pip dependencies to the list for installation."
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.PLUGINS_APPS:1
|
|
msgid "Called with an empty list, use this filter to append apps to INSTALLED_APPS"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.MIDDLEWARES_BEFORE:1
|
|
msgid "Called with an empty list, use this filter to prepend middlewares to MIDDLEWARE"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.MIDDLEWARES_AFTER:1
|
|
msgid "Called with an empty list, use this filter to append middlewares to MIDDLEWARE"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.URLS:1
|
|
msgid "Called with an empty list, use this filter to register new urls and views"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:78
|
|
msgid "Write your plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:80
|
|
msgid "Once you know what type of plugin you want to write and what entrypoint you want to use, you can start writing your plugin."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:82
|
|
msgid "Plugins are made up of the following 3 files:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:84
|
|
msgid "`__init__.py` - indicates that the directory is a Python package"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:85
|
|
msgid "`funkwhale_startup.py` - the file that loads during Funkwhale initialization"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:86
|
|
msgid "`funkwhale_ready.py` - the file that loads when Funkwhale is configured and ready"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:88
|
|
msgid "Declare your plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:90
|
|
msgid "You need to declare your plugin and its configuration options so that Funkwhale knows how to load the plugin. To do this, you must declare a new `plugins` instance in your `funkwhale_startup.py` file."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:92
|
|
msgid "Your `plugins` should include the following information:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:98
|
|
msgid "Parameter"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:99
|
|
msgid "Data type"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:100
|
|
msgid "Description"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:101
|
|
msgid "`name`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:102
|
|
#: ../../developer/plugins/create.md:105
|
|
#: ../../developer/plugins/create.md:108
|
|
#: ../../developer/plugins/create.md:111
|
|
msgid "String"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:103
|
|
msgid "The name of your plugin, used in the `.env` file"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:104
|
|
msgid "`label`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:106
|
|
msgid "The readable label that appears in the Funkwhale frontend"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:107
|
|
msgid "`description`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:109
|
|
msgid "A meaningful description of your plugin and what it does"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:110
|
|
msgid "`version`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:112
|
|
msgid "The version number of your plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:113
|
|
msgid "`user`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:114
|
|
msgid "Boolean"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:115
|
|
msgid "Whether the plugin is a **user-level** plugin or a **pod-level** plugin. See [scopes](#scopes) for more information"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:116
|
|
msgid "`conf`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:117
|
|
msgid "Array of Objects"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:118
|
|
msgid "A list of configuration options"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:121
|
|
msgid "In this example, we declare a new **user-level** plugin called \"My Plugin\". The user can configure a `greeting` in the plugin configuration."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:140
|
|
msgid "Write your plugin logic"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:142
|
|
msgid "Once you've declared your plugin, you can write the plugin code in your `funkwhale_ready.py` file."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:145
|
|
msgid "You must import your plugin declaration from your `funkwhale_startup.py` file."
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:148
|
|
msgid "In this example, we create a simple API endpoint that returns a greeting to the user. To do this:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:150
|
|
msgid "We create a new APIView class that accepts a `GET` request"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:151
|
|
msgid "We read the greeting value from the plugin `conf`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:152
|
|
msgid "We return the greeting value with the user's username"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:153
|
|
msgid "We register this view at the endpoint `/greeting`"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:193
|
|
msgid "Result"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:195
|
|
msgid "Here is an example of how the above plugin works:"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:197
|
|
msgid "User \"Harry\" enables the plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:198
|
|
msgid "\"Harry\" changes the greeting to \"You're a wizard\""
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:199
|
|
msgid "\"Harry\" visits the `/greeting` endpoint in their browser"
|
|
msgstr ""
|
|
|
|
#: ../../developer/plugins/create.md:200
|
|
msgid "The browser returns the message \"You're a wizard Harry\""
|
|
msgstr ""
|