- Deployed Yggdrasil on master (aarch64) and clone (x86_64) - Connected to 2 public peers + LAN multicast auto-discovery - Bidirectional ping6 and SSH over Yggdrasil working - Fixed firewall zones: device="ygg0" required for nftables - IPv6: master 201:e4d4:..., clone 201:a9d8:... - Marks v1.1+ Yggdrasil overlay as complete Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
724 lines
24 KiB
HTML
724 lines
24 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SecuBox — Services Portal</title>
|
|
<style>
|
|
:root {
|
|
--bg: #0a0a0f;
|
|
--surface: #12121a;
|
|
--border: #1a1a2e;
|
|
--accent: #005f9e;
|
|
--accent-glow: rgba(0,95,158,0.3);
|
|
--text: #e0e0e0;
|
|
--muted: #666;
|
|
}
|
|
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font-family: "Segoe UI", system-ui, sans-serif;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
body::before {
|
|
content: "";
|
|
position: fixed;
|
|
inset: 0;
|
|
background-image:
|
|
linear-gradient(rgba(0,95,158,0.03) 1px, transparent 1px),
|
|
linear-gradient(90deg, rgba(0,95,158,0.03) 1px, transparent 1px);
|
|
background-size: 50px 50px;
|
|
animation: gridMove 20s linear infinite;
|
|
pointer-events: none;
|
|
}
|
|
|
|
@keyframes gridMove {
|
|
0% { transform: translate(0,0); }
|
|
100% { transform: translate(50px,50px); }
|
|
}
|
|
|
|
.container { max-width: 1200px; margin: 0 auto; padding: 20px; position: relative; z-index: 1; }
|
|
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 20px 0;
|
|
border-bottom: 1px solid var(--border);
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.logo { display: flex; align-items: center; gap: 15px; }
|
|
.logo-icon {
|
|
width: 50px; height: 50px;
|
|
background: linear-gradient(135deg, var(--accent), #007acc);
|
|
border-radius: 12px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
font-family: "Courier New", monospace;
|
|
font-size: 1.5rem; font-weight: 900; color: #fff;
|
|
}
|
|
.logo-text { font-size: 1.5rem; font-weight: 700; }
|
|
.logo-text span { color: var(--accent); }
|
|
|
|
.user-info { display: flex; align-items: center; gap: 15px; }
|
|
.user-badge {
|
|
background: rgba(0,95,158,0.1);
|
|
border: 1px solid var(--accent);
|
|
padding: 8px 16px;
|
|
border-radius: 20px;
|
|
font-size: 0.9rem;
|
|
}
|
|
.logout-btn {
|
|
background: rgba(231,76,60,0.1);
|
|
border: 1px solid #e74c3c;
|
|
color: #e74c3c;
|
|
padding: 8px 16px;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
font-size: 0.9rem;
|
|
}
|
|
.logout-btn:hover { background: rgba(231,76,60,0.2); }
|
|
|
|
.section-title {
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 2px;
|
|
color: var(--accent);
|
|
margin: 30px 0 15px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
|
|
.services-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
gap: 15px;
|
|
}
|
|
|
|
.service-card {
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
transition: all 0.2s;
|
|
cursor: pointer;
|
|
}
|
|
.service-card:hover {
|
|
border-color: var(--accent);
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 8px 25px var(--accent-glow);
|
|
}
|
|
|
|
.service-icon { font-size: 2rem; margin-bottom: 10px; }
|
|
.service-name { font-weight: 600; color: #fff; margin-bottom: 5px; }
|
|
.service-url { font-size: 0.75rem; color: var(--accent); font-family: monospace; }
|
|
|
|
.footer {
|
|
text-align: center;
|
|
padding: 40px 0 20px;
|
|
color: var(--muted);
|
|
font-size: 0.85rem;
|
|
}
|
|
.footer a { color: var(--accent); text-decoration: none; }
|
|
|
|
/* Modal styles */
|
|
.modal-overlay {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0,0,0,0.8);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 1000;
|
|
}
|
|
.modal-box {
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
width: 90%;
|
|
max-width: 500px;
|
|
box-shadow: 0 20px 60px rgba(0,95,158,0.3);
|
|
}
|
|
.modal-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 20px;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
.modal-header h3 { margin: 0; color: #fff; }
|
|
.modal-close {
|
|
background: none;
|
|
border: none;
|
|
color: var(--muted);
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
}
|
|
.modal-close:hover { color: #fff; }
|
|
.modal-body { padding: 20px; }
|
|
.modal-footer {
|
|
padding: 15px 20px;
|
|
border-top: 1px solid var(--border);
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 10px;
|
|
}
|
|
.form-group { margin-bottom: 15px; }
|
|
.form-group label { display: block; margin-bottom: 5px; color: var(--text); font-size: 0.9rem; }
|
|
.modal-input {
|
|
width: 100%;
|
|
padding: 10px 12px;
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
color: var(--text);
|
|
font-size: 0.95rem;
|
|
}
|
|
.modal-input:focus { outline: none; border-color: var(--accent); }
|
|
.checkbox-group { display: flex; flex-wrap: wrap; gap: 15px; }
|
|
.checkbox-label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
|
|
.checkbox-label input { accent-color: var(--accent); }
|
|
.btn-primary {
|
|
background: var(--accent);
|
|
border: none;
|
|
color: #fff;
|
|
padding: 10px 20px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-weight: 600;
|
|
}
|
|
.btn-primary:hover { background: #007acc; }
|
|
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
.btn-secondary {
|
|
background: transparent;
|
|
border: 1px solid var(--border);
|
|
color: var(--text);
|
|
padding: 10px 20px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
}
|
|
.btn-secondary:hover { border-color: var(--accent); }
|
|
.progress-bar {
|
|
background: var(--bg);
|
|
border-radius: 4px;
|
|
height: 8px;
|
|
overflow: hidden;
|
|
margin-bottom: 10px;
|
|
}
|
|
.progress-fill {
|
|
background: var(--accent);
|
|
height: 100%;
|
|
width: 0%;
|
|
transition: width 0.3s;
|
|
}
|
|
.progress-status { font-size: 0.85rem; color: var(--muted); }
|
|
.result-success { color: #2ecc71; padding: 15px; background: rgba(46,204,113,0.1); border-radius: 6px; }
|
|
.result-success a { color: var(--accent); }
|
|
.result-error { color: #e74c3c; padding: 15px; background: rgba(231,76,60,0.1); border-radius: 6px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<header class="header">
|
|
<div class="logo">
|
|
<div class="logo-icon">S</div>
|
|
<h1 class="logo-text">Secu<span>Box</span></h1>
|
|
</div>
|
|
<div class="user-info">
|
|
<span class="user-badge" id="userBadge"></span>
|
|
<button class="logout-btn" id="logoutBtn">Deconnexion</button>
|
|
</div>
|
|
</header>
|
|
|
|
<h2 class="section-title">Communication</h2>
|
|
<div class="services-grid">
|
|
<a href="https://webmail.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">📧</div>
|
|
<div class="service-name">Webmail</div>
|
|
<div class="service-url">webmail.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://matrix.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">💬</div>
|
|
<div class="service-name">Matrix</div>
|
|
<div class="service-url">matrix.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://xmpp.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🗨️</div>
|
|
<div class="service-name">Jabber</div>
|
|
<div class="service-url">xmpp.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://meet.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">📹</div>
|
|
<div class="service-name">Jitsi Meet</div>
|
|
<div class="service-url">meet.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://voip.gk2.secubox.in/voip/phone.html" class="service-card" target="_blank">
|
|
<div class="service-icon">📞</div>
|
|
<div class="service-name">WebRTC Phone</div>
|
|
<div class="service-url">voip.gk2.secubox.in</div>
|
|
</a>
|
|
</div>
|
|
|
|
<h2 class="section-title">Cloud & Media</h2>
|
|
<div class="services-grid">
|
|
<a href="https://cloud.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">☁️</div>
|
|
<div class="service-name">Nextcloud</div>
|
|
<div class="service-url">cloud.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://git.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🔀</div>
|
|
<div class="service-name">Gitea</div>
|
|
<div class="service-url">git.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://tube.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🎬</div>
|
|
<div class="service-name">PeerTube</div>
|
|
<div class="service-url">tube.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://jellyfin.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🎵</div>
|
|
<div class="service-name">Jellyfin</div>
|
|
<div class="service-url">jellyfin.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://social.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🐘</div>
|
|
<div class="service-name">GoToSocial</div>
|
|
<div class="service-url">social.gk2.secubox.in</div>
|
|
</a>
|
|
</div>
|
|
|
|
<h2 class="section-title">Intelligence & Analyse</h2>
|
|
<div class="services-grid">
|
|
<a href="https://analyse.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🔍</div>
|
|
<div class="service-name">PeerTube Analyse</div>
|
|
<div class="service-url">analyse.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="#" class="service-card" id="importVideoCard" onclick="openImportModal(); return false;">
|
|
<div class="service-icon">📥</div>
|
|
<div class="service-name">Video Import</div>
|
|
<div class="service-url">YouTube, Vimeo, 1000+ sites</div>
|
|
</a>
|
|
<a href="https://stream.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">📻</div>
|
|
<div class="service-name">Radio Stream</div>
|
|
<div class="service-url">stream.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://radio.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🎵</div>
|
|
<div class="service-name">Lyrion Radio</div>
|
|
<div class="service-url">radio.gk2.secubox.in</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="section-title">Sécurité & Conformité</h2>
|
|
<div class="services-grid">
|
|
<a href="https://alerte.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🚨</div>
|
|
<div class="service-name">ALERTE.DEPOT</div>
|
|
<div class="service-url">Signalement anonyme (Loi Waserman)</div>
|
|
</a>
|
|
</div>
|
|
|
|
<h2 class="section-title">Account</h2>
|
|
<div class="services-grid">
|
|
<a href="#" class="service-card" id="changePasswordCard" onclick="openPasswordModal(); return false;">
|
|
<div class="service-icon">🔑</div>
|
|
<div class="service-name">Change Password</div>
|
|
<div class="service-url">Update password for all services</div>
|
|
</a>
|
|
<a href="#" class="service-card" onclick="showMyServices(); return false;">
|
|
<div class="service-icon">📋</div>
|
|
<div class="service-name">My Services</div>
|
|
<div class="service-url">View enabled services</div>
|
|
</a>
|
|
</div>
|
|
|
|
<h2 class="section-title">Administration</h2>
|
|
<div class="services-grid">
|
|
<a href="https://admin.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">⚙️</div>
|
|
<div class="service-name">Admin LuCI</div>
|
|
<div class="service-url">admin.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://vpn.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🔐</div>
|
|
<div class="service-name">WireGuard VPN</div>
|
|
<div class="service-url">vpn.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://hub.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🏠</div>
|
|
<div class="service-name">Hub</div>
|
|
<div class="service-url">hub.gk2.secubox.in</div>
|
|
</a>
|
|
<a href="https://guacamole.gk2.secubox.in/" class="service-card" target="_blank">
|
|
<div class="service-icon">🖥️</div>
|
|
<div class="service-name">Guacamole</div>
|
|
<div class="service-url">guacamole.gk2.secubox.in</div>
|
|
</a>
|
|
</div>
|
|
|
|
<footer class="footer">
|
|
SecuBox Portal — <a href="https://cybermind.fr">CyberMind.FR</a>
|
|
</footer>
|
|
</div>
|
|
|
|
<!-- Video Import Modal -->
|
|
<div class="modal-overlay" id="importModal" style="display:none;">
|
|
<div class="modal-box">
|
|
<div class="modal-header">
|
|
<h3>📥 Video Import</h3>
|
|
<button class="modal-close" onclick="closeImportModal()">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label>Video URL</label>
|
|
<input type="text" id="importUrl" placeholder="https://youtube.com/watch?v=..." class="modal-input">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Subtitle Languages</label>
|
|
<div class="checkbox-group">
|
|
<label class="checkbox-label"><input type="checkbox" value="fr" checked> Francais</label>
|
|
<label class="checkbox-label"><input type="checkbox" value="en" checked> English</label>
|
|
<label class="checkbox-label"><input type="checkbox" value="de"> Deutsch</label>
|
|
<label class="checkbox-label"><input type="checkbox" value="es"> Espanol</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Privacy</label>
|
|
<select id="importPrivacy" class="modal-input">
|
|
<option value="1">Public</option>
|
|
<option value="2">Unlisted</option>
|
|
<option value="3">Private</option>
|
|
</select>
|
|
</div>
|
|
<div id="importProgress" style="display:none;">
|
|
<div class="progress-bar">
|
|
<div class="progress-fill" id="progressFill"></div>
|
|
</div>
|
|
<div class="progress-status" id="progressStatus">Starting...</div>
|
|
</div>
|
|
<div id="importResult" style="display:none;"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn-secondary" onclick="closeImportModal()">Cancel</button>
|
|
<button class="btn-primary" id="startImportBtn" onclick="startImport()">Import Video</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Password Change Modal -->
|
|
<div class="modal-overlay" id="passwordModal" style="display:none;">
|
|
<div class="modal-box">
|
|
<div class="modal-header">
|
|
<h3>🔑 Change Password</h3>
|
|
<button class="modal-close" onclick="closePasswordModal()">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label>Current Password</label>
|
|
<input type="password" id="currentPassword" placeholder="Enter current password" class="modal-input">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>New Password</label>
|
|
<input type="password" id="newPassword" placeholder="Enter new password (min 8 chars)" class="modal-input">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Confirm New Password</label>
|
|
<input type="password" id="confirmPassword" placeholder="Confirm new password" class="modal-input">
|
|
</div>
|
|
<div id="passwordResult" style="display:none;"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn-secondary" onclick="closePasswordModal()">Cancel</button>
|
|
<button class="btn-primary" id="changePasswordBtn" onclick="doChangePassword()">Change Password</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Services Modal -->
|
|
<div class="modal-overlay" id="servicesModal" style="display:none;">
|
|
<div class="modal-box">
|
|
<div class="modal-header">
|
|
<h3>📋 My Services</h3>
|
|
<button class="modal-close" onclick="closeServicesModal()">×</button>
|
|
</div>
|
|
<div class="modal-body" id="servicesContent">
|
|
Loading...
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn-primary" onclick="closeServicesModal()">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Check authentication
|
|
var token = sessionStorage.getItem("secubox_token");
|
|
var user = sessionStorage.getItem("secubox_user");
|
|
var email = sessionStorage.getItem("secubox_email");
|
|
|
|
if (!token || !user) {
|
|
window.location.href = "/login.html";
|
|
} else {
|
|
document.getElementById("userBadge").textContent = user + " (" + email + ")";
|
|
}
|
|
|
|
document.getElementById("logoutBtn").onclick = function() {
|
|
sessionStorage.clear();
|
|
window.location.href = "/login.html";
|
|
};
|
|
|
|
// Password Change Modal
|
|
function openPasswordModal() {
|
|
document.getElementById("passwordModal").style.display = "flex";
|
|
document.getElementById("currentPassword").value = "";
|
|
document.getElementById("newPassword").value = "";
|
|
document.getElementById("confirmPassword").value = "";
|
|
document.getElementById("passwordResult").style.display = "none";
|
|
document.getElementById("changePasswordBtn").disabled = false;
|
|
}
|
|
|
|
function closePasswordModal() {
|
|
document.getElementById("passwordModal").style.display = "none";
|
|
}
|
|
|
|
function doChangePassword() {
|
|
var currentPass = document.getElementById("currentPassword").value;
|
|
var newPass = document.getElementById("newPassword").value;
|
|
var confirmPass = document.getElementById("confirmPassword").value;
|
|
|
|
if (!currentPass || !newPass || !confirmPass) {
|
|
showPasswordResult("Please fill in all fields", true);
|
|
return;
|
|
}
|
|
|
|
if (newPass.length < 8) {
|
|
showPasswordResult("New password must be at least 8 characters", true);
|
|
return;
|
|
}
|
|
|
|
if (newPass !== confirmPass) {
|
|
showPasswordResult("New passwords do not match", true);
|
|
return;
|
|
}
|
|
|
|
document.getElementById("changePasswordBtn").disabled = true;
|
|
showPasswordResult("Updating password on all services...", false);
|
|
|
|
fetch("/cgi-bin/luci/rpc/sys", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
method: "call",
|
|
params: ["00000000000000000000000000000000", "luci.secubox-users", "change_password", {
|
|
username: user,
|
|
current_password: currentPass,
|
|
new_password: newPass
|
|
}]
|
|
})
|
|
})
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
var result = data.result;
|
|
if (result && result.success) {
|
|
var msg = result.message || "Password updated successfully";
|
|
if (result.manual) {
|
|
msg += "<br><br><small>Note: Some services require manual password update:<br>" + result.manual + "</small>";
|
|
}
|
|
showPasswordResult(msg, false);
|
|
setTimeout(function() {
|
|
closePasswordModal();
|
|
// Clear session and redirect to login
|
|
sessionStorage.clear();
|
|
alert("Password changed. Please log in again with your new password.");
|
|
window.location.href = "/login.html";
|
|
}, 3000);
|
|
} else {
|
|
showPasswordResult(result.error || "Failed to change password", true);
|
|
document.getElementById("changePasswordBtn").disabled = false;
|
|
}
|
|
})
|
|
.catch(function(err) {
|
|
showPasswordResult("Error: " + err.message, true);
|
|
document.getElementById("changePasswordBtn").disabled = false;
|
|
});
|
|
}
|
|
|
|
function showPasswordResult(message, isError) {
|
|
var el = document.getElementById("passwordResult");
|
|
el.style.display = "block";
|
|
el.className = isError ? "result-error" : "result-success";
|
|
el.innerHTML = message;
|
|
}
|
|
|
|
// Services Modal
|
|
function showMyServices() {
|
|
document.getElementById("servicesModal").style.display = "flex";
|
|
document.getElementById("servicesContent").innerHTML = "Loading your services...";
|
|
|
|
// For now, show static list based on what portal shows
|
|
var services = [
|
|
{icon: "📧", name: "Email", status: "webmail.gk2.secubox.in"},
|
|
{icon: "💬", name: "Matrix", status: "matrix.gk2.secubox.in"},
|
|
{icon: "🗨️", name: "Jabber", status: "xmpp.gk2.secubox.in"},
|
|
{icon: "☁️", name: "Nextcloud", status: "cloud.gk2.secubox.in"},
|
|
{icon: "🎬", name: "PeerTube", status: "tube.gk2.secubox.in"}
|
|
];
|
|
|
|
var html = '<div style="margin-top:10px;">';
|
|
html += '<p style="color:var(--muted);margin-bottom:15px;">Services enabled for <strong>' + user + '</strong>:</p>';
|
|
services.forEach(function(s) {
|
|
html += '<div style="padding:10px;border:1px solid var(--border);border-radius:8px;margin-bottom:8px;display:flex;align-items:center;gap:10px;">';
|
|
html += '<span style="font-size:1.5rem;">' + s.icon + '</span>';
|
|
html += '<div><strong>' + s.name + '</strong><br><small style="color:var(--accent);">' + s.status + '</small></div>';
|
|
html += '</div>';
|
|
});
|
|
html += '</div>';
|
|
|
|
document.getElementById("servicesContent").innerHTML = html;
|
|
}
|
|
|
|
function closeServicesModal() {
|
|
document.getElementById("servicesModal").style.display = "none";
|
|
}
|
|
|
|
// Video Import Modal
|
|
var importJobId = null;
|
|
var pollInterval = null;
|
|
|
|
function openImportModal() {
|
|
document.getElementById("importModal").style.display = "flex";
|
|
document.getElementById("importUrl").value = "";
|
|
document.getElementById("importProgress").style.display = "none";
|
|
document.getElementById("importResult").style.display = "none";
|
|
document.getElementById("startImportBtn").disabled = false;
|
|
}
|
|
|
|
function closeImportModal() {
|
|
document.getElementById("importModal").style.display = "none";
|
|
if (pollInterval) {
|
|
clearInterval(pollInterval);
|
|
pollInterval = null;
|
|
}
|
|
}
|
|
|
|
function getSelectedLanguages() {
|
|
var checkboxes = document.querySelectorAll('.checkbox-group input:checked');
|
|
var langs = [];
|
|
checkboxes.forEach(function(cb) { langs.push(cb.value); });
|
|
return langs.length > 0 ? langs : ["fr", "en"];
|
|
}
|
|
|
|
function startImport() {
|
|
var url = document.getElementById("importUrl").value.trim();
|
|
if (!url) {
|
|
alert("Please enter a video URL");
|
|
return;
|
|
}
|
|
|
|
var languages = getSelectedLanguages();
|
|
var privacy = document.getElementById("importPrivacy").value;
|
|
|
|
document.getElementById("startImportBtn").disabled = true;
|
|
document.getElementById("importProgress").style.display = "block";
|
|
document.getElementById("importResult").style.display = "none";
|
|
document.getElementById("progressFill").style.width = "5%";
|
|
document.getElementById("progressStatus").textContent = "Starting import...";
|
|
|
|
fetch("/cgi-bin/peertube-import", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
url: url,
|
|
languages: languages,
|
|
privacy: parseInt(privacy)
|
|
})
|
|
})
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (data.error) {
|
|
showImportError(data.error);
|
|
return;
|
|
}
|
|
importJobId = data.job_id;
|
|
pollImportStatus();
|
|
})
|
|
.catch(function(err) {
|
|
showImportError("Failed to start import: " + err.message);
|
|
});
|
|
}
|
|
|
|
function pollImportStatus() {
|
|
if (!importJobId) return;
|
|
|
|
pollInterval = setInterval(function() {
|
|
fetch("/cgi-bin/peertube-import-status?job_id=" + importJobId)
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (data.error) {
|
|
clearInterval(pollInterval);
|
|
showImportError(data.error);
|
|
return;
|
|
}
|
|
|
|
var progress = data.progress || 0;
|
|
var status = data.status || "unknown";
|
|
document.getElementById("progressFill").style.width = progress + "%";
|
|
|
|
if (status === "downloading") {
|
|
document.getElementById("progressStatus").textContent = "Downloading video and subtitles...";
|
|
} else if (status === "uploading") {
|
|
document.getElementById("progressStatus").textContent = "Uploading to PeerTube...";
|
|
} else if (status === "completed") {
|
|
clearInterval(pollInterval);
|
|
showImportSuccess(data);
|
|
} else if (status === "failed") {
|
|
clearInterval(pollInterval);
|
|
showImportError(data.error || "Import failed");
|
|
} else {
|
|
document.getElementById("progressStatus").textContent = status;
|
|
}
|
|
})
|
|
.catch(function(err) {
|
|
document.getElementById("progressStatus").textContent = "Checking status...";
|
|
});
|
|
}, 3000);
|
|
}
|
|
|
|
function showImportSuccess(data) {
|
|
document.getElementById("importProgress").style.display = "none";
|
|
document.getElementById("importResult").style.display = "block";
|
|
document.getElementById("importResult").className = "result-success";
|
|
|
|
var videoUrl = data.video_url || ("https://tube.gk2.secubox.in/w/" + data.video_uuid);
|
|
var title = data.title || "Imported Video";
|
|
|
|
document.getElementById("importResult").innerHTML =
|
|
'<strong>Import successful!</strong><br><br>' +
|
|
'Title: ' + title + '<br>' +
|
|
'<a href="' + videoUrl + '" target="_blank">Open video on PeerTube</a>';
|
|
}
|
|
|
|
function showImportError(message) {
|
|
document.getElementById("importProgress").style.display = "none";
|
|
document.getElementById("importResult").style.display = "block";
|
|
document.getElementById("importResult").className = "result-error";
|
|
document.getElementById("importResult").innerHTML = '<strong>Import failed</strong><br>' + message;
|
|
document.getElementById("startImportBtn").disabled = false;
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|