| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/self-hosted/ |
Upload File : |
<?php
require_once __DIR__ . '/brand_header.php';
require_once __DIR__ . '/self_hosted_activation_helpers.php';
if (!selfHostedModeEnabled()) {
if (selfHostedInstallerAllowed()) {
header('Location: /app/self_hosted_install.php');
exit;
}
http_response_code(404);
echo 'Self-hosted mode is not enabled.';
exit;
}
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$message = '';
$error = '';
$friendlyError = '';
$state = selfHostedLoadState();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$licenseKey = trim((string) ($_POST['license_key'] ?? ''));
$result = selfHostedActivateLicense($licenseKey);
if (!empty($result['ok'])) {
header('Location: /app/index.php?license_activated=1');
exit;
}
$error = trim((string) ($result['error'] ?? 'Could not activate the license.'));
$state = selfHostedLoadState();
} elseif (!empty($_GET['license_error'])) {
$error = trim((string) ($state['last_error'] ?? 'This self-hosted license needs attention before the app can open.'));
}
if ($error !== '') {
$normalizedError = strtolower($error);
if (strpos($normalizedError, 'revoked') !== false) {
$friendlyError = 'This HouseTab Pro license is no longer active. Please contact support if you believe this is an error.';
} elseif (strpos($normalizedError, 'not valid') !== false || strpos($normalizedError, 'validation failed') !== false) {
$friendlyError = 'This self-hosted install could not validate its license. Please check your connection and try again, or contact support if the issue continues.';
} elseif (strpos($normalizedError, 'not activated yet') !== false) {
$friendlyError = 'This self-hosted install still needs to be activated before the app can open.';
} elseif (strpos($normalizedError, 'another server') !== false) {
$friendlyError = 'This license is already active on another server. If this install was moved, please contact support or reset the activation from admin first.';
} else {
$friendlyError = 'This self-hosted license needs attention before the app can open.';
}
}
if ($error === '' && !empty($state['license_key'])) {
$message = 'This install is already activated.';
}
$dbConfigError = selfHostedDbConfigurationError();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Self-Hosted Setup</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 30px;
background: #f8fafc;
color: #1f2937;
}
.container {
max-width: 760px;
margin: 0 auto;
background: #fff;
padding: 28px;
border-radius: 14px;
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
h1 {
margin-top: 0;
}
.note,
.error,
.success {
padding: 12px 14px;
border-radius: 10px;
margin-bottom: 16px;
}
.note {
background: #eff6ff;
border: 1px solid #bfdbfe;
color: #1d4ed8;
}
.error {
background: #fef2f2;
border: 1px solid #fecaca;
color: #b91c1c;
}
.success {
background: #ecfdf5;
border: 1px solid #86efac;
color: #166534;
}
label {
display: block;
margin: 18px 0 8px;
font-weight: 700;
}
input[type="text"] {
width: 100%;
padding: 12px 14px;
border: 1px solid #cbd5e1;
border-radius: 10px;
box-sizing: border-box;
font-size: 16px;
}
.submit-btn,
.secondary-btn {
display: inline-block;
margin-top: 18px;
padding: 12px 18px;
border-radius: 10px;
text-decoration: none;
border: none;
cursor: pointer;
font-size: 15px;
font-weight: 700;
}
.submit-btn {
background: #2563eb;
color: #fff;
}
.secondary-btn {
background: #e2e8f0;
color: #1f2937;
margin-left: 10px;
}
dl {
display: grid;
grid-template-columns: 180px 1fr;
gap: 10px 14px;
margin: 18px 0 0;
}
dt {
font-weight: 700;
}
@media (max-width: 680px) {
body {
padding: 16px;
}
.container {
padding: 20px;
}
dl {
grid-template-columns: 1fr;
gap: 6px;
}
.secondary-btn {
margin-left: 0;
}
}
</style>
<?php echo appBrandStyles(); ?>
</head>
<body>
<div class="container">
<?php renderAppBrandHeader(); ?>
<h1>Self-Hosted License Setup</h1>
<p>Enter your HouseTab Pro license key once on this server. After that, this install will validate automatically in the background.</p>
<?php if ($dbConfigError !== ''): ?>
<div class="error"><?php echo htmlspecialchars($dbConfigError, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
<?php if ($error !== ''): ?>
<div class="error">
<strong><?php echo htmlspecialchars($friendlyError, ENT_QUOTES, 'UTF-8'); ?></strong>
<?php if ($friendlyError !== $error): ?>
<div style="margin-top:8px;font-size:14px;line-height:1.5;"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
</div>
<?php elseif ($message !== ''): ?>
<div class="success"><?php echo htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); ?></div>
<?php else: ?>
<div class="note">Use the same license key that was emailed after the self-hosted purchase.</div>
<?php endif; ?>
<form method="post">
<label for="license_key">License Key</label>
<input
type="text"
id="license_key"
name="license_key"
value="<?php echo htmlspecialchars((string) ($state['license_key'] ?? ''), ENT_QUOTES, 'UTF-8'); ?>"
placeholder="HTP-XXXX-XXXX-XXXX-XXXX"
autocomplete="off"
spellcheck="false"
required
>
<button type="submit" class="submit-btn">Activate This Server</button>
<?php if (!empty($state['license_key'])): ?>
<a class="secondary-btn" href="/app/index.php">Open App</a>
<?php endif; ?>
</form>
<dl>
<dt>Server Domain</dt>
<dd><?php echo htmlspecialchars(selfHostedCurrentDomain(), ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>Server Fingerprint</dt>
<dd style="word-break: break-all;"><?php echo htmlspecialchars(selfHostedCurrentFingerprint(), ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>License API</dt>
<dd><?php echo htmlspecialchars(SELF_HOSTED_LICENSE_API_URL, ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>Validation Interval</dt>
<dd><?php echo (int) round(SELF_HOSTED_VALIDATE_INTERVAL_SECONDS / 3600); ?> hours</dd>
<?php if (!empty($state['last_validated_at'])): ?>
<dt>Last Validation</dt>
<dd><?php echo htmlspecialchars((string) $state['last_validated_at'], ENT_QUOTES, 'UTF-8'); ?></dd>
<?php endif; ?>
</dl>
</div>
</body>
</html>