160 lines
4.3 KiB
HTML
160 lines
4.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Odoo Database Upload</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background: #f4f6f8;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
padding: 50px 0;
|
|
}
|
|
.container {
|
|
background: #fff;
|
|
padding: 30px;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
|
width: 400px;
|
|
}
|
|
h2 {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
}
|
|
label {
|
|
font-weight: bold;
|
|
margin-top: 15px;
|
|
display: block;
|
|
}
|
|
input, select, textarea, button {
|
|
width: 100%;
|
|
padding: 10px;
|
|
margin-top: 5px;
|
|
border-radius: 6px;
|
|
border: 1px solid #ccc;
|
|
box-sizing: border-box;
|
|
}
|
|
button {
|
|
background: #007bff;
|
|
color: white;
|
|
border: none;
|
|
margin-top: 20px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
button:hover {
|
|
background: #0056b3;
|
|
}
|
|
.progress-container {
|
|
margin-top: 15px;
|
|
display: none;
|
|
}
|
|
.progress-bar {
|
|
width: 0;
|
|
height: 12px;
|
|
background: #007bff;
|
|
border-radius: 6px;
|
|
}
|
|
.progress-bg {
|
|
width: 100%;
|
|
background: #e0e0e0;
|
|
border-radius: 6px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h2>Upload Odoo Database</h2>
|
|
<form id="uploadForm">
|
|
<label for="uuid">UUID</label>
|
|
<input type="text" id="uuid" name="uuid" required placeholder="Enter UUID">
|
|
|
|
<label for="serverLocation">Server Location</label>
|
|
<select id="serverLocation" name="serverLocation" required>
|
|
<option value="">Select a location</option>
|
|
<option value="Mumbai">Mumbai</option>
|
|
<option value="Sao Paulo">Sao Paulo</option>
|
|
<option value="Meppel">Meppel</option>
|
|
<option value="Boston">Boston</option>
|
|
<option value="Manchester">Manchester</option>
|
|
</select>
|
|
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required placeholder="Enter your email">
|
|
|
|
<label for="sshKey">Public SSH Key</label>
|
|
<textarea id="sshKey" name="sshKey" rows="4" placeholder="Paste your public SSH key here"></textarea>
|
|
|
|
<label for="fileInput">Odoo Database File</label>
|
|
<input type="file" id="fileInput" required>
|
|
|
|
<button type="submit">Upload</button>
|
|
|
|
<div class="progress-container">
|
|
<div class="progress-bg">
|
|
<div class="progress-bar" id="progressBar"></div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById("uploadForm").addEventListener("submit", function(e) {
|
|
e.preventDefault();
|
|
|
|
const file = document.getElementById("fileInput").files[0];
|
|
if (!file) return alert("Please select a file");
|
|
|
|
const uuid = document.getElementById("uuid").value;
|
|
const serverLocation = document.getElementById("serverLocation").value;
|
|
const email = document.getElementById("email").value;
|
|
const sshKey = document.getElementById("sshKey").value;
|
|
|
|
const webhookUrl = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/98984f8f-37f1-45f3-8df5-ad1bf0fc7fcd";
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
xhr.open("POST", webhookUrl, true);
|
|
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
|
xhr.setRequestHeader("X-UUID", uuid);
|
|
xhr.setRequestHeader("X-Server-Location", serverLocation);
|
|
xhr.setRequestHeader("X-Email", email);
|
|
xhr.setRequestHeader("X-SSH-Key", sshKey);
|
|
xhr.setRequestHeader("X-Filename", encodeURIComponent(file.name));
|
|
|
|
const progressContainer = document.querySelector(".progress-container");
|
|
const progressBar = document.getElementById("progressBar");
|
|
progressContainer.style.display = "block";
|
|
|
|
xhr.upload.onprogress = function(e) {
|
|
if (e.lengthComputable) {
|
|
const percent = (e.loaded / e.total) * 100;
|
|
progressBar.style.width = percent + "%";
|
|
}
|
|
};
|
|
|
|
xhr.onload = function() {
|
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
alert("Upload complete!");
|
|
progressBar.style.width = "0%";
|
|
progressContainer.style.display = "none";
|
|
document.getElementById("uploadForm").reset();
|
|
} else {
|
|
alert("Upload failed: " + xhr.statusText);
|
|
}
|
|
};
|
|
|
|
xhr.onerror = function() {
|
|
alert("Upload error. Please try again.");
|
|
};
|
|
|
|
xhr.send(file);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|