{#include layout}
{#title}Settings · {repo.ownerHandle}/{repo.name} – git-shark{/title}
<div class="repo-layout">
{#include RepositoryResource/sidebar nav=nav active='settings' /}
<section class="repo-main">
<h1>Settings</h1>
{#if error}
<p class="error">{error}</p>
{/if}
<section class="panel settings-card">
<h2>Visibility</h2>
<p class="muted">This repository is currently <strong>{repo.visibility.name()}</strong>.
Public repositories can be seen and cloned by anyone, including other federated instances;
private repositories are visible only to you and your collaborators.</p>
<form method="post" action="/repos/{repo.ownerHandle}/{repo.name}/visibility"
onsubmit="return confirm('Change the visibility of this repository?')">
<p>
<select name="visibility">
<option value="PUBLIC"{#if repo.visibility.name() == 'PUBLIC'} selected{/if}>Public</option>
<option value="PRIVATE"{#if repo.visibility.name() == 'PRIVATE'} selected{/if}>Private</option>
</select>
</p>
<button class="btn btn-primary">Change visibility</button>
</form>
</section>
<section class="panel settings-card">
<h2>Repository image</h2>
<p class="muted">Shown next to this repository across git-shark. Without one, the owner's profile picture is used.</p>
{#if repo.hasImage}
<img class="avatar-preview" src="/repos/{repo.ownerHandle}/{repo.name}/image?v={repo.imageUpdatedAt.toEpochMilli}" alt="Current repository image">
{/if}
<form method="post" action="/repos/{repo.ownerHandle}/{repo.name}/image" enctype="multipart/form-data">
<p><input type="file" name="image" accept="image/png,image/jpeg,image/gif,image/webp" required></p>
<p class="muted">PNG, JPEG, GIF or WebP, up to 2 MB.</p>
<button class="btn btn-primary">Upload</button>
</form>
{#if repo.hasImage}
<form method="post" action="/repos/{repo.ownerHandle}/{repo.name}/image/delete"
onsubmit="return confirm('Remove this repository image?')">
<button class="btn btn-danger">Remove image</button>
</form>
{/if}
</section>
<section class="panel settings-card">
<h2>Collaborators</h2>
<p class="muted">Grant other users read and write access to this repository, including when it is private.</p>
<p><a class="btn btn-secondary" href="/repos/{repo.ownerHandle}/{repo.name}/settings/collaborators">Manage collaborators</a></p>
</section>
<section class="panel settings-card">
<h2>Push mirrors</h2>
{#if mirrors}
<ul class="mirror-list">
{#for m in mirrors}
<li class="mirror-row">
<div class="mirror-url"><code>{m.remoteUrl}</code> <span class="tag">{m.authType.name()}</span></div>
<div class="mirror-status meta">
{#if m.lastError}
<span class="mirror-error">Last attempt failed: {m.lastError}</span>
{#else if m.lastSuccessAt}
<span>Last synced {m.lastSuccessAt}</span>
{#else}
<span>Not synced yet</span>
{/if}
{#if m.lastAttemptAt}<span> · last attempt {m.lastAttemptAt}</span>{/if}
</div>
{#if m.publicKey}
<div class="mirror-key">
<p class="meta">Add this deploy key (with write access) at the remote:</p>
<div class="mirror-deploy-key">
<code>{m.publicKey}</code>
<button type="button" class="btn-icon copy-btn" data-copy="{m.publicKey}" aria-label="Copy deploy key" title="Copy">⧉</button>
</div>
</div>
{/if}
<div class="mirror-actions">
<form class="inline" method="post" action="/repos/{repo.ownerHandle}/{repo.name}/mirrors/{m.id}/push">
<button class="btn">Push now</button>
</form>
<form class="inline" method="post" action="/repos/{repo.ownerHandle}/{repo.name}/mirrors/{m.id}/delete">
<button class="btn btn-danger">Delete</button>
</form>
</div>
</li>
{/for}
</ul>
{/if}
<form method="post" action="/repos/{repo.ownerHandle}/{repo.name}/mirrors" class="mirror-add">
<p><label>Remote URL <input name="url" placeholder="https://host/owner/repo.git or ssh://git@host/owner/repo.git" required></label></p>
<p><label>Authentication
<select name="authType">
<option value="HTTPS">HTTPS — username + password/token</option>
<option value="SSH">SSH — generated deploy key</option>
</select>
</label></p>
<p><label>Username (HTTPS only) <input name="username" autocomplete="off"></label></p>
<p><label>Password / token (HTTPS only) <input type="password" name="secret" autocomplete="new-password"></label></p>
<button class="btn">Add mirror</button>
</form>
</section>
<section class="panel settings-card">
<h2>Danger zone</h2>
<form method="post" action="/repos/{repo.ownerHandle}/{repo.name}/delete">
<p><label>Type the repository name to confirm deletion <input name="confirm"></label></p>
<button class="btn btn-danger">Delete repository</button>
</form>
</section>
</section>
</div>
{/include}