Fixed backgrounds repeating and entry in settings

This commit is contained in:
BuildTools 2024-05-18 12:04:12 -02:30
parent 42db1fd15e
commit aa6807a0ff
3 changed files with 7 additions and 8 deletions

View file

@ -100,7 +100,7 @@ const BootLoader: Process = {
const dataString = Buffer.from(data).toString()
const config = parse(dataString)
document.body.style.backgroundImage = "url(" + config.BACKGROUND.toString() + ")"})
document.body.style.backgroundSize = "cover"
await statusBar.element.appendTo(document.body)
await launcher.element.appendTo(document.body)
await wm.windowArea.appendTo(document.body)

View file

@ -377,7 +377,8 @@ export const defaultFS: { root: Directory } = {
'SERVER=http://localhost:3000/',
'24_HOUR=false',
'THEME=Mocha',
'THEME_PRIMARY=blue'
'THEME_PRIMARY=blue',
'BACKGROUND='
].join('\n'))
},
hostname: {
@ -449,6 +450,10 @@ class VirtualFS {
config.THEME_PRIMARY = 'blue'
await this.writeFile('/etc/flow', stringify(config))
}
if (config.BACKGROUND == null) {
config.BACKGROUND = ''
await this.writeFile('/etc/flow', stringify(config))
}
})
}

View file

@ -39,12 +39,6 @@ const Settings: Process = {
} else if (item === 'THEME') {
input = Dropdown.new((await fs.readdir('/etc/themes')).map((theme: string) => theme.replace('.theme', '')))
}
if (item === 'BACKGROUND') {
const { background } = JSON.parse(Buffer.from(await fs.readFile(`/etc/flow/${config.BACKGROUND as string}.BACKGROUND`)).toString())
document.cookie = "background=" + background + "; expires=Thu, 18 Dec 9999 12:00:00 UTC; path=/";
} else if (item === 'THEME') {
input = Dropdown.new((await fs.readdir('/etc/themes')).map((theme: string) => theme.replace('.theme', '')))
}
if (item === 'THEME_PRIMARY' || item === 'THEME') {
(input.elm as HTMLSelectElement).value = config[item]