diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-26 11:44:33 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-26 11:47:00 +0200 |
commit | f5af5feb5a41eb6e2796e480402106b55bd10f04 (patch) | |
tree | 7df617cb94eeb6b9fa1eb838db6c56be1378e2a4 | |
parent | ec3228cae714e4989dcedd96a855fc3a3481081e (diff) | |
download | PeerTube-f5af5feb5a41eb6e2796e480402106b55bd10f04.tar.gz PeerTube-f5af5feb5a41eb6e2796e480402106b55bd10f04.tar.zst PeerTube-f5af5feb5a41eb6e2796e480402106b55bd10f04.zip |
Use built in toc doc
As we mainly use this file on https://docs.joinpeertube.org/contribute/plugins
-rw-r--r-- | support/doc/plugins/guide.md | 80 |
1 files changed, 15 insertions, 65 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index 73f58330c..ff08ce8c4 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md | |||
@@ -1,56 +1,6 @@ | |||
1 | # Plugins & Themes | 1 | # Plugins & Themes |
2 | 2 | ||
3 | <!-- START doctoc generated TOC please keep comment here to allow auto update --> | 3 | [[toc]] |
4 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
5 | |||
6 | - [Concepts](#concepts) | ||
7 | - [Hooks](#hooks) | ||
8 | - [Static files](#static-files) | ||
9 | - [CSS](#css) | ||
10 | - [Server API (only for plugins)](#server-api-only-for-plugins) | ||
11 | - [Settings](#settings) | ||
12 | - [Storage](#storage) | ||
13 | - [Update video constants](#update-video-constants) | ||
14 | - [Add custom routes](#add-custom-routes) | ||
15 | - [Add custom WebSocket handlers](#add-custom-websocket-handlers) | ||
16 | - [Add external auth methods](#add-external-auth-methods) | ||
17 | - [Add new transcoding profiles](#add-new-transcoding-profiles) | ||
18 | - [Server helpers](#server-helpers) | ||
19 | - [Federation](#federation) | ||
20 | - [Client API (themes & plugins)](#client-api-themes--plugins) | ||
21 | - [Get plugin static and router routes](#get-plugin-static-and-router-routes) | ||
22 | - [Notifier](#notifier) | ||
23 | - [Markdown Renderer](#markdown-renderer) | ||
24 | - [Auth header](#auth-header) | ||
25 | - [Custom Modal](#custom-modal) | ||
26 | - [Translate](#translate) | ||
27 | - [Get public settings](#get-public-settings) | ||
28 | - [Get server config](#get-server-config) | ||
29 | - [Add custom fields to video form](#add-custom-fields-to-video-form) | ||
30 | - [Register settings script](#register-settings-script) | ||
31 | - [Plugin selector on HTML elements](#plugin-selector-on-html-elements) | ||
32 | - [HTML placeholder elements](#html-placeholder-elements) | ||
33 | - [Add/remove left menu links](#addremove-left-menu-links) | ||
34 | - [Create client page](#create-client-page) | ||
35 | - [Publishing](#publishing) | ||
36 | - [Write a plugin/theme](#write-a-plugintheme) | ||
37 | - [Clone the quickstart repository](#clone-the-quickstart-repository) | ||
38 | - [Configure your repository](#configure-your-repository) | ||
39 | - [Update README](#update-readme) | ||
40 | - [Update package.json](#update-packagejson) | ||
41 | - [Write code](#write-code) | ||
42 | - [Add translations](#add-translations) | ||
43 | - [Build your plugin](#build-your-plugin) | ||
44 | - [Test your plugin/theme](#test-your-plugintheme) | ||
45 | - [Publish](#publish) | ||
46 | - [Unpublish](#unpublish) | ||
47 | - [Plugin & Theme hooks/helpers API](#plugin--theme-hookshelpers-api) | ||
48 | - [Tips](#tips) | ||
49 | - [Compatibility with PeerTube](#compatibility-with-peertube) | ||
50 | - [Spam/moderation plugin](#spammoderation-plugin) | ||
51 | - [Other plugin examples](#other-plugin-examples) | ||
52 | |||
53 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
54 | 4 | ||
55 | ## Concepts | 5 | ## Concepts |
56 | 6 | ||
@@ -167,7 +117,7 @@ or `/themes/{theme-name}/{theme-version}/static/` routes. | |||
167 | Plugins can declare CSS files that PeerTube will automatically inject in the client. | 117 | Plugins can declare CSS files that PeerTube will automatically inject in the client. |
168 | If you need to override existing style, you can use the `#custom-css` selector: | 118 | If you need to override existing style, you can use the `#custom-css` selector: |
169 | 119 | ||
170 | ``` | 120 | ```css |
171 | body#custom-css { | 121 | body#custom-css { |
172 | color: red; | 122 | color: red; |
173 | } | 123 | } |
@@ -946,13 +896,13 @@ Steps: | |||
946 | 896 | ||
947 | If you develop a plugin, clone the `peertube-plugin-quickstart` repository: | 897 | If you develop a plugin, clone the `peertube-plugin-quickstart` repository: |
948 | 898 | ||
949 | ``` | 899 | ```sh |
950 | git clone https://framagit.org/framasoft/peertube/peertube-plugin-quickstart.git peertube-plugin-mysupername | 900 | git clone https://framagit.org/framasoft/peertube/peertube-plugin-quickstart.git peertube-plugin-mysupername |
951 | ``` | 901 | ``` |
952 | 902 | ||
953 | If you develop a theme, clone the `peertube-theme-quickstart` repository: | 903 | If you develop a theme, clone the `peertube-theme-quickstart` repository: |
954 | 904 | ||
955 | ``` | 905 | ```sh |
956 | git clone https://framagit.org/framasoft/peertube/peertube-theme-quickstart.git peertube-theme-mysupername | 906 | git clone https://framagit.org/framasoft/peertube/peertube-theme-quickstart.git peertube-theme-mysupername |
957 | ``` | 907 | ``` |
958 | 908 | ||
@@ -960,7 +910,7 @@ git clone https://framagit.org/framasoft/peertube/peertube-theme-quickstart.git | |||
960 | 910 | ||
961 | Set your repository URL: | 911 | Set your repository URL: |
962 | 912 | ||
963 | ``` | 913 | ```sh |
964 | cd peertube-plugin-mysupername # or cd peertube-theme-mysupername | 914 | cd peertube-plugin-mysupername # or cd peertube-theme-mysupername |
965 | git remote set-url origin https://your-git-repo | 915 | git remote set-url origin https://your-git-repo |
966 | ``` | 916 | ``` |
@@ -969,7 +919,7 @@ git remote set-url origin https://your-git-repo | |||
969 | 919 | ||
970 | Update `README.md` file: | 920 | Update `README.md` file: |
971 | 921 | ||
972 | ``` | 922 | ```sh |
973 | $EDITOR README.md | 923 | $EDITOR README.md |
974 | ``` | 924 | ``` |
975 | 925 | ||
@@ -1099,19 +1049,19 @@ If you added client scripts, you'll need to build them using webpack. | |||
1099 | 1049 | ||
1100 | Install webpack: | 1050 | Install webpack: |
1101 | 1051 | ||
1102 | ``` | 1052 | ```sh |
1103 | npm install | 1053 | npm install |
1104 | ``` | 1054 | ``` |
1105 | 1055 | ||
1106 | Add/update your files in the `clientFiles` array of `webpack.config.js`: | 1056 | Add/update your files in the `clientFiles` array of `webpack.config.js`: |
1107 | 1057 | ||
1108 | ``` | 1058 | ```sh |
1109 | $EDITOR ./webpack.config.js | 1059 | $EDITOR ./webpack.config.js |
1110 | ``` | 1060 | ``` |
1111 | 1061 | ||
1112 | Build your client files: | 1062 | Build your client files: |
1113 | 1063 | ||
1114 | ``` | 1064 | ```sh |
1115 | npm run build | 1065 | npm run build |
1116 | ``` | 1066 | ``` |
1117 | 1067 | ||
@@ -1128,31 +1078,31 @@ You'll need to have a local PeerTube instance: | |||
1128 | (to clone the repository, install dependencies and prepare the database) | 1078 | (to clone the repository, install dependencies and prepare the database) |
1129 | * Build PeerTube: | 1079 | * Build PeerTube: |
1130 | 1080 | ||
1131 | ``` | 1081 | ```sh |
1132 | npm run build | 1082 | npm run build |
1133 | ``` | 1083 | ``` |
1134 | 1084 | ||
1135 | * Build the CLI: | 1085 | * Build the CLI: |
1136 | 1086 | ||
1137 | ``` | 1087 | ```sh |
1138 | npm run setup:cli | 1088 | npm run setup:cli |
1139 | ``` | 1089 | ``` |
1140 | 1090 | ||
1141 | * Run PeerTube (you can access to your instance on `localhost:9000`): | 1091 | * Run PeerTube (you can access to your instance on `localhost:9000`): |
1142 | 1092 | ||
1143 | ``` | 1093 | ```sh |
1144 | NODE_ENV=dev npm start | 1094 | NODE_ENV=dev npm start |
1145 | ``` | 1095 | ``` |
1146 | 1096 | ||
1147 | * Register the instance via the CLI: | 1097 | * Register the instance via the CLI: |
1148 | 1098 | ||
1149 | ``` | 1099 | ```sh |
1150 | node ./dist/server/tools/peertube.js auth add -u 'http://localhost:9000' -U 'root' --password 'test' | 1100 | node ./dist/server/tools/peertube.js auth add -u 'http://localhost:9000' -U 'root' --password 'test' |
1151 | ``` | 1101 | ``` |
1152 | 1102 | ||
1153 | Then, you can install or reinstall your local plugin/theme by running: | 1103 | Then, you can install or reinstall your local plugin/theme by running: |
1154 | 1104 | ||
1155 | ``` | 1105 | ```sh |
1156 | node ./dist/server/tools/peertube.js plugins install --path /your/absolute/plugin-or-theme/path | 1106 | node ./dist/server/tools/peertube.js plugins install --path /your/absolute/plugin-or-theme/path |
1157 | ``` | 1107 | ``` |
1158 | 1108 | ||
@@ -1160,7 +1110,7 @@ node ./dist/server/tools/peertube.js plugins install --path /your/absolute/plugi | |||
1160 | 1110 | ||
1161 | Go in your plugin/theme directory, and run: | 1111 | Go in your plugin/theme directory, and run: |
1162 | 1112 | ||
1163 | ``` | 1113 | ```sh |
1164 | npm publish | 1114 | npm publish |
1165 | ``` | 1115 | ``` |
1166 | 1116 | ||