View | Details | Raw Unified | Return to bug 24633
Collapse All | Expand All

(-)a/plugins/plugins-home.pl (-1 / +32 lines)
Lines 86-91 if ($plugins_enabled) { Link Here
86
                    push( @results, { repo => $r, result => $result } );
86
                    push( @results, { repo => $r, result => $result } );
87
                }
87
                }
88
            }
88
            }
89
            elsif ( $r->{service} eq 'gitlab' ) {
90
                my $org_name = $r->{org_name};
91
                my $url = "https://gitlab.com/api/v4/groups/$org_name/projects?with_issues_enabled=no\&with_merge_requests_enabled=no\&with_shared=no\&include_subgroups=yes\&search=koha-plugin+$plugin_search";
92
                my $response = from_json( get($url) );
93
                foreach my $result ( @{ $response } ) {
94
                    next unless $result->{name} =~ /^koha-plugin-/;
95
                    my $project_id   = $result->{id};
96
                    my $description  = $result->{description} // '';
97
                    my $web_url      = $result->{web_url};
98
                    my $releases_url = "https://gitlab.com/api/v4/projects/$project_id/releases";
99
                    my @releases     = @{ from_json( get($releases_url) ) };
100
101
                    if ( scalar @releases > 0 ) {
102
                        # Pick the first one, the latest release
103
                        my $latest = $releases[0];
104
                        my $name  = $latest->{name};
105
                        my @links = @{$latest->{assets}->{links}};
106
                        my $url   = $links[0]->{direct_asset_url};
107
                        my @parts = split( '/', $url);
108
                        my $filename = $parts[-1];
109
                        next unless $url =~ m/\.kpz$/;
110
                        my $result = {
111
                            description  => $description,
112
                            install_name => $filename,
113
                            install_url  => $url,
114
                            html_url     => $web_url,
115
                            name         => $name,
116
                        };
117
                        push @results, { repo => $r, result => $result };
118
                    }
119
                }
120
            }
89
        }
121
        }
90
122
91
        $template->param(
123
        $template->param(
92
- 

Return to bug 24633