Skip to content

Commit 07b5be3

Browse files
committed
merge 1
2 parents b50dc67 + 878ef8a commit 07b5be3

File tree

18 files changed

+328
-90
lines changed

18 files changed

+328
-90
lines changed

build/icons/512x512.png

21.1 KB
Loading

build/icons/icon.jpeg

6.91 KB
Loading

build/icons/icon.png

27.6 KB
Loading

build/icons/icon_smol.png

6.66 KB
Loading

config.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

config.json

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"app_info":
3+
{
4+
"author":
5+
{
6+
"name": "Leonardo Pollini",
7+
"email": "[email protected]"
8+
},
9+
"version": "0.0.23",
10+
"autoupdate": false,
11+
"electron_package": "package.json",
12+
"app_name": "Webpage Accessor",
13+
"app_executable": "webpage_accessor"
14+
},
15+
16+
"log":
17+
{
18+
"log_level": "WARNING",
19+
"log_file": "log.log",
20+
"actions":
21+
{
22+
"theese are just some examples": "I cannot use comments in json :(",
23+
"send_mail": {},
24+
"end_session": {}
25+
}
26+
},
27+
28+
"configuration":
29+
{
30+
"touchscreen_config":
31+
{
32+
"enabled": false,
33+
"remap_to_pointeraction": true,
34+
"disable_physical_keyboard": false,
35+
"disable_virtual_keyboard": false,
36+
"actions":
37+
{
38+
"enlarged_doubleclick":
39+
{
40+
"enabled": true,
41+
"doubleclick_sqr_radius": 1600,
42+
"doubleclick_max_delay": 500,
43+
"actions":
44+
{
45+
"lel": {"enabled": true, "extension": "touch-utils"}
46+
}
47+
},
48+
"keyboard_config":
49+
{
50+
"enabled": false,
51+
"whitelist": false,
52+
"blacklist": [],
53+
"extension": "keyboard-config"
54+
},
55+
"mouse_config": {},
56+
"splashscreen":
57+
{
58+
"enabled": false,
59+
"extension": "splashscreen",
60+
"splash_timeout": 5,
61+
"splash_url":
62+
{
63+
"pathname": "google.com",
64+
"protocol": "https"
65+
}
66+
}
67+
}
68+
},
69+
"other_actions":
70+
{
71+
"enabled": true,
72+
"actions":
73+
{
74+
"webpage_filter":
75+
{
76+
"enabled": true,
77+
"hosts_whitelist": [],
78+
"hosts_blacklist": [],
79+
"webpages_whitelist": [],
80+
"webpages_blacklist": [],
81+
"allow_navigation": true,
82+
"extension": "webpage-filter"
83+
},
84+
"toolbar":
85+
{
86+
"enabled": true,
87+
"hidden": false,
88+
"toolbar_width": 50,
89+
"toolbar_html": "toolbar.html",
90+
"extension": "toolbar",
91+
"allow_target_blank": true,
92+
"default_url":
93+
{
94+
"pathname": "pms.parchotels.dev",
95+
"protocol": "https"
96+
}
97+
},
98+
"electron-api":
99+
{
100+
"enabled": true,
101+
"extension": "electronAPI"
102+
},
103+
"window-utils":
104+
{
105+
"enable_shortcuts": true,
106+
"hide_toolbar": true,
107+
"start_with_dev_tools": true,
108+
"extension": "window-events"
109+
},
110+
"startup_actions": {},
111+
"keys-checker":
112+
{
113+
"enabled": true,
114+
"extension": "keys-checker",
115+
"custom_id": false,
116+
"structure_id": [1,2,3,4]
117+
},
118+
"autostart":
119+
{
120+
"desktop_filename": "webpage_accessor.desktop",
121+
"extension": "autostart"
122+
},
123+
"autoupdate":
124+
{
125+
"enabled": true,
126+
"extension": "autoupdate",
127+
"auto_download": false,
128+
"ask_update_on_start": false,
129+
"update_mode":
130+
{
131+
"mode": "long_press",
132+
"duration": 5
133+
}
134+
}
135+
}
136+
}
137+
},
138+
139+
"default_data":
140+
{
141+
"fullscreen": false,
142+
"autostart": false,
143+
"autorestart": false,
144+
"autoreload": false,
145+
"allow_navigation": true,
146+
"webpages":
147+
[
148+
]
149+
}
150+
}

extensions/electronAPI/main.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ class ElectronAPI extends require('../../lib/BaseModule')
1010
// constructor(window, tab) { super(window, tab); }
1111

1212
// Setup code here. This function is called in BaseModule's constructor.
13-
setup()
14-
{
15-
ipcMain.handle('select-file', async () => await this.selectFile());
16-
ipcMain.handle('read-file', async (event, path) => await this.readFile(path));
17-
// ipcMain.handle('get-key', async () => await this.getLocalKey()); --> moved in keys-checker.js
18-
}
13+
// setup()
14+
// {
15+
// ipcMain.handle('select-file', async () => await this.selectFile());
16+
// ipcMain.handle('read-file', async (event, path) => await this.readFile(path));
17+
// // ipcMain.handle('get-key', async () => await this.getLocalKey()); --> moved in keys-checker.js
18+
// }
1919

20-
async readFile(path)
21-
{
22-
console.log("reading file");
23-
try {
24-
return fs.readFileSync(path, 'utf-8');
25-
} catch (err) {
26-
console.error(err);
27-
return null;
28-
}
29-
}
20+
// async readFile(path)
21+
// {
22+
// console.log("reading file");
23+
// try {
24+
// return fs.readFileSync(path, 'utf-8');
25+
// } catch (err) {
26+
// console.error(err);
27+
// return null;
28+
// }
29+
// }
3030

3131
}
3232

extensions/keys-checker/main.js

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,74 @@
11
const { ipcMain, remote, dialog } = require('electron');
22
const { machineIdSync } = require("node-machine-id");
33
const ipcChannel = require('../../lib/icpChannel');
4+
const os = require('os');
45

56
// Sample Module. Plase copy-paste this file into new module's main folder
67
class LocalKeysCheck extends require('../../lib/BaseModule')
78
{
8-
MODULE_NAME = "keys-checker";
9-
machine_id = null;
10-
real_machine_id;
11-
12-
13-
setup()
14-
{
15-
ipcChannel.newMainHandler('get-key', async () => await this.getLocalKey());
16-
17-
const id = machineIdSync();
18-
this.real_machine_id = machineIdSync(false);
19-
20-
this.machine_id = this.__conf.custom_id || id;
21-
22-
this.log('Loaded local id:', this.machine_id);
23-
24-
this.askStructureId();
25-
}
26-
27-
async getLocalKey()
9+
MODULE_NAME = "keys-checker";
10+
machine_id = null;
11+
real_machine_id;
12+
13+
14+
setup()
15+
{
16+
ipcChannel.newMainHandler('get-info', async () => await this.getInfo());
17+
18+
const id = machineIdSync();
19+
this.real_machine_id = machineIdSync(false);
20+
21+
this.machine_id = this.__conf.custom_id || id;
22+
23+
this.log('Loaded local id:', this.machine_id);
24+
25+
this.warn('ip addressen:', this.getIpAddr());
26+
27+
this.askStructureId();
28+
}
29+
30+
async getInfo()
2831
{
29-
this.log(this.tab.webContents.getURL(), 'is trying to access local keys info');
30-
return {machine_id: this.machine_id, structure_id: this.__conf.structure_id};
32+
this.log(this.tab.webContents.getURL(), 'is trying to access local keys info');
33+
return {machine_id: this.machine_id, structure_id: this.__conf.structure_id, ip_address: this.getIpAddr()};
3134
}
3235

33-
askStructureId()
34-
{
35-
if (!this.__conf.structure_id)
36-
dialog.showMessageBox(this.window, {
37-
type: 'info',
38-
title: 'Set structure id',
39-
message: `Please set the app's structure id in ${this.getAppDataDir() + this.MODULE_NAME + '.json'}`,
40-
buttons: ['Ok']
41-
})
42-
}
36+
getIpAddr()
37+
{
38+
const ifaces = os.networkInterfaces();
39+
let ipAdresse = {};
40+
Object.keys(ifaces).forEach(function (ifname) {
41+
let alias = 0;
42+
ifaces[ifname].forEach(function (iface) {
43+
if ('IPv4' !== iface.family || iface.internal !== false) {
44+
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
45+
return;
46+
}
47+
48+
if (alias < 1) {
49+
// this interface has only one ipv4 adress
50+
// console.log(ifname, iface.address);
51+
ipAdresse = iface.address;
52+
} else {
53+
// console.log(ifname + ':' + alias, iface.address);
54+
// this single interface has multiple ipv4 addresses
55+
}
56+
++alias;
57+
});
58+
});
59+
return ipAdresse;
60+
}
61+
62+
askStructureId()
63+
{
64+
if (!this.__conf.structure_id)
65+
dialog.showMessageBox(this.window, {
66+
type: 'info',
67+
title: 'Set structure id',
68+
message: `Please set the app's structure id in ${this.getAppDataDir() + this.MODULE_NAME + '.json'}`,
69+
buttons: ['Ok']
70+
})
71+
}
4372
}
4473

4574
module.exports = LocalKeysCheck;

extensions/keys-checker/preload.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
const { contextBridge, ipcRenderer } = require('electron');
22
const ipcChannel = require('../../lib/icpChannel.js');
3+
const BasePreload = require('../../lib/BasePreload.js');
34

4-
class TouchUtils_preload extends require('../../lib/BasePreload.js')
5+
class TouchUtils_preload extends BasePreload
56
{
67
MODULE_NAME = "keys-checker";
8+
79
contextbridge_expose = {
810
'electronAPI': {
9-
getLocalKey: () => ipcRenderer.invoke('get-key')
11+
getExtraInfo: () => ipcRenderer.invoke('get-info')
1012
}
1113
};
1214

13-
getKeyPlease()
14-
{
15-
ipcChannel.sendSignalToMain('get-key').then(keys => {return keys.machine_id});
16-
}
17-
1815
setup() {}
1916
}
2017

extensions/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Loader2
2121
// 'data' shoud be app.data
2222
static load(data) {
2323
this.mainWindow = TabsManager.mainWindow;
24-
this.mainTab = TabsManager.activeTab.tab;
24+
this.mainTab = TabsManager.getActiveTab();
2525
this.data = data;
2626

2727
// load modules -> no setup

0 commit comments

Comments
 (0)