This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Virtru encrypt function. | |
async function encrypt(path, fileName) { | |
const encryptParams = new Virtru.EncryptParamsBuilder() | |
.withFileSource(path) | |
.withDisplayFilename(fileName) | |
.build(); | |
ct = await client.encrypt(encryptParams); | |
var ctString = await ct.toString(); | |
return ctString; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Watch the source folder for changes | |
async function watchFiles(auth) { | |
if (store.get('save_location') !== '') { | |
const watcher = chokidar.watch(store.get('save_location'), { | |
persistent: true, | |
ignoreInitial: true // ignores files that already exist in this folder | |
}); | |
watcher.on('add', async path => { | |
// code to execute when a new file is added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an icon in the tray. | |
const createTray = () => { | |
tray = new Tray('./images/virtru-mark-black.png'); | |
tray.on('click', function (event) { | |
toggleWindow() | |
}); | |
} | |
// Determine where the tray icon is located so the | |
// window can be positioned directly below it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createSettings() { | |
settingsPage = new BrowserWindow({ | |
parent: win, | |
width: 500, | |
height: 310, | |
webPreferences: { | |
nodeIntegration: true | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipcMain.on('disable-reshare-on', (event) => { | |
disableResharing = true; | |
console.log('Disable Resharing: ' + disableResharing); | |
}) | |
ipcMain.on('disable-reshare-off', (event) => { | |
disableResharing = false; | |
console.log('Disable Resharing: ' + disableResharing); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send Disable Reshare information to Main process when button toggled. | |
const disableReshareBtn = document.getElementById('disable-reshare-toggle'); | |
disableReshareBtn.addEventListener('click', (event) => { | |
console.log('clicked - disable reshare'); | |
if (disableReshareBtn.checked) { | |
ipcRenderer.send('disable-reshare-on'); | |
} else { | |
ipcRenderer.send('disable-reshare-off'); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function encrypt(filePath, fileName) { | |
const encryptParams = new Virtru.EncryptParamsBuilder() | |
.withFileSource(filePath) | |
.withDisplayFilename(fileName) | |
.build(); | |
ct = await client.encrypt(encryptParams); | |
await ct.toFile(`${filePath}.tdf3.html`); | |
} | |
ipcMain.on('open-file-dialog', async (event) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipcMain.on('open-file-dialog', async (event) => { | |
var paths = dialog.showOpenDialogSync(win, { | |
properties: ['openFile', 'multiSelections'] | |
}); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modules to control application life and create native browser window | |
const {app, BrowserWindow} = require('electron') | |
const path = require('path') | |
function createWindow () { | |
// Create the browser window. | |
const mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
webPreferences: { |
NewerOlder