File tree Expand file tree Collapse file tree 4 files changed +20
-16
lines changed
email_mailbox/src/containers Expand file tree Collapse file tree 4 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 1818 "scripts" : {
1919 "electron" : " electron ." ,
2020 "start" : " npm run electron ." ,
21+ "start:dev" : " npm run electron . --allow-file-access-from-file" ,
2122 "postinstall" : " install-app-deps" ,
2223 "test" : " criptext-js-tools test" ,
2324 "integration" : " NODE_ENV=test criptext-js-tools integration" ,
Original file line number Diff line number Diff line change 11const ipc = require ( '@criptext/electron-better-ipc' ) ;
2- const { app, BrowserWindow } = require ( 'electron' ) ;
2+ const { app } = require ( 'electron' ) ;
33const unusedFilename = require ( 'unused-filename' ) ;
44const { download } = require ( 'electron-dl' ) ;
55const path = require ( 'path' ) ;
@@ -67,21 +67,13 @@ ipc.answerRenderer(
6767 metadataKey
6868 } ) ;
6969 const filePath = path . join ( directory , filename ) ;
70- if ( isInlineImage ) {
71- if ( checkIfExists ( filePath ) ) return filePath ;
72- } else {
70+ if ( ! isInlineImage ) {
7371 filename = path . basename ( unusedFilename . sync ( filePath ) ) ;
7472 }
75-
76- const downloadedItem = await download (
77- BrowserWindow . getFocusedWindow ( ) ,
78- url ,
79- {
80- directory,
81- filename,
82- openFolderWhenDone : ! isInlineImage
83- }
84- ) ;
73+ const downloadedItem = await download ( mailboxWindow . getWindow ( ) , url , {
74+ directory,
75+ filename
76+ } ) ;
8577 const newFilePath = downloadedItem . getSavePath ( ) ;
8678 return { filePath : newFilePath , filename } ;
8779 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -180,10 +180,14 @@ const isVisibleAndFocused = () => {
180180 return mailboxWindow . isVisible ( ) && mailboxWindow . isFocused ( ) ;
181181} ;
182182
183+ function getWindow ( ) {
184+ return mailboxWindow ;
185+ }
186+
183187module . exports = {
184188 close,
185189 hide,
186- mailboxWindow ,
190+ getWindow ,
187191 send,
188192 show,
189193 isVisibleAndFocused,
Original file line number Diff line number Diff line change 1+ /* eslint-env node, process */
12import { connect } from 'react-redux' ;
23import { makeGetFiles } from './../selectors/files' ;
34import EmailView from './../components/EmailWrapper' ;
@@ -116,6 +117,12 @@ const makeMapStateToProps = () => {
116117 return mapStateToProps ;
117118} ;
118119
120+ const defineInjectedSrc = imgPath => {
121+ return `src="${
122+ process . env . NODE_ENV === 'development' ? 'file://' : ''
123+ } ${ imgPath } "`;
124+ } ;
125+
119126const mapDispatchToProps = ( dispatch , ownProps ) => {
120127 const email = ownProps . email ;
121128 const isLast = ownProps . staticOpen ;
@@ -283,7 +290,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
283290 const imgPath = cidFilepathPairs [ cid ] ;
284291 return emailContentInjected . replace (
285292 `src="cid:${ cid } "` ,
286- `src=" ${ imgPath } "`
293+ defineInjectedSrc ( imgPath )
287294 ) ;
288295 } ,
289296 emailContent
You can’t perform that action at this time.
0 commit comments