@@ -52,13 +52,15 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { f7, f7ready } from 'framework7-vue';
|
||||
import { getDevice } from 'framework7/lite-bundle';
|
||||
import cordovaApp from '../js/cordova-app.js';
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { f7, f7ready } from 'framework7-vue'
|
||||
import { getDevice } from 'framework7/lite-bundle'
|
||||
import cordovaApp from '../js/cordova-app.js'
|
||||
|
||||
import routes from '../js/routes.js';
|
||||
import store from '../js/store';
|
||||
import YAML from 'yaml'
|
||||
|
||||
import routes from '../js/routes.js'
|
||||
import store from '../js/store'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@@ -66,27 +68,49 @@
|
||||
rememberAgreement: false,
|
||||
siteAgreement: false,
|
||||
dateAgreement: null,
|
||||
showDisclaimer: true,
|
||||
alvinnVersion: store().getVersion
|
||||
showDisclaimer: false,
|
||||
alvinnVersion: store().getVersion,
|
||||
siteConf: {}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
var loadSiteSettings = localStorage.getItem('siteSettings')
|
||||
async created () {
|
||||
if (!window.cordova) {
|
||||
const confText = await fetch('./conf/conf.yaml')
|
||||
.then((mod) => { return mod.text() })
|
||||
this.siteConf = YAML.parse(confText)
|
||||
}
|
||||
const loadSiteSettings = localStorage.getItem('siteSettings')
|
||||
if (loadSiteSettings) {
|
||||
var loadedSettings = JSON.parse(loadSiteSettings)
|
||||
let loadedSettings = JSON.parse(loadSiteSettings)
|
||||
this.siteAgreement = loadedSettings.siteAgreement
|
||||
this.rememberAgreement = loadedSettings.rememberAgreement
|
||||
this.dateAgreement = loadedSettings.dateAgreement && new Date(loadedSettings.dateAgreement)
|
||||
}
|
||||
var curDate = new Date ()
|
||||
var agreeStillValid = this.dateAgreement && (curDate < this.dateAgreement.setMonth(this.dateAgreement.getMonth() + 3))
|
||||
const curDate = new Date ()
|
||||
const expireMonth = (this.dateAgreement?.getMonth() || 0) + (this.siteConf?.agreeExpire || 3)
|
||||
const agreeStillValid = this.dateAgreement && (curDate < this.dateAgreement.setMonth(expireMonth))
|
||||
if (this.siteAgreement && this.rememberAgreement && agreeStillValid) {
|
||||
this.showDisclaimer = false
|
||||
store().agree()
|
||||
} else {
|
||||
this.showDisclaimer = true
|
||||
}
|
||||
var loadServerSettings = localStorage.getItem('serverSettings')
|
||||
if (!loadServerSettings) {
|
||||
store().set('enabledRegions',this.siteConf?.regions)
|
||||
store().set('siteDemo',this.siteConf?.demo)
|
||||
const loadServerSettings = localStorage.getItem('serverSettings')
|
||||
if (this.siteConf?.useExternal) {
|
||||
if (!['none','list','optional','required'].includes(this.siteConf.useExternal)) {
|
||||
console.warn(`'${this.siteConf.useExternal}' is not a valid value for useExternal configuration: using 'optional'`)
|
||||
} else {
|
||||
store().set('useExternal',this.siteConf.useExternal)
|
||||
if (this.siteConf.external) {
|
||||
store().set('externalServerList',this.siteConf.external)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!loadServerSettings && !this.siteConf.external) {
|
||||
localStorage.setItem('serverSettings','{"use":false,"address":"10.188.0.98","port":"9001","previous":{"10.188.0.98":"9001"}}')
|
||||
} else if (this.siteConf.useExternal == 'required') {
|
||||
localStorage.setItem('serverSettings',`{"use":true,"address":"${this.siteConf.external[0].address}","port":${this.siteConf.external[0].port}}`)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -113,7 +137,7 @@
|
||||
this.showDisclaimer = false
|
||||
},
|
||||
() => {
|
||||
var toast = f7.toast.create({
|
||||
const toast = f7.toast.create({
|
||||
text: 'ERROR: No settings saved',
|
||||
closeTimeout: 2000
|
||||
})
|
||||
@@ -125,13 +149,11 @@
|
||||
setup() {
|
||||
const device = getDevice();
|
||||
// Framework7 Parameters
|
||||
var loadThemeSettings = localStorage.getItem('themeSettings')
|
||||
if (loadThemeSettings) var themeSettings = JSON.parse(loadThemeSettings)
|
||||
try {
|
||||
if (themeSettings.darkMode.toString()) var darkTheme = themeSettings.darkMode
|
||||
} catch {
|
||||
var darkTheme = 'auto'
|
||||
}
|
||||
const loadThemeSettings = localStorage.getItem('themeSettings')
|
||||
let themeSettings = {}
|
||||
let darkTheme = 'auto'
|
||||
if (loadThemeSettings) { themeSettings = JSON.parse(loadThemeSettings) }
|
||||
if (themeSettings?.darkMode) darkTheme = themeSettings.darkMode
|
||||
const f7params = {
|
||||
name: 'ALVINN', // App name
|
||||
theme: 'auto', // Automatic theme detection
|
||||
|
||||
Reference in New Issue
Block a user