diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-23 14:10:17 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-06-23 16:00:49 +0200 |
commit | 67ed6552b831df66713bac9e672738796128d33f (patch) | |
tree | 59c97d41e0b49d75a90aa3de987968ab9b1ff447 /client/src/app/core/plugins | |
parent | 0c4bacbff53bc732f5a2677d62a6ead7752e2405 (diff) | |
download | PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.gz PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.zst PeerTube-67ed6552b831df66713bac9e672738796128d33f.zip |
Reorganize client shared modules
Diffstat (limited to 'client/src/app/core/plugins')
-rw-r--r-- | client/src/app/core/plugins/hooks.service.ts | 3 | ||||
-rw-r--r-- | client/src/app/core/plugins/index.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/plugins/plugin.service.ts | 44 |
3 files changed, 27 insertions, 22 deletions
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts index 2fbf406d1..ec47aa48c 100644 --- a/client/src/app/core/plugins/hooks.service.ts +++ b/client/src/app/core/plugins/hooks.service.ts | |||
@@ -2,8 +2,7 @@ import { from, Observable } from 'rxjs' | |||
2 | import { mergeMap, switchMap } from 'rxjs/operators' | 2 | import { mergeMap, switchMap } from 'rxjs/operators' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { PluginService } from '@app/core/plugins/plugin.service' | 4 | import { PluginService } from '@app/core/plugins/plugin.service' |
5 | import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model' | 5 | import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models' |
6 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' | ||
7 | 6 | ||
8 | type RawFunction<U, T> = (params: U) => T | 7 | type RawFunction<U, T> = (params: U) => T |
9 | type ObservableFunction<U, T> = RawFunction<U, Observable<T>> | 8 | type ObservableFunction<U, T> = RawFunction<U, Observable<T>> |
diff --git a/client/src/app/core/plugins/index.ts b/client/src/app/core/plugins/index.ts new file mode 100644 index 000000000..b3239f1f3 --- /dev/null +++ b/client/src/app/core/plugins/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './hooks.service' | ||
2 | export * from './plugin.service' | ||
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index c6efcac6d..3cab64142 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts | |||
@@ -1,28 +1,33 @@ | |||
1 | import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { getCompleteLocale, isDefaultLocale, peertubeTranslate, ServerConfigPlugin } from '@shared/models' | ||
4 | import { ServerService } from '@app/core/server/server.service' | ||
5 | import { ClientScript } from '@shared/models/plugins/plugin-package-json.model' | ||
6 | import { ClientScript as ClientScriptModule } from '../../../types/client-script.model' | ||
7 | import { environment } from '../../../environments/environment' | ||
8 | import { Observable, of, ReplaySubject } from 'rxjs' | 1 | import { Observable, of, ReplaySubject } from 'rxjs' |
9 | import { catchError, first, map, shareReplay } from 'rxjs/operators' | 2 | import { catchError, first, map, shareReplay } from 'rxjs/operators' |
10 | import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' | ||
11 | import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model' | ||
12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' | ||
13 | import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' | ||
14 | import { HttpClient } from '@angular/common/http' | 3 | import { HttpClient } from '@angular/common/http' |
4 | import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' | ||
15 | import { AuthService } from '@app/core/auth' | 5 | import { AuthService } from '@app/core/auth' |
16 | import { Notifier } from '@app/core/notification' | 6 | import { Notifier } from '@app/core/notification' |
17 | import { RestExtractor } from '@app/shared/rest' | 7 | import { MarkdownService } from '@app/core/renderer' |
18 | import { MarkdownService } from '@app/shared/renderer' | 8 | import { RestExtractor } from '@app/core/rest' |
19 | import { PluginType } from '@shared/models/plugins/plugin.type' | 9 | import { ServerService } from '@app/core/server/server.service' |
20 | import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' | 10 | import { getDevLocale, importModule, isOnDevLocale } from '@app/helpers' |
21 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' | ||
22 | import { RegisterClientHelpers } from '../../../types/register-client-option.model' | ||
23 | import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model' | ||
24 | import { importModule } from '@app/shared/misc/utils' | ||
25 | import { CustomModalComponent } from '@app/modal/custom-modal.component' | 11 | import { CustomModalComponent } from '@app/modal/custom-modal.component' |
12 | import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' | ||
13 | import { | ||
14 | ClientHook, | ||
15 | ClientHookName, | ||
16 | clientHookObject, | ||
17 | ClientScript, | ||
18 | getCompleteLocale, | ||
19 | isDefaultLocale, | ||
20 | peertubeTranslate, | ||
21 | PluginClientScope, | ||
22 | PluginTranslation, | ||
23 | PluginType, | ||
24 | PublicServerSetting, | ||
25 | RegisterClientHookOptions, | ||
26 | ServerConfigPlugin | ||
27 | } from '@shared/models' | ||
28 | import { environment } from '../../../environments/environment' | ||
29 | import { ClientScript as ClientScriptModule } from '../../../types/client-script.model' | ||
30 | import { RegisterClientHelpers } from '../../../types/register-client-option.model' | ||
26 | 31 | ||
27 | interface HookStructValue extends RegisterClientHookOptions { | 32 | interface HookStructValue extends RegisterClientHookOptions { |
28 | plugin: ServerConfigPlugin | 33 | plugin: ServerConfigPlugin |
@@ -64,7 +69,6 @@ export class PluginService implements ClientHook { | |||
64 | private hooks: { [ name: string ]: HookStructValue[] } = {} | 69 | private hooks: { [ name: string ]: HookStructValue[] } = {} |
65 | 70 | ||
66 | constructor ( | 71 | constructor ( |
67 | private router: Router, | ||
68 | private authService: AuthService, | 72 | private authService: AuthService, |
69 | private notifier: Notifier, | 73 | private notifier: Notifier, |
70 | private markdownRenderer: MarkdownService, | 74 | private markdownRenderer: MarkdownService, |