Upload files to "public"
This commit is contained in:
parent
920d49ef7d
commit
ac019e6274
93
public/dashboard.html
Normal file
93
public/dashboard.html
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dashboard</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; padding: 10px; }
|
||||||
|
input { margin: 5px 0; }
|
||||||
|
#logs { margin-top: 20px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Auto Update Settings</h2>
|
||||||
|
<input type="text" id="baseUrl" placeholder="Enter base URL (e.g., https://novelbin.com/b/a-villains-will-to-survive/)" /><br/>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="autoUpdateToggle" />
|
||||||
|
Auto Update Chapters
|
||||||
|
</label><br/>
|
||||||
|
<button id="logoutBtn">Logout</button>
|
||||||
|
<div id="status"></div>
|
||||||
|
|
||||||
|
<h3>Update Logs</h3>
|
||||||
|
<ul id="logs"></ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const autoUpdateToggle = document.getElementById('autoUpdateToggle');
|
||||||
|
const baseUrlInput = document.getElementById('baseUrl');
|
||||||
|
const statusDiv = document.getElementById('status');
|
||||||
|
const logsUl = document.getElementById('logs');
|
||||||
|
const logoutBtn = document.getElementById('logoutBtn');
|
||||||
|
|
||||||
|
autoUpdateToggle.addEventListener('change', function(e) {
|
||||||
|
if(e.target.checked) {
|
||||||
|
const baseUrl = baseUrlInput.value.trim();
|
||||||
|
if(!baseUrl) {
|
||||||
|
statusDiv.textContent = 'Please enter a base URL.';
|
||||||
|
autoUpdateToggle.checked = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startAutoUpdate(baseUrl);
|
||||||
|
} else {
|
||||||
|
stopAutoUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function startAutoUpdate(baseUrl) {
|
||||||
|
fetch('/start', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ baseUrl })
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
statusDiv.textContent = data.message;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
statusDiv.textContent = 'Error starting auto update.';
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopAutoUpdate() {
|
||||||
|
fetch('/stop', { method: 'POST' })
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
statusDiv.textContent = data.message;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
statusDiv.textContent = 'Error stopping auto update.';
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Poll the update logs every 5 seconds
|
||||||
|
setInterval(() => {
|
||||||
|
fetch('/logs')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
logsUl.innerHTML = '';
|
||||||
|
data.updates.forEach(update => {
|
||||||
|
const li = document.createElement('li');
|
||||||
|
li.textContent = `${new Date(update.timestamp).toLocaleTimeString()}: ${update.url}`;
|
||||||
|
logsUl.appendChild(li);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
logoutBtn.addEventListener('click', function() {
|
||||||
|
window.location.href = '/logout';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
14
public/login.html
Normal file
14
public/login.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Login</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Login</h2>
|
||||||
|
<form method="POST" action="/login">
|
||||||
|
<input type="text" name="username" placeholder="Username" required /><br/>
|
||||||
|
<input type="password" name="password" placeholder="Password" required /><br/>
|
||||||
|
<button type="submit">Login</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user