AItestt / app /index.html
Artificial-superintelligence's picture
Rename index.html to app/index.html
eece415 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Terminal & Image Download</title>
<style>
body {
margin: 0;
font-family: monospace;
background: black;
color: #00ff00;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.button-container {
margin-bottom: 20px;
}
button {
background-color: #00ff00;
border: 1px solid #00ff00;
padding: 10px 20px;
margin: 10px;
color: black;
font-size: 16px;
cursor: pointer;
}
.image-container {
display: none;
justify-content: center;
align-items: center;
}
.terminal {
display: none;
width: 80%;
height: 80%;
background: black;
border: 2px solid #00ff00;
padding: 10px;
overflow-y: auto;
}
.input-line {
display: flex;
align-items: center;
}
.prompt {
margin-right: 5px;
}
.input {
border: none;
background: transparent;
color: #00ff00;
outline: none;
flex: 1;
}
.output {
white-space: pre-wrap;
margin: 5px 0;
}
</style>
</head>
<body>
<div class="container">
<div class="button-container">
<button onclick="showImages()">Show Images</button>
<button onclick="showTerminal()">Show Terminal</button>
</div>
<!-- Image Container -->
<div class="image-container" id="image-container">
<h3>Downloaded Image:</h3>
<img id="downloaded-image" src="" alt="Image will appear here" style="width: 100%; max-width: 600px;">
<p id="image-size"></p>
<input type="text" id="image-url" placeholder="Enter image URL">
<button onclick="downloadImage()">Download Image</button>
</div>
<!-- Terminal Container -->
<div class="terminal" id="terminal">
<div class="output">Welcome to the Advanced KalY Linux Terminal! Type `help` for a list of commands.</div>
<div class="input-line">
<span class="prompt">kaly@linux:~$</span>
<input type="text" class="input" id="input" autofocus>
</div>
</div>
</div>
<script>
function showImages() {
document.getElementById('image-container').style.display = 'flex';
document.getElementById('terminal').style.display = 'none';
}
function showTerminal() {
document.getElementById('terminal').style.display = 'block';
document.getElementById('image-container').style.display = 'none';
}
function downloadImage() {
const imageUrl = document.getElementById('image-url').value;
if (imageUrl) {
fetch(`/download_image?url=${encodeURIComponent(imageUrl)}`)
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('downloaded-image').src = data.image_url;
document.getElementById('image-size').innerText = `File size: ${data.file_size}`;
} else {
alert('Failed to download image.');
}
});
} else {
alert('Please enter a valid image URL.');
}
}
document.getElementById("input").addEventListener("keydown", function (event) {
if (event.key === "Enter") {
let command = event.target.value;
fetch('/terminal', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ command: command })
})
.then(response => response.json())
.then(data => {
let output = document.querySelector(".output");
output.textContent += '\n' + data.output;
event.target.value = '';
window.scrollTo(0, document.body.scrollHeight);
});
}
});
</script>
</body>
</html>