aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/plugins
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2021-11-09 13:49:08 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-12-16 10:08:43 +0100
commitb8fa3e8c734a46918118afe7976f248cc883f675 (patch)
tree0ebf8fd10b1c690602da14d4dd626cd04a9ff748 /support/doc/plugins
parent8b03e2ce1a2098261de2f729f660b1ae2a320b65 (diff)
downloadPeerTube-b8fa3e8c734a46918118afe7976f248cc883f675.tar.gz
PeerTube-b8fa3e8c734a46918118afe7976f248cc883f675.tar.zst
PeerTube-b8fa3e8c734a46918118afe7976f248cc883f675.zip
refactor(types): create dedicated folder for types package src
fix guide examples and add types package readme refactor(tsconfig): move back base tsconfig to base directory
Diffstat (limited to 'support/doc/plugins')
-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