import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model'
import { HttpClient } from '@angular/common/http'
-import { AuthService } from '@app/core/auth'
+import { AuthService, Notifier } from '@app/core'
import { RestExtractor } from '@app/shared/rest'
import { PluginType } from '@shared/models/plugins/plugin.type'
import { PublicServerSetting } from '@shared/models/plugins/public-server.setting'
constructor (
private router: Router,
private authService: AuthService,
+ private notifier: Notifier,
private server: ServerService,
private zone: NgZone,
private authHttp: HttpClient,
return this.authService.isLoggedIn()
},
+ notifier: this.notifier,
+
translate: (value: string) => {
return this.translationsObservable
.pipe(map(allTranslations => allTranslations[npmName]))
import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model'
+import { Notifier } from '@app/core'
export type RegisterClientOptions = {
registerHook: (options: RegisterClientHookOptions) => void
getSettings: () => Promise<{ [ name: string ]: string }>
+ notifier: Notifier
+
translate: (toTranslate: string) => Promise<string>
}
### Client helpers (themes & plugins)
-### Plugin static route
+#### Plugin static route
To get your plugin static route:
const imageUrl = baseStaticUrl + '/images/chocobo.png'
```
+#### Notifier
+
+To notify the user with the PeerTube ToastModule:
+
+```js
+const { notifier } = peertubeHelpers
+notifier.success('Success message content.')
+notifier.error('Error message content.')
+```
+
#### Translate
You can translate some strings of your plugin (PeerTube will use your `translations` object of your `package.json` file):