Added basic background support,not much of anything else,host only at the moment,supply your background image at src assets background.jpg

This commit is contained in:
BuildTools 2024-05-11 20:31:48 -02:30
parent fa9876cb21
commit 0049209def
9 changed files with 33 additions and 12 deletions

2
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,2 @@
{
}

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FlowOS</title>
<title>FlowOS Neo</title>
<link rel="shortcut icon" href="./src/assets/flow.png" type="image/png">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9675905177363247" crossorigin="anonymous"></script>
@ -20,5 +20,6 @@
</head>
<body>
<script src="./src/bootloader.ts" type="module"></script>
<script src="./src/background.js" type="module"></script>
</body>
</html>

BIN
src/assets/background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

12
src/assets/background.svg Normal file
View file

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="1920" height="835" preserveAspectRatio="none" viewBox="0 0 1440 560">
<g mask="url(&quot;#SvgjsMask1000&quot;)" fill="none">
<rect width="1440" height="560" x="0" y="0" fill="#0e2a47"></rect>
<path d="M 0,206 C 57.6,175.4 172.8,62.4 288,53 C 403.2,43.6 460.8,146.8 576,159 C 691.2,171.2 748.8,95.8 864,114 C 979.2,132.2 1036.8,271.8 1152,250 C 1267.2,228.2 1382.4,54 1440,5L1440 560L0 560z" fill="#184a7e"></path>
<path d="M 0,325 C 96,363 288,516.6 480,515 C 672,513.4 768,331 960,317 C 1152,303 1344,419.4 1440,445L1440 560L0 560z" fill="#2264ab"></path>
</g>
<defs>
<mask id="SvgjsMask1000">
<rect width="1440" height="560" fill="#ffffff"></rect>
</mask>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 881 B

View file

@ -121,7 +121,7 @@ window-area {
height: 100%;
overflow: hidden;
margin: 10px;
window {
resize: both;
max-width: 100%;

View file

@ -43,7 +43,7 @@ boot.appendMany(
src: logo,
height: '40px'
}),
new HTML('h1').text('FlowOS').styleJs({
new HTML('h1').text('FlowOS Neo').styleJs({
color: 'white'
})
),
@ -116,16 +116,16 @@ window.console.group = (...args: any) => {
try {
const args = new URLSearchParams(window.location.search)
const kernel = new Kernel()
writeln('/-----------------------------------------------\\')
writeln('| FlowOS is now discontinued. Starting in 10s...|')
writeln('\\-----------------------------------------------/')
writeln('/-----------------------------------------------------------------------------------\\')
writeln('| FlowOS Neo is a planned project by Neptune6866 to continue what FlowOS meant to do|')
writeln('\\-----------------------------------------------------------------------------------/')
setTimeout(() => {
kernel.boot(boot, progress, args).catch(e => console.error(e))
}, 10000)
}, 5000)
} catch (e) {
writeln()
writeln('An error occured while booting FlowOS.')
writeln('Please report this error to Flow Works.')
writeln('Please report this error to Neptune6866.')
writeln()
console.error(e.stack)
writeln()

View file

@ -17,7 +17,7 @@ const BootLoader: Process = {
const wm = await process.loadLibrary('lib/WindowManager')
const launcher = await process.loadLibrary('lib/Launcher')
const { Input } = await process.loadLibrary('lib/Components')
const windowArea = document.querySelector('window-area')
const input = Input.new().attr({
type: 'text',
placeholder: 'Search'
@ -93,6 +93,7 @@ const BootLoader: Process = {
})
document.body.style.flexDirection = 'column-reverse'
document.body.style.backgroundImage = 'url(/src/assets/background.jpg)'
await statusBar.element.appendTo(document.body)
await launcher.element.appendTo(document.body)

View file

@ -374,7 +374,7 @@ export const defaultFS: { root: Directory } = {
deleteable: false,
permission: Permission.ELEVATED,
content: Buffer.from([
'SERVER=https://server.flow-works.me',
'SERVER=http://localhost:3000/',
'24_HOUR=false',
'THEME=Mocha',
'THEME_PRIMARY=blue'
@ -434,7 +434,7 @@ class VirtualFS {
const config = parse(dataString)
if (config.SERVER == null) {
config.SERVER = 'https://server.flow-works.me'
config.SERVER = 'http://localhost:3000/'
await this.writeFile('/etc/flow', stringify(config))
}
if (config['24_HOUR'] == null) {

View file

@ -1,7 +1,6 @@
import { Process } from '../../types'
import icon from '../../assets/icons/preferences-system.svg'
import { stringify } from 'js-ini'
const Settings: Process = {
config: {
name: 'Settings',
@ -40,6 +39,12 @@ 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]