Merge pull request #129 from Flow-Works/feature/check-for-new-apps-at-homeapplications
[⚡] Added new application check
This commit is contained in:
commit
fc675e8300
7 changed files with 53 additions and 42 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: build
|
name: build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master, dev]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master]
|
branches: [master, dev]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
4
.github/workflows/ts-standard.yml
vendored
4
.github/workflows/ts-standard.yml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: ts-standard
|
name: ts-standard
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master, dev]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master]
|
branches: [master, dev]
|
||||||
jobs:
|
jobs:
|
||||||
ts-standard:
|
ts-standard:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import './assets/style.less'
|
import './assets/style.less'
|
||||||
import { version } from '../package.json'
|
import { version } from '../package.json'
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
import { Permission } from './system/lib/VirtualFS'
|
|
||||||
import ProcessLib from './structures/ProcessLib'
|
import ProcessLib from './structures/ProcessLib'
|
||||||
import ProcLib from './structures/ProcLib'
|
import ProcLib from './structures/ProcLib'
|
||||||
import { Executable, Process, Package, ProcessInfo, KernelConfig } from './types'
|
import { Executable, Process, Package, ProcessInfo, KernelConfig, Permission } from './types'
|
||||||
import semver from 'semver'
|
import semver from 'semver'
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import semver from 'semver'
|
import semver from 'semver'
|
||||||
import Kernel from '../kernel'
|
import Kernel from '../kernel'
|
||||||
import { Permission } from '../system/lib/VirtualFS'
|
import { Process, Executable, LibraryData, Package, Library, Permission } from '../types'
|
||||||
import { Process, Executable, LibraryData, Package, Library } from '../types'
|
|
||||||
import FlowWindow from './FlowWindow'
|
import FlowWindow from './FlowWindow'
|
||||||
import LibraryLib from './LibraryLib'
|
import LibraryLib from './LibraryLib'
|
||||||
import ProcLib from './ProcLib'
|
import ProcLib from './ProcLib'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import HTML from '../HTML'
|
import HTML from '../HTML'
|
||||||
import { AppClosedEvent, AppOpenedEvent, Process } from '../types'
|
import { AppClosedEvent, AppOpenedEvent, Directory, FileSystemObject, Process } from '../types'
|
||||||
import { getTime } from '../utils'
|
import { getTime } from '../utils'
|
||||||
import { db, defaultFS, initializeDatabase, read, setFileSystem, write } from './lib/VirtualFS'
|
import { db, defaultFS, initializeDatabase, read, setFileSystem, write } from './lib/VirtualFS'
|
||||||
import nullIcon from '../assets/icons/application-default-icon.svg'
|
import nullIcon from '../assets/icons/application-default-icon.svg'
|
||||||
|
|
@ -32,10 +32,19 @@ const BootLoader: Process = {
|
||||||
} else {
|
} else {
|
||||||
console.warn('Persistent storage is not supported.')
|
console.warn('Persistent storage is not supported.')
|
||||||
}
|
}
|
||||||
const fileSystem = await read()
|
const fileSystem = await read() as FileSystemObject
|
||||||
if (fileSystem === undefined) {
|
if (fileSystem === undefined) {
|
||||||
await write(defaultFS)
|
await write(defaultFS)
|
||||||
} else {
|
} else {
|
||||||
|
const appsDirectory = ((fileSystem.root.children.home as Directory).children.Applications as Directory).children
|
||||||
|
const defaultAppsDirectory = ((defaultFS.root.children.home as Directory).children.Applications as Directory).children
|
||||||
|
for (const file in defaultAppsDirectory) {
|
||||||
|
if (appsDirectory[file] === undefined && defaultAppsDirectory[file] !== undefined) {
|
||||||
|
console.log(file)
|
||||||
|
appsDirectory[file] = defaultAppsDirectory[file]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await write(fileSystem)
|
||||||
await setFileSystem(fileSystem)
|
await setFileSystem(fileSystem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,11 @@
|
||||||
import Kernel from '../../kernel'
|
import Kernel from '../../kernel'
|
||||||
import ProcessLib from '../../structures/ProcessLib'
|
import ProcessLib from '../../structures/ProcessLib'
|
||||||
import { Library } from '../../types'
|
import { Directory, Errors, File, Library, Permission } from '../../types'
|
||||||
|
|
||||||
console.debug = (...args: any[]) => {
|
console.debug = (...args: any[]) => {
|
||||||
console.log('[VirtualFS]', ...args)
|
console.log('[VirtualFS]', ...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Errors {
|
|
||||||
ENOENT = 'ENOENT',
|
|
||||||
EISDIR = 'EISDIR',
|
|
||||||
EEXIST = 'EEXIST',
|
|
||||||
EPERM = 'EPERM',
|
|
||||||
ENOTDIR = 'ENOTDIR',
|
|
||||||
EACCES = 'EACCES'
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum Permission {
|
|
||||||
USER,
|
|
||||||
ELEVATED,
|
|
||||||
SYSTEM
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Directory {
|
|
||||||
type: 'directory'
|
|
||||||
permission: Permission
|
|
||||||
deleteable: boolean
|
|
||||||
children: {
|
|
||||||
[key: string]: Directory | File
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface File {
|
|
||||||
type: 'file'
|
|
||||||
permission: Permission
|
|
||||||
deleteable: boolean
|
|
||||||
content: Buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
export const defaultFS: { root: Directory } = {
|
export const defaultFS: { root: Directory } = {
|
||||||
root: {
|
root: {
|
||||||
type: 'directory',
|
type: 'directory',
|
||||||
|
|
|
||||||
35
src/types.ts
35
src/types.ts
|
|
@ -9,6 +9,41 @@ export interface AppClosedEvent extends CustomEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum Errors {
|
||||||
|
ENOENT = 'ENOENT',
|
||||||
|
EISDIR = 'EISDIR',
|
||||||
|
EEXIST = 'EEXIST',
|
||||||
|
EPERM = 'EPERM',
|
||||||
|
ENOTDIR = 'ENOTDIR',
|
||||||
|
EACCES = 'EACCES'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Permission {
|
||||||
|
USER,
|
||||||
|
ELEVATED,
|
||||||
|
SYSTEM
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Directory {
|
||||||
|
type: 'directory'
|
||||||
|
permission: Permission
|
||||||
|
deleteable: boolean
|
||||||
|
children: {
|
||||||
|
[key: string]: Directory | File
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface File {
|
||||||
|
type: 'file'
|
||||||
|
permission: Permission
|
||||||
|
deleteable: boolean
|
||||||
|
content: Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileSystemObject {
|
||||||
|
root: Directory
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppOpenedEvent extends CustomEvent {
|
export interface AppOpenedEvent extends CustomEvent {
|
||||||
detail: {
|
detail: {
|
||||||
proc: Process
|
proc: Process
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue