]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix theme npm link
authorChocobozzz <me@florianbigard.com>
Mon, 11 Jan 2021 09:46:02 +0000 (10:46 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Jan 2021 09:46:02 +0000 (10:46 +0100)
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
client/src/app/+admin/plugins/shared/plugin-api.service.ts

index 919b5d26d93bf9f5a3479f096206f139c6fdfdcc..82a965313b57f41c0cdb30c72d376ba63261d604 100644 (file)
@@ -18,7 +18,7 @@
           <my-global-icon iconName="home"></my-global-icon>
         </a>
 
-        <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="'https://www.npmjs.com/package/peertube-plugin-' + plugin.name" i18n-title title="Plugin homepage (new window)">
+        <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin homepage (new window)">
           <my-global-icon iconName="npm"></my-global-icon>
         </a>
 
index 1ffd001c6e52a7c24f093d8ebc33374c75b10f2b..c78b195850ec14c77e6923285123b884c3c850f9 100644 (file)
@@ -149,6 +149,10 @@ export class PluginListInstalledComponent implements OnInit {
     return [ '/admin', 'plugins', 'show', this.pluginService.nameToNpmName(plugin.name, plugin.type) ]
   }
 
+  getPluginOrThemeHref (name: string) {
+    return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name)
+  }
+
   private getUpdatingKey (plugin: PeerTubePlugin) {
     return plugin.name + plugin.type
   }
index d3333a370aa4536748d987ab7dffa6853e1eec45..1b5fe45c6c5dd7b4285207c72e6c788dac9edd62 100644 (file)
@@ -41,7 +41,7 @@
           <my-global-icon iconName="home"></my-global-icon>
         </a>
 
-        <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="'https://www.npmjs.com/package/peertube-plugin-' + plugin.name" i18n-title title="Plugin npm package (new window)">
+        <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin npm package (new window)">
           <my-global-icon iconName="npm"></my-global-icon>
         </a>
 
index 1a6b4eba3ecf50c88aa7fdcc254c3ebf2291c096..4c571dee43298a3e9d9462d1b971db696b5f5199 100644 (file)
@@ -39,13 +39,13 @@ export class PluginSearchComponent implements OnInit {
   private searchSubject = new Subject<string>()
 
   constructor (
-    private pluginService: PluginApiService,
+    private pluginApiService: PluginApiService,
     private notifier: Notifier,
     private confirmService: ConfirmService,
     private router: Router,
     private route: ActivatedRoute
   ) {
-    this.pluginTypeOptions = this.pluginService.getPluginTypeOptions()
+    this.pluginTypeOptions = this.pluginApiService.getPluginTypeOptions()
   }
 
   ngOnInit () {
@@ -83,7 +83,7 @@ export class PluginSearchComponent implements OnInit {
   loadMorePlugins () {
     this.isSearching = true
 
-    this.pluginService.searchAvailablePlugins(this.pluginType, this.pagination, this.sort, this.search)
+    this.pluginApiService.searchAvailablePlugins(this.pluginType, this.pagination, this.sort, this.search)
         .subscribe(
           res => {
             this.isSearching = false
@@ -115,6 +115,10 @@ export class PluginSearchComponent implements OnInit {
     return !!this.installing[plugin.npmName]
   }
 
+  getPluginOrThemeHref (name: string) {
+    return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name)
+  }
+
   async install (plugin: PeerTubePluginIndex) {
     if (this.installing[plugin.npmName]) return
 
@@ -126,7 +130,7 @@ export class PluginSearchComponent implements OnInit {
 
     this.installing[plugin.npmName] = true
 
-    this.pluginService.install(plugin.npmName)
+    this.pluginApiService.install(plugin.npmName)
         .subscribe(
           () => {
             this.installing[plugin.npmName] = false
index b28d46df4a199e7407a384cb1a6eb20318b2906b..fad30576b3e552572dbea46abeb9f940c83dc62b 100644 (file)
@@ -134,6 +134,14 @@ export class PluginApiService {
                .pipe(catchError(res => this.restExtractor.handleError(res)))
   }
 
+  getPluginOrThemeHref (type: PluginType, name: string) {
+    const typeString = type === PluginType.PLUGIN
+      ? 'plugin'
+      : 'theme'
+
+    return `https://www.npmjs.com/package/peertube-${typeString}-${name}`
+  }
+
   private translateSettingsLabel (npmName: string, res: RegisteredServerSettings): Observable<RegisteredServerSettings> {
     return this.pluginService.translationsObservable
       .pipe(