Skip to content

Commit

Permalink
Major Bug Fix
Browse files Browse the repository at this point in the history
Latest Electron

Removed AMPPS. Maybe later.
Find now uses Regex
Added Developer Tools to Help Menu
Convert old remote calls to IPC
Fixed Load fake sendmail
Added style sheet to toggle platform specific content
Changed PHPMyAdmin style sheet reference
Fixed About & Instructions
Changed form display to grid for more flexible layout
Fixed vertical size of content
  • Loading branch information
manngo committed Aug 2, 2022
1 parent 9cd808c commit 1f890ca
Show file tree
Hide file tree
Showing 11 changed files with 2,605 additions and 1,362 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions compile.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# electron-packager . --overwrite --platform=win32 --arch=x64 --prune=true --extra-resource="resources/fakemail" --out="..\release-builds"

npm run dist
cd "../electron-builder/edit-virtual-hosts/";
mv "mac" "Edit Virtual Hosts macOS";
# cd "../electron-builder/edit-virtual-hosts/";
# mv "mac" "Edit Virtual Hosts macOS";
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

npm run dist
cd "../electron-builder/edit-virtual-hosts/";
mv "mac" "Edit Virtual Hosts macOS";
# mv "mac" "Edit Virtual Hosts macOS";
# mv "mac" "Edit Virtual Hosts macOS";


Expand Down
21 changes: 10 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
// require('./renderer.js');
require('./scripts/utilities.js');
require('./scripts/edit-virtual-hosts.js');
require('./scripts/do-virtual-hosts.js');
// require('./scripts/do-virtual-hosts.js');
// alert('hello')
}
</script>
</head>
Expand All @@ -33,7 +34,7 @@
<option value="">Server …</option>
<option value="xampp">XAMPP</option>
<option value="mamp">MAMP</option>
<option value="ampps">AMPPS</option>
<!--option value="ampps">AMPPS</option-->
</select>
</div>
</form>
Expand All @@ -58,10 +59,11 @@ <h3>Apache Configuration File (httpd.conf)</h3>
This gives:</p>
<pre># Virtual hosts
Include etc/extra/httpd-vhosts.conf</pre>

<p>(MacOS:) Find <a href="doit:find:User/Group"><code>User/Group</code></a> and change the User and Group to your own. Something like:</p>
<pre>User fred
<div class="macos">
<p>(MacOS:) Find <a href="doit:find:User/Group"><code>User/Group</code></a> and change the User and Group to your own. Something like:</p>
<pre>User fred
Group admin</pre>
</div>
</div>
<div class="textarea etc">
<textarea name="content">Open httpd.conf file or Select Platform</textarea>
Expand Down Expand Up @@ -98,14 +100,11 @@ <h3>PHP Configuration File (php.ini)</h3>
<p>Make sure that you have selected the server (XAMPP or MAMP) from the menu.</p>
<p>Find <a href="doit:find:sendmail_path"><code>sendmail_path</code></a> and remove the comment(<code>;</code>) at the beginning of the line(if any).<br>
Select the part after <code>sendmail_path=</code><br>
Locate your (fake) <a href="doit:locate:Sendmail Path:replace">sendmail</a> program and add the path at the end inside "quotes".<br>
This gives something like: <code>sendmail_path = "…/…/sendmail"</code></p>
<!--
<p>While you’re at it, check <a href="doit:find:extension=gd"><code>extension=gd</code></a> or
<a href="doit:find:extension=gd2"><code>extension=gd2</code></a>and remove the comment(<code>;</code>) at the beginning of the line(if any).<br>
Locate your (fake) <a href="doit:open:Sendmail Path:clipboard">sendmail</a> program and add the path at the end inside "quotes".<br>
This gives something like: <code>sendmail_path = "…/…/sendmail"</code>. Paste the resulting path.</p>
<p>While you’re at it, check <a href="doit:find:extension ?= ?.*gd"><code>extension=gd</code></a> and remove the comment(<code>;</code>) at the beginning of the line(if any).<br>
This will enable you to use image functions in PHP.
</p>
-->

</div>
<div class="textarea etc">
Expand Down
52 changes: 31 additions & 21 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,12 @@
if(DEVELOPMENT && process.platform == 'darwin') require('electron-reload')(__dirname);

// Required Modules
const {app, BrowserWindow, Menu, MenuItem, shell, ipcRenderer, protocol} = require('electron');

// const {app, BrowserWindow, Menu, MenuItem, shell, ipcRenderer, protocol} = require('electron');
const {app, BrowserWindow, Menu, MenuItem, shell, ipcRenderer, protocol, ipcMain, dialog} = require('electron');

// console.log(require.resolve('electron'))
const path = require('path');













// Global Variables
var window, menu;

Expand Down Expand Up @@ -69,8 +57,9 @@
{ label: 'Instructions …', id: 'INSTRUCTIONS', click: send },
{ type:'separator' },
{ label: 'Edit Virtual Hosts Home', icon: path.join(__dirname, 'images/external.png'), click: () => { shell.openExternal('https://github.com/manngo/edit-virtual-hosts'); } },
{ label: 'Internotes Virtual Hosts', icon: path.join(__dirname,'images/external.png'), click: () => { shell.openExternal('https://www.internotes.net/virtual-hosts'); }
},
{ label: 'Internotes Virtual Hosts', icon: path.join(__dirname,'images/external.png'), click: () => { shell.openExternal('https://www.internotes.net/virtual-hosts'); } },
{ id: 'debug-separator', type:'separator' },
{ id: 'debug-developer-tools', accelerator: 'CmdOrCtrl+Shift+I', label: 'Show Development Tools', click: function (menuItem, focusedWindow) { window.webContents.openDevTools({mode: 'detach'}); } },
]
}
];
Expand All @@ -92,15 +81,14 @@ if(DEVELOPMENT) menu=menu.concat(developmentMenu);
width: 1200,
height: 800,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
}
});


protocol.registerStringProtocol('doit',(request,callback)=>{
// console.log(request);
// console.log(callback);
var [dummy,action,data,more]=request.url.split(/:/);
var [dummy,action,data,more]=decodeURI(request.url).split(/:/);
window.webContents.send('DOIT',action,data,more);
},(error)=> {});

Expand Down Expand Up @@ -134,3 +122,25 @@ if(DEVELOPMENT) menu=menu.concat(developmentMenu);
app.on('activate', function () {
if (window === null) init();
});

ipcMain.on('open-path',(event,options,returnMessage)=>{
options.properties=['openDirectory'];
openDialog(event,options,returnMessage);
});
ipcMain.on('open-file',(event,options,returnMessage)=>{
openDialog(event,options,returnMessage);
});
function openDialog(event,options,returnMessage) {
dialog.showOpenDialog(null, options).then(result => {
event.sender.send(returnMessage, result);
});
}

ipcMain.on('home',(event,options)=>{
var home=`${app.getPath('home')}`;
event.returnValue = home;
});
ipcMain.on('app-path',(event,options)=>{
var home=`${app.getAppPath()}`;
event.returnValue = home;
});
Loading

0 comments on commit 1f890ca

Please sign in to comment.