setup do linter run & fix

This commit is contained in:
janis
2023-10-05 13:31:51 +02:00
parent 46d565fbe7
commit 0352bb9051
12 changed files with 374 additions and 374 deletions

View File

@@ -176,5 +176,5 @@ export default {
this.theme = '☽'; this.theme = '☽';
} }
} }
} };
</script> </script>

View File

@@ -15,108 +15,108 @@
</template> </template>
<script> <script>
export default { export default {
name: 'notificationsAPI', name: 'notificationsAPI',
props: { props: {
location: { location: {
type: String, type: String,
'default': 'topleft', 'default': 'topleft',
},
size: {
type: String,
'default': 'default',
}
// Size options: small, default (default option), big, bigger, huge
}, },
data () { size: {
return { type: String,
notifications: {}, 'default': 'default',
queue: [], }
message: '', // Size options: small, default (default option), big, bigger, huge
messageType: 'hide', },
notificationDisplayTime: 0, data () {
notificationPriority: 'normal', return {
currentlyDisplayedNotificationID: 0, notifications: {},
currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 }, queue: [],
displayTimeCurrentNotification: 0, message: '',
notificationScheduler: null, messageType: 'hide',
} notificationDisplayTime: 0,
}, notificationPriority: 'normal',
methods: { currentlyDisplayedNotificationID: 0,
createNotification( message, showDuration, messageType, priority ) { currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 },
/* displayTimeCurrentNotification: 0,
notificationScheduler: null,
};
},
methods: {
createNotification( message, showDuration, messageType, priority ) {
/*
Takes a notification options array that contains: message, showDuration (in seconds), messageType (ok, error, progress, info) and priority (low, normal, critical). Takes a notification options array that contains: message, showDuration (in seconds), messageType (ok, error, progress, info) and priority (low, normal, critical).
Returns a notification ID which can be used to cancel the notification. The component will throttle notifications and display Returns a notification ID which can be used to cancel the notification. The component will throttle notifications and display
one at a time and prioritize messages with higher priority. Use vue refs to access these methods. one at a time and prioritize messages with higher priority. Use vue refs to access these methods.
*/ */
let id = 0; let id = 0;
if ( priority === 'critical' ) { if ( priority === 'critical' ) {
this.currentID[ 'critical' ] += 1; this.currentID[ 'critical' ] += 1;
id = this.currentID[ 'critical' ]; id = this.currentID[ 'critical' ];
} else if ( priority === 'normal' ) { } else if ( priority === 'normal' ) {
this.currentID[ 'medium' ] += 1; this.currentID[ 'medium' ] += 1;
id = this.currentID[ 'medium' ]; id = this.currentID[ 'medium' ];
} else if ( priority === 'low' ) { } else if ( priority === 'low' ) {
this.currentID[ 'low' ] += 1; this.currentID[ 'low' ] += 1;
id = this.currentID[ 'low' ]; id = this.currentID[ 'low' ];
} }
this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority, 'id': id }; this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority, 'id': id };
this.queue.push( id ); this.queue.push( id );
console.log( 'scheduled notification: ' + id + ' (' + message + ')' ); console.log( 'scheduled notification: ' + id + ' (' + message + ')' );
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) { if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
this.handleNotifications(); this.handleNotifications();
} }
return id; return id;
}, },
cancelNotification ( id ) { cancelNotification ( id ) {
/* /*
This method deletes a notification and, in case the notification is being displayed, hides it. This method deletes a notification and, in case the notification is being displayed, hides it.
*/ */
try { try {
delete this.notifications[ id ]; delete this.notifications[ id ];
delete this.queue[ this.queue.findIndex( id ) ]; delete this.queue[ this.queue.findIndex( id ) ];
} catch ( error ) { } catch ( error ) {
console.log( 'notification to be deleted is nonexistent or currently being displayed' ); console.log( 'notification to be deleted is nonexistent or currently being displayed' );
} }
if ( this.currentlyDisplayedNotificationID == id ) { if ( this.currentlyDisplayedNotificationID == id ) {
this.handleNotifications(); this.handleNotifications();
}
},
handleNotifications () {
/*
This methods should NOT be called in any other component than this one!
*/
this.displayTimeCurrentNotification = 0;
this.notificationDisplayTime = 0;
this.message = '';
this.queue.sort();
if ( this.queue.length > 0 ) {
this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ];
this.messageType = this.notifications[ this.queue[ 0 ] ][ 'messageType' ];
this.priority = this.notifications[ this.queue[ 0 ] ][ 'priority' ];
this.currentlyDisplayedNotificationID = this.notifications[ this.queue[ 0 ] ][ 'id' ];
this.notificationDisplayTime = this.notifications[ this.queue[ 0 ] ][ 'showDuration' ];
this.queue.reverse();
this.queue.pop();
} else {
this.messageType = 'hide';
}
} }
}, },
created () { handleNotifications () {
this.notificationScheduler = setInterval( () => { /*
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) { This methods should NOT be called in any other component than this one!
this.handleNotifications(); */
} else { this.displayTimeCurrentNotification = 0;
this.displayTimeCurrentNotification += 0.5; this.notificationDisplayTime = 0;
} this.message = '';
}, 500 ); this.queue.sort();
}, if ( this.queue.length > 0 ) {
unmounted ( ) { this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ];
clearInterval( this.notificationScheduler ); this.messageType = this.notifications[ this.queue[ 0 ] ][ 'messageType' ];
this.priority = this.notifications[ this.queue[ 0 ] ][ 'priority' ];
this.currentlyDisplayedNotificationID = this.notifications[ this.queue[ 0 ] ][ 'id' ];
this.notificationDisplayTime = this.notifications[ this.queue[ 0 ] ][ 'showDuration' ];
this.queue.reverse();
this.queue.pop();
} else {
this.messageType = 'hide';
}
} }
},
created () {
this.notificationScheduler = setInterval( () => {
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
this.handleNotifications();
} else {
this.displayTimeCurrentNotification += 0.5;
}
}, 500 );
},
unmounted ( ) {
clearInterval( this.notificationScheduler );
} }
};
</script> </script>
<style scoped> <style scoped>

View File

@@ -9,4 +9,4 @@ const app = createApp( App );
app.use( createPinia() ); app.use( createPinia() );
app.use( router ); app.use( router );
app.mount('#app'); app.mount( '#app' );

View File

@@ -20,14 +20,14 @@ let routes = [
title: 'Admin login - Restart required! :: libreevent' title: 'Admin login - Restart required! :: libreevent'
} }
}, },
] ];
routes.push( setupRoutes ); routes.push( setupRoutes );
const router = createRouter({ const router = createRouter( {
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory( import.meta.env.BASE_URL ),
routes: routes routes: routes
} ) } );
router.beforeEach( ( to ) => { router.beforeEach( ( to ) => {
let backendStore = useBackendStore(); let backendStore = useBackendStore();
@@ -41,4 +41,4 @@ router.afterEach( ( to ) => {
document.title = to.meta.title ? to.meta.title : 'libreevent'; document.title = to.meta.title ? to.meta.title : 'libreevent';
} ); } );
export default router export default router;

View File

@@ -53,4 +53,4 @@ export default {
} }
}, },
] ]
} };

View File

@@ -7,9 +7,9 @@
* *
*/ */
import { defineStore } from "pinia"; import { defineStore } from 'pinia';
export const useBackendStore = defineStore ( 'backend', { export const useBackendStore = defineStore( 'backend', {
state: () => ( { 'visitedSetupPages': {} } ), state: () => ( { 'visitedSetupPages': {} } ),
getters: { getters: {
getVisitedSetupPages: ( state ) => state.visitedSetupPages, getVisitedSetupPages: ( state ) => state.visitedSetupPages,

View File

@@ -81,77 +81,77 @@
</style> </style>
<script> <script>
import { useBackendStore } from '@/stores/backendStore.js'; import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import notifications from '../components/notifications.vue'; import notifications from '../components/notifications.vue';
export default { export default {
components: { components: {
notifications, notifications,
}, },
data () { data () {
return { return {
formData: { formData: {
'dbType': 'mysql', 'dbType': 'mysql',
'db': { 'db': {
'port': 3306, 'port': 3306,
},
'email': {
'port': 587
},
'websiteName': 'libreevent',
}, },
} 'email': {
}, 'port': 587
computed: { },
...mapStores( useBackendStore ) 'websiteName': 'libreevent',
}, },
methods: { };
submit() { },
this.collectUrl(); computed: {
if ( this.formData.dbType === 'mysql' ) { ...mapStores( useBackendStore )
if ( !this.formData.db.port || !this.formData.db.host || !this.formData.db.database || !this.formData.db.user || !this.formData.db.password ) { },
this.$refs.notification.createNotification( 'Database settings are not complete!', 5, 'error', 'normal' ); methods: {
return; submit() {
} this.collectUrl();
} if ( this.formData.dbType === 'mysql' ) {
if( this.formData.email.port && this.formData.email.host && this.formData.email.user && this.formData.email.pass if ( !this.formData.db.port || !this.formData.db.host || !this.formData.db.database || !this.formData.db.user || !this.formData.db.password ) {
&& this.formData.dpEmail && this.formData.display && this.formData.websiteName ) { this.$refs.notification.createNotification( 'Database settings are not complete!', 5, 'error', 'normal' );
this.formData.mailDisplay = this.formData.display + ' <' + this.formData.dpEmail + '>';
const options = {
method: 'post',
body: JSON.stringify( this.formData ),
headers: {
'Content-Type': 'application/json',
'charset': 'utf-8'
}
};
fetch( '/setup/saveBasicSettings', options ).then( res => {
if ( res.status === 200 ) {
this.continue();
} else {
this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
} else {
this.$refs.notification.createNotification( 'Missing entries', 5, 'error', 'normal' );
return; return;
} }
}, }
continue () { if ( this.formData.email.port && this.formData.email.host && this.formData.email.user && this.formData.email.pass
sessionStorage.setItem( 'basics', JSON.stringify( this.formData ) ); && this.formData.dpEmail && this.formData.display && this.formData.websiteName ) {
this.backendStore.addVisitedSetupPages( 'root', true ); this.formData.mailDisplay = this.formData.display + ' <' + this.formData.dpEmail + '>';
this.$router.push( '/setup/root' ); const options = {
}, method: 'post',
collectUrl() { body: JSON.stringify( this.formData ),
this.formData.yourDomain = location.protocol + '//' + location.host; headers: {
this.formData.db.host = location.hostname; 'Content-Type': 'application/json',
'charset': 'utf-8'
}
};
fetch( '/setup/saveBasicSettings', options ).then( res => {
if ( res.status === 200 ) {
this.continue();
} else {
this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
} else {
this.$refs.notification.createNotification( 'Missing entries', 5, 'error', 'normal' );
return;
} }
}, },
created () { continue () {
if ( sessionStorage.getItem( 'basics' ) ) { sessionStorage.setItem( 'basics', JSON.stringify( this.formData ) );
this.formData = JSON.parse( sessionStorage.getItem( 'basics' ) ); this.backendStore.addVisitedSetupPages( 'root', true );
} this.$router.push( '/setup/root' );
},
collectUrl() {
this.formData.yourDomain = location.protocol + '//' + location.host;
this.formData.db.host = location.hostname;
} }
}; },
created () {
if ( sessionStorage.getItem( 'basics' ) ) {
this.formData = JSON.parse( sessionStorage.getItem( 'basics' ) );
}
}
};
</script> </script>

View File

@@ -22,48 +22,48 @@
</template> </template>
<script> <script>
import notifications from '../components/notifications.vue'; import notifications from '../components/notifications.vue';
export default { export default {
data() { data() {
return { return {
formData: {}, formData: {},
} };
}, },
components: { components: {
notifications, notifications,
}, },
methods: { methods: {
setup () { setup () {
const options = { const options = {
method: 'post', method: 'post',
body: JSON.stringify( this.formData ), body: JSON.stringify( this.formData ),
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'charset': 'utf-8' 'charset': 'utf-8'
} }
}; };
fetch( '/setup/start', options ).then( res => { fetch( '/setup/start', options ).then( res => {
if ( res.status === 200 ) {
this.$router.push( '/setup' );
} else {
this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
}
},
created() {
fetch( '/setup/getKeyStatus' ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
res.text().then( text => { this.$router.push( '/setup' );
if ( text === 'ok' ) { } else {
this.$router.push( '/setup' ); this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
} }
} ); } );
} }
},
created() {
fetch( '/setup/getKeyStatus' ).then( res => {
if ( res.status === 200 ) {
res.text().then( text => {
if ( text === 'ok' ) {
this.$router.push( '/setup' );
}
} );
}
} );
} }
};
</script> </script>
<style scoped> <style scoped>

View File

@@ -45,156 +45,156 @@
</template> </template>
<script> <script>
import { useBackendStore } from '@/stores/backendStore.js'; import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import notifications from '../components/notifications.vue'; import notifications from '../components/notifications.vue';
const lookup = [ '@', '!', '.', ',', '?', '%', '&', '-', '_', ':', ';', '*', '§', '<', '>', '{', '}', '[', ']', '(', ')', '/', '#' ]; const lookup = [ '@', '!', '.', ',', '?', '%', '&', '-', '_', ':', ';', '*', '§', '<', '>', '{', '}', '[', ']', '(', ')', '/', '#' ];
export default { export default {
data () { data () {
return { return {
formData: {}, formData: {},
passwordCheck: true, passwordCheck: true,
emailStatus: '', emailStatus: '',
} };
},
components: {
notifications,
},
computed: {
...mapStores( useBackendStore )
},
methods: {
emailLiveChecker () {
setTimeout( () => {
if ( this.checkEmail() ) {
this.emailStatus = '';
} else {
this.emailStatus = 'Invalid email address';
}
}, 100 );
}, },
components: { checkEmail () {
notifications, const mail = this.formData.mail ?? '';
}, let stat = { 'atPos': 0, 'topLevelPos': 0 };
computed: { for ( let l in mail ) {
...mapStores( useBackendStore ) if ( stat[ 'atPos' ] > 0 ) {
}, if ( mail[ l ] === '@' ) {
methods: { return false;
emailLiveChecker () { } else if ( mail[ l ] === '.' ) {
setTimeout( () => { if ( stat[ 'topLevelPos' ] > 0 ) {
if ( this.checkEmail() ) { if ( l > stat[ 'topLevelPos' ] + 2 ) {
this.emailStatus = ''; stat[ 'topLevelPos' ] = parseInt( l );
} else {
this.emailStatus = 'Invalid email address';
}
}, 100 );
},
checkEmail () {
const mail = this.formData.mail ?? '';
let stat = { 'atPos': 0, 'topLevelPos': 0 };
for ( let l in mail ) {
if ( stat[ 'atPos' ] > 0 ) {
if ( mail[ l ] === '@' ) {
return false;
} else if ( mail[ l ] === '.' ) {
if ( stat[ 'topLevelPos' ] > 0 ) {
if ( l > stat[ 'topLevelPos' ] + 2 ) {
stat[ 'topLevelPos' ] = parseInt( l );
} else {
return false;
}
} else {
if ( l > stat[ 'atPos' ] + 2 ) {
stat[ 'topLevelPos' ] = parseInt( l );
} else {
return false;
}
}
} else if ( !( /[a-z]/.test( mail[ l ] ) || /[A-Z]/.test( mail[ l ] ) || /[1-9]/.test( mail[ l ] ) || mail[ l ] === '-' || mail[ l ] === '_' ) ) {
return false
}
} else {
if ( mail[ l ] === '@' ) {
if ( l > 2 ) {
stat[ 'atPos' ] = parseInt( l );
} else { } else {
return false; return false;
} }
} else if ( !( /[a-z]/.test( mail[ l ] ) || /[A-Z]/.test( mail[ l ] ) || /[1-9]/.test( mail[ l ] ) || mail[ l ] === '.' || mail[ l ] === '-' || mail[ l ] == '_' ) ) { } else {
if ( l > stat[ 'atPos' ] + 2 ) {
stat[ 'topLevelPos' ] = parseInt( l );
} else {
return false;
}
}
} else if ( !( /[a-z]/.test( mail[ l ] ) || /[A-Z]/.test( mail[ l ] ) || /[1-9]/.test( mail[ l ] ) || mail[ l ] === '-' || mail[ l ] === '_' ) ) {
return false;
}
} else {
if ( mail[ l ] === '@' ) {
if ( l > 2 ) {
stat[ 'atPos' ] = parseInt( l );
} else {
return false; return false;
} }
} else if ( !( /[a-z]/.test( mail[ l ] ) || /[A-Z]/.test( mail[ l ] ) || /[1-9]/.test( mail[ l ] ) || mail[ l ] === '.' || mail[ l ] === '-' || mail[ l ] == '_' ) ) {
return false;
} }
} }
if ( mail.length > stat[ 'topLevelPos' ] + 2 && stat[ 'topLevelPos' ] > 0 && stat[ 'atPos' ] > 0 ) { }
return true; if ( mail.length > stat[ 'topLevelPos' ] + 2 && stat[ 'topLevelPos' ] > 0 && stat[ 'atPos' ] > 0 ) {
} else { return true;
return false; } else {
} return false;
}, }
submit () { },
if ( this.formData.mail && this.formData.password && this.formData.password2 ) { submit () {
if ( this.checkEmail() ) { if ( this.formData.mail && this.formData.password && this.formData.password2 ) {
if ( this.formData.password == this.formData.password2 ) { if ( this.checkEmail() ) {
if ( this.passwordCheck ) { if ( this.formData.password == this.formData.password2 ) {
let requirementsCount = { 'special': 0, 'numbers': 0, 'lower': 0, 'upper': 0, 'incorrect': '' }; if ( this.passwordCheck ) {
const pw = this.formData.password; let requirementsCount = { 'special': 0, 'numbers': 0, 'lower': 0, 'upper': 0, 'incorrect': '' };
for ( let l in pw ) { const pw = this.formData.password;
console.log( pw[ l ] ); for ( let l in pw ) {
if ( /[a-z]/.test( pw[ l ] ) ) { console.log( pw[ l ] );
requirementsCount[ 'lower' ] += 1; if ( /[a-z]/.test( pw[ l ] ) ) {
} else if ( /[A-Z]/.test( pw[ l ] ) ) { requirementsCount[ 'lower' ] += 1;
requirementsCount[ 'upper' ] += 1; } else if ( /[A-Z]/.test( pw[ l ] ) ) {
} else if ( lookup.includes( pw[ l ] ) ) { requirementsCount[ 'upper' ] += 1;
requirementsCount[ 'special' ] += 1; } else if ( lookup.includes( pw[ l ] ) ) {
} else if ( !isNaN( pw[ l ] * 1 ) ) { requirementsCount[ 'special' ] += 1;
requirementsCount[ 'number' ] += 1; } else if ( !isNaN( pw[ l ] * 1 ) ) {
} else { requirementsCount[ 'number' ] += 1;
console.log( 'incorrect letter' );
requirementsCount[ 'incorrect' ] = pw[ l ];
break;
}
}
if ( requirementsCount[ 'incorrect' ] ) {
this.$refs.notification.createNotification( `Character "${ requirementsCount[ 'incorrect' ] }" cannot be used for passwords`, 5, 'error', 'normal' );
} else { } else {
if ( pw.length > 14 ) { console.log( 'incorrect letter' );
if ( requirementsCount[ 'lower' ] > 1 && requirementsCount[ 'upper' ] > 1 && requirementsCount[ 'special' ] > 1 && requirementsCount[ 'numbers' ] > 1 ) { requirementsCount[ 'incorrect' ] = pw[ l ];
this.proceed(); break;
} else {
this.$refs.notification.createNotification( 'Your password does not fulfill the requirements', 5, 'error', 'normal' );
}
} else {
this.$refs.notification.createNotification( 'Your password is not long enough', 5, 'error', 'normal' );
}
} }
}
if ( requirementsCount[ 'incorrect' ] ) {
this.$refs.notification.createNotification( `Character "${ requirementsCount[ 'incorrect' ] }" cannot be used for passwords`, 5, 'error', 'normal' );
} else { } else {
if ( confirm( 'Do you really want to proceed without having your password checked? This is strongly discouraged as it essentially removes the first factor (the password) of the authentication making it much less secure.' ) ) { if ( pw.length > 14 ) {
if ( confirm( 'Are you really sure?' ) ) { if ( requirementsCount[ 'lower' ] > 1 && requirementsCount[ 'upper' ] > 1 && requirementsCount[ 'special' ] > 1 && requirementsCount[ 'numbers' ] > 1 ) {
this.proceed(); this.proceed();
} else {
this.$refs.notification.createNotification( 'Your password does not fulfill the requirements', 5, 'error', 'normal' );
} }
} else {
this.$refs.notification.createNotification( 'Your password is not long enough', 5, 'error', 'normal' );
} }
} }
} else { } else {
this.$refs.notification.createNotification( 'Passwords do not match', 10, 'error', 'normal' ); if ( confirm( 'Do you really want to proceed without having your password checked? This is strongly discouraged as it essentially removes the first factor (the password) of the authentication making it much less secure.' ) ) {
if ( confirm( 'Are you really sure?' ) ) {
this.proceed();
}
}
} }
} else { } else {
this.$refs.notification.createNotification( 'The email address you entered is not an email address', 10, 'error', 'normal' ); this.$refs.notification.createNotification( 'Passwords do not match', 10, 'error', 'normal' );
} }
} else { } else {
this.$refs.notification.createNotification( 'One or more fields missing!', 10, 'error', 'normal' ); this.$refs.notification.createNotification( 'The email address you entered is not an email address', 10, 'error', 'normal' );
} }
}, } else {
proceed () { this.$refs.notification.createNotification( 'One or more fields missing!', 10, 'error', 'normal' );
const options = {
method: 'post',
body: JSON.stringify( this.formData ),
headers: {
'Content-Type': 'application/json',
'charset': 'utf-8'
}
};
fetch( '/setup/saveRootAccount', options ).then( res => {
if ( res.status === 200 ) {
sessionStorage.setItem( 'basics', JSON.stringify( this.formData ) );
this.backendStore.addVisitedSetupPages( 'complete', true );
this.$router.push( 'complete' );
} else {
this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
},
},
created () {
if ( sessionStorage.getItem( 'root' ) ) {
this.formData = JSON.parse( sessionStorage.getItem( 'root' ) );
} }
},
proceed () {
const options = {
method: 'post',
body: JSON.stringify( this.formData ),
headers: {
'Content-Type': 'application/json',
'charset': 'utf-8'
}
};
fetch( '/setup/saveRootAccount', options ).then( res => {
if ( res.status === 200 ) {
sessionStorage.setItem( 'basics', JSON.stringify( this.formData ) );
this.backendStore.addVisitedSetupPages( 'complete', true );
this.$router.push( 'complete' );
} else {
this.$refs.notification.createNotification( 'Setup key incorrect!', 5, 'error', 'normal' );
}
} );
},
},
created () {
if ( sessionStorage.getItem( 'root' ) ) {
this.formData = JSON.parse( sessionStorage.getItem( 'root' ) );
} }
}; }
};
</script> </script>

View File

@@ -21,23 +21,23 @@
</template> </template>
<script> <script>
import { useBackendStore } from '@/stores/backendStore.js'; import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
export default { export default {
data () { data () {
return { return {
formData: {} formData: {}
} };
}, },
computed: { computed: {
...mapStores( useBackendStore ) ...mapStores( useBackendStore )
}, },
methods: { methods: {
setup () { setup () {
this.backendStore.addVisitedSetupPages( 'basics', true ); this.backendStore.addVisitedSetupPages( 'basics', true );
this.$router.push( '/setup/basics' ); this.$router.push( '/setup/basics' );
} }
}, },
}; };
</script> </script>

View File

@@ -29,33 +29,33 @@
</template> </template>
<script> <script>
import { useBackendStore } from '@/stores/backendStore.js'; import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
export default { export default {
data () { data () {
return { return {
formData: {} formData: {}
};
},
computed: {
...mapStores( useBackendStore )
},
created () {
this.backendStore.loadVisitedSetupPages();
fetch( '/setup/getKeyStatus' ).then( res => {
if ( res.status === 200 ) {
res.text().then( text => {
if ( text != 'ok' ) {
this.$router.push( '/' );
}
} );
} else {
this.$router.push( '/' );
} }
}, } );
computed: { },
...mapStores( useBackendStore ) };
},
created () {
this.backendStore.loadVisitedSetupPages();
fetch( '/setup/getKeyStatus' ).then( res => {
if ( res.status === 200 ) {
res.text().then( text => {
if ( text != 'ok' ) {
this.$router.push( '/' );
}
} );
} else {
this.$router.push( '/' );
}
} );
},
};
</script> </script>

View File

@@ -1,7 +1,7 @@
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite' import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig( { export default defineConfig( {
@@ -16,4 +16,4 @@ export default defineConfig( {
server: { server: {
'port': 8081 'port': 8081
} }
}) } );