test
This commit is contained in:
parent
25695889a0
commit
78f37b137a
|
|
@ -7,9 +7,26 @@
|
|||
// - staging (0 or 1)
|
||||
|
||||
$FORM_PAGE = "domain.php"; // redirect back to your form
|
||||
|
||||
$https = false;
|
||||
function alert_and_back($message)
|
||||
{
|
||||
global $https;
|
||||
$domain = trim($_POST['domain'] ?? '');
|
||||
$subdomains_raw = trim($_POST['subdomains'] ?? '');
|
||||
$email = trim($_POST['email'] ?? '');
|
||||
|
||||
|
||||
$jsonFile = __DIR__ . '/domain.json';
|
||||
$new = [
|
||||
'domain' => $domain,
|
||||
'subdomain' => $subdomains_raw,
|
||||
'email' => $email,
|
||||
'https' => $https
|
||||
];
|
||||
$json = json_encode($new, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
file_put_contents($jsonFile, $json, LOCK_EX);
|
||||
|
||||
|
||||
global $FORM_PAGE;
|
||||
|
||||
// SAFELY escape entire message for JavaScript (supports newlines, quotes, etc.)
|
||||
|
|
@ -38,21 +55,8 @@ function alert_and_back($message)
|
|||
exit;
|
||||
}
|
||||
|
||||
// Read POST values
|
||||
$domain = trim($_POST['domain'] ?? '');
|
||||
$subdomains_raw = trim($_POST['subdomains'] ?? '');
|
||||
$email = trim($_POST['email'] ?? '');
|
||||
$staging = ($_POST['staging'] ?? "0") === "1" ? 1 : 0;
|
||||
|
||||
$jsonFile = __DIR__ . '/domain.json';
|
||||
$new = [
|
||||
'domain' => $domain,
|
||||
'subdomain' => $subdomains_raw,
|
||||
'email' => $email,
|
||||
];
|
||||
$json = json_encode($new, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
file_put_contents($jsonFile, $json, LOCK_EX);
|
||||
|
||||
// Validation helpers
|
||||
function valid_domain_name($d)
|
||||
{
|
||||
|
|
@ -135,6 +139,6 @@ exec("sudo systemctl reload nginx 2>&1", $reload_out, $reload_rc);
|
|||
if ($reload_rc !== 0) {
|
||||
alert_and_back("Cert created, nginx tested OK, but reload failed:\n" . implode("\n", $reload_out));
|
||||
}
|
||||
|
||||
$https = true;
|
||||
// Success
|
||||
alert_and_back("Certificate installed successfully for:\n" . implode(", ", $domains));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,35 @@
|
|||
<?php include 'header.php'; ?>
|
||||
<?php
|
||||
|
||||
$domain = "";
|
||||
$https = false;
|
||||
|
||||
$jsonFile = __DIR__ . '/domain.json';
|
||||
|
||||
if (file_exists($jsonFile)) {
|
||||
$raw = file_get_contents($jsonFile);
|
||||
$data = json_decode($raw, true);
|
||||
$domain = $data['domain'];
|
||||
$https = $data['https'];
|
||||
} else {
|
||||
$domain = $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
|
||||
$jsonFile = __DIR__ . '/output.json';
|
||||
if (file_exists($jsonFile)) {
|
||||
$raw = file_get_contents($jsonFile);
|
||||
$data = json_decode($raw, true);
|
||||
}
|
||||
|
||||
$service_rtmp0_multiple = $data['service_rtmp0_multiple'];
|
||||
$service_rtmp0_hls = $data['service_rtmp0_hls'];
|
||||
$service_rtmp0_dash = $data['service_rtmp0_dash'];
|
||||
$service_rtmp1_multiple = $data['service_rtmp0_multiple'];
|
||||
$service_rtmp1_hls = $data['service_rtmp0_hls'];
|
||||
$service_rtmp1_dash = $data['service_rtmp0_dash'];
|
||||
$service_srt_multiple = $data['service_srt_multiple'];
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
if (isset($_POST['action'])) {
|
||||
|
|
@ -594,7 +623,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
$serviceEnabled = false;
|
||||
?>
|
||||
|
||||
<div class="card-row">shree
|
||||
<div class="card-row">
|
||||
<div class="service-label">
|
||||
<strong>Service</strong>
|
||||
|
||||
|
|
@ -622,6 +651,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card wide">
|
||||
<h3>Output Links</h3>
|
||||
<h4>Encoder IP</h4>
|
||||
<?php echo "<h5>http://".$domain."</h5>"; ?>
|
||||
<?php if($https) echo "<h5>https://".$domain."</h5>"; ?>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue