mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-09 23:37:58 +00:00
Fix the credentials page for port 8080 and improve the readme
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
3f672595ea
commit
1ff0576ee5
4 changed files with 41 additions and 3 deletions
|
|
@ -98,7 +98,7 @@ $app->get('/setup', function ($request, $response, $args) use ($container) {
|
|||
/** @var \AIO\Data\Setup $setup */
|
||||
$setup = $container->get(\AIO\Data\Setup::class);
|
||||
|
||||
if(!$setup->CanBeInstalled()) {
|
||||
if(!$setup->CanBeInstalled($request)) {
|
||||
return $view->render(
|
||||
$response,
|
||||
'already-installed.twig'
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ class DataConst {
|
|||
return self::GetDataDirectory() . '/configuration.json';
|
||||
}
|
||||
|
||||
public static function GetTempSetupFile() : string {
|
||||
return self::GetDataDirectory() . '/temp.setup';
|
||||
}
|
||||
|
||||
public static function GetBackupSecretFile() : string {
|
||||
return self::GetDataDirectory() . '/backupsecret';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace AIO\Data;
|
||||
|
||||
use AIO\Auth\PasswordGenerator;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class Setup
|
||||
{
|
||||
|
|
@ -26,7 +27,29 @@ class Setup
|
|||
return $password;
|
||||
}
|
||||
|
||||
public function CanBeInstalled() : bool {
|
||||
return !file_exists(DataConst::GetConfigFile());
|
||||
public function CanBeInstalled(?Request $request) : bool {
|
||||
if (file_exists(DataConst::GetConfigFile())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($request === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$uri = $request->getUri();
|
||||
if ($uri->getPort() === '8080') {
|
||||
if (!file_exists(DataConst::GetTempSetupFile())) {
|
||||
if(!is_dir(DataConst::GetDataDirectory())) {
|
||||
mkdir(DataConst::GetDataDirectory());
|
||||
}
|
||||
file_put_contents(DataConst::GetTempSetupFile(), '');
|
||||
return false;
|
||||
} else {
|
||||
unlink(DataConst::GetTempSetupFile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue