58 lines
1.8 KiB
HTML
58 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>Gitea Sync AI 🧠</title>
|
||
<style>
|
||
body { font-family: sans-serif; padding: 20px; background: #f5f5f5; }
|
||
h1 { color: #333; }
|
||
.repo-card { background: white; margin: 10px 0; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,.1); }
|
||
button { padding: 8px 16px; cursor: pointer; border: none; border-radius: 4px; }
|
||
.btn-subscribe { background: #007bff; color: white; }
|
||
.btn-push { background: #28a745; color: white; }
|
||
input, button { margin-top: 10px; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<h1>🧠 Gitea Sync AI – Dashboard</h1>
|
||
|
||
<h3>Verfügbare Repositories:</h3>
|
||
<div id="repos"></div>
|
||
|
||
<script>
|
||
async function loadRepos() {
|
||
const res = await fetch("/api/repos");
|
||
const repos = await res.json();
|
||
const container = document.getElementById("repos");
|
||
container.innerHTML = "";
|
||
repos.forEach(repo => {
|
||
const card = document.createElement("div");
|
||
card.className = "repo-card";
|
||
card.innerHTML = `
|
||
<strong>${repo.name}</strong>
|
||
<p>${repo.full_name || repo.id} - ${repo.owner?.login || "unbekannt"}</p>
|
||
<button class="btn-subscribe" onclick="subscribe(${JSON.stringify(repo).replace(/"/g, '"')})">➕ Abonnieren & Klonen</button>
|
||
`;
|
||
container.appendChild(card);
|
||
});
|
||
}
|
||
|
||
async function subscribe(repo) {
|
||
const target = prompt("Ziel-Name (optional):") || repo.name;
|
||
const token = prompt("Gitea Token:");
|
||
|
||
await fetch("/api/subscribe", {
|
||
method: "POST",
|
||
headers: {"Content-Type": "application/json"},
|
||
body: JSON.stringify({repo_url: repo.clone_url, target_name: target, token})
|
||
});
|
||
|
||
alert(`📦 "${target}" wurde geklont!`);
|
||
}
|
||
|
||
loadRepos();
|
||
</script>
|
||
|
||
</body>
|
||
</html> |