aboutsummaryrefslogtreecommitdiffhomepage
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/doc/plugins/guide.md33
1 files changed, 26 insertions, 7 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 5c96d1b03..92cc20db0 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -889,12 +889,12 @@ If you want to use __Typescript__ see section below.
889 889
890You can add __PeerTube__ types as dev dependencies: 890You can add __PeerTube__ types as dev dependencies:
891``` 891```
892npm install --dev @peertube/peertube-types 892npm install --save-dev @peertube/peertube-types
893``` 893```
894 894
895This package exposes *server* definition files by default: 895This package exposes *server* definition files by default:
896```ts 896```ts
897import { RegisterServerOptions } from '@peertube/peertube-types' 897import { RegisterServerOptions } from '@peertube/peertube-types/server/types'
898 898
899export async function register ({ registerHook }: RegisterServerOptions) { 899export async function register ({ registerHook }: RegisterServerOptions) {
900 registerHook({ 900 registerHook({
@@ -906,14 +906,33 @@ export async function register ({ registerHook }: RegisterServerOptions) {
906 906
907But it also exposes client types and various models used in __PeerTube__: 907But it also exposes client types and various models used in __PeerTube__:
908```ts 908```ts
909import { RegisterClientOptions } from '@peertube/peertube-types/client' 909import { RegisterClientOptions } from '@larriereguichet/peertube-types/client/types';
910import { Video } from '@larriereguichet/peertube-types/shared';
910 911
911export function register ({ registerHook, peertubeHelpers }: RegisterClientOptions) { 912function register({ registerHook, peertubeHelpers }: RegisterClientOptions) {
912 registerHook({ 913 registerHook({
913 target: 'action:application.init', 914 target: 'action:admin-plugin-settings.init',
914 handler: () => onApplicationInit(peertubeHelpers) 915 handler: ({ npmName }: { npmName: string }) => {
915 }) 916 if ('peertube-plugin-transcription' !== npmName) {
917 return;
918 }
919 },
920 });
921
922 registerHook({
923 target: 'action:video-watch.video.loaded',
924 handler: ({ video }: { video: Video }) => {
925 fetch(`${peertubeHelpers.getBaseRouterRoute()}/videos/${video.uuid}/captions`, {
926 method: 'PUT',
927 headers: peertubeHelpers.getAuthHeader(),
928 })
929 .then((res) => res.json())
930 .then((data) => console.log('Hi %s.', data));
931 },
932 });
916} 933}
934
935export { register };
917``` 936```
918> Other types are accessible from the shared path `@peertube/peertube-types/shared`. 937> Other types are accessible from the shared path `@peertube/peertube-types/shared`.
919 938