Spaces:
Running
Running
Download index.html from TutorialMentor/serverdev: direct link, hf CLI and curl.
- Browser
- Download file 57.9 kB
-
https://huggingface.co/spaces/TutorialMentor/serverdev/resolve/main/index.html
- Command line
-
hf download hf://spaces/TutorialMentor/serverdev/index.html
-
curl -L -o index.html https://huggingface.co/spaces/TutorialMentor/serverdev/resolve/main/index.html
57.9 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ServerDev | Template Builder</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Roboto+Mono:wght@300;400;500;600&display=swap');
body {
font-family: 'Roboto Mono', monospace;
background-color: #0a0a0a;
color: #e0e0e0;
overflow-x: hidden;
}
.title-font {
font-family: 'Orbitron', sans-serif;
}
.glow-text {
text-shadow: 0 0 8px rgba(0, 150, 255, 0.7);
}
.glow-box {
box-shadow: 0 0 15px rgba(0, 150, 255, 0.3);
}
.cyber-border {
position: relative;
border: 1px solid transparent;
}
.cyber-border::before {
content: '';
position: absolute;
inset: 0;
border-radius: 0.5rem;
padding: 2px;
background: linear-gradient(135deg, #00f2ff, #0066ff, #00f2ff);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
.input-field {
background-color: rgba(20, 20, 20, 0.8);
border: 1px solid #333;
transition: all 0.3s ease;
}
.input-field:focus {
border-color: #0066ff;
box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}
.password-btn {
background: linear-gradient(135deg, #0066ff, #00c6ff);
transition: all 0.3s ease;
}
.password-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 102, 255, 0.4);
}
.grid-bg {
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 30px 30px;
}
.cyber-loader {
width: 48px;
height: 48px;
border: 3px solid #0066ff;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
.cyber-loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 56px;
height: 56px;
border-radius: 50%;
border: 3px solid;
border-color: #00f2ff transparent;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
/* Dashboard styles */
.sidebar {
background-color: rgba(10, 10, 15, 0.8);
backdrop-filter: blur(10px);
border-right: 1px solid rgba(0, 102, 255, 0.2);
}
.nav-item {
transition: all 0.3s ease;
border-left: 3px solid transparent;
}
.nav-item:hover {
background-color: rgba(0, 102, 255, 0.1);
border-left-color: #0066ff;
}
.nav-item.active {
background-color: rgba(0, 102, 255, 0.2);
border-left-color: #0066ff;
}
.dashboard-card {
background-color: rgba(20, 20, 25, 0.6);
backdrop-filter: blur(10px);
border: 1px solid rgba(0, 102, 255, 0.2);
transition: all 0.3s ease;
}
.dashboard-card:hover {
border-color: rgba(0, 102, 255, 0.5);
box-shadow: 0 5px 15px rgba(0, 102, 255, 0.1);
}
/* Template Builder Styles */
.template-item {
background-color: rgba(30, 30, 35, 0.6);
border: 1px solid rgba(0, 102, 255, 0.2);
margin-bottom: 10px;
padding: 12px;
border-radius: 6px;
cursor: move;
transition: all 0.2s ease;
}
.template-item:hover {
background-color: rgba(40, 40, 45, 0.6);
border-color: rgba(0, 102, 255, 0.4);
}
.template-item.dragging {
opacity: 0.5;
background-color: rgba(0, 102, 255, 0.1);
}
.permission-chip {
display: inline-block;
background-color: rgba(0, 102, 255, 0.2);
border: 1px solid rgba(0, 102, 255, 0.3);
border-radius: 4px;
padding: 2px 6px;
margin-right: 4px;
margin-bottom: 4px;
font-size: 12px;
color: #e0e0e0;
}
.channel-icon {
width: 20px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 8px;
border-radius: 4px;
}
.text-channel {
background-color: rgba(100, 149, 237, 0.2);
color: #6495ed;
}
.voice-channel {
background-color: rgba(50, 205, 50, 0.2);
color: #32cd32;
}
.category-channel {
background-color: rgba(255, 165, 0, 0.2);
color: #ffa500;
}
.role-color {
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
margin-right: 8px;
}
.tab-button {
padding: 8px 16px;
border-bottom: 2px solid transparent;
transition: all 0.2s ease;
}
.tab-button.active {
border-bottom-color: #0066ff;
color: #0066ff;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: rgba(30, 30, 35, 0.95);
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
border-radius: 6px;
border: 1px solid rgba(0, 102, 255, 0.3);
}
.dropdown:hover .dropdown-content {
display: block;
}
/* Bot status indicator */
.status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 6px;
}
.status-online {
background-color: #3ba55c;
}
.status-offline {
background-color: #747f8d;
}
.status-idle {
background-color: #faa61a;
}
.status-dnd {
background-color: #ed4245;
}
</style>
</head>
<body class="grid-bg min-h-screen">
<!-- Login Screen (shown by default) -->
<div id="loginScreen" class="flex items-center justify-center p-4 min-h-screen">
<div class="fixed top-0 left-0 w-full h-full bg-black/50 backdrop-blur-sm z-0"></div>
<div class="relative z-10 w-full max-w-md">
<!-- Main Login Card -->
<div class="bg-gray-900/80 backdrop-blur-md rounded-xl p-8 cyber-border">
<!-- Header -->
<div class="text-center mb-8">
<div class="flex justify-center mb-4">
<lottie-player src="https://assets9.lottiefiles.com/packages/lf20_obhph3sh.json" background="transparent" speed="1" style="width: 100px; height: 100px;" loop autoplay></lottie-player>
</div>
<h1 class="title-font text-3xl font-bold text-white glow-text mb-2">SERVER<span class="text-blue-400">DEV</span></h1>
<p class="text-gray-400">Admin Control Panel</p>
</div>
<!-- Login Form -->
<div class="space-y-6">
<!-- Password Login Form -->
<div id="passwordForm">
<div class="mb-4">
<label for="password" class="block text-sm font-medium text-gray-300 mb-2">Admin Password</label>
<div class="relative">
<input type="password" id="password" class="w-full px-4 py-3 rounded-lg input-field text-white focus:outline-none" placeholder="Enter secret key">
<button onclick="togglePasswordVisibility()" class="absolute right-3 top-3 text-gray-400 hover:text-white">
<i class="fas fa-eye"></i>
</button>
</div>
</div>
<button onclick="checkPassword()" class="w-full py-3 px-4 rounded-lg font-medium text-white password-btn flex items-center justify-center space-x-2">
<span>Authenticate</span>
<i class="fas fa-lock"></i>
</button>
</div>
<!-- Loading State -->
<div id="loadingState" class="hidden flex-col items-center justify-center space-y-4 py-8">
<div class="cyber-loader"></div>
<p class="text-blue-400">Authenticating...</p>
</div>
<!-- Error Message -->
<div id="errorMessage" class="hidden bg-red-900/50 border border-red-700 rounded-lg p-4 text-red-200 text-sm"></div>
</div>
</div>
<!-- Footer -->
<div class="mt-6 text-center text-xs text-gray-600">
<p>ServerDev Bot © 2023 | Secure Admin Portal</p>
</div>
</div>
</div>
<!-- Dashboard Screen (hidden by default) -->
<div id="dashboardScreen" class="hidden min-h-screen">
<!-- Sidebar -->
<div class="sidebar fixed top-0 left-0 w-64 h-full z-20">
<div class="p-4 flex items-center space-x-3 border-b border-gray-800/50 pb-6">
<div id="botAvatar" class="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center overflow-hidden">
<i class="fas fa-robot text-white"></i>
</div>
<div>
<h2 class="font-bold text-white">ServerDev</h2>
<p class="text-xs text-gray-400">Template Builder</p>
<div class="flex items-center mt-1">
<span id="botStatus" class="status-indicator status-offline"></span>
<span id="botStatusText" class="text-xs text-gray-400">Offline</span>
</div>
</div>
</div>
<nav class="p-4 space-y-1">
<a href="#" class="nav-item active flex items-center space-x-3 p-3 rounded-lg text-white">
<i class="fas fa-layer-group w-5 text-center text-blue-400"></i>
<span>Templates</span>
</a>
<a href="#" class="nav-item flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-white">
<i class="fas fa-history w-5 text-center"></i>
<span>Recent Servers</span>
</a>
<a href="#" class="nav-item flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-white">
<i class="fas fa-cog w-5 text-center"></i>
<span>Settings</span>
</a>
</nav>
<div class="absolute bottom-0 left-0 w-full p-4 border-t border-gray-800/50">
<button onclick="logout()" class="w-full flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-red-400 hover:bg-red-900/10 transition">
<i class="fas fa-sign-out-alt w-5 text-center"></i>
<span>Logout</span>
</button>
</div>
</div>
<!-- Main Content -->
<div class="ml-64 p-8">
<div class="flex justify-between items-center mb-8">
<h1 class="title-font text-2xl font-bold text-white">Server Template Builder</h1>
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2 bg-gray-800/50 px-4 py-2 rounded-lg">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center">
<i class="fas fa-user text-xs text-white"></i>
</div>
<span class="text-sm font-medium" id="userDisplay">Admin</span>
<span class="text-xs text-blue-400">(Owner)</span>
</div>
</div>
</div>
<!-- Bot Connection Status -->
<div id="botConnectionStatus" class="dashboard-card rounded-xl p-4 mb-6 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div id="connectionStatusIndicator" class="status-indicator status-offline"></div>
<span id="connectionStatusText" class="text-gray-300">Connecting to bot...</span>
</div>
<button id="refreshConnectionBtn" class="text-blue-400 hover:text-blue-300 text-sm flex items-center">
<i class="fas fa-sync-alt mr-1"></i> Refresh
</button>
</div>
<!-- Template Builder Section -->
<div class="dashboard-card rounded-xl p-6 mb-8">
<div class="flex justify-between items-center mb-6">
<h2 class="title-font text-xl font-bold text-white">Create New Template</h2>
<button id="createServerBtn" class="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium flex items-center space-x-2">
<i class="fas fa-plus"></i>
<span>Create Server</span>
</button>
</div>
<!-- Template Name -->
<div class="mb-6">
<label for="templateName" class="block text-sm font-medium text-gray-300 mb-2">Template Name</label>
<input type="text" id="templateName" class="w-full px-4 py-3 rounded-lg input-field text-white focus:outline-none" placeholder="My Awesome Server Template">
</div>
<!-- Template Tabs -->
<div class="border-b border-gray-700 mb-6">
<div class="flex space-x-4">
<button class="tab-button active" onclick="openTab(event, 'categoriesTab')">
<i class="fas fa-folder mr-2"></i> Categories
</button>
<button class="tab-button" onclick="openTab(event, 'channelsTab')">
<i class="fas fa-hashtag mr-2"></i> Channels
</button>
<button class="tab-button" onclick="openTab(event, 'rolesTab')">
<i class="fas fa-user-shield mr-2"></i> Roles
</button>
<button class="tab-button" onclick="openTab(event, 'settingsTab')">
<i class="fas fa-cog mr-2"></i> Settings
</button>
</div>
</div>
<!-- Categories Tab -->
<div id="categoriesTab" class="tab-content active">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Server Structure</h3>
<button onclick="addCategory()" class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Category
</button>
</div>
<div id="categoriesContainer" class="space-y-4">
<!-- Categories will be added here -->
</div>
</div>
<!-- Channels Tab -->
<div id="channelsTab" class="tab-content">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Channel Configuration</h3>
<div class="dropdown relative">
<button class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Channel
</button>
<div class="dropdown-content mt-2 p-2">
<a href="#" onclick="addTextChannel()" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700/50 rounded"><i class="fas fa-hashtag mr-2 text-blue-400"></i>Text Channel</a>
<a href="#" onclick="addVoiceChannel()" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700/50 rounded"><i class="fas fa-volume-up mr-2 text-green-400"></i>Voice Channel</a>
</div>
</div>
</div>
<div id="channelsContainer" class="space-y-4">
<!-- Channels will be added here -->
</div>
</div>
<!-- Roles Tab -->
<div id="rolesTab" class="tab-content">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Role Configuration</h3>
<button onclick="addRole()" class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Role
</button>
</div>
<div id="rolesContainer" class="space-y-4">
<!-- Roles will be added here -->
</div>
</div>
<!-- Settings Tab -->
<div id="settingsTab" class="tab-content">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="font-medium text-gray-300 mb-4">Server Settings</h3>
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-400 mb-1">Server Region</label>
<select class="w-full px-4 py-2 rounded-lg input-field text-white focus:outline-none">
<option>North America</option>
<option>Europe</option>
<option>Asia</option>
</select>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">Verification Level</label>
<select class="w-full px-4 py-2 rounded-lg input-field text-white focus:outline-none">
<option>None</option>
<option>Low</option>
<option>Medium</option>
<option>High</option>
</select>
</div>
</div>
</div>
<div>
<h3 class="font-medium text-gray-300 mb-4">Default Notifications</h3>
<div class="space-y-4">
<div class="flex items-center">
<input type="checkbox" id="suppressEveryone" class="mr-2">
<label for="suppressEveryone" class="text-sm text-gray-300">Suppress @everyone and @here</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="suppressRoles" class="mr-2">
<label for="suppressRoles" class="text-sm text-gray-300">Suppress All Role @mentions</label>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Preview Section -->
<div class="dashboard-card rounded-xl p-6">
<h2 class="title-font text-xl font-bold text-white mb-4">Template Preview</h2>
<div id="templatePreview" class="bg-gray-900/50 rounded-lg p-4 min-h-40">
<p class="text-gray-500 text-center py-10">Your server structure will appear here as you build it</p>
</div>
</div>
</div>
</div>
<script>
// Bot configuration
const BOT_TOKEN = "MTM2ODM3ODM2MzIzNTc5OTA4MA.GgWxwc.0GUxt0uPBFpDiwlIJOza0GQq1nVwd_xx8f2_so";
const BOT_CLIENT_ID = "1368378363235799080";
const BOT_AVATAR_URL = `https://cdn.discordapp.com/avatars/${BOT_CLIENT_ID}/a_1e9a4c5e5e5e5e5e5e5e5e5e5e5e5e5.webp?size=80`;
// Toggle password visibility
function togglePasswordVisibility() {
const passwordInput = document.getElementById('password');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
} else {
passwordInput.type = 'password';
}
}
// Check password
function checkPassword() {
const password = document.getElementById('password').value;
const errorElement = document.getElementById('errorMessage');
// Show loading state
document.getElementById('passwordForm').classList.add('hidden');
document.getElementById('loadingState').classList.remove('hidden');
// Simulate authentication
setTimeout(() => {
if (password === 'ServerDev!29') {
// Successful login
document.getElementById('loginScreen').classList.add('hidden');
document.getElementById('dashboardScreen').classList.remove('hidden');
initializeTemplateBuilder();
checkBotStatus();
} else {
// Show error
document.getElementById('loadingState').classList.add('hidden');
document.getElementById('passwordForm').classList.remove('hidden');
errorElement.textContent = 'Invalid password. Please try again.';
errorElement.classList.remove('hidden');
// Hide error after 5 seconds
setTimeout(() => {
errorElement.classList.add('hidden');
}, 5000);
}
}, 1500);
}
// Logout function
function logout() {
document.getElementById('dashboardScreen').classList.add('hidden');
document.getElementById('loginScreen').classList.remove('hidden');
// Reset forms
document.getElementById('password').value = '';
document.getElementById('loadingState').classList.add('hidden');
document.getElementById('errorMessage').classList.add('hidden');
}
// Tab switching
function openTab(evt, tabName) {
const tabContents = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove("active");
}
const tabButtons = document.getElementsByClassName("tab-button");
for (let i = 0; i < tabButtons.length; i++) {
tabButtons[i].classList.remove("active");
}
document.getElementById(tabName).classList.add("active");
evt.currentTarget.classList.add("active");
}
// Check bot status via Discord API
async function checkBotStatus() {
const statusIndicator = document.getElementById('connectionStatusIndicator');
const statusText = document.getElementById('connectionStatusText');
const botStatusIndicator = document.getElementById('botStatus');
const botStatusText = document.getElementById('botStatusText');
try {
statusText.textContent = "Checking bot status...";
statusIndicator.className = "status-indicator status-idle";
// Fetch bot user data
const response = await fetch(`https://discord.com/api/v10/users/${BOT_CLIENT_ID}`, {
headers: {
'Authorization': `Bot ${BOT_TOKEN}`
}
});
if (response.ok) {
const botData = await response.json();
// Update bot avatar
const botAvatar = document.getElementById('botAvatar');
if (botData.avatar) {
const avatarUrl = `https://cdn.discordapp.com/avatars/${BOT_CLIENT_ID}/${botData.avatar}.png?size=80`;
botAvatar.innerHTML = `<img src="${avatarUrl}" class="w-full h-full object-cover" alt="Bot Avatar">`;
} else {
botAvatar.innerHTML = `<i class="fas fa-robot text-white"></i>`;
}
// Check if bot is in any guilds (as a proxy for "is running")
const guildsResponse = await fetch(`https://discord.com/api/v10/users/@me/guilds`, {
headers: {
'Authorization': `Bot ${BOT_TOKEN}`
}
});
if (guildsResponse.ok) {
const guilds = await guildsResponse.json();
if (guilds.length > 0) {
// Bot is online and in at least one guild
statusIndicator.className = "status-indicator status-online";
statusText.textContent = "Bot is online and connected to Discord";
botStatusIndicator.className = "status-indicator status-online";
botStatusText.textContent = "Online";
} else {
// Bot is online but not in any guilds
statusIndicator.className = "status-indicator status-idle";
statusText.textContent = "Bot is online but not in any servers";
botStatusIndicator.className = "status-indicator status-idle";
botStatusText.textContent = "Idle";
}
} else {
// Error checking guilds
statusIndicator.className = "status-indicator status-dnd";
statusText.textContent = "Error checking bot guilds";
botStatusIndicator.className = "status-indicator status-dnd";
botStatusText.textContent = "Error";
}
} else {
// Bot is offline or token is invalid
statusIndicator.className = "status-indicator status-offline";
statusText.textContent = "Bot is offline or token is invalid";
botStatusIndicator.className = "status-indicator status-offline";
botStatusText.textContent = "Offline";
}
} catch (error) {
console.error("Error checking bot status:", error);
statusIndicator.className = "status-indicator status-dnd";
statusText.textContent = "Error connecting to Discord API";
botStatusIndicator.className = "status-indicator status-dnd";
botStatusText.textContent = "Error";
}
}
// Create a server from template
async function createServerFromTemplate() {
const templateName = document.getElementById('templateName').value || 'Unnamed Template';
// Get all categories and their channels
const categories = [];
const categoryElements = document.getElementById('categoriesContainer').children;
for (let category of categoryElements) {
const categoryName = category.querySelector('input').value || 'Unnamed Category';
const categoryChannels = [];
// Get channels in this category
const channelElements = category.querySelector('.category-channels').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
categoryChannels.push({
name: channelName,
type: isTextChannel ? 'text' : 'voice'
});
}
categories.push({
name: categoryName,
channels: categoryChannels
});
}
// Get standalone channels (not in categories)
const standaloneChannels = [];
const channelElements = document.getElementById('channelsContainer').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
standaloneChannels.push({
name: channelName,
type: isTextChannel ? 'text' : 'voice'
});
}
// Get roles
const roles = [];
const roleElements = document.getElementById('rolesContainer').children;
for (let role of roleElements) {
const roleName = role.querySelector('input').value || 'Unnamed Role';
const roleColor = role.querySelector('.role-color').style.backgroundColor;
roles.push({
name: roleName,
color: roleColor
});
}
// Prepare the server creation payload
const payload = {
name: templateName,
categories: categories,
channels: standaloneChannels,
roles: roles
};
try {
// Show loading state
const createBtn = document.getElementById('createServerBtn');
createBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Creating Server...';
createBtn.disabled = true;
// In a real implementation, you would send this to your backend
// which would then use the bot token to create the server
console.log("Server creation payload:", payload);
// Simulate API call delay
await new Promise(resolve => setTimeout(resolve, 2000));
// Show success message
alert(`Server "${templateName}" created successfully!`);
// Reset button
createBtn.innerHTML = '<i class="fas fa-plus mr-2"></i> Create Server';
createBtn.disabled = false;
} catch (error) {
console.error("Error creating server:", error);
alert("Failed to create server: " + error.message);
// Reset button
const createBtn = document.getElementById('createServerBtn');
createBtn.innerHTML = '<i class="fas fa-plus mr-2"></i> Create Server';
createBtn.disabled = false;
}
}
// Template Builder Functions
function initializeTemplateBuilder() {
// Initialize sortable for all containers
new Sortable(document.getElementById('categoriesContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
new Sortable(document.getElementById('channelsContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
new Sortable(document.getElementById('rolesContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
// Add event listener for refresh button
document.getElementById('refreshConnectionBtn').addEventListener('click', checkBotStatus);
// Add event listener for create server button
document.getElementById('createServerBtn').addEventListener('click', createServerFromTemplate);
// Add some default items
addDefaultAdminRole();
addDefaultCategory();
}
function addCategory() {
const categoriesContainer = document.getElementById('categoriesContainer');
const categoryId = 'category-' + Date.now();
const categoryHtml = `
<div class="template-item" id="${categoryId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon category-channel">
<i class="fas fa-folder text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="New Category" placeholder="Category Name">
</div>
<div class="flex space-x-2">
<button onclick="addChannelToCategory('${categoryId}')" class="text-xs text-blue-400 hover:text-blue-300">
<i class="fas fa-plus"></i> Channel
</button>
<button onclick="document.getElementById('${categoryId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="category-channels mt-3 ml-8 pl-4 border-l border-gray-700 space-y-3" id="${categoryId}-channels"></div>
</div>
`;
categoriesContainer.insertAdjacentHTML('beforeend', categoryHtml);
// Make the channels inside this category sortable
new Sortable(document.getElementById(`${categoryId}-channels`), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
updatePreview();
}
function addDefaultCategory() {
const categoriesContainer = document.getElementById('categoriesContainer');
const categoryId = 'category-default';
const categoryHtml = `
<div class="template-item" id="${categoryId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon category-channel">
<i class="fas fa-folder text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="General" placeholder="Category Name">
</div>
<div class="flex space-x-2">
<button onclick="addChannelToCategory('${categoryId}')" class="text-xs text-blue-400 hover:text-blue-300">
<i class="fas fa-plus"></i> Channel
</button>
<button onclick="document.getElementById('${categoryId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="category-channels mt-3 ml-8 pl-4 border-l border-gray-700 space-y-3" id="${categoryId}-channels"></div>
</div>
`;
categoriesContainer.insertAdjacentHTML('beforeend', categoryHtml);
// Make the channels inside this category sortable
new Sortable(document.getElementById(`${categoryId}-channels`), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
// Add default channels
addTextChannelToCategory(categoryId, 'welcome');
addTextChannelToCategory(categoryId, 'general');
addVoiceChannelToCategory(categoryId, 'General Voice');
updatePreview();
}
function addChannelToCategory(categoryId) {
const dropdownHtml = `
<div class="absolute left-0 mt-1 w-48 bg-gray-800 rounded-md shadow-lg z-10 border border-gray-700">
<div class="py-1">
<a href="#" onclick="addTextChannelToCategory('${categoryId}'); return false;" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700">
<i class="fas fa-hashtag mr-2 text-blue-400"></i> Text Channel
</a>
<a href="#" onclick="addVoiceChannelToCategory('${categoryId}'); return false;" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700">
<i class="fas fa-volume-up mr-2 text-green-400"></i> Voice Channel
</a>
</div>
</div>
`;
// Create and show dropdown
const dropdown = document.createElement('div');
dropdown.innerHTML = dropdownHtml;
dropdown.className = 'origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg';
dropdown.id = 'channel-type-dropdown';
const button = event.currentTarget;
button.parentNode.appendChild(dropdown);
// Close dropdown when clicking elsewhere
document.addEventListener('click', function closeDropdown(e) {
if (!dropdown.contains(e.target) && e.target !== button) {
dropdown.remove();
document.removeEventListener('click', closeDropdown);
}
});
}
function addTextChannel() {
const channelsContainer = document.getElementById('channelsContainer');
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon text-channel">
<i class="fas fa-hashtag text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="new-text-channel" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addVoiceChannel() {
const channelsContainer = document.getElementById('channelsContainer');
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon voice-channel">
<i class="fas fa-volume-up text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="new-voice-channel" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addTextChannelToCategory(categoryId, defaultName = 'new-text-channel') {
const channelsContainer = document.getElementById(`${categoryId}-channels`);
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon text-channel">
<i class="fas fa-hashtag text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="${defaultName}" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addVoiceChannelToCategory(categoryId, defaultName = 'new-voice-channel') {
const channelsContainer = document.getElementById(`${categoryId}-channels`);
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon voice-channel">
<i class="fas fa-volume-up text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="${defaultName}" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addRole() {
const rolesContainer = document.getElementById('rolesContainer');
const roleId = 'role-' + Date.now();
const roleHtml = `
<div class="template-item" id="${roleId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="role-color" style="background-color: #${Math.floor(Math.random()*16777215).toString(16)}"></div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="New Role" placeholder="Role Name">
</div>
<div class="flex space-x-2">
<button onclick="configureRolePermissions('${roleId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${roleId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
rolesContainer.insertAdjacentHTML('beforeend', roleHtml);
updatePreview();
}
function addDefaultAdminRole() {
const rolesContainer = document.getElementById('rolesContainer');
const roleId = 'role-admin';
const roleHtml = `
<div class="template-item" id="${roleId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="role-color" style="background-color: #ff0000"></div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="Admin" placeholder="Role Name">
</div>
<div class="flex space-x-2">
<button onclick="configureRolePermissions('${roleId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${roleId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="mt-2">
<span class="permission-chip">Administrator</span>
</div>
</div>
`;
rolesContainer.insertAdjacentHTML('beforeend', roleHtml);
updatePreview();
}
function configureChannelPermissions(channelId) {
alert('Channel permission configuration would go here for: ' + channelId);
// In a real implementation, this would open a modal with permission checkboxes
}
function configureRolePermissions(roleId) {
alert('Role permission configuration would go here for: ' + roleId);
// In a real implementation, this would open a modal with permission checkboxes
}
function updatePreview() {
const previewContainer = document.getElementById('templatePreview');
// Get template name
const templateName = document.getElementById('templateName').value || 'Unnamed Template';
// Get categories and their channels
let categoriesHtml = '';
const categoryElements = document.getElementById('categoriesContainer').children;
for (let category of categoryElements) {
const categoryName = category.querySelector('input').value || 'Unnamed Category';
// Get channels in this category
let channelsHtml = '';
const channelElements = category.querySelector('.category-channels').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
channelsHtml += `
<div class="flex items-center py-1 pl-6">
<div class="${isTextChannel ? 'text-blue-400' : 'text-green-400'} mr-2">
<i class="fas ${isTextChannel ? 'fa-hashtag' : 'fa-volume-up'}"></i>
</div>
<span class="text-gray-300">${channelName}</span>
</div>
`;
}
categoriesHtml += `
<div class="mb-4">
<div class="flex items-center py-2 border-b border-gray-700">
<div class="text-yellow-400 mr-2">
<i class="fas fa-folder"></i>
</div>
<span class="font-medium text-gray-200">${categoryName}</span>
</div>
${channelsHtml}
</div>
`;
}
// Get standalone channels (not in categories)
let standaloneChannelsHtml = '';
const channelElements = document.getElementById('channelsContainer').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
standaloneChannelsHtml += `
<div class="flex items-center py-1">
<div class="${isTextChannel ? 'text-blue-400' : 'text-green-400'} mr-2">
<i class="fas ${isTextChannel ? 'fa-hashtag' : 'fa-volume-up'}"></i>
</div>
<span class="text-gray-300">${channelName}</span>
</div>
`;
}
if (standaloneChannelsHtml) {
categoriesHtml += `
<div class="mb-4">
<div class="flex items-center py-2 border-b border-gray-700">
<span class="font-medium text-gray-200">Standalone Channels</span>
</div>
${standaloneChannelsHtml}
</div>
`;
}
// Get roles
let rolesHtml = '';
const roleElements = document.getElementById('rolesContainer').children;
for (let role of roleElements) {
const roleName = role.querySelector('input').value || 'Unnamed Role';
const roleColor = role.querySelector('.role-color').style.backgroundColor;
rolesHtml += `
<div class="flex items-center py-1">
<div class="w-3 h-3 rounded-full mr-2" style="background-color: ${roleColor}"></div>
<span class="text-gray-300">${roleName}</span>
</div>
`;
}
// Update preview
previewContainer.innerHTML = `
<h3 class="text-lg font-bold text-white mb-4">${templateName}</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="md:col-span-2">
<h4 class="text-md font-medium text-gray-300 mb-2">Server Structure</h4>
${categoriesHtml || '<p class="text-gray-500">No categories or channels added yet</p>'}
</div>
<div>
<h4 class="text-md font-medium text-gray-300 mb-2">Roles</h4>
${rolesHtml || '<p class="text-gray-500">No roles added yet</p>'}
</div>
</div>
`;
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=TutorialMentor/serverdev" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ServerDev | Template Builder</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Roboto+Mono:wght@300;400;500;600&display=swap');
body {
font-family: 'Roboto Mono', monospace;
background-color: #0a0a0a;
color: #e0e0e0;
overflow-x: hidden;
}
.title-font {
font-family: 'Orbitron', sans-serif;
}
.glow-text {
text-shadow: 0 0 8px rgba(0, 150, 255, 0.7);
}
.glow-box {
box-shadow: 0 0 15px rgba(0, 150, 255, 0.3);
}
.cyber-border {
position: relative;
border: 1px solid transparent;
}
.cyber-border::before {
content: '';
position: absolute;
inset: 0;
border-radius: 0.5rem;
padding: 2px;
background: linear-gradient(135deg, #00f2ff, #0066ff, #00f2ff);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
.input-field {
background-color: rgba(20, 20, 20, 0.8);
border: 1px solid #333;
transition: all 0.3s ease;
}
.input-field:focus {
border-color: #0066ff;
box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}
.password-btn {
background: linear-gradient(135deg, #0066ff, #00c6ff);
transition: all 0.3s ease;
}
.password-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 102, 255, 0.4);
}
.grid-bg {
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 30px 30px;
}
.cyber-loader {
width: 48px;
height: 48px;
border: 3px solid #0066ff;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
.cyber-loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 56px;
height: 56px;
border-radius: 50%;
border: 3px solid;