=> {
win.content.innerHTML = `
@@ -203,16 +208,11 @@ const Editor: Process = {
document.addEventListener('fs_update', () => {
render().catch(e => console.error(e))
})
- } else {
- await process.launch('lib/FileManager')
- setTimeout(() => {
- win.close()
- }, 10)
}
- } else {
- await process.kill()
- await process.launch('apps/Files')
+ return
}
+ await process.kill()
+ await process.launch('apps/Files')
}
}
diff --git a/src/system/apps/Files.ts b/src/system/apps/Files.ts
index a7503d3..8e4b042 100644
--- a/src/system/apps/Files.ts
+++ b/src/system/apps/Files.ts
@@ -48,14 +48,14 @@ const Files: Process = {
(win.content.querySelector('.file') as HTMLElement).onclick = async () => {
const title: string | null | undefined = prompt('Enter file name')
- if (title !== null && title !== undefined) {
+ if (title != null) {
await fs.writeFile(`${dir}/${title}`, '')
}
}
(win.content.querySelector('.folder') as HTMLElement).onclick = async () => {
const title: string | null | undefined = prompt('Enter folder name')
- if (title !== null && title !== undefined) {
+ if (title != null) {
await fs.mkdir(`${dir}/${title}`, '')
}
}
diff --git a/src/system/apps/ImageViewer.ts b/src/system/apps/ImageViewer.ts
index 61553b0..499cf92 100644
--- a/src/system/apps/ImageViewer.ts
+++ b/src/system/apps/ImageViewer.ts
@@ -43,10 +43,10 @@ const ImageViewer: Process = {
document.addEventListener('fs_update', () => {
render().catch(e => console.error(e))
})
- } else {
- await process.kill()
- await process.launch('apps/Files')
+ return
}
+ await process.kill()
+ await process.launch('apps/Files')
}
}
diff --git a/src/system/apps/Store.ts b/src/system/apps/Store.ts
index dc05597..59e6d66 100644
--- a/src/system/apps/Store.ts
+++ b/src/system/apps/Store.ts
@@ -25,12 +25,12 @@ const Store: Process = {
win.content.style.background = 'var(--base)'
- fetch(process.kernel.config.SERVER as string + '/apps/list/')
+ fetch(`${process.kernel.config.SERVER as string}/apps/list/`)
.then(async (res) => await res.json())
.then(handle)
.catch(e => console.error(e))
document.addEventListener('fs_update', () => {
- fetch(process.kernel.config.SERVER as string + '/apps/list/')
+ fetch(`${process.kernel.config.SERVER as string}/apps/list/`)
.then(async (res) => await res.json())
.then(handle)
.catch(e => console.error(e))
diff --git a/src/system/apps/TaskManager.ts b/src/system/apps/TaskManager.ts
index b995887..9f906e6 100644
--- a/src/system/apps/TaskManager.ts
+++ b/src/system/apps/TaskManager.ts
@@ -49,7 +49,7 @@ const TaskManager: Process = {
}).appendTo(win.content)
const render = (): void => {
- const processList = process.kernel.processList
+ const { processList } = process.kernel
table.html('')
new HTML('thead').appendTo(table)
diff --git a/src/system/lib/SplashScreen.ts b/src/system/lib/SplashScreen.ts
index c60c61b..8e9ce9a 100644
--- a/src/system/lib/SplashScreen.ts
+++ b/src/system/lib/SplashScreen.ts
@@ -4,7 +4,8 @@ import FlowLogo from '../../assets/flow.png'
import { Library } from '../../types'
import LibraryLib from '../../structures/LibraryLib'
-let library: LibraryLib, kernel: Kernel
+let library: LibraryLib
+let kernel: Kernel
const SplashScreen: Library = {
config: {
diff --git a/src/system/lib/StatusBar.ts b/src/system/lib/StatusBar.ts
index 9343dde..db2198e 100644
--- a/src/system/lib/StatusBar.ts
+++ b/src/system/lib/StatusBar.ts
@@ -29,24 +29,22 @@ const StatusBar: Library = {
} else if (battery.level >= 0) {
iconHTML = 'battery_charging_20'
}
- } else {
- if (battery.level === 1) {
- iconHTML = 'battery_full'
- } else if (battery.level >= 0.6) {
- iconHTML = 'battery_6_bar'
- } else if (battery.level >= 0.5) {
- iconHTML = 'battery_5_bar'
- } else if (battery.level >= 0.4) {
- iconHTML = 'battery_4_bar'
- } else if (battery.level >= 0.3) {
- iconHTML = 'battery_3_bar'
- } else if (battery.level >= 0.2) {
- iconHTML = 'battery_2_bar'
- } else if (battery.level >= 0.1) {
- iconHTML = 'battery_1_bar'
- } else if (battery.level >= 0) {
- iconHTML = 'battery_0_bar'
- }
+ } else if (battery.level === 1) {
+ iconHTML = 'battery_full'
+ } else if (battery.level >= 0.6) {
+ iconHTML = 'battery_6_bar'
+ } else if (battery.level >= 0.5) {
+ iconHTML = 'battery_5_bar'
+ } else if (battery.level >= 0.4) {
+ iconHTML = 'battery_4_bar'
+ } else if (battery.level >= 0.3) {
+ iconHTML = 'battery_3_bar'
+ } else if (battery.level >= 0.2) {
+ iconHTML = 'battery_2_bar'
+ } else if (battery.level >= 0.1) {
+ iconHTML = 'battery_1_bar'
+ } else if (battery.level >= 0) {
+ iconHTML = 'battery_0_bar'
}
const batteryDiv = document.querySelector('div[data-toolbar-id="controls"] > .battery')
diff --git a/src/system/lib/VirtualFS.ts b/src/system/lib/VirtualFS.ts
index f8f5291..02fc73e 100644
--- a/src/system/lib/VirtualFS.ts
+++ b/src/system/lib/VirtualFS.ts
@@ -253,7 +253,8 @@ export const setFileSystem = async (fileSystemObject: { root: Directory }): Prom
export let db: IDBDatabase
let fileSystem: { root: Directory }
-let kernel: Kernel, process: ProcessLib
+let kernel: Kernel
+let process: ProcessLib
export const initializeDatabase = async (dbName: string): Promise => {
return await new Promise((resolve, reject) => {
@@ -315,9 +316,7 @@ const save = async (): Promise => {
}
const handlePermissions = async (path: string): Promise => {
- let current
-
- current = (await navigatePath(path)).current
+ let { current } = (await navigatePath(path))
if (current === undefined) current = (await navigatePathParent(path)).current
@@ -374,7 +373,7 @@ const VirtualFS: Library = {
Reflect.deleteProperty(current.children, filename)
- console.debug('unlink ' + path)
+ console.debug(`unlink ${path}`)
await save()
},
readFile: async (path: string): Promise => {
@@ -384,7 +383,7 @@ const VirtualFS: Library = {
if (current.type !== 'file') throw new Error(Errors.EISDIR)
- console.debug('read ' + path)
+ console.debug(`read ${path}`)
return current.content
},
writeFile: async (path: string, content: string | Buffer): Promise => {
@@ -392,11 +391,11 @@ const VirtualFS: Library = {
let permission
- if (typeof current.children[filename] !== 'undefined') {
+ if (typeof current.children[filename] === 'undefined') {
+ permission = Permission.USER
+ } else {
await handlePermissions(path)
permission = current.children[filename].permission
- } else {
- permission = Permission.USER
}
current.children[filename] = {
@@ -406,7 +405,7 @@ const VirtualFS: Library = {
content: Buffer.from(content)
}
- console.debug('write ' + path)
+ console.debug(`write ${path}`)
await save()
},
mkdir: async (path: string): Promise => {
@@ -414,11 +413,11 @@ const VirtualFS: Library = {
let permission
- if (typeof current.children[filename] !== 'undefined') {
+ if (typeof current.children[filename] === 'undefined') {
+ permission = Permission.USER
+ } else {
await handlePermissions(path)
permission = current.children[filename].permission
- } else {
- permission = Permission.USER
}
current.children[filename] = {
@@ -428,7 +427,7 @@ const VirtualFS: Library = {
children: {}
}
- console.debug('mkdir ' + path)
+ console.debug(`mkdir ${path}`)
await save()
},
rmdir: async (path: string): Promise => {
@@ -441,7 +440,7 @@ const VirtualFS: Library = {
Reflect.deleteProperty(current.children, filename)
- console.debug('rmdir ' + path)
+ console.debug(`rmdir ${path}`)
await save()
},
readdir: async (path: string): Promise => {
@@ -450,13 +449,13 @@ const VirtualFS: Library = {
if (current.type === 'file') throw new Error(Errors.ENOTDIR)
const result = await Promise.all(Object.keys(current.children ?? {}))
- console.debug('readdir ' + path)
+ console.debug(`readdir ${path}`)
return result
},
stat: async (path: string): Promise<{ isDirectory: () => boolean, isFile: () => boolean }> => {
const { current } = await navigatePath(path)
- console.debug('stat ' + path)
+ console.debug(`stat ${path}`)
return {
isDirectory: () => current.type === 'directory',
isFile: () => current.type === 'file'
@@ -475,11 +474,11 @@ const VirtualFS: Library = {
newCurrent.children[newFilename] = oldCurrent.children[oldFilename]
Reflect.deleteProperty(oldCurrent.children, oldFilename)
- console.debug('rename ' + oldPath + ' -> ' + newPath)
+ console.debug(`rename ${oldPath} -> ${newPath}`)
await save()
},
exists: async (path: string): Promise => {
- console.debug('exists ' + path)
+ console.debug(`exists ${path}`)
try {
const { current } = await navigatePath(path)
return current !== undefined
diff --git a/src/system/lib/XOR.ts b/src/system/lib/XOR.ts
index ca1c7cd..63d2f20 100644
--- a/src/system/lib/XOR.ts
+++ b/src/system/lib/XOR.ts
@@ -37,7 +37,7 @@ const XOR: Library = {
return indCheck ? String.fromCharCode(char.charCodeAt(0) ^ 2) : char
})
- .join('') + ((search.length > 0) ? '?' + search.join('?') : '')
+ .join('') + ((search.length > 0) ? `?${search.join('?')}` : '')
)
}
}