Jelajahi Sumber

+Versioning

root 6 bulan lalu
induk
melakukan
4277494300

TEMPAT SAMPAH
__pycache__/config.cpython-39.pyc


+ 1 - 1
app.py

@@ -8,7 +8,7 @@ from core import file_manager as fm
 from core import dns_manager as dns
 from core import adblock_manager as ab
 from core import cluster_manager as cm
-from core import stats_manager as stats
+from core import stats_manager as stats 
 
 app = Flask(__name__)
 app.secret_key = "bind_pro_v108_modular_masterpiece"

TEMPAT SAMPAH
core/__pycache__/__init__.cpython-39.pyc


TEMPAT SAMPAH
core/__pycache__/adblock_manager.cpython-39.pyc


TEMPAT SAMPAH
core/__pycache__/cluster_manager.cpython-39.pyc


TEMPAT SAMPAH
core/__pycache__/dns_manager.cpython-39.pyc


TEMPAT SAMPAH
core/__pycache__/file_manager.cpython-39.pyc


TEMPAT SAMPAH
core/__pycache__/stats_manager.cpython-39.pyc


+ 1 - 1
templates/dashboard.html

@@ -260,7 +260,7 @@ function closeAddModal() { document.getElementById('addZoneModal').classList.add
 function openAssignModal(d, o) { document.getElementById('assignDomainInput').value=d; document.getElementById('assignDomainDisplay').innerText=d; document.getElementById('assignOwnerSelect').value=o; document.getElementById('assignZoneModal').classList.remove('hidden'); }
 function closeAssignModal() { document.getElementById('assignZoneModal').classList.add('hidden'); }
 
-function toggleZoneFields() {
+function toggleZoneFields() { 
     const type = document.getElementById('zoneType').value;
     const domCont = document.getElementById('domainContainer');
     const domInp = document.getElementById('domainInput');

+ 1 - 1
templates/general_config.html

@@ -8,7 +8,7 @@
     <button onclick="saveAllSettings()" class="bg-blue-600 hover:bg-blue-500 px-10 py-3 rounded-xl font-black shadow-2xl transition transform hover:scale-[1.05] text-white uppercase tracking-widest text-xs">Save All Changes</button>
 </div>
 
-<form id="mainForm" action="/settings/save" method="POST" class="space-y-12">
+<form id="mainForm" action="/settings/save" method="POST" class="space-y-12"> 
     <div class="grid grid-cols-1 xl:grid-cols-3 gap-10">
         
         <div class="xl:col-span-1 space-y-6">

+ 45 - 12
templates/users.html

@@ -29,10 +29,17 @@
                 </td>
                 <td class="p-6 text-xs text-gray-500">{{ data.assigned_templates|join(', ') or 'None' }}</td>
                 <td class="p-6 text-right">
-                    <button onclick="editUser('{{u}}', '{{data.role}}', {{data.assigned_templates|tojson}})" class="text-blue-500 hover:text-blue-400 text-[10px] font-black uppercase mr-4">Edit</button>
+                    
+                    <button type="button" 
+							onclick="editUser('{{ u|e }}', '{{ data.role|e }}', '{{ data.assigned_templates|join(',') if data.assigned_templates else '' }}')" 
+							class="text-blue-500 hover:text-blue-400 text-[10px] font-black uppercase mr-4">
+						Edit
+					</button>
+
                     {% if u != 'admin' %}
-                    <a href="/users/delete/{{ u }}" onclick="return confirm('Delete user?')" class="text-red-500 hover:text-red-400 text-[10px] font-black uppercase">Delete</a>
+                    <a href="/users/delete/{{ u|urlencode }}" onclick="return confirm('Are you sure you want to delete this user?')" class="text-red-500 hover:text-red-400 text-[10px] font-black uppercase">Delete</a>
                     {% endif %}
+                    
                 </td>
             </tr>
             {% endfor %}
@@ -48,7 +55,7 @@
             <input type="hidden" name="old_username" id="oldUsername">
             
             <input type="text" name="username" id="userName" placeholder="Username" required class="w-full bg-[#0b0e14] border border-gray-800 rounded-xl p-3 text-sm font-bold text-white outline-none">
-            <input type="password" name="password" id="userPass" placeholder="Password" class="w-full bg-[#0b0e14] border border-gray-800 rounded-xl p-3 text-sm font-bold text-white outline-none">
+            <input type="password" name="password" id="userPass" placeholder="Password (Leave blank to keep current)" class="w-full bg-[#0b0e14] border border-gray-800 rounded-xl p-3 text-sm font-bold text-white outline-none">
             
             <select name="role" id="userRole" class="w-full bg-[#0b0e14] border border-gray-800 rounded-xl p-3 text-sm font-bold text-white outline-none">
                 <option value="user">User (Restricted)</option>
@@ -57,7 +64,7 @@
 
             <div class="bg-black/20 p-4 rounded-xl border border-gray-800">
                 <label class="text-[10px] font-black text-gray-500 uppercase block mb-3">Assigned Templates</label>
-                <div class="grid grid-cols-2 gap-2">
+                <div class="grid grid-cols-2 gap-2 max-h-48 overflow-y-auto pr-2">
                     {% for t in all_templates %}
                     <label class="flex items-center gap-2 text-xs text-gray-400 cursor-pointer hover:text-white">
                         <input type="checkbox" name="assigned_templates[]" value="{{ t }}" class="template-check rounded border-gray-700 bg-gray-900 text-blue-600">
@@ -68,8 +75,8 @@
             </div>
 
             <div class="flex gap-4 pt-4">
-                <button type="button" onclick="closeUserModal()" class="flex-1 bg-gray-800 text-gray-400 font-bold py-3 rounded-xl uppercase text-xs">Cancel</button>
-                <button type="submit" class="flex-1 bg-blue-600 text-white font-black py-3 rounded-xl uppercase text-xs">Save</button>
+                <button type="button" onclick="closeUserModal()" class="flex-1 bg-gray-800 text-gray-400 font-bold py-3 rounded-xl uppercase text-xs hover:text-white transition">Cancel</button>
+                <button type="submit" class="flex-1 bg-blue-600 text-white font-black py-3 rounded-xl uppercase text-xs hover:bg-blue-500 transition">Save</button>
             </div>
         </form>
     </div>
@@ -81,19 +88,45 @@ function openAddUser() {
     document.getElementById('userAction').value = 'add';
     document.getElementById('modalTitle').innerText = 'Add User';
     document.getElementById('userName').value = '';
-    document.querySelectorAll('.template-check').forEach(c => c.checked = false);
+    document.getElementById('userPass').value = '';
+    document.getElementById('userPass').placeholder = 'Password (Required)';
+    document.getElementById('userPass').required = true;
+    
+    var checkboxes = document.querySelectorAll('.template-check');
+    for (var i = 0; i < checkboxes.length; i++) {
+        checkboxes[i].checked = false;
+    }
 }
-function editUser(u, role, templates) {
+
+function editUser(u, role, rawTemplates) {
+    // Παίρνουμε το απλό κείμενο "AWMN,LOCAL" και το κόβουμε εκεί που έχει κόμμα, 
+    // φτιάχνοντας μια σωστή λίστα. Αν είναι άδειο, φτιάχνουμε κενή λίστα.
+    var templates = rawTemplates ? rawTemplates.split(',') : [];
+
+    // Εμφάνιση Modal
     document.getElementById('userModal').classList.remove('hidden');
+    
+    // Συμπλήρωση πεδίων
     document.getElementById('userAction').value = 'edit';
     document.getElementById('oldUsername').value = u;
     document.getElementById('userName').value = u;
     document.getElementById('userRole').value = role;
     document.getElementById('modalTitle').innerText = 'Edit User';
-    document.querySelectorAll('.template-check').forEach(c => {
-        c.checked = templates.includes(c.value);
-    });
+    
+    // Ο κωδικός στο Edit δεν είναι υποχρεωτικός
+    document.getElementById('userPass').value = '';
+    document.getElementById('userPass').placeholder = 'Password (Leave blank to keep current)';
+    document.getElementById('userPass').required = false; 
+
+    // Τσεκάρισμα των σωστών Templates
+    var checkboxes = document.querySelectorAll('.template-check');
+    for (var i = 0; i < checkboxes.length; i++) {
+        checkboxes[i].checked = templates.includes(checkboxes[i].value);
+    }
+}
+
+function closeUserModal() { 
+    document.getElementById('userModal').classList.add('hidden'); 
 }
-function closeUserModal() { document.getElementById('userModal').classList.add('hidden'); }
 </script>
 {% endblock %}