Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/modules/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const utils = require('../utils');
const {patchWindowsExecutable} = require('./exepatch');
const path = require('path');
const {inject} = require('postject');
const SENSITIVE_STORAGE_ITEMS = ['auth_info.json', 'tokens.json', '.env'];

async function createAsarFile() {
utils.log(`Generating ${constants.files.resourceFile}...`);
Expand Down Expand Up @@ -185,9 +186,19 @@ module.exports.bundleApp = async (options = {}) => {
}

if (options.copyStorage) {
utils.warn('Copying .storage directory. Please ensure that it does not contain any sensitive data.');
utils.log('Copying storage data...');
try {
fse.copySync('.storage', `${buildDir}/${binaryName}/.storage`);
fse.copySync('.storage', `${buildDir}/${binaryName}/.storage`, {
filter: (src) => {
const filename = path.basename(src);
if (SENSITIVE_STORAGE_ITEMS.includes(filename)) {
utils.warn(`Skipping sensitive file: ${filename}`);
return false;
}
return true;
}
});
}
catch (err) {
utils.error('Unable to copy storage data from the .storage directory. Please check if the directory exists');
Expand Down