test
This commit is contained in:
parent
25695889a0
commit
78f37b137a
|
|
@ -7,9 +7,26 @@
|
||||||
// - staging (0 or 1)
|
// - staging (0 or 1)
|
||||||
|
|
||||||
$FORM_PAGE = "domain.php"; // redirect back to your form
|
$FORM_PAGE = "domain.php"; // redirect back to your form
|
||||||
|
$https = false;
|
||||||
function alert_and_back($message)
|
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;
|
global $FORM_PAGE;
|
||||||
|
|
||||||
// SAFELY escape entire message for JavaScript (supports newlines, quotes, etc.)
|
// SAFELY escape entire message for JavaScript (supports newlines, quotes, etc.)
|
||||||
|
|
@ -38,21 +55,8 @@ function alert_and_back($message)
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read POST values
|
|
||||||
$domain = trim($_POST['domain'] ?? '');
|
|
||||||
$subdomains_raw = trim($_POST['subdomains'] ?? '');
|
|
||||||
$email = trim($_POST['email'] ?? '');
|
|
||||||
$staging = ($_POST['staging'] ?? "0") === "1" ? 1 : 0;
|
$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
|
// Validation helpers
|
||||||
function valid_domain_name($d)
|
function valid_domain_name($d)
|
||||||
{
|
{
|
||||||
|
|
@ -135,6 +139,6 @@ exec("sudo systemctl reload nginx 2>&1", $reload_out, $reload_rc);
|
||||||
if ($reload_rc !== 0) {
|
if ($reload_rc !== 0) {
|
||||||
alert_and_back("Cert created, nginx tested OK, but reload failed:\n" . implode("\n", $reload_out));
|
alert_and_back("Cert created, nginx tested OK, but reload failed:\n" . implode("\n", $reload_out));
|
||||||
}
|
}
|
||||||
|
$https = true;
|
||||||
// Success
|
// Success
|
||||||
alert_and_back("Certificate installed successfully for:\n" . implode(", ", $domains));
|
alert_and_back("Certificate installed successfully for:\n" . implode(", ", $domains));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,35 @@
|
||||||
<?php include 'header.php'; ?>
|
<?php include 'header.php'; ?>
|
||||||
<?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 ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
|
||||||
if (isset($_POST['action'])) {
|
if (isset($_POST['action'])) {
|
||||||
|
|
@ -594,7 +623,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$serviceEnabled = false;
|
$serviceEnabled = false;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card-row">shree
|
<div class="card-row">
|
||||||
<div class="service-label">
|
<div class="service-label">
|
||||||
<strong>Service</strong>
|
<strong>Service</strong>
|
||||||
|
|
||||||
|
|
@ -622,6 +651,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue