| Hash | Commit message | Author | Date | Files | + | - |
1 | commit fa69a6aef712b81f65bd8be4f0cc146cb3c27068 |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Fri Mar 17 21:59:55 2023 +0200 |
4 | |
5 | Auto-Commit Update 17.03.2023 - 21:59:55 |
6 | --- |
7 | Makefile | 15 ++++++++++++++- |
8 | web2desk/usr/bin/web2desk | 37 ++++++++++++++++--------------------- |
9 | 2 files changed, 30 insertions(+), 22 deletions(-) |
10 | |
11 | diff --git a/Makefile b/Makefile |
12 | index 9e6baf5..a4131cd 100644 |
13 | --- a/Makefile |
14 | +++ b/Makefile |
15 | @@ -23,12 +23,25 @@ endif |
16 | |
17 | all: info web2desk |
18 | |
19 | + |
20 | web2desk: |
21 | @echo -e "\n\e[1;33m[+]\e[0m Installing ${PKG}...\n" |
22 | - @cp -rvf ${PKG} ${DESTDIR}/ || true |
23 | + @cp -rvf ${PKG}/usr ${PKGDIR}/ || true |
24 | + @[ ! -d ${PKGDIR}/usr/share/${PKG} ] && echo -e "\n\e[1;31m[-]\e[0m Please ensure you have sufficient premission to install ${PKG}." || true |
25 | + |
26 | +clean: |
27 | + @echo -e "\n\e[1;33m[+]\e[0m Cleaning up...\n" |
28 | + @rm -fv ${PKGDIR}/usr/bin/${PKG} || true |
29 | + @rm -rfv ${PKGDIR}/usr/share/${PKG} || true |
30 | + @rm -rfv ${PKGDIR}/usr/share/licenses/${PKG} || true |
31 | + @rm -rfv ${PKGDIR}/usr/share/doc/${PKG} || true |
32 | + @[ -d ${PKGDIR}/usr/share/${PKG} ] && echo -e "\n\e[1;31m[-]\e[0m Please ensure you have sufficient premission to install ${PKG}." || true |
33 | + |
34 | |
35 | install: all |
36 | |
37 | +uninstall: clean |
38 | + |
39 | info: |
40 | @echo -e "\n\e[1;33m[*]\e[0m ${INFO}" |
41 | |
42 | diff --git a/web2desk/usr/bin/web2desk b/web2desk/usr/bin/web2desk |
43 | index 731db9b..06d359b 100755 |
44 | --- a/web2desk/usr/bin/web2desk |
45 | +++ b/web2desk/usr/bin/web2desk |
46 | @@ -44,7 +44,7 @@ let exists = false; |
47 | const baseDir = path.join(homeDir, '.local/share/WebApps/baseDir'); |
48 | const webAppsDir = path.join(homeDir, '.local/share/WebApps'); |
49 | const appDir = path.join(webAppsDir, response.name); |
50 | - const binDir = path.join(webAppsDir, 'bin'); |
51 | + const binDir = '/usr/local/bin'; |
52 | const appBin = path.join(binDir, response.name); |
53 | const configFile = path.join(appDir, 'config.json'); |
54 | const pJson = path.join(appDir, 'package.json'); |
55 | @@ -78,6 +78,7 @@ const mkMainWin = () => { |
56 | width: 800, |
57 | height: 600 |
58 | }) |
59 | + |
60 | session.defaultSession.on('will-download', (event, item, webContents) => { |
61 | event.preventDefault() |
62 | require('got')(item.getURL()).then((response) => { |
63 | @@ -85,21 +86,9 @@ const mkMainWin = () => { |
64 | }) |
65 | }) |
66 | mWin.loadURL(url); |
67 | - return mWin; |
68 | } |
69 | |
70 | |
71 | -if (fs.existsSync(cookiesFile)) { |
72 | - const cookies = JSON.parse(fs.readFileSync(cookiesFile, 'utf8')); |
73 | - session.defaultSession.cookies.set(cookies, (error) => { |
74 | - if (error) { |
75 | - console.error(error); |
76 | - } |
77 | - }); |
78 | -} else { |
79 | - console.log('No cookies file found'); |
80 | -} |
81 | - |
82 | const menu = [ |
83 | { |
84 | label: name, |
85 | @@ -109,28 +98,35 @@ const menu = [ |
86 | accelerator: 'CmdOrCtrl+R', |
87 | click: () => { |
88 | BrowserWindow.getFocusedWindow().reload() |
89 | - } |
90 | - }, |
91 | + } |
92 | + }, |
93 | { |
94 | label: 'Clear Cache', |
95 | accelerator: 'CmdOrCtrl+Shift+R', |
96 | click: () => { |
97 | BrowserWindow.getFocusedWindow().webContents.session.clearCache(() => {}) |
98 | - } |
99 | - }, |
100 | + } |
101 | + }, |
102 | { |
103 | label: 'Clear Cookies', |
104 | accelerator: 'CmdOrCtrl+Shift+C', |
105 | click: () => { |
106 | BrowserWindow.getFocusedWindow().webContents.session.clearStorageData(() => {}) |
107 | - } |
108 | - }, |
109 | + } |
110 | + }, |
111 | + { |
112 | + label: 'Quit', |
113 | + accelerator: 'CmdOrCtrl+Q', |
114 | + click: () => { |
115 | + app.quit() |
116 | + } |
117 | + } |
118 | ] |
119 | } |
120 | ] |
121 | |
122 | app.on('ready', () => { |
123 | - mkMainWin(). |
124 | + mkMainWin() |
125 | Menu.setApplicationMenu(Menu.buildFromTemplate(menu)) |
126 | }) |
127 | |
128 | @@ -180,7 +176,6 @@ app.on('before-quit', () => { |
129 | await fs.chmodSync(appBin, '755'); |
130 | await fs.writeFileSync(pJson, JSON.stringify(packageJson, null, 2)); |
131 | await fs.writeFileSync(path.join(appDir, 'main.js'), MAIN); |
132 | - await sh(`install -Dm644 ${appBin} /usr/local/bin/$(basename ${appBin})`); |
133 | console.log('Desktop App Created!'); |
134 | } else { |
135 | console.log('App already exists'); |