122 lines
3.8 KiB
HTML
122 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="sv">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>HedgeDoc Agent - Lägg till dokument</title>
|
|
<style>
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
background-color: #f4f7f9;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
}
|
|
.container {
|
|
background: white;
|
|
padding: 2rem;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
width: 100%;
|
|
max-width: 500px;
|
|
}
|
|
h1 {
|
|
color: #333;
|
|
font-size: 1.5rem;
|
|
margin-bottom: 1.5rem;
|
|
text-align: center;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 1rem;
|
|
}
|
|
label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
color: #666;
|
|
font-size: 0.9rem;
|
|
}
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
border: 1px solid #ddd;
|
|
border-radius: 6px;
|
|
box-sizing: border-box;
|
|
font-size: 1rem;
|
|
}
|
|
button {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
#message {
|
|
margin-top: 1rem;
|
|
padding: 0.75rem;
|
|
border-radius: 6px;
|
|
display: none;
|
|
text-align: center;
|
|
font-size: 0.9rem;
|
|
}
|
|
.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
|
|
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🤖 HedgeAgent</h1>
|
|
<div class="form-group">
|
|
<label for="note_id">Klistra in HedgeDoc-URL eller ID</label>
|
|
<input type="text" id="note_id" placeholder="https://hedgedoc.../ID" required>
|
|
</div>
|
|
<button onclick="addNote()">Lägg till dokument</button>
|
|
<div id="message"></div>
|
|
</div>
|
|
|
|
<script>
|
|
async function addNote() {
|
|
const noteIdInput = document.getElementById('note_id');
|
|
const messageDiv = document.getElementById('message');
|
|
const note_id = noteIdInput.value.trim();
|
|
|
|
if (!note_id) return;
|
|
|
|
messageDiv.style.display = 'block';
|
|
messageDiv.className = '';
|
|
messageDiv.textContent = 'Lägger till...';
|
|
|
|
try {
|
|
const response = await fetch('/add_note', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ note_id })
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (response.ok) {
|
|
messageDiv.className = 'success';
|
|
messageDiv.textContent = '✅ Dokument tillagt och övervakas nu!';
|
|
noteIdInput.value = '';
|
|
} else {
|
|
messageDiv.className = 'error';
|
|
messageDiv.textContent = '❌ Fel: ' + (result.error || 'Okänt fel');
|
|
}
|
|
} catch (err) {
|
|
messageDiv.className = 'error';
|
|
messageDiv.textContent = '❌ Nätverksfel: Kunde inte kontakta agenten.';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|