Browse Source

Fix theme npm link

tags/v3.0.1
Chocobozzz 1 week ago
parent
commit
078b4716cd
No known key found for this signature in database GPG Key ID: 583A612D890159BE
5 changed files with 22 additions and 6 deletions
  1. +1
    -1
      client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
  2. +4
    -0
      client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
  3. +1
    -1
      client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
  4. +8
    -4
      client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
  5. +8
    -0
      client/src/app/+admin/plugins/shared/plugin-api.service.ts

+ 1
- 1
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html View 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>



+ 4
- 0
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts View 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
}


+ 1
- 1
client/src/app/+admin/plugins/plugin-search/plugin-search.component.html View 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>



+ 8
- 4
client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts View 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


+ 8
- 0
client/src/app/+admin/plugins/shared/plugin-api.service.ts View 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(


Loading…
Cancel
Save