forked from Webdeskme/wdOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.js
54 lines (53 loc) · 2.29 KB
/
browser.js
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
$(document).ready(function(){
/*$("button").click(function(){
console.log("test");
/*request.post(
'http://192.168.2.13:4002/login',
{ form: { user:'Donal Duck',pwd:'12345' } },
function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
alert(body);
}
}
);*/
/*$.get("192.168.2.13:4002/get?id=adam&token=12345&geo=us", function(data, status){
console.log("Data: " + data + "\nStatus: " + status);
});*/
/*$.post("http://192.168.2.13:4002/login",
{
user: "Donald Duck",
pwd: "Duckburg"
},
function(data, status){
console.log("Data: " + data + "\nStatus: " + status);
});
});*/
const remote = require('electron').remote;
const {ipcRenderer} = require('electron');
var fs = require('fs');
const {shell} = require('electron');
const wd_homedir = require('os').homedir();
var wd_home = wd_homedir + '/Documents/wdOS/App/';
//$("#app").append('<h1>Bill</h1>');
console.log("Starting OS GUI");
$("#app").html('');
var f = fs.readFileSync(wd_homedir + '/Documents/wdOS/Core/pin.json');
var p = JSON.parse(f);
files = fs.readdirSync(wd_home);
for (i = 0; i < files.length; i++) {
console.log(files[i]);
if (fs.existsSync(wd_home + files[i] + '/index.html')) {
var file = fs.readFileSync(wd_home + files[i] + '/wd.json');
var obj = JSON.parse(file);
var aname = obj.name.substr(0, 9);
if(obj.ser != "on"){
$("#app").append('<div class="col-sm-1 wd_apps" data-toggle="tooltip" title="' + obj.des + '"><a href="' + wd_home + files[i] + '/index.html"><img class="card-img-bottom" src="' + wd_home + files[i] + '/ic.png" alt="' + obj.name + '" style="width:100%"></a><figcaption><a href="' + wd_home + files[i] + '/index.html" class="text-light">' + aname + '</a></figcaption></div>');
}
else{
//alert(p[files[i]]);
$("#app").append('<div class="col-sm-1 wd_apps" data-toggle="tooltip" title="' + obj.des + '"><a href="http://127.0.0.1:' + p[files[i]] + '/index.html"><img class="card-img-bottom" src="' + wd_home + files[i] + '/ic.png" alt="' + obj.name + '" style="width:100%"></a><figcaption><a href="http://127.0.0.1:' + p[files[i]] + '/index.html" class="text-light">' + aname + '</a></figcaption></div>');
}
}
}
});