Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2001d0a
fix(build): obfuscation
Aug 21, 2023
03781a9
fix(fs-build): improve build, update terms
Aug 26, 2023
e2e8258
fix(rootfs-build): remove some erros
Sep 1, 2023
58b580e
duh
Sep 3, 2023
006de07
chore(build): prettify build output
Sep 5, 2023
8266519
fix(devwatch): no more console error
Sep 5, 2023
1e236b9
refactor(kernel:fs): make structure better
Sep 5, 2023
a6c4c60
feat(targetfs): add coffeescript parser
Sep 5, 2023
46e6692
feat(build): add an actual fs build
Sep 5, 2023
4ad9068
feat(build): copy over and make an installer fs
Sep 5, 2023
8c2b907
feat(build): copy over and make an installer fs
Sep 5, 2023
af65f24
Updated 'devtool-blocker' to 'DevToolsDetector', added 'portalog' to …
Sep 8, 2023
eabc345
"Refactor ESLint configuration and update dependencies"
Sep 12, 2023
97279e1
"Refactor build process, modularize tasks, and implement logging"
Sep 12, 2023
eb1bfc2
add global ts support
Sep 12, 2023
88485bd
stop bundling jszip with kernel
Sep 13, 2023
7cb37b6
add obfuscation
Sep 13, 2023
431aa4c
huge fix
Sep 13, 2023
3b40a53
Add anti-piracy check
Sep 13, 2023
3469e46
remove pointer lock requirement
Sep 13, 2023
5e25a78
DIST not public
Sep 13, 2023
dae6531
Move build scripts to 'build' directory and refactor
Sep 13, 2023
ab12232
critical bugfix
Sep 14, 2023
d9c2ff5
critical bugfix
Sep 15, 2023
2905b18
Refactor build tasks and improve clean functionality
Sep 15, 2023
e2fb648
Add serve script and update startup message
Sep 16, 2023
2c2f911
Update metadata and refine startup script
Sep 16, 2023
affcd00
Refactor startup process and relocate utility scripts
Sep 16, 2023
4e649f6
make readme better
Sep 16, 2023
c1ea931
cloudflare pages bugfix?
Sep 21, 2023
a3358e5
Organize code for better clarity and efficiency.
Sep 21, 2023
cfb50f5
fix build, use installer fs
Sep 23, 2023
b29d76f
ADD TAURI SUPPORT
Sep 23, 2023
f56bc43
ADD TAURI SUPPORT again
Sep 23, 2023
7c6659e
fix tauri support
Sep 23, 2023
8002ff5
fix tauri support again
Sep 24, 2023
d09589d
Update README with accurate build paths and Tauri code info
Sep 24, 2023
1b49a36
add tauri action
Sep 24, 2023
d4b5a31
element cleanup, etc
Sep 24, 2023
dbbcee7
clutter cleanup
Sep 24, 2023
42dca76
Reorganise startup files and update README
Sep 26, 2023
69bad23
fix things here and there
Sep 26, 2023
b899500
Add CSS loader and minify HTML for improving performance
Sep 26, 2023
9ce658a
inline css now
Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 5 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"extends": "standard-with-typescript",
"overrides": [
{
"files": ["**/*.ts"],
"extends": "plugin:@typescript-eslint/recommended"
}
],
"parserOptions": {
"ecmaVersion": "latest",
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'publish'
on:
push:
branches:
- RELEASE
- staging

jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: yarn install # change this to npm or pnpm depending on which one you use
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRERELEASE: ${{ startsWith(github.ref, 'refs/heads/staging') }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'Pluto Desktop v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: ${{ env.PRERELEASE }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
public/assets/rootfs.zip
# temporary folders that get zipped... @TODO remove these folders after they get zipped
target_fs_BUILD/
installer_fs_BUILD/

.vscode
out
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# open99
# 🌌 pluto
a complete web OS
## About
open99 is a close-sourced Web OS, similar to Windows93 or Windows96. It intends to be the most sophisticated, complete, and developer-friendly web OS.
Applications in open99 run under the 41worker environment, which is comparable to WRT for Windows 96. 41worker applications run in workers to improve speed, security, and convenience. To learn more, visit [the docs page](https://docs.open99.ga/api/41worker).
Pluto is a close-sourced Web OS, similar to Windows93 or Windows96. It intends to be the most sophisticated, complete, and developer-friendly web OS.
Applications in open99 run under the 41worker environment, which is comparable to WRT for Windows 96. 41worker applications run in workers to improve speed, security, and convenience. To learn more, visit [the docs page](https://developers.pluto.stretch.wtf/learn/api/41worker).
## Install
You can install the codebase onto your system by cloning the repo and running `npm i -g serve && npm i -g nodemon && npm i`.
Note that installing both of those packages globally is required.
## Usage
You can build open99 by running `npm run build`. This will build the OS and put it in the `/dist` folder.
You can build pluto by running `npm run build`. This will build the OS and copy it into the `/dist` folder.
## Structure
`/sys` gets built into `/fs`.
`/fs` gets built into `/public/assets/rootfs.zip` as a zip file.
`/public` is static files. This currently includes CSS.
`/src` is the OS kernel and gets built to `/public/index.js`. The source map is also available there.
`/dist` is your ready-to-run build of open99.
`/installer_fs` gets built into `/dist/assets/installer.zip` as a zip file.
`/target_fs` gets built into `/dist/assets/rootfs.zip` as a zip file.
`/build` is the build scripts.
`/public` is static files. This includes CSS as well as images.
`/src` is the OS kernel and gets built to `/dist/index.js`.
`/src-tauri` is the Tauri application code (contains rust and tauri config, mainly)
`/dist` is your ready-to-run build of Pluto.
17 changes: 17 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import tasks from "./tasks/index.js"
import { LogSession } from "portalog"
import { config } from "dotenv"
config()
process.env.NODE_ENV = process.argv.includes("--devmode") ? "development" : process.env.NODE_ENV || "production"
process.env.NODE_ENV = process.argv.includes("--prodmode") ? "production" : process.env.NODE_ENV || "production"

const session = new LogSession
const logger = session.addItem(`PLUTO OS building on ${new Date()}\nin ${process.env.NODE_ENV} mode. Watch mode is ${process.argv.includes("--watch") ? "on" : "off"}`, "🌌")
const args = {
session: logger,
isWatchMode: process.argv.includes("--watch"),
NODE_ENV: process.env.NODE_ENV,
}
for (const task of tasks) {
await task(args)
}
41 changes: 41 additions & 0 deletions build/meta/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import copy from "esbuild-copy-plugin"
import {config} from "dotenv"
import {readFile} from "fs/promises"
config()
const json = JSON.parse(
await readFile("./package.json", "utf-8")
);

export function args(){
return {
entryPoints: ["./src/index.js"],
bundle: true,
minify: true,
sourcemap: process.env.NODE_ENV === "development",
target: ["esnext"], //@TODO fix esbuild target
outfile: "./dist/index.js",
plugins: [copy({
from: "./public",
to: ".",
})],
platform: "browser",
format: "esm",
loader: {".zip": "file", ".css": "text"},
define: {
"process.env.NODE_ENV": "\"" + process.env.NODE_ENV + "\"" || "production",
"SYSVER": `"${json.version}"`,
},
legalComments: "none", //we don't want people to know what dependencies we rely on
drop: process.env.NODE_ENV === "development" ? undefined : [
"debugger",
"console",
],
banner: {
js: `/*
* PLUTO - A sophisticated, fast and secure web operating system.
* Copyright stretch07, 2023, All rights reserved.
* Copying this project is prohibited by law.
*/`,
}
}
}
64 changes: 64 additions & 0 deletions build/meta/fsbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { readdir, mkdir, copyFile } from "fs/promises"
import { join, extname } from "path"
import esbuild from "esbuild"

async function recursiveCopy(sourceDir, targetDir) {
const dirents = await readdir(sourceDir, { withFileTypes: true })

for (const dirent of dirents) {
let sourcePath = join(sourceDir, dirent.name)
let targetPath

if (dirent.isDirectory()) {
if (dirent.name.startsWith("DIR_")) {
targetPath = join(targetDir, dirent.name.replace(/^DIR_/, ""))
await mkdir(targetPath, { recursive: true })
await recursiveCopy(sourcePath, targetPath)
} else {
let bundlePath = join(targetDir, `${dirent.name}.js`)
await handleDirectory(sourcePath, bundlePath)
}
} else {
targetPath = join(targetDir, dirent.name)
await handleFile(sourcePath, targetPath)
}
}
}

async function handleDirectory(sourcePath, bundlePath) {
const files = await readdir(sourcePath)
const indexExists = files.includes("index.js")
if (!indexExists) {
return
}
await esbuild.build({
entryPoints: [join(sourcePath, "index.js")],
outfile: bundlePath,
bundle: true,
minify: true,
format: "esm",
})
}

async function handleFile(sourcePath, targetPath) {
if (extname(sourcePath) === ".js") {
return
}
await copyFile(sourcePath, targetPath)
}

try {
await mkdir("./target_fs_BUILD")
await mkdir("./installer_fs_BUILD")
await mkdir("./dist")
} catch {
// ignore
}

//I won't lie I have no idea how these paths are working.
export async function buildTargetFs() {
await recursiveCopy("./target_fs/Pluto/System41", "./target_fs_BUILD/Pluto/System41")
}
export async function buildInstallerFs() {
await recursiveCopy("./installer_fs/Pluto/System41", "./installer_fs_BUILD/Pluto/System41")
}
8 changes: 8 additions & 0 deletions build/tasks/afterClean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {rimraf} from "rimraf"

export async function build({session}) {
const msg = session.addItem("Cleaning up...", "🧹")
await rimraf("./target_fs_BUILD")
await rimraf("./installer_fs_BUILD")
msg.addItem("Cleaned up!", "✅")
}
13 changes: 13 additions & 0 deletions build/tasks/beforeClean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {rimraf} from "rimraf"
import * as fs from "fs/promises"

export async function build({session}) {
const msg = session.addItem("Cleaning up previous build...", "🧹")
await rimraf("./dist")
//these two are probably unnecessary but who cares
await rimraf("./target_fs_BUILD")
await rimraf("./installer_fs_BUILD")
await fs.mkdir("./dist")

msg.addItem("Cleaned up!", "✅")
}
16 changes: 16 additions & 0 deletions build/tasks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { build as beforeClean} from "./beforeClean.js"
import { build as kernel } from "./kernel.js"
import { build as target_fs } from "./target_fs.js"
import { build as installer_fs } from "./installer_fs.js"
import { build as minifyHtml } from "./minifyHtml.js"
import { build as afterClean} from "./afterClean.js"

// THIS IS ORDER SENSITIVE! DO NOT CHANGE THE ORDER OF THIS ARRAY!
export default [
beforeClean, //clean should ALWAYS go first
target_fs,
installer_fs,
kernel,
minifyHtml,
afterClean
]
12 changes: 12 additions & 0 deletions build/tasks/installer_fs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { buildInstallerFs } from "../meta/fsbuild.js"
import zippy from "file-zippy"

export async function build({session}) {
const msg = session.addItem("Target fs", "🛠")
const buildingMsg = msg.addItem("Building", "🛠️")
await buildInstallerFs()
buildingMsg.addItem("Built", "✅")
const packingMsg = msg.addItem("Packing", "📦")
zippy("installer_fs_BUILD/", "./dist/assets/installer.zip")
packingMsg.addItem("Packed", "✅")
}
32 changes: 32 additions & 0 deletions build/tasks/kernel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { rimraf } from "rimraf";
import { context, build as esbuild } from "esbuild";
import JavascriptObfuscator from "javascript-obfuscator";
import { promises as fs } from "fs"
import {args} from "../meta/esbuild.js"

export async function build({session, isWatchMode, NODE_ENV}) {
const msg = session.addItem("Building kernel...", "🛠")
if (!isWatchMode) {
try {
await esbuild(args())
if (NODE_ENV !== "development") {
msg.addItem("Obfuscating kernel...", "🕶")
const obfuscated = JavascriptObfuscator.obfuscate(await fs.readFile("./dist/index.js", {encoding:"utf8"}))
await fs.writeFile("./dist/index.js", obfuscated.getObfuscatedCode())
msg.addItem("Kernel obfuscated!", "✅")
}
msg.addItem("Kernel built!", "✅")
} catch (e) {
// First, we'll just remove the directory to begin with
await rimraf("./dist")
// error handling
msg.addItem("Kernel build failed! Details below", "❌")
console.error(e)
process.exit(1)
}
} else {
//@TODO implement watch mode
msg.addItem("WATCH MODE NOT IMPLEMENTED", "❌")
process.exit(1)
}
}
9 changes: 9 additions & 0 deletions build/tasks/minifyHtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as fs from "fs/promises"
import minifyHtml from "@minify-html/node"

export async function build() {
await fs.writeFile("./dist/index.html", minifyHtml.minify(await fs.readFile("./dist/index.html", ), {
do_not_minify_doctype: true,
keep_spaces_between_attributes: true,
}))
}
12 changes: 12 additions & 0 deletions build/tasks/target_fs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { buildTargetFs } from "../meta/fsbuild.js"
import zippy from "file-zippy"

export async function build({session}) {
const msg = session.addItem("Installer fs", "🛠")
const buildingMsg = msg.addItem("Building", "🛠️")
await buildTargetFs()
buildingMsg.addItem("Built", "✅")
const packingMsg = msg.addItem("Packing", "📦")
zippy("target_fs_BUILD/", "./dist/assets/rootfs.zip")
packingMsg.addItem("Packed", "✅")
}
10 changes: 10 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { tauri } from "@tauri-apps/api"
import * as jszip from "jszip"

declare global {
interface Window {
__TAURI__: typeof tauri | undefined,
JSZip: jszip
}
const SYSVER: string
}
1 change: 1 addition & 0 deletions installer_fs/Pluto/System41/DIR_testing/static.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this static file should be present during fs build. testtt

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions installer_fs/Pluto/System41/cscript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// COFFEESCRIPT SERVICE

import { compile } from "./bundled/__coffeescript-parse.js"
/* argument[0] = shell? argument[1] = cscript argument[2] = filename */

let content
try {
content = await sys41.fs.getFile(__process.argv[2])
} catch(e) {
console.error(e)
await __process.respond(e)
}

let compiled
try {
compiled = compile(content)
} catch (e) {
await __process.respond(e)
}

await __process.respond(compiled)
1 change: 1 addition & 0 deletions installer_fs/Pluto/System41/virtualnet/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// VIRTUAL NETWORK PROXY SERVICE
1 change: 1 addition & 0 deletions installer_fs/Users/SYSTEM/taskbar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Loading