forked from randomuser691337/another-webdesk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·303 lines (289 loc) · 9.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html lang="en" style="">
<head>
<style>
html:not(:has(.setupbar)){background-color: black;}
</style>
</style>
<link rel="stylesheet" id="stockstyles" href="./assets/style.css" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="shortcut icon" href="./assets/img/systemIcons/os.svg" />
<link rel="apple-touch-icon" href="./assets/img/systemIcons/os.svg" />
<title>NovaOS NG</title>
<!-- Make sure your page supports utf-8 characterset. -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Load TensorFlow.js. This is required to use the qna model. -->
<script src="./assets/lib/tf.js"></script>
<!-- Load the qna model. -->
<script src="./assets/models/qna.model"></script>
<!-- Load the Universal Sentence Encoder. This is required to use the novaOS AI. -->
<script src="./assets/lib/use.js"></script>
</head>
<style>
@font-face {
font-family: "LucideIcons";
src: url(https://unpkg.com/lucide-static@latest/font/Lucide.ttf)
format("truetype");
}
</style>
<script>
var abt = {
lastmod: "July 29, 2024",
ver: "0.0.9",
product: "novaOS",
};
var sys = {
deskid: undefined,
setupd: undefined,
migrid: 1,
autodarkacc: undefined,
webdrop: true,
name: "Default User",
isIOT: false,
iotApp: null,
idLen: 8,
};
var el = {
taskbar: undefined,
sm: undefined,
tr: undefined,
};
</script>
<body style="display: none !important;">
<!-- <div class="circle"></div>
<div class="circle2"></div> -->
<div id="setuparea"></div>
<div style="display: none" id="contcent" class="contcent">
<p class="h3">Control Center</p>
<p class="lockdown">
Your DeskID is <span class="mcode bold deskid">----</span>
</p>
<span
class="ckbx"
id="dnd"
onclick='localStorage.setItem("doNotDisturb", localStorage.getItem("doNotDisturb") == "false");if(localStorage.getItem("doNotDisturb") == "false") this.classList.remove("on"); else this.classList.add("on")'
>
Do not disturb
</span>
<!-- <span class="ckbx" id="netw" onclick='localStorage.setItem("networking", localStorage.getItem("networking") == "false");if(localStorage.getItem("networking") == "false") this.classList.remove("on"); else this.classList.add("on")'>
Network Services
</span> -->
<select id="dm">
<option value="titol" disabled>Display Mode</option>
<option value="dark">Dark mode</option>
<option value="light">Light</option>
<option value="auto">Auto</option>
<option value="cml">Clear Mode: Light</option>
<option value="cmd">Clear Mode: Dark</option>
</select>
<p class="med" style="margin-top: 3px; margin-bottom: 3px">
Notifications (select to delete)
</p>
<div id="notif">
<!-- <div class="notif2" id="defnotif">No notifications yet.</div> -->
</div>
<button
id="cccb"
class="b1"
style="margin-top: 7px; width: 60%"
onclick="wd.controls.toggle()"
>
Close
</button>
</div>
<div id="desktopNotificationsArea"></div>
<div id="background"></div>
<!-- <div class="splashscreen">
<div class="splashscreen-content">
<div class="splashscreen-logo">
<img src="./assets/img/systemIcons/os.svg" alt="NovaOS NG">
</div>
<div class="splashscreen-text">
<h1>NovaOS</h1>
<progress id="currentComponent"></progress>
<br>
<small id="currentComponentText"></small>
<p>Version 0.0.9</p>
<button onclick="document.querySelector('.splashscreen').remove()" class="b1">Skip (not reccomended)</button>
</div>
</div>
</div> -->
</body>
</html>
<script src="./assets/code/vals.js"></script>
<script src="./assets/lib/jq.js"></script>
<script src="./assets/lib/jszip.js"></script>
<script src="./assets/lib/peer.js"></script>
<script src="./assets/lib/picker.js"></script>
<script src="./assets/code/core.js"></script>
<script src="./assets/code/wm.js"></script>
<script src="./assets/code/services.js"></script>
<script src="./assets/code/ui.js"></script>
<script src="./assets/code/fs.js"></script>
<script src="./assets/code/apps.js"></script>
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker
.register("./serviceworker.js")
.then((registration) => {
console.log("ServiceWorker registered");
// boot();./
})
.catch((err) => console.error("ServiceWorker registration failed:", err));
}
window.addEventListener("load", function(){
document.body.style.display = "block";
window.removeEventListener("load")
})
async function boot() {
var uname = "No Username, somehow.";
var lsofuserinfo = await fs.ls("/user/info");
console.log(lsofuserinfo);
function hasNameFile(element, index, array) {
return element.name == "name";
}
// var unamexist = lsofuserinfo.items.some(hasNameFile);
if (lsofuserinfo.items !== undefined) {
console.log("yea");
const name = await fs.read("/user/info/name");
const deskid = await fs.read("/system/deskid");
const darkpref = await fs.read("/user/info/lightdarkpref");
const lightdark = await fs.read("/user/info/lightdark");
const color = await fs.read("/user/info/color");
if ((await fs.read("/system/useCustomDesktopFunc")) == "yes") {
await eval(
`${await fs.read(
"/system/customDesktopFunc"
)}("${name}", ${deskid}, "wait")`
);
} else {
await wd.desktop(name, deskid, "wait");
}
await ptp.go(deskid);
sys.setupd = true;
if (darkpref === "auto") {
sys.autodarkacc = true;
} else {
sys.autodarkacc = false;
}
if (lightdark === "dark") {
wd.dark();
} else if (lightdark === "clear") {
wd.clearm();
} else if (lightdark === "clear2") {
wd.clearm2();
} else {
wd.light();
}
ui.crtheme(color);
console.log(color);
if (!color) {
fs.write("/user/info/color", "#C68A00");
ui.crtheme("#C68A00");
}
} else {
console.log("narr");
const id = gen(4);
await ptp.go(id);
await fs.mkdir("/system", "opfs");
await fs.write("/system/deskid", id, "opfs");
app.setup.init();
sys.setupd = false;
}
const dropZone = document.body;
["dragenter", "dragover", "dragleave", "drop"].forEach((eventName) => {
dropZone.addEventListener(eventName, preventDefaults, false);
document.body.addEventListener(eventName, preventDefaults, false);
});
dropZone.addEventListener("drop", handleDrop, false);
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
function handleDrop(e) {
let dt = e.dataTransfer;
let files = dt.files;
handleFiles(files);
}
async function handleFiles(files) {
let filesArray = [...files];
filesArray.forEach((file) => {
const reader = new FileReader();
reader.onload = function (e) {
const contents = e.target.result;
fs.write(`/user/files/${file.name}`, contents);
};
if (file.type.startsWith("image")) {
reader.readAsDataURL(file);
} else {
reader.readAsArrayBuffer(file);
}
});
}
const data = await fs.read("/system/apps.json");
if (data) {
const apps = JSON.parse(data);
try {
const response = await fetch("https://appmarket.meower.xyz/refresh");
const onlineApps = await response.json();
for (const inapp of apps) {
await wd.loadapps(inapp, onlineApps, apps);
}
} catch (err) {
console.log(err);
try {
for (const inapp of apps) {
await wd.loadapps(inapp, inapp, inapp);
}
} catch (error) {
if (sys.fucker === false) {
sys.fucker = true;
fs.del("/system/apps.json");
fs.delfold("/system/apps");
wm.notif(
"App Issues",
"All apps were uninstalled due to corruption or an update. Your data is safe, you can reinstall them anytime.",
() => app.appmark.init(),
"App Market"
);
}
}
}
} else {
fs.write("/system/apps.json", "");
}
}
// if(localStorage.getItem("networking") == "false") {
// document.querySelector("#netw").classList.remove("on");
// } else {
// document.querySelector("#netw").classList.add("on")
// }
if (localStorage.getItem("doNotDisturb") == "falsbrthe") {
document.querySelector("#dnd").classList.remove("on");
} else {
document.querySelector("#dnd").classList.add("on");
}
$("#dm").on("change", function () {
if ($(this).val() == "dark") {
wd.dark();
fs.write("/user/info/lightdark", "dark");
} else if ($(this).val() == "light") {
wd.light();
fs.write("/user/info/lightdark", "light");
} else if ($(this).val() == "auto") {
fs.write("/user/info/lightdarkpref", "auto");
fs.read("/user/info/color").then((col) => ui.crtheme(col));
sys.autodarkacc = true;
} else if ($(this).val() == "cml") {
wd.clearm();
fs.write("/user/info/lightdark", "clear");
} else if ($(this).val() == "cmd") {
wd.clearm2();
fs.write("/user/info/lightdark", "clear2");
}
});
</script>