diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-04-24 13:54:46 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-04-24 14:48:52 +0200 |
commit | 5fc045114c9b6faf0e7f506f0af06b8ca3a2996b (patch) | |
tree | 69e8118885a933ab513ee207ee884cac088b4d35 /lib/api/entities.rb | |
parent | 2a00858533f1dcae71e97ba52386bfb2bfc1f752 (diff) | |
download | gitlab-ce-pages-host-api.tar.gz |
Add `token`pages-host-api
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ee8480122c4..22195c6a994 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1628,5 +1628,44 @@ module API class ClusterProject < Cluster expose :project, using: Entities::BasicProjectDetails end + + module Pages + class ProjectLookupPath < Grape::Entity + expose :pages_https_only?, as: :https_only + expose :id, as: :project_id + expose :private_pages?, as: :access_control + + expose :prefix do |project, opts| + if project.pages_root? + '/' + else + project.full_path.delete_prefix(opts[:prefix]) + '/' + end + end + + expose :path do |project| + "#{project.public_pages_path}/" + end + end + + class Domain < Grape::Entity + end + + class PagesDomain < Domain + expose :certificate + expose :key + + expose :lookup_paths, using: Pages::ProjectLookupPath do |domain| + [domain.project] + end + end + + class NamespaceDomain < Domain + expose :lookup_paths, using: Pages::ProjectLookupPath do |group| + group.all_projects.with_pages.select(&:pages_deployed?) + .sort_by(&:pages_url).reverse + end + end + end end end |