Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native electron support #371

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b1233b4
Files for electron platform
zorn-v Jan 19, 2020
959d382
Electron paths
zorn-v Jan 19, 2020
0f9183e
Remove chrome check for electron
zorn-v Jan 19, 2020
540cfaa
Fix electron paths
zorn-v Jan 19, 2020
75423fa
Try to load electron via require
zorn-v Jan 19, 2020
5777476
Fix lint errors
zorn-v Jan 19, 2020
c32ab7b
Try to req electron app
zorn-v Jan 19, 2020
99bdb0e
Electron data in package.json
zorn-v Jan 22, 2020
bb2849a
console.error if node integration is disabled
zorn-v Jan 22, 2020
11ff744
Set node integration after plugin install
zorn-v Jan 22, 2020
0d6513c
Fix lint error
zorn-v Jan 22, 2020
9f3cffa
Resolve correct system paths
zorn-v Jan 22, 2020
50a2de6
resolveLocalFileSystemURI draft
zorn-v Jan 23, 2020
a2f822b
resolveLocalFileSystemURI
zorn-v Jan 23, 2020
fabf8b8
getDirectory
zorn-v Jan 23, 2020
efd2b0e
getFile
zorn-v Jan 23, 2020
e33f721
getFileMetadata + getMetadata
zorn-v Jan 23, 2020
b4b22da
getFileMetadata fix
zorn-v Jan 23, 2020
665fa87
write
zorn-v Jan 23, 2020
db2d4ff
[write] fs.close in finally
zorn-v Jan 23, 2020
ce16718
Use nodeRequire const
zorn-v Jan 23, 2020
52dbfc4
readEntries
zorn-v Jan 23, 2020
4393d95
setMetadata
zorn-v Jan 23, 2020
dfd2ed2
getParent
zorn-v Jan 23, 2020
c201254
copyTo
zorn-v Jan 23, 2020
6ab97c1
remove
zorn-v Jan 23, 2020
a7a7b89
removeRecursively draft
zorn-v Jan 23, 2020
5c6f44a
buggy removeRecursively
zorn-v Jan 23, 2020
ff39957
Use rimraf module for removeRecursively
zorn-v Jan 23, 2020
4000756
Add trailing slash to pathsPrefix
zorn-v Jan 24, 2020
0fb00c4
readAs
zorn-v Jan 24, 2020
92f45a6
Cleanup
zorn-v Jan 24, 2020
2562aa9
var -> const
zorn-v Jan 24, 2020
fc1528c
Fix lint errors
zorn-v Jan 24, 2020
c6c4f5b
Fix lint
zorn-v Jan 24, 2020
2d61ff9
Do not use nodejs *Sync functions
zorn-v Jan 27, 2020
7a8cb25
Fix typos
zorn-v Jan 28, 2020
29056e3
Remove trailing separators in pathsPrefix
zorn-v Jan 28, 2020
1ea98b7
Revert "Remove trailing separators in pathsPrefix"
zorn-v Jan 28, 2020
fac4d31
Fix resolveLocalFileSystemURI for cdvfile://
zorn-v Jan 28, 2020
96e84aa
Fix electron setMetadata
zorn-v Mar 26, 2020
9d1c148
Fix close fd in electron readAs
zorn-v Mar 26, 2020
a2ba6b4
truncate support
zorn-v May 21, 2020
6e0540e
Fix lint error
zorn-v May 21, 2020
b2667d9
Fix electron app path
zorn-v Oct 15, 2020
655b0c1
Merge branch 'master' of https://github.com/apache/cordova-plugin-fil…
zorn-v Oct 17, 2020
460f8d0
enableRemoteModule = true on plugin install
zorn-v Dec 21, 2020
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"platforms": [
"android",
"browser",
"electron",
"ios",
"osx",
"windows"
Expand All @@ -21,6 +22,7 @@
"ecosystem:cordova",
"cordova-android",
"cordova-browser",
"cordova-electron",
"cordova-ios",
"cordova-osx",
"cordova-windows"
Expand Down
17 changes: 17 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ to config.xml in order for the application to find previously stored files.
</js-module>
</platform>

<!-- browser -->
<platform name="browser">
<!-- File for Chrome -->
<js-module src="www/browser/Preparing.js" name="Preparing">
Expand All @@ -259,4 +260,20 @@ to config.xml in order for the application to find previously stored files.
</js-module>
</platform>

<!-- electron -->
<platform name="electron">
<hook type="after_plugin_install" src="scripts/electron/addNodeIntegration.js" />

<js-module src="src/electron/FileProxy.js" name="FileProxy">
<runs />
</js-module>

<js-module src="src/electron/rimraf.js" name="rimraf" />

<js-module src="www/fileSystemPaths.js" name="fileSystemPaths">
<merges target="cordova" />
<runs />
</js-module>
</platform>

</plugin>
11 changes: 11 additions & 0 deletions scripts/electron/addNodeIntegration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const fs = require('fs');

module.exports = ctx => {
const cfgPath = ctx.opts.projectRoot + '/platforms/electron/platform_www/cdv-electron-settings.json';
const cfg = require(cfgPath);
cfg.browserWindow = cfg.browserWindow || {};
cfg.browserWindow.webPreferences = cfg.browserWindow.webPreferences || {};
cfg.browserWindow.webPreferences.nodeIntegration = true;
cfg.browserWindow.webPreferences.enableRemoteModule = true;
fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 4), 'utf8');
}
Loading