package webui import ( "github.com/pogo-vcs/pogo/db" "github.com/pogo-vcs/pogo/server/webui/components" "strconv" ) templ Settings() { if !IsLoggedIn(ctx) { @layout("Unauthorized") { @components.Header(nil) @components.Main() {
You must be logged in to access repository settings.
} } } else { if repoIdStr, ok := GetParam(ctx, "id"); ok { if repoId, err := strconv.ParseInt(repoIdStr, 10, 32); err == nil { if repo, err := db.Q.GetRepository(ctx, int32(repoId)); err == nil { {{ user := GetUser(ctx) }} {{ hasAccess := false }} if user != nil { if accessCheck, err := db.Q.CheckUserRepositoryAccess(ctx, repo.ID, user.ID); err == nil { {{ hasAccess = accessCheck }} } } if !hasAccess { @layout("Unauthorized") { @components.Header(user) @components.Main() {You do not have access to manage this repository.
} } } else { @layout(repo.Name + " - Settings") { @components.Header(user) { Back to Repository } @components.Main() {Current visibility: if repo.Public { Public } else { Private }
if repo.Public { Public repositories can be accessed by anyone. Making it private will restrict access to users you explicitly grant access to. } else { Private repositories can only be accessed by users you explicitly grant access to. Making it public will allow anyone to access it. }
No users have access to this repository.
} } else {Failed to load users.
}
Secrets can be used in CI pipeline configurations using the { "{{ secret \"KEY\" }}" } template function.
They are useful for storing sensitive data like API tokens and credentials.
No secrets configured.
} } else {Failed to load secrets.
}The repository you are looking for does not exist.
} } } } else { @layout("Invalid Repository ID") { @components.Header(GetUser(ctx)) @components.Main() {The repository ID is invalid.
} } } } else { @layout("Missing Repository ID") { @components.Header(GetUser(ctx)) @components.Main() {No repository ID was provided.
} } } } } script confirmVisibilityChange(isPublic bool, repoId int) { const action = isPublic ? "private" : "public"; const actionText = isPublic ? "make this repository private" : "make this repository public"; const warning = isPublic ? "This will restrict access to only users you have explicitly granted access to." : "This will allow anyone to access this repository, including cloning and viewing its contents."; if (confirm(`Are you sure you want to ${actionText}?\n\n${warning}`)) { const form = document.createElement('form'); form.method = 'POST'; form.action = `/api/repository/${repoId}/visibility`; const input = document.createElement('input'); input.type = 'hidden'; input.name = 'public'; input.value = isPublic ? 'false' : 'true'; form.appendChild(input); document.body.appendChild(form); form.submit(); } } script toggleSecretVisibility(key string) { const valueEl = document.getElementById('secret-value-' + key); const btn = event.target; if (valueEl.classList.contains('hidden')) { valueEl.classList.remove('hidden'); btn.textContent = 'Hide'; } else { valueEl.classList.add('hidden'); btn.textContent = 'Show'; } }