mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
Fix the installation template.
This commit is contained in:
@@ -19,10 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
"use strict";
|
|
||||||
//var status = $('#status-box');
|
|
||||||
// set HTML to "migrating...":
|
|
||||||
console.log('Starting...');
|
console.log('Starting...');
|
||||||
startRunningCommands(0);
|
startRunningCommands(0);
|
||||||
});
|
});
|
||||||
@@ -30,57 +27,81 @@ $(function () {
|
|||||||
function startRunningCommands(index) {
|
function startRunningCommands(index) {
|
||||||
console.log('Now in startRunningCommands with index' + index);
|
console.log('Now in startRunningCommands with index' + index);
|
||||||
if (0 === index) {
|
if (0 === index) {
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Running first command...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-spin fa-spinner"></span> Running first command...';
|
||||||
}
|
}
|
||||||
runCommand(index);
|
runCommand(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function runCommand(index) {
|
function runCommand(index) {
|
||||||
console.log('Now in runCommand(' + index + '): ' + runCommandUrl);
|
console.log('Now in runCommand(' + index + '): ' + runCommandUrl);
|
||||||
$.post(runCommandUrl, {_token: token, index: parseInt(index)}).done(function (data) {
|
|
||||||
if (data.error === false) {
|
|
||||||
// increase index
|
|
||||||
index++;
|
|
||||||
|
|
||||||
if(data.hasNextCommand) {
|
fetch(runCommandUrl, {
|
||||||
// inform user
|
method: 'POST',
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Just executed ' + data.previous + '...');
|
headers: {
|
||||||
console.log('Will call next command.');
|
'Accept': 'application/json',
|
||||||
runCommand(index);
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
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="fa fa-spin fa-spinner"></span> Just executed ' + response.previous + '...';
|
||||||
|
console.log('Will call next command.');
|
||||||
|
runCommand(index);
|
||||||
|
} else {
|
||||||
|
completeDone();
|
||||||
|
console.log('Finished!');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
completeDone();
|
displaySoftFail(response.errorMessage);
|
||||||
console.log('Finished!');
|
console.error(response);
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
displaySoftFail(data.errorMessage);
|
|
||||||
console.error(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}).fail(function () {
|
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> Command failed! See log files :(');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startMigration() {
|
function startMigration() {
|
||||||
console.log('Now in startMigration');
|
console.log('Now in startMigration');
|
||||||
$.post(migrateUrl, {_token: token}).done(function (data) {
|
|
||||||
if (data.error === false) {
|
fetch(migrateUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({_token: token}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
if (response.error === false) {
|
||||||
// move to decrypt routine.
|
// move to decrypt routine.
|
||||||
startDecryption();
|
startDecryption();
|
||||||
} else {
|
} else {
|
||||||
displaySoftFail(data.message);
|
displaySoftFail(response.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> Migration failed! See log files :(');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> Migration failed! See log files :(';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDecryption() {
|
function startDecryption() {
|
||||||
console.log('Now in startDecryption');
|
console.log('Now in startDecryption');
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Setting up DB #2...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-spin fa-spinner"></span> Setting up DB #2...';
|
||||||
$.post(decryptUrl, {_token: token}).done(function (data) {
|
fetch(decryptUrl, {
|
||||||
if (data.error === false) {
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({_token: token}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
if (response.error === false) {
|
||||||
// move to decrypt routine.
|
// move to decrypt routine.
|
||||||
startPassport();
|
startPassport();
|
||||||
} else {
|
} else {
|
||||||
@@ -88,7 +109,7 @@ function startDecryption() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> Migration failed! See log files :(');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> Migration failed! See log files :(';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,16 +117,25 @@ function startDecryption() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function startPassport() {
|
function startPassport() {
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Setting up OAuth2...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-spin fa-spinner"></span> Setting up OAuth2...';
|
||||||
$.post(keysUrl, {_token: token}).done(function (data) {
|
fetch(keysUrl, {
|
||||||
if (data.error === false) {
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({_token: token}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
if (response.error === false) {
|
||||||
startUpgrade();
|
startUpgrade();
|
||||||
} else {
|
} else {
|
||||||
displaySoftFail(data.message);
|
displaySoftFail(data.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> OAuth2 failed! See log files :(');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> OAuth2 failed! See log files :(';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,15 +143,24 @@ function startPassport() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function startUpgrade() {
|
function startUpgrade() {
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Upgrading database...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-spin fa-spinner"></span> Upgrading database...';
|
||||||
$.post(upgradeUrl, {_token: token}).done(function (data) {
|
fetch(upgradeUrl, {
|
||||||
if (data.error === false) {
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({_token: token}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
if (response.error === false) {
|
||||||
startVerify();
|
startVerify();
|
||||||
} else {
|
} else {
|
||||||
displaySoftFail(data.message);
|
displaySoftFail(data.message);
|
||||||
}
|
}
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> Upgrade failed! See log files :(');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> Upgrade failed! See log files :(';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,15 +168,24 @@ function startUpgrade() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function startVerify() {
|
function startVerify() {
|
||||||
$('#status-box').html('<span class="fa fa-spin fa-spinner"></span> Verify database integrity...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-spin fa-spinner"></span> Verify database integrity...';
|
||||||
$.post(verifyUrl, {_token: token}).done(function (data) {
|
fetch(veifyUrl, {
|
||||||
if (data.error === false) {
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({_token: token}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
if (response.error === false) {
|
||||||
completeDone();
|
completeDone();
|
||||||
} else {
|
} else {
|
||||||
displaySoftFail(data.message);
|
displaySoftFail(data.message);
|
||||||
}
|
}
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> Verification failed! See log files :(');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> Verification failed! See log files :(';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,14 +193,14 @@ function startVerify() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function completeDone() {
|
function completeDone() {
|
||||||
$('#status-box').html('<span class="fa fa-thumbs-up"></span> Installation + upgrade complete! Wait to be redirected...');
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-thumbs-up"></span> Installation + upgrade complete! Wait to be redirected...';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.location = homeUrl;
|
window.location = homeUrl;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function displaySoftFail(message) {
|
function displaySoftFail(message) {
|
||||||
$('#status-box').html('<span class="fa fa-warning"></span> ' + message + '<br /><br />Please read the ' +
|
document.querySelector('#status-box').innerHTML = '<span class="fa fa-warning"></span> ' + message + '<br /><br />Please read the ' +
|
||||||
'<a href="https://docs.firefly-iii.org/">' +
|
'<a href="https://docs.firefly-iii.org/">' +
|
||||||
'documentation</a> about this, and upgrade by hand.');
|
'documentation</a> about this, and upgrade by hand.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,6 @@
|
|||||||
var runCommandUrl = '{{ route('installer.runCommand') }}';
|
var runCommandUrl = '{{ route('installer.runCommand') }}';
|
||||||
var homeUrl = '{{ route('flush') }}';
|
var homeUrl = '{{ route('flush') }}';
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="v1/js/ff/install/index.js" nonce="{{ JS_NONCE }}"></script>
|
<script type="text/javascript" src="v1/js/ff/install/Xindex.js" nonce="{{ JS_NONCE }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
104
resources/views/install/index.blade.php
Normal file
104
resources/views/install/index.blade.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<!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="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(['resources/assets/v2/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>
|
||||||
|
<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">
|
||||||
|
<div class="card">
|
||||||
|
<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" style="border:1px #ddd solid;padding:5px;">
|
||||||
|
<span class="fa fa-spin fa-spinner"></span> Waiting to start...
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@yield('scripts')
|
||||||
|
<script type="text/javascript" nonce="{{ $JS_NONCE }}">
|
||||||
|
var token = '{{ csrf_token() }}';
|
||||||
|
var index = 0;
|
||||||
|
var runCommandUrl = '{{ route('installer.runCommand') }}';
|
||||||
|
var homeUrl = '{{ route('flush') }}';
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="v1/js/ff/install/index.js" nonce="{{ $JS_NONCE }}"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user