install-finish-magic

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-20 13:44:44 +02:00
parent 07094f231a
commit 3ee04a6e75
9 changed files with 66 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ return [
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'checkbox',
'default' => false,
'default' => true,
'save_method' => 'storeSettingField'
],
'system_froxloraliases' => [

View File

@@ -598,7 +598,7 @@ opcache.validate_timestamps'),
('system', 'ftpserver', 'proftpd'),
('system', 'dns_createmailentry', '0'),
('system', 'dns_createcaaentry', '1'),
('system', 'froxlordirectlyviahostname', '0'),
('system', 'froxlordirectlyviahostname', '1'),
('system', 'report_enable', '1'),
('system', 'report_webmax', '90'),
('system', 'report_trafficmax', '90'),

View File

@@ -163,11 +163,14 @@ class UI
self::$install_mode = $install_mode;
// init twig template engine
$loader = new FilesystemLoader(Froxlor::getInstallDir() . '/templates/');
self::$twig = new Environment($loader, [
'debug' => true,
'cache' => Froxlor::getInstallDir() . '/cache',
'auto_reload' => true
]);
$twig_params = [
'auto_reload' => true,
'debug' => false,
];
if (is_writable(Froxlor::getInstallDir() . '/cache')) {
$twig_params['cache'] = Froxlor::getInstallDir() . '/cache';
}
self::$twig = new Environment($loader, $twig_params);
self::$twig->addExtension(new DebugExtension());
self::$twig->addExtension(new CustomReflection());
self::$twig->addExtension(new FroxlorTwig());

View File

@@ -231,7 +231,11 @@ return [
'type' => 'checkbox',
'value' => '1',
'checked' => old('manual_config', '0', 'installation'),
]
],
'target_servername' => [
'type' => 'hidden',
'value' => $_SESSION['installation']['servername'] ?? "",
],
]
]
]

View File

@@ -2169,6 +2169,7 @@ Vielen Dank, Ihr Administrator',
'description' => 'Der untenstehende Befehl lädt, installiert und konfiguriert die benötigten Dienste auf dem System aufgrund der Angaben die während des Installationsprozessen gesammelt wurden.',
'runcmd' => 'Folgenden Befehl als root-Benutzer in der Shell auf dem Server ausführen:',
'manual_config' => 'Ich werden die Dienste manuell konfigurieren, direkt zum Login umleiten',
'waitforconfig' => 'Warte auf Abschluss der Dienstkonfiguration...',
],
'errors' => [
'wrong_ownership' => 'Die froxlor Dateien gehören nicht vollständig dem Benutzer %s:%s',

View File

@@ -2555,6 +2555,7 @@ Yours sincerely, your administrator',
'description' => 'The command below will download, install and configure required services on your system according to the data you have given in this installation process.',
'runcmd' => 'Run the following command as root-user in your shell on this server:',
'manual_config' => 'I will manually configure the services, just take me to the login',
'waitforconfig' => 'Waiting for services to be configured...',
],
'errors' => [
'wrong_ownership' => 'Make sure the froxlor files are owned by %s:%s',

View File

@@ -60,7 +60,8 @@
<a href="?step={{ setup.step - 1 }}" class="btn btn-secondary">&laquo; {{ lng('panel.back') }}</a>
<button type="submit" name="submit" class="btn btn-primary">{{ lng('panel.next') }} &raquo;</button>
{% else %}
<button type="submit" name="submit" class="btn btn-success">{{ lng('install.install.top') }} &raquo;</button>
<span id="submitAuto"><i class="fas fa-spinner fa-pulse"></i> {{ lng('install.install.waitforconfig') }}</span>
<button id="submitManual" type="submit" name="submit" class="btn btn-success d-none">{{ lng('install.install.top') }} &raquo;</button>
{% endif %}
</div>
{% else %}

View File

@@ -11,7 +11,7 @@
<pre>chown -R {{ user }}:{{ group }} {{ installdir }}</pre>
<hr>
<p class="mt-1 text-center">
<a href="./install/install.php" class="btn btn-primary" title="Click to start the install process">Start install</a>
<a href="" class="btn btn-primary" title="Reload page">Reload</a>
</p>
</div>
</div>

View File

@@ -4,7 +4,7 @@ $(function () {
*/
$('#switchInstallMode').on('click', function () {
var checked = $(this).prop('checked');
window.location = '/install/install.php' + replaceQueryParam('extended', +checked, window.location.search);
window.location = window.location.pathname + replaceQueryParam('extended', +checked, window.location.search);
});
function replaceQueryParam(param, newval, search) {
@@ -14,4 +14,49 @@ $(function () {
}
return search + '&' + param + '=' + newval;
}
function checkConfigState() {
$.ajax({
url: window.location.href,
type: "GET",
success: function (data, textStatus, request) {
if (request.status >= 300) {
window.location = "http://" + srvName;
}
},
error: function (request, textStatus, errorThrown) {
// continue
if (request.status >= 300) {
window.location = "http://" + srvName;
}
}
});
}
var cTimer;
/**
* check manual-config switch
*/
$('#manual_config').on('click', function () {
clearInterval(cTimer);
var checked = $(this).prop('checked');
if (checked) {
// button zum login
$('#submitAuto').addClass('d-none');
$('#submitManual').removeClass('d-none');
} else {
cTimer = setInterval(checkConfigState, 1000);
// spinner fürs warten
$('#submitAuto').removeClass('d-none');
$('#submitManual').addClass('d-none');
}
});
if ($('#manual_config').length > 0) {
var srvName = $('#target_servername').val();
clearInterval(cTimer);
cTimer = setInterval(checkConfigState, 1000);
}
});