Updated default data to mirror repo content
This commit is contained in:
parent
dd0590ef01
commit
4729a6d623
8 changed files with 126 additions and 53 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
<options>
|
<options>
|
||||||
<startup></startup>
|
<startup>file-explorer</startup>
|
||||||
</options>
|
</options>
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
.Container {
|
.Container {
|
||||||
--header-height: 3.5rem;
|
--header-height: 3.5rem;
|
||||||
--sidebar-width: 10rem;
|
--sidebar-width: 10rem;
|
||||||
|
--footer-height: 1.75rem;
|
||||||
--scale: 1.15rem;
|
--scale: 1.15rem;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -131,6 +132,7 @@
|
||||||
align-content: flex-start;
|
align-content: flex-start;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
padding-bottom: calc(0.5rem + var(--footer-height));
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +144,7 @@
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 1.75rem;
|
height: var(--footer-height);
|
||||||
padding: 0 0.75rem;
|
padding: 0 0.75rem;
|
||||||
border-top: 0.25rem solid var(--background-color-a);
|
border-top: 0.25rem solid var(--background-color-a);
|
||||||
background-color: var(--background-color-c);
|
background-color: var(--background-color-c);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { useEffect } from "react";
|
||||||
import { useWindowsManager } from "../../../hooks/windows/windowsManagerContext.js";
|
import { useWindowsManager } from "../../../hooks/windows/windowsManagerContext.js";
|
||||||
import styles from "./MediaViewer.module.css";
|
import styles from "./MediaViewer.module.css";
|
||||||
import { APPS } from "../../../config/apps.config.js";
|
import { APPS } from "../../../config/apps.config.js";
|
||||||
|
import { IMAGE_FORMATS } from "../../../config/apps/mediaViewer.config.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../windows/WindowView.jsx").windowProps} props
|
* @param {import("../../windows/WindowView.jsx").windowProps} props
|
||||||
|
|
@ -23,7 +24,7 @@ export function MediaViewer({ file, close, setTitle }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!["png"].includes(file.extension))
|
if (!IMAGE_FORMATS.includes(file.extension))
|
||||||
return (<p>Invalid file format.</p>);
|
return (<p>Invalid file format.</p>);
|
||||||
|
|
||||||
if (file.source == null)
|
if (file.source == null)
|
||||||
|
|
|
||||||
8
src/config/apps/mediaViewer.config.js
Normal file
8
src/config/apps/mediaViewer.config.js
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
export const IMAGE_FORMATS = [
|
||||||
|
"png",
|
||||||
|
"jpeg",
|
||||||
|
"svg",
|
||||||
|
"gif",
|
||||||
|
"webp",
|
||||||
|
"ico"
|
||||||
|
];
|
||||||
|
|
@ -9,6 +9,7 @@ import { Settings } from "../../components/apps/settings/Settings.jsx";
|
||||||
import Vector2 from "../math/vector2.js";
|
import Vector2 from "../math/vector2.js";
|
||||||
import { APPS } from "../../config/apps.config.js";
|
import { APPS } from "../../config/apps.config.js";
|
||||||
import { Browser } from "../../components/apps/browser/Browser.jsx";
|
import { Browser } from "../../components/apps/browser/Browser.jsx";
|
||||||
|
import { IMAGE_FORMATS } from "../../config/apps/mediaViewer.config.js";
|
||||||
|
|
||||||
export default class AppsManager {
|
export default class AppsManager {
|
||||||
static APPS = [
|
static APPS = [
|
||||||
|
|
@ -62,14 +63,11 @@ export default class AppsManager {
|
||||||
static getAppByFileExtension(fileExtension) {
|
static getAppByFileExtension(fileExtension) {
|
||||||
let app = null;
|
let app = null;
|
||||||
|
|
||||||
// eslint-disable-next-line default-case
|
if (IMAGE_FORMATS.includes(fileExtension))
|
||||||
|
return this.getAppById(APPS.MEDIA_VIEWER);
|
||||||
|
|
||||||
switch (fileExtension) {
|
switch (fileExtension) {
|
||||||
case "png":
|
default:
|
||||||
app = this.getAppById(APPS.MEDIA_VIEWER);
|
|
||||||
break;
|
|
||||||
case "txt":
|
|
||||||
case "md":
|
|
||||||
case "xml":
|
|
||||||
app = this.getAppById(APPS.TEXT_EDITOR);
|
app = this.getAppById(APPS.TEXT_EDITOR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { APPS } from "../../../config/apps.config.js";
|
import { APPS } from "../../../config/apps.config.js";
|
||||||
|
import { IMAGE_FORMATS } from "../../../config/apps/mediaViewer.config.js";
|
||||||
import AppsManager from "../../apps/appsManager.js";
|
import AppsManager from "../../apps/appsManager.js";
|
||||||
import WindowsManager from "../../windows/windowsManager.js";
|
import WindowsManager from "../../windows/windowsManager.js";
|
||||||
import { VirtualBase } from "../virtualBase.js";
|
import { VirtualBase } from "../virtualBase.js";
|
||||||
|
|
@ -120,15 +121,21 @@ export class VirtualFile extends VirtualBase {
|
||||||
|
|
||||||
let iconUrl = null;
|
let iconUrl = null;
|
||||||
|
|
||||||
|
if (IMAGE_FORMATS.includes(this.extension))
|
||||||
|
return this.source;
|
||||||
|
|
||||||
switch (this.extension) {
|
switch (this.extension) {
|
||||||
case "png":
|
|
||||||
iconUrl = this.source;
|
|
||||||
break;
|
|
||||||
case "txt":
|
case "txt":
|
||||||
case "md":
|
case "md":
|
||||||
iconUrl = AppsManager.getAppIconUrl(APPS.FILE_EXPLORER, "file-text");
|
iconUrl = AppsManager.getAppIconUrl(APPS.FILE_EXPLORER, "file-text");
|
||||||
break;
|
break;
|
||||||
case "xml":
|
case "xml":
|
||||||
|
case "js":
|
||||||
|
case "json":
|
||||||
|
case "jsx":
|
||||||
|
case "css":
|
||||||
|
case "html":
|
||||||
|
case "yml":
|
||||||
iconUrl = AppsManager.getAppIconUrl(APPS.FILE_EXPLORER, "file-code");
|
iconUrl = AppsManager.getAppIconUrl(APPS.FILE_EXPLORER, "file-code");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -8,29 +8,6 @@ import { VirtualRoot } from "./virtualRoot.js";
|
||||||
* @param {VirtualRoot} virtualRoot
|
* @param {VirtualRoot} virtualRoot
|
||||||
*/
|
*/
|
||||||
export function loadDefaultData(virtualRoot) {
|
export function loadDefaultData(virtualRoot) {
|
||||||
virtualRoot.createFolder("bin", (folder) => {
|
|
||||||
folder.createFiles([
|
|
||||||
{ name: "echo" },
|
|
||||||
{ name: "cd" },
|
|
||||||
{ name: "ls" },
|
|
||||||
{ name: "clear" },
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
virtualRoot.createFolder("dev", (folder) => {
|
|
||||||
folder.createFiles([
|
|
||||||
{ name: "null" },
|
|
||||||
{ name: "zero" },
|
|
||||||
{ name: "random" },
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
virtualRoot.createFolder("etc");
|
|
||||||
|
|
||||||
virtualRoot.createFolder("usr", (folder) => {
|
|
||||||
folder.createFolders(["bin", "sbin", "lib", "share"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
const linkedPaths = {};
|
const linkedPaths = {};
|
||||||
|
|
||||||
virtualRoot.createFolder("home", (folder) => {
|
virtualRoot.createFolder("home", (folder) => {
|
||||||
|
|
@ -98,22 +75,101 @@ export function loadDefaultData(virtualRoot) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
virtualRoot.createFolder("lib");
|
virtualRoot.createFolder(".github", (folder) => {
|
||||||
virtualRoot.createFolder("sbin");
|
folder.createFile("FUNDING", "yml", (file) => {
|
||||||
virtualRoot.createFolder("tmp");
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/.github/FUNDING.yml");
|
||||||
virtualRoot.createFolder("var");
|
});
|
||||||
virtualRoot.createFolder("boot");
|
|
||||||
|
|
||||||
virtualRoot.createFolder("proc", (folder) => {
|
|
||||||
folder.createFiles([
|
|
||||||
{ name: "cpuinfo" },
|
|
||||||
{ name: "meminfo" },
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
virtualRoot.createFolder("var");
|
virtualRoot.createFolder(".vscode", (folder) => {
|
||||||
virtualRoot.createFolder("opt");
|
folder.createFile("settings", "json", (file) => {
|
||||||
virtualRoot.createFolder("media");
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/.vscode/settings.json");
|
||||||
virtualRoot.createFolder("mnt");
|
});
|
||||||
virtualRoot.createFolder("srv");
|
});
|
||||||
|
|
||||||
|
virtualRoot.createFolder("docs", (folder) => {
|
||||||
|
folder.createFile("README", "md", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/docs/README.md");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
virtualRoot.createFolder("public", (folder) => {
|
||||||
|
folder.createFolder("assets", (folder) => {
|
||||||
|
folder.createFolder("apps", (folder) => {
|
||||||
|
folder.createFolder("icons", (folder) => {
|
||||||
|
AppsManager.APPS.forEach(({ id }) => {
|
||||||
|
folder.createFile(id, "svg", (file) => {
|
||||||
|
file.setSource(AppsManager.getAppIconUrl(id));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).createFolder("fonts", (folder) => {
|
||||||
|
folder.createFolders(["poppins", "roboto-mono"]);
|
||||||
|
}).createFolder("screenshots", (folder) => {
|
||||||
|
folder.createFile("screenshot", "png", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/assets/screenshots/screenshot-files-settings-taskbar-desktop.png`);
|
||||||
|
});
|
||||||
|
}).createFolder("wallpapers", (folder) => {
|
||||||
|
folder.setProtected(true);
|
||||||
|
for (let i = 0; i < WALLPAPERS.length; i++) {
|
||||||
|
const source = WALLPAPERS[i];
|
||||||
|
const name = source.split("/").pop().split(".")[0];
|
||||||
|
folder.createFile(name, "png", (file) => {
|
||||||
|
file.setSource(source);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).createFile("banner", "png", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/assets/banner-logo-title.png`);
|
||||||
|
}).createFile("logo", "svg", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/assets/logo.svg`);
|
||||||
|
});
|
||||||
|
}).createFolder("config", (folder) => {
|
||||||
|
folder.createFile("apps", "xml", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/config/apps.xml`);
|
||||||
|
}).createFile("desktop", "xml", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/config/desktop.xml`);
|
||||||
|
}).createFile("taskbar", "xml", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/config/taskbar.xml`);
|
||||||
|
});
|
||||||
|
}).createFolder("documents", (folder) => {
|
||||||
|
folder.createFile("info", "md", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/documents/info.md`);
|
||||||
|
}).createFile("links", "md", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/documents/links.md`);
|
||||||
|
});
|
||||||
|
}).createFile("favicon", "ico", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/favicon.ico`);
|
||||||
|
}).createFile("index", "html", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/index.html`);
|
||||||
|
}).createFile("robots", "txt", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/robots.txt`);
|
||||||
|
}).createFile("sitemap", "xml", (file) => {
|
||||||
|
file.setSource(`${process.env.PUBLIC_URL}/sitemap.xml`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
virtualRoot.createFolder("src", (folder) => {
|
||||||
|
folder.createFolder("components")
|
||||||
|
.createFolder("config")
|
||||||
|
.createFolder("features")
|
||||||
|
.createFolder("hooks")
|
||||||
|
.createFolder("styles")
|
||||||
|
.createFile("App", "jsx", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/src/App.jsx");
|
||||||
|
}).createFile("index", "js", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/src/index.js");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
virtualRoot.createFile("", "env", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/.env");
|
||||||
|
}).createFile("", "gitignore", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/.gitignore");
|
||||||
|
}).createFile("LICENSE", "md", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/LICENSE.md");
|
||||||
|
}).createFile("README", "md", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/README.md");
|
||||||
|
}).createFile("package", "json", (file) => {
|
||||||
|
file.setSource("https://raw.githubusercontent.com/Prozilla/Prozilla-OS/main/package.json");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +214,8 @@ export class VirtualRoot extends VirtualFolder {
|
||||||
object.scs = {};
|
object.scs = {};
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(this.shortcuts)) {
|
for (const [key, value] of Object.entries(this.shortcuts)) {
|
||||||
object.scs[key] = value.absolutePath;
|
if (!value.root)
|
||||||
|
object.scs[key] = value.absolutePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue