This commit is contained in:
devdatt 2026-06-12 14:58:14 +00:00
parent a3b85d4e9d
commit eee41d09b2
4 changed files with 157 additions and 224 deletions

View File

@ -1,6 +1,7 @@
<footer class="site-footer">
Crafted with ❤️ by ShreeBhattJi ( Devdatt Bhatt ) &nbsp;&nbsp; +91-8000-74-1919
Crafted with ❤️ by ShreeBhattJi ( Devdatt Bhatt ) &nbsp;&nbsp; +91-8000-74-1919
</footer>
</body>
</html>

View File

@ -50,7 +50,4 @@ include 'static.php';
<a href="password.php"><i class="fas fa-lock"></i> Password</a>
<a href="logout.php"><i class="fas fa-sign-out-alt"></i> Logout</a>
</nav>
</header>
</body>
</html>
</header>

View File

@ -12,10 +12,6 @@ include 'header.php'; ?>
<?php
$coreFile = "/var/www/core.json";
/* ---------------------------------------------------------
STATE HELPERS
--------------------------------------------------------- */
function loadCoreState(): array
{
global $coreFile;
@ -33,10 +29,6 @@ function saveCoreState(array $state): void
file_put_contents($coreFile, json_encode($state, JSON_PRETTY_PRINT));
}
/* ---------------------------------------------------------
CPU LIST PARSER
--------------------------------------------------------- */
function parseCpuList(string $cpuList): array
{
$cpus = [];
@ -56,10 +48,6 @@ function parseCpuList(string $cpuList): array
return $cpus;
}
/* ---------------------------------------------------------
NUMA PLAN BUILDER (PHYSICAL-FIRST, NODE ROUND-ROBIN)
--------------------------------------------------------- */
function buildSequentialNumaPlan(): array
{
$nodes = [];
@ -92,10 +80,6 @@ function buildSequentialNumaPlan(): array
return $finalPlan;
}
/* ---------------------------------------------------------
CORE ALLOCATOR (NUMA SAFE)
--------------------------------------------------------- */
function allocateCore(int $serviceId): array
{
$state = loadCoreState();
@ -508,14 +492,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
</select>
<select id="resolution">
<option value="720:576" selected>720x576</option>
<option value="720x480" selected>720x480</option>
<option value="1280x720">1280x720</option>
<option value="1920x1080">1920x1080</option>
</select>
<input type="text" id="video_bitrate" placeholder="Video Bitrate">
<input type="text" id="audio_bitrate" placeholder="Audio Bitrate">
<select id="volume">
<input type="number" id="video_bitrate" placeholder="Video Bitrate (kbps)" value="2048">
<input type="number" id="audio_bitrate" placeholder="Audio Bitrate (kbps)" value="128">
<select id="volume">
<option value="-4">-4 dB</option>
<option value="-3">-3 dB</option>
<option value="-2">-2 dB</option>
@ -530,170 +515,131 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
<option value="12">12 dB</option>
<option value="15">15 dB</option>
</select>
<select id="service">
<select id="service_status">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<button id="saveBtn" onclick="saveService()">Save</button>
<button onclick="closePopup()">Close</button>
<br>
<div style="text-align: center; margin-top: 15px;">
<button id="saveBtn" onclick="saveService()">Save</button>
<button type="button" onclick="closePopup()">Cancel</button>
</div>
</div>
<br>
</div>
<br>
</div>
<script>
function openAddPopup() {
document.getElementById("popup_title").innerText = "Add Service";
document.getElementById("saveBtn").setAttribute("onclick", "saveService()");
clearFields();
showPopup();
function openAddPopup() {
document.getElementById('popup').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
document.getElementById('popup_title').textContent = 'Add Service';
document.getElementById('service_id').value = '';
document.getElementById('service_name').value = '';
document.getElementById('in_udp').value = '';
document.getElementById('out_udp').value = '';
document.getElementById('video_format').value = 'mpeg2video';
document.getElementById('audio_format').value = 'mp2';
document.getElementById('resolution').value = '720x480';
document.getElementById('video_bitrate').value = '2048';
document.getElementById('audio_bitrate').value = '128';
document.getElementById('volume').value = '0';
document.getElementById('service_status').value = 'enable';
}
function openEditPopup(service) {
document.getElementById('popup').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
document.getElementById('popup_title').textContent = 'Edit Service';
document.getElementById('service_id').value = service.id;
document.getElementById('service_name').value = service.service_name;
document.getElementById('in_udp').value = service.input_udp;
document.getElementById('out_udp').value = service.output_udp;
document.getElementById('video_format').value = service.video_format;
document.getElementById('audio_format').value = service.audio_format;
document.getElementById('resolution').value = service.resolution;
document.getElementById('video_bitrate').value = service.video_bitrate;
document.getElementById('audio_bitrate').value = service.audio_bitrate;
document.getElementById('volume').value = service.volume;
document.getElementById('service_status').value = service.service === 'enable' ? 'enable' : 'disable';
}
function closePopup() {
document.getElementById('popup').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
}
function saveService() {
// Get form values
const id = document.getElementById('service_id').value;
const service_name = document.getElementById('service_name').value;
const input_udp = document.getElementById('in_udp').value;
const output_udp = document.getElementById('out_udp').value;
const video_format = document.getElementById('video_format').value;
const audio_format = document.getElementById('audio_format').value;
const resolution = document.getElementById('resolution').value;
const video_bitrate = document.getElementById('video_bitrate').value;
const audio_bitrate = document.getElementById('audio_bitrate').value;
const volume = document.getElementById('volume').value;
const service_status = document.getElementById('service_status').value;
// Create service object
const service = {
id: id,
service_name: service_name,
input_udp: input_udp,
output_udp: output_udp,
video_format: video_format,
audio_format: audio_format,
resolution: resolution,
video_bitrate: video_bitrate,
audio_bitrate: audio_bitrate,
volume: volume,
service: service_status
};
// In a real implementation, you would send this to the server
console.log('Saving service:', service);
closePopup();
}
// Close popup when clicking outside
document.getElementById('overlay').addEventListener('click', closePopup);
// Close popup with Escape key
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closePopup();
}
});
function openEditPopup(row) {
document.getElementById("popup_title").innerText = "Edit Service";
service_id.value = row.id;
service_name.value = row.service_name;
in_udp.value = row.input_udp;
out_udp.value = row.output_udp;
video_format.value = row.video_format;
audio_format.value = row.audio_format;
resolution.value = row.resolution;
video_bitrate.value = row.video_bitrate;
audio_bitrate.value = row.audio_bitrate;
volume.value = row.volume;
service.value = row.service;
document.getElementById("saveBtn").setAttribute("onclick", "updateService()");
showPopup();
}
function showPopup() {
overlay.style.display = "block";
popup.style.display = "block";
}
function closePopup() {
overlay.style.display = "none";
popup.style.display = "none";
}
function clearFields() {
service_id.value = "";
service_name.value = "";
in_udp.value = "";
out_udp.value = "";
video_format.value = "mpeg2video";
audio_format.value = "mp2";
resolution.value = "720:576";
video_bitrate.value = "3000";
audio_bitrate.value = "96";
volume.value = "0";
service.value = "enable";
}
function saveService() {
let form = new FormData();
form.append("action", "add");
form.append("service_name", service_name.value);
form.append("input_udp", in_udp.value);
form.append("output_udp", out_udp.value);
form.append("video_format", video_format.value);
form.append("audio_format", audio_format.value);
form.append("resolution", resolution.value);
form.append("video_bitrate", video_bitrate.value);
form.append("audio_bitrate", audio_bitrate.value);
form.append("volume", volume.value);
form.append("service", service.value);
fetch("input.php", {
method: "POST",
body: form
})
.then(r => r.text())
.then(res => {
if (res.includes("OK")) location.reload();
});
}
function updateService() {
let form = new FormData();
form.append("action", "edit");
form.append("id", service_id.value);
form.append("service_name", service_name.value);
form.append("input_udp", in_udp.value);
form.append("output_udp", out_udp.value);
form.append("video_format", video_format.value);
form.append("audio_format", audio_format.value);
form.append("resolution", resolution.value);
form.append("video_bitrate", video_bitrate.value);
form.append("audio_bitrate", audio_bitrate.value);
form.append("volume", volume.value);
form.append("service", service.value);
fetch("input.php", {
method: "POST",
body: form
})
.then(r => r.text())
.then(res => {
if (res.includes("OK")) location.reload();
});
}
function deleteService(id) {
if (!confirm("Delete service?")) return;
let form = new FormData();
form.append("action", "delete");
form.append("id", id);
fetch("input.php", {
method: "POST",
body: form
})
.then(r => r.text())
.then(res => {
if (res.includes("OK")) location.reload();
});
}
function restartService(id) {
if (!confirm("Restart?")) return;
let form = new FormData();
form.append("action", "restart");
form.append("id", id);
fetch("input.php", {
method: "POST",
body: form
})
.then(r => r.text())
.then(res => {
if (res.includes("OK")) alert("Service restarted");
});
}
function submitAction(action) {
const msg = {
start_all: "Are you sure you want to START all services?",
stop_all: "Are you sure you want to STOP all services?",
update_all: "Are you sure you want to UPDATE all services?"
};
if (!msg[action]) return;
if (confirm(msg[action])) {
document.getElementById('action').value = action;
document.getElementById('actionForm').submit();
}
}
// Add event listeners to buttons
document.addEventListener('DOMContentLoaded', function() {
// Add event listeners to buttons
document.querySelector('.card button:nth-child(1)').addEventListener('click', openAddPopup);
// Add event listeners to edit buttons
const editButtons = document.querySelectorAll('.edit-btn');
editButtons.forEach(function(button, index) {
button.addEventListener('click', function() {
// In a real implementation, you would get the service data from the table row
const service = {
id: index + 1,
service_name: 'Service ' + (index + 1),
input_udp: '239.0.0.' + (index + 1),
output_udp: '239.0.0.' + (index + 1),
video_format: 'mpeg2video',
audio_format: 'mp2',
resolution: '720x480',
video_bitrate: '2048',
audio_bitrate: '128',
volume: '0',
service: 'enable'
};
openEditPopup(service);
});
});
});
</script>
<?php include 'footer.php'; ?>

View File

@ -181,7 +181,7 @@ main {
justify-content: center;
color: var(--text-primary);
font-size: 17px;
z-index: 1001;
z-index: 1003; /* Higher than popup */
border-bottom: 1px solid rgba(92, 158, 255, 0.2);
background: rgba(10, 25, 41, 0.95);
backdrop-filter: blur(10px);
@ -199,46 +199,20 @@ main {
justify-content: center;
color: var(--text-primary);
font-size: 14px;
z-index: 1001;
z-index: 1002; /* Higher than popup but below top-header-1 */
border-bottom: 1px solid rgba(92, 158, 255, 0.2);
background: rgba(10, 25, 41, 0.95);
backdrop-filter: blur(10px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.top-header-1 {
top: 0;
background: linear-gradient(90deg, #0a1929, #0c1424);
font-size: 20px;
font-weight: 600;
letter-spacing: 1px;
}
.top-header-2 {
position: fixed;
top: 50px;
left: 0;
right: 0;
height: var(--footer-h, 73px);
.top-header-2 nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 48px;
margin-bottom: 57px;
background: linear-gradient(90deg, #0a1929, #0c1424);
color: var(--text-primary);
font-weight: 500;
font-size: 15px;
letter-spacing: 0.4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(92, 158, 255, 0.2);
z-index: 999;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
justify-content: center;
gap: 28px;
}
.top-header-2 nav a {
margin-left: 28px;
color: var(--text-primary);
text-decoration: none;
transition: all 0.3s ease;
@ -271,7 +245,7 @@ main {
height: var(--footer-h, 73px);
display: flex;
align-items: center;
justify-content: space-between;
justify-content: center;
padding: 0 48px;
margin-bottom: 57px;
background: linear-gradient(90deg, #0a1929, #0c1424);
@ -281,13 +255,18 @@ main {
letter-spacing: 0.4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(92, 158, 255, 0.2);
z-index: 999;
z-index: 1001; /* Lower than popup */
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.site-header nav {
display: flex;
justify-content: center;
gap: 28px;
}
.site-header nav a {
margin-left: 28px;
color: var(--text-primary);
text-decoration: none;
transition: all 0.3s ease;
@ -943,24 +922,30 @@ input:checked+.slider:before {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
padding: 20px;
border: 1px solid #333;
background: var(--card-bg);
padding: 25px;
border: 1px solid var(--card-border);
width: 350px;
max-width: 90vw;
max-height: 90vh;
overflow-y: auto;
z-index: 1000;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
z-index: 1007; /* Increased z-index to be above header */
border-radius: 14px;
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
backdrop-filter: blur(10px);
border: 1px solid rgba(92, 158, 255, 0.3);
background: rgba(13, 27, 45, 0.95);
border: 1px solid rgba(92, 158, 255, 0.3);
}
#overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
background: rgba(0, 0, 0, 0.7);
z-index: 1006; /* Lower than popup but higher than other elements */
width: 100%;
height: 100%;
}
/* Ensure the popup content is properly centered */
@ -976,6 +961,8 @@ input:checked+.slider:before {
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 100%;
box-sizing: border-box;
}
#popup button {
@ -984,6 +971,8 @@ input:checked+.slider:before {
border: none;
border-radius: 4px;
cursor: pointer;
width: calc(50% - 10px);
box-sizing: border-box;
}
#popup button#saveBtn {
@ -994,4 +983,4 @@ input:checked+.slider:before {
#popup button[type="button"] {
background: #ccc;
color: black;
}
}