mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-25 13:41:43 +02:00
691 lines
21 KiB
HTML
691 lines
21 KiB
HTML
{% extends "baseTemplate/index.html" %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Create Nameserver - CyberPanel" %}{% endblock %}
|
|
|
|
{% block header_scripts %}
|
|
<style>
|
|
/* Modern Create Nameserver Styles */
|
|
.nameserver-creator {
|
|
background: transparent;
|
|
padding: 20px;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
}
|
|
|
|
.nameserver-container {
|
|
max-width: 1000px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
/* Header Section */
|
|
.nameserver-header {
|
|
margin-bottom: 40px;
|
|
text-align: center;
|
|
}
|
|
|
|
.nameserver-title {
|
|
font-size: 32px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.nameserver-title i {
|
|
color: #5b5fcf;
|
|
font-size: 36px;
|
|
}
|
|
|
|
.nameserver-subtitle {
|
|
font-size: 16px;
|
|
color: var(--text-secondary, #64748b);
|
|
line-height: 1.6;
|
|
max-width: 600px;
|
|
margin: 0 auto 20px;
|
|
}
|
|
|
|
.docs-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 10px 20px;
|
|
background: var(--bg-secondary, #f8f9ff);
|
|
color: #5b5fcf;
|
|
border: 1px solid var(--border-primary, #e8e9ff);
|
|
border-radius: 8px;
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.docs-link:hover {
|
|
background: #5b5fcf;
|
|
color: white;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(91,95,207,0.2);
|
|
}
|
|
|
|
/* PowerDNS Disabled State */
|
|
.powerdns-disabled {
|
|
background: var(--warning-light, #fff8e1);
|
|
border: 1px solid var(--warning-border, #ffe082);
|
|
border-radius: 12px;
|
|
padding: 40px;
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.powerdns-disabled i {
|
|
font-size: 48px;
|
|
color: #ffa000;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.powerdns-disabled h3 {
|
|
font-size: 20px;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.enable-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 24px;
|
|
background: #5b5fcf;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.enable-btn:hover {
|
|
background: #4a4fc4;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(91,95,207,0.3);
|
|
color: white;
|
|
}
|
|
|
|
/* Info Cards */
|
|
.info-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.info-card {
|
|
background: var(--bg-primary, white);
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
border: 1px solid var(--border-primary, #e8e9ff);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.info-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.08));
|
|
}
|
|
|
|
.info-card-icon {
|
|
width: 48px;
|
|
height: 48px;
|
|
background: var(--bg-secondary, #f8f9ff);
|
|
border-radius: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 16px;
|
|
color: #5b5fcf;
|
|
font-size: 24px;
|
|
}
|
|
|
|
.info-card-title {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.info-card-text {
|
|
font-size: 14px;
|
|
color: var(--text-secondary, #64748b);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
/* Main Form Card */
|
|
.nameserver-form-card {
|
|
background: var(--bg-primary, white);
|
|
border-radius: 16px;
|
|
box-shadow: var(--shadow-md, 0 1px 3px rgba(0,0,0,0.05)), var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.08));
|
|
border: 1px solid var(--border-primary, #e8e9ff);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.form-card-header {
|
|
background: linear-gradient(135deg, var(--bg-secondary, #f8f9ff) 0%, var(--bg-primary, #fff) 100%);
|
|
padding: 30px;
|
|
border-bottom: 1px solid var(--border-primary, #e8e9ff);
|
|
}
|
|
|
|
.form-card-title {
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #1e293b);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
|
|
.form-card-title::before {
|
|
content: '';
|
|
width: 4px;
|
|
height: 28px;
|
|
background: #5b5fcf;
|
|
border-radius: 2px;
|
|
}
|
|
|
|
/* Form Sections */
|
|
.form-section {
|
|
padding: 30px;
|
|
}
|
|
|
|
.section-divider {
|
|
border-top: 1px solid var(--border-primary, #e8e9ff);
|
|
margin: 0 30px;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.section-title i {
|
|
color: #5b5fcf;
|
|
font-size: 18px;
|
|
}
|
|
|
|
/* Form Groups */
|
|
.form-group {
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.form-group:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--text-secondary, #64748b);
|
|
margin-bottom: 8px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.form-control {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
border: 2px solid var(--border-primary, #e8e9ff);
|
|
border-radius: 10px;
|
|
font-size: 15px;
|
|
color: var(--text-primary, #1e293b);
|
|
background: var(--bg-primary, white);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.form-control:hover {
|
|
border-color: var(--border-secondary, #c7c9ff);
|
|
}
|
|
|
|
.form-control:focus {
|
|
outline: none;
|
|
border-color: #5b5fcf;
|
|
box-shadow: 0 0 0 3px rgba(91,95,207,0.1);
|
|
}
|
|
|
|
.form-hint {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-top: 8px;
|
|
font-size: 13px;
|
|
color: var(--text-muted, #94a3b8);
|
|
}
|
|
|
|
.form-hint i {
|
|
color: #5b5fcf;
|
|
font-size: 14px;
|
|
}
|
|
|
|
/* IP Input Group */
|
|
.ip-input-group {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 16px;
|
|
}
|
|
|
|
/* Visual Nameserver Display */
|
|
.nameserver-preview {
|
|
background: var(--bg-secondary, #f8f9ff);
|
|
border: 1px solid var(--border-primary, #e8e9ff);
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.preview-title {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--text-secondary, #64748b);
|
|
margin-bottom: 16px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.preview-servers {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 16px;
|
|
}
|
|
|
|
.preview-server {
|
|
background: var(--bg-primary, white);
|
|
border: 1px solid var(--border-primary, #e8e9ff);
|
|
border-radius: 8px;
|
|
padding: 16px;
|
|
text-align: center;
|
|
}
|
|
|
|
.preview-server-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
background: #5b5fcf;
|
|
color: white;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 12px;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.preview-server-name {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 4px;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
.preview-server-ip {
|
|
font-size: 13px;
|
|
color: var(--text-secondary, #64748b);
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
/* Submit Button */
|
|
.form-actions {
|
|
padding: 30px;
|
|
background: var(--bg-secondary, #fafbff);
|
|
text-align: center;
|
|
}
|
|
|
|
.btn-create {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 14px 32px;
|
|
background: #5b5fcf;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 10px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.btn-create:hover {
|
|
background: #4a4fc4;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 6px 20px rgba(91,95,207,0.3);
|
|
}
|
|
|
|
.btn-create:disabled {
|
|
background: #cbd5e1;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
/* Loading State */
|
|
.loading-spinner {
|
|
display: inline-block;
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid var(--bg-primary, #ffffff);
|
|
border-right-color: transparent;
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
margin-left: 8px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Alert Messages */
|
|
.alert {
|
|
padding: 16px 20px;
|
|
border-radius: 10px;
|
|
margin-top: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
animation: fadeIn 0.3s ease-out;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(-10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.alert-danger {
|
|
background: #ffebee;
|
|
border: 1px solid #ffcdd2;
|
|
color: #c62828;
|
|
}
|
|
|
|
.alert-success {
|
|
background: #e8f5e9;
|
|
border: 1px solid #c8e6c9;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
.alert i {
|
|
font-size: 20px;
|
|
}
|
|
|
|
.alert-content {
|
|
flex: 1;
|
|
}
|
|
|
|
.nameserver-list {
|
|
margin-top: 8px;
|
|
padding-left: 20px;
|
|
}
|
|
|
|
.nameserver-list li {
|
|
font-family: 'Courier New', monospace;
|
|
font-weight: 600;
|
|
font-size: 15px;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 768px) {
|
|
.nameserver-header {
|
|
text-align: left;
|
|
}
|
|
|
|
.nameserver-title {
|
|
font-size: 24px;
|
|
justify-content: flex-start;
|
|
}
|
|
|
|
.ip-input-group {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.info-cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.form-section {
|
|
padding: 20px;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% load static %}
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
|
|
<div class="nameserver-creator" ng-controller="createNameserver">
|
|
<div class="nameserver-container">
|
|
<div class="nameserver-header">
|
|
<h1 class="nameserver-title">
|
|
<i class="fas fa-server"></i>
|
|
{% trans "Create Nameserver" %}
|
|
</h1>
|
|
<p class="nameserver-subtitle">
|
|
{% trans "Set up custom nameservers to allow people on the internet to resolve websites hosted on this server" %}
|
|
</p>
|
|
<a href="https://cyberpanel.net/KnowledgeBase/home/manage-dns-in-cyberpanel/" target="_blank" class="docs-link">
|
|
<i class="fas fa-book"></i>
|
|
{% trans "DNS Documentation" %}
|
|
</a>
|
|
</div>
|
|
|
|
{% if not status %}
|
|
<div class="powerdns-disabled">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
<h3>{% trans "PowerDNS is disabled" %}</h3>
|
|
<p style="margin-bottom: 24px; color: var(--text-secondary, #64748b);">
|
|
{% trans "You need to enable PowerDNS to create custom nameservers" %}
|
|
</p>
|
|
<a href="{% url 'managePowerDNS' %}" class="enable-btn">
|
|
<i class="fas fa-power-off"></i>
|
|
{% trans "Enable PowerDNS" %}
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
|
|
<!-- Info Cards -->
|
|
<div class="info-cards">
|
|
<div class="info-card">
|
|
<div class="info-card-icon">
|
|
<i class="fas fa-info-circle"></i>
|
|
</div>
|
|
<div class="info-card-title">{% trans "What are Nameservers?" %}</div>
|
|
<div class="info-card-text">
|
|
{% trans "Nameservers translate domain names into IP addresses, allowing browsers to connect to websites." %}
|
|
</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-card-icon">
|
|
<i class="fas fa-shield-alt"></i>
|
|
</div>
|
|
<div class="info-card-title">{% trans "Redundancy" %}</div>
|
|
<div class="info-card-text">
|
|
{% trans "Two nameservers provide redundancy - if one fails, the other can still resolve your domains." %}
|
|
</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-card-icon">
|
|
<i class="fas fa-globe"></i>
|
|
</div>
|
|
<div class="info-card-title">{% trans "Domain Registrar" %}</div>
|
|
<div class="info-card-text">
|
|
{% trans "After creation, update your domain registrar to use these custom nameservers." %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Main Form Card -->
|
|
<div class="nameserver-form-card">
|
|
<div class="form-card-header">
|
|
<h2 class="form-card-title">
|
|
{% trans "Nameserver Configuration" %}
|
|
<span ng-hide="createNameserverLoading" class="loading-spinner"></span>
|
|
</h2>
|
|
</div>
|
|
|
|
<form class="nameserver-form">
|
|
<!-- Domain Section -->
|
|
<div class="form-section">
|
|
<h3 class="section-title">
|
|
<i class="fas fa-globe"></i>
|
|
{% trans "Domain Information" %}
|
|
</h3>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Domain Name" %}</label>
|
|
<input type="text" class="form-control" ng-model="domainForNS"
|
|
placeholder="example.com" required>
|
|
<div class="form-hint">
|
|
<i class="fas fa-info-circle"></i>
|
|
{% trans "Enter the main domain for which you're creating nameservers" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-divider"></div>
|
|
|
|
<!-- Primary Nameserver Section -->
|
|
<div class="form-section">
|
|
<h3 class="section-title">
|
|
<i class="fas fa-server"></i>
|
|
{% trans "Primary Nameserver (NS1)" %}
|
|
</h3>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Nameserver Hostname" %}</label>
|
|
<input type="text" class="form-control" ng-model="firstNS"
|
|
placeholder="ns1.example.com" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "IP Address" %}</label>
|
|
<input type="text" class="form-control" ng-model="firstNSIP"
|
|
placeholder="192.168.1.1" required>
|
|
<div class="form-hint">
|
|
<i class="fas fa-network-wired"></i>
|
|
{% trans "Enter the IP address for the primary nameserver" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-divider"></div>
|
|
|
|
<!-- Secondary Nameserver Section -->
|
|
<div class="form-section">
|
|
<h3 class="section-title">
|
|
<i class="fas fa-server"></i>
|
|
{% trans "Secondary Nameserver (NS2)" %}
|
|
</h3>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Nameserver Hostname" %}</label>
|
|
<input type="text" class="form-control" ng-model="secondNS"
|
|
placeholder="ns2.example.com" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "IP Address" %}</label>
|
|
<input type="text" class="form-control" ng-model="secondNSIP"
|
|
placeholder="192.168.1.2" required>
|
|
<div class="form-hint">
|
|
<i class="fas fa-network-wired"></i>
|
|
{% trans "Enter the IP address for the secondary nameserver" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Preview Section -->
|
|
<div class="form-section" ng-show="domainForNS && firstNS && secondNS">
|
|
<div class="nameserver-preview">
|
|
<div class="preview-title">{% trans "Preview" %}</div>
|
|
<div class="preview-servers">
|
|
<div class="preview-server">
|
|
<div class="preview-server-icon">
|
|
<i class="fas fa-server"></i>
|
|
</div>
|
|
<div class="preview-server-name">{$ firstNS || 'ns1.example.com' $}</div>
|
|
<div class="preview-server-ip">{$ firstNSIP || '0.0.0.0' $}</div>
|
|
</div>
|
|
<div class="preview-server">
|
|
<div class="preview-server-icon">
|
|
<i class="fas fa-server"></i>
|
|
</div>
|
|
<div class="preview-server-name">{$ secondNS || 'ns2.example.com' $}</div>
|
|
<div class="preview-server-ip">{$ secondNSIP || '0.0.0.0' $}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="form-actions">
|
|
<button type="button" ng-click="createNameserverFunc()" class="btn-create"
|
|
ng-disabled="!domainForNS || !firstNS || !firstNSIP || !secondNS || !secondNSIP">
|
|
<i class="fas fa-plus-circle"></i>
|
|
{% trans "Create Nameservers" %}
|
|
<span ng-hide="createNameserverLoading" class="loading-spinner"></span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Alert Messages -->
|
|
<div class="form-section" style="padding-top: 0;">
|
|
<div ng-hide="nameserverCreationFailed" class="alert alert-danger">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
<div class="alert-content">
|
|
<strong>{% trans "Nameserver creation failed" %}</strong><br>
|
|
{$ errorMessage $}
|
|
</div>
|
|
</div>
|
|
|
|
<div ng-hide="nameserverCreated" class="alert alert-success">
|
|
<i class="fas fa-check-circle"></i>
|
|
<div class="alert-content">
|
|
<strong>{% trans "Nameservers successfully created!" %}</strong>
|
|
<ul class="nameserver-list">
|
|
<li>{$ nameServerOne $}</li>
|
|
<li>{$ nameServerTwo $}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
|
<i class="fas fa-network-wired"></i>
|
|
<div class="alert-content">
|
|
{% trans "Could not connect to server. Please refresh this page." %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block footer_scripts %}
|
|
<script>
|
|
// Enhance the form with real-time preview
|
|
$(document).ready(function() {
|
|
// Initialize visibility states
|
|
var scope = angular.element($('[ng-controller="createNameserver"]')).scope();
|
|
if (scope) {
|
|
scope.$apply(function() {
|
|
scope.createNameserverLoading = true;
|
|
scope.nameserverCreationFailed = true;
|
|
scope.nameserverCreated = true;
|
|
scope.couldNotConnect = true;
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %} |