Skip to content

Firefly III: a personal finances manager

Clean up install page.

James Cole4932d04844a1
diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php
index 2f418aaec5..7456625f83 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -102,6 +102,7 @@ final class InstallController extends Controller
public function runCommand(Request $request): JsonResponse
{
+ //return response()->json([], 403);
if ($this->hasNoTables() || $this->isOldVersionInstalled()) {
$requestIndex = (int) $request->input('index');
$response = ['hasNextCommand' => false, 'done' => true, 'previous' => null, 'error' => false, 'errorMessage' => null];
diff --git a/public/v1/js/ff/install/index.js b/public/v1/js/ff/install/index.js
index 5ee367b625..92a0725712 100644
--- a/public/v1/js/ff/install/index.js
+++ b/public/v1/js/ff/install/index.js
@@ -25,7 +25,7 @@ document.addEventListener("DOMContentLoaded", (event) => {
});
function startRunningCommands(index) {
- console.log('Now in startRunningCommands with index' + index);
+ console.log('Now in startRunningCommands with index ' + index);
if (0 === index) {
document.querySelector('#status-box').innerHTML = '<span class="bi bi-hourglass"></span> Running first command...';
}
@@ -43,24 +43,31 @@ function runCommand(index) {
},
body: JSON.stringify({_token: token, index: parseInt(index)}),
})
- .then(response => response.json())
.then(response => {
- if (response.error === false) {
- index++;
- if (response.hasNextCommand) {
- // inform user
- document.querySelector('#status-box').innerHTML = '<span class="bi bi-hourglass"></span> Just executed ' + response.previous + '...';
- console.log('Will call next command.');
- runCommand(index);
- } else {
- completeDone();
- console.log('Finished!');
- }
- } else {
- displaySoftFail(response.errorMessage);
- console.error(response);
+ if(403 === response.status) {
+ window.location.reload();
+ //displaySoftFail('Please reload the page to continue.');
+ //console.error(response);
}
- })
+ response.json().then(json => {
+ console.log('JSON is', json);
+ if (false === json.error) {
+ index++;
+ if (json.hasNextCommand) {
+ // inform user
+ document.querySelector('#status-box').innerHTML = '<span class="bi bi-hourglass"></span> Just executed ' + json.previous + '...';
+ console.log('Will call next command.');
+ runCommand(index);
+ } else {
+ completeDone();
+ console.log('Finished!');
+ }
+ }
+ if(true === json.error) {
+ displaySoftFail(json.errorMessage);
+ }
+ });
+ });
}
function startMigration() {
@@ -105,7 +112,7 @@ function startDecryption() {
// move to decrypt routine.
startPassport();
} else {
- displaySoftFail(data.message);
+ displaySoftFail(response.message);
}
}).fail(function () {
@@ -169,7 +176,7 @@ function startUpgrade() {
*/
function startVerify() {
document.querySelector('#status-box').innerHTML = '<span class="bi bi-hourglass"></span> Verify database integrity...';
- fetch(veifyUrl, {
+ fetch(verifyUrl, {
method: 'POST',
headers: {
'Accept': 'application/json',
diff --git a/resources/views/install/index.blade.php b/resources/views/install/index.blade.php
index 7231e3a9c5..c7dc8daee2 100644
--- a/resources/views/install/index.blade.php
+++ b/resources/views/install/index.blade.php
@@ -1,87 +1,10 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <base href="{{ route('index') }}/"/>
- <meta charset="utf-8">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Firefly III - Installation and update</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="title" content="Firefly III - Installation and update">
-
- <!-- copy of head.blade.php -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="csrf-token" content="{{ csrf_token() }}">
- <meta name="robots" content="noindex, nofollow, noarchive, noodp, NoImageIndex, noydir">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="mobile-web-app-capable" content="yes">
- <meta name="color-scheme" content="light dark">
-
- <script type="text/javascript" nonce="{{ $JS_NONCE }}">
- /*!
- * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
- * Copyright 2011-2023 The Bootstrap Authors
- * Licensed under the Creative Commons Attribution 3.0 Unported License.
- */
-
- (() => {
- 'use strict'
- // todo store just happens to store in localStorage but if not, this would break.
- const getStoredTheme = () => JSON.parse(localStorage.getItem('darkMode'))
-
- const getPreferredTheme = () => {
- const storedTheme = getStoredTheme()
- if (storedTheme) {
- return storedTheme
- }
-
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
- }
-
- const setTheme = theme => {
- if (theme === 'browser' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
- document.documentElement.setAttribute('data-bs-theme', 'dark')
- window.theme = 'dark';
- return;
- }
- if (theme === 'browser' && window.matchMedia('(prefers-color-scheme: light)').matches) {
- window.theme = 'light';
- document.documentElement.setAttribute('data-bs-theme', 'light')
- return;
- }
- document.documentElement.setAttribute('data-bs-theme', theme)
- window.theme = theme;
- }
-
- setTheme(getPreferredTheme())
-
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
- const storedTheme = getStoredTheme()
- if (storedTheme !== 'light' && storedTheme !== 'dark') {
- setTheme(getPreferredTheme())
- }
- })
- })()
- </script>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- @vite(['sass/app.scss'])
-
-</head>
-<body class="container bg-body-secondary">
-<div class="row">
- <div class="col mt-3">
- <img src="images/logo-session.png" width="68" height="100" alt="Firefly III Logo" title="Firefly III"/><br>
- </div>
-</div>
+@extends('layout.v3.install')
+ @section('content')
<div class="row">
<div class="col">
- <h1><strong>Firefly</strong> III - <code>Installation and update</code></h1>
- </div>
-</div>
-<div class="row">
- <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
+ <p>The upgrade and installation is ongoing. Please track its progress through the box below.</p>
<div class="card mb-2">
<div class="card-body">
- <p>The upgrade and installation is ongoing. Please track its progress through the box below.</p>
<div class="row">
<div class="col-lg-12">
<div id="status-box" class="p-3 install-box-border">
@@ -95,6 +18,8 @@
</div>
</div>
</div>
+@endsection
+@section('scripts')
@yield('scripts')
<script type="text/javascript" nonce="{{ $JS_NONCE }}">
var token = '{{ csrf_token() }}';
@@ -103,5 +28,6 @@
var homeUrl = '{{ route('flush') }}';
</script>
<script type="text/javascript" src="v1/js/ff/install/index.js" nonce="{{ $JS_NONCE }}"></script>
+@endsection
</body>
</html>
diff --git a/resources/views/layout/v3/blank.blade.php b/resources/views/layout/v3/blank.blade.php
index e89ba98d48..947c8753c3 100644
--- a/resources/views/layout/v3/blank.blade.php
+++ b/resources/views/layout/v3/blank.blade.php
@@ -44,6 +44,6 @@
</div>
</main>
@vite(['js/pages/blank.js'])
-
+@yield('scripts')
</body>
</html>
diff --git a/resources/views/layout/v3/install.blade.php b/resources/views/layout/v3/install.blade.php
new file mode 100644
index 0000000000..9d1cc8687c
--- /dev/null
+++ b/resources/views/layout/v3/install.blade.php
@@ -0,0 +1,60 @@
+<!doctype html>
+<html lang="{{ __('config.html_language') }}">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="csrf-token" content="{{ csrf_token() }}">
+ <meta name="robots" content="noindex, nofollow, noarchive, noodp, NoImageIndex, noydir">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <meta name="mobile-web-app-capable" content="yes">
+ <!--
+ (BLANK)
+ If the base href URL begins with "http://" but you are sure it should start with "https://",
+ please visit the following page: https://bit.ly/FF3-broken-base-href
+ -->
+ <base href="{{ route('index', null, true) }}/">
+ <title>Firefly III - Installation and upgrade</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
+ <meta name="theme-color" content="#007bff" media="(prefers-color-scheme: light)"/>
+ <meta name="theme-color" content="#1a1a1a" media="(prefers-color-scheme: dark)"/>
+ <meta name="color-scheme" content="light dark">
+ @vite(['sass/app.scss'])
+ <x-layout.fav-icons/>
+ <script nonce="{{ $JS_NONCE ?? '' }}">
+ (() => {
+ 'use strict'
+ document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
+ })()
+ </script>
+ <style nonce="{{ $JS_NONCE }}">
+ textarea {font-family:Menlo, Monaco, Consolas, monospace;font-size:8pt !important;}
+ </style>
+</head>
+<body class="bg-body-tertiary">
+<main class="align-items-center min-vh-100 py-5">
+ <div class="container">
+ <div class="row justify-content-center">
+ <div class="col-md-12 col-lg-8 col-xl-8">
+ <p class="text-center">
+ <img src="images/logo-session.png" width="68" height="100" alt="Firefly III Logo" title="Firefly III"/><br>
+ </p>
+ @if(str_starts_with($FF_VERSION, 'develop'))
+ <h1 style="font-family: monospace;font-size:16pt;">
+ <em class="bi bi-wrench"></em>
+ <strong>Firefly</strong> III {{ $FF_VERSION }} - Installation and upgrade</h1>
+ @endif
+ @if(!str_starts_with($FF_VERSION, 'develop'))
+ <h1>
+ <em class="bi bi-wrench"></em>
+ <strong>Firefly</strong> III v{{ $FF_VERSION }} - Installation and upgrade</h1>
+ @endif
+ @yield('content')
+ </div>
+ </div>
+ </div>
+</main>
+@vite(['js/pages/blank.js'])
+@yield('scripts')
+</body>
+</html>