-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser-tabs.js
33 lines (28 loc) · 953 Bytes
/
browser-tabs.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
function firefoxProfileTabs(){
var pwuid = require("pwuid");
var fs = require("fs");
var path = require("path");
var home = pwuid().dir;
// on apple
var profilePath;
var AppleProfilePath = "Library/Application Support/Firefox/Profiles";
if(fs.existsSync(path.join(home, AppleProfilePath))){
profilePath = path.join(home,AppleProfilePath);
}else {
console.log("Path does not exists: " + path.join(home, AppleProfilePath));
}
var profileTabs = {};
console.log(profilePath);
var profileList = fs.readdirSync(profilePath);
for(var i in profileList){
var profile = profileList[i];
var sessionStoreFile = path.join(profilePath,profile,"sessionstore.js");
profileTabs[profile] = JSON.parse(fs.readFileSync(sessionStoreFile).toString());
}
return profileTabs;
}
var chrome = require("./build/Release/chromeTabs");
module.exports = {
chrome: chrome.getOpenTabs,
firefox: firefoxProfileTabs
}