WebOS 2 Devlog #11: Reset btn + Notepad IDE + other changes
This was a long long coding session. Had to stay awake till like 2am. Here are the changes i made. Ill try to keep everythign concise because theres a 4000 char limit and i have lot more to say than that.
Change 1:
I added a factory reset button in settings that directs the user to the webos setup screen like the one they get when they first enter the website. When testing this feature, i realised that random variables from completely different web projects started appearing in the File Manager. Because browsers share localStorage databases across the same local port (e.g., 127.0.0.1:5500), the OS was inheriting the ghosts of old projects.
The solution:
I had to upgrade the Initial Setup Utility. When formatting the Virtual Hard Drive, the system now temporarily caches the user’s OS credentials in memory that they entered, executes a total localStorage.clear() wipe to delete all the localStorage varialbles, and then safely restores the username and stuff before continuing normally.
Change 2: Notepad IDE
This was the part that took the longest (and its still not done). I wanted to create something absolutely unique that i havent seen in any other webos projects that i saw. And i realised, why dont i make an IDE in me webos? Not an actual IDE ofc but the goal was to allow users to write raw HTML/JS in the Notepad, save it as a .app file, and double-click it on the desktop to launch it as a fully functioning, program.
Attempt 1 (Failure):
I initially tried parsing the saved text and running it directly in the OS context using eval(). It was an absolute security and stability nightmare. The custom app had root access to the OS memory and instantly overwrote the osState object, completely crashing the Window Manager within seconds.
Attempt 2 (Failure):
I tried fixing attempt 1 but messed up the entire code in the process so i had to revert to that commit and this time, i tried putting the apps in Web Components and the Shadow DOM. While this successfully isolated the CSS so custom apps didn’t break the OS styling, the JavaScript still executed in the global window scope. Running two different custom apps simultaneously caused variable collisions that bricked the taskbar. It was too complex and fundamentally flawed.
I wiped the slate clean again.
Attempt 3 (Success):
I realised that the answer was looking straignt at me. I was so stupid. I can just take the code and slap it on to an , and it runs it, just like how i made the web browser. The solution was that When a user double-clicks a custom .app, the OS takes the raw code and converts it into a text/html Blob. It then passes that Blob through URL.createObjectURL(), creating a localized URL. By feeding that URL into an , the custom app boots perfectly. I am really proud of this feature. It’s still not fully done but i had to make a devlog since the tracked time almost reached 10hrs.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.