Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ package-lock.json
/src/key*
.DS_Store
/dist
/appbuild
.vs
/tmp_node_modules
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
}
133 changes: 70 additions & 63 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,74 @@
{
"env": {
"includePath": [
"${default}",
"${workspaceFolder}/node_modules/node-addon-api",
"${env:HOME}/AppData/Local/node-gyp/Cache/16.0.1/include/node"
],
"defines": []
},
"configurations": [
{
"name": "Win32",
"defines": ["${defines}", "_DEBUG", "UNICODE", "_UNICODE", "_CRT_SECURE_NO_WARNINGS"],
"compilerPath": "${env:VCToolsInstallDir}\\bin\\Host${env:VSCMD_ARG_HOST_ARCH}\\${env:VSCMD_ARG_TGT_ARCH}\\cl.exe",
"windowsSdkVersion": "10.0.19041.0",
"intelliSenseMode": "windows-msvc-x64",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
},
{
"name": "Linux",
"defines": ["${defines}"],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": [
"${workspaceFolder}"
"env": {
"includePath": [
"${default}",
"${workspaceFolder}/node_modules/node-addon-api",
"${env:HOME}/AppData/Local/node-gyp/Cache/16.0.1/include/node"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"includePath": ["${includePath}"]
},
{
"name": "macOS",
"includePath": ["${includePath}"],
"defines": ["${defines}"],
"macFrameworkPath": ["/System/Library/Frameworks", "/Library/Frameworks"],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64"
"defines": []
},
{
"name": "Emscripten",
"defines": ["${defines}"],
"compilerPath": "${env:EMSDK}/upstream/emscripten/emcc",
"intelliSenseMode": "clang-x86",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
},
{
"name": "Emscripten (Win32)",
"defines": ["${defines}"],
"compilerPath": "${env:EMSDK}/upstream/emscripten/emcc.bat",
"intelliSenseMode": "clang-x86",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
}
],
"version": 4
"configurations": [
{
"name": "Win32",
"defines": [
"${defines}",
"_DEBUG",
"UNICODE",
"_UNICODE",
"_CRT_SECURE_NO_WARNINGS"
],
"compilerPath": "${env:VCToolsInstallDir}\\bin\\Host${env:VSCMD_ARG_HOST_ARCH}\\${env:VSCMD_ARG_TGT_ARCH}\\cl.exe",
"windowsSdkVersion": "10.0.19041.0",
"intelliSenseMode": "windows-msvc-x64",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
},
{
"name": "Linux",
"defines": ["${defines}"],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": ["${workspaceFolder}"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"includePath": ["${includePath}"]
},
{
"name": "macOS",
"includePath": ["${includePath}"],
"defines": ["${defines}"],
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64"
},
{
"name": "Emscripten",
"defines": ["${defines}"],
"compilerPath": "${env:EMSDK}/upstream/emscripten/emcc",
"intelliSenseMode": "clang-x86",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
},
{
"name": "Emscripten (Win32)",
"defines": ["${defines}"],
"compilerPath": "${env:EMSDK}/upstream/emscripten/emcc.bat",
"intelliSenseMode": "clang-x86",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${includePath}"]
}
],
"version": 4
}
40 changes: 20 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Debug",
"console": "integratedTerminal",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}\\node_modules\\.bin\\electron.cmd"
},
"program": "${workspaceFolder}/app/index.js"
},
{
"name": "Windows Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Debug",
"console": "integratedTerminal",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}\\node_modules\\.bin\\electron.cmd"
},
"program": "${workspaceFolder}/appbuild/index.js"
},
{
"name": "Windows Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

63 changes: 39 additions & 24 deletions app/asar.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
const path = require('path')
const Module = require('module')
const path = require("path");
const Module = require("module");

const originalResolveLookupPaths = Module._resolveLookupPaths
const originalResolveLookupPaths = Module._resolveLookupPaths;

Module._resolveLookupPaths = originalResolveLookupPaths.length === 2 ? function (request, parent) {
const result = originalResolveLookupPaths.call(this, request, parent)
Module._resolveLookupPaths =
originalResolveLookupPaths.length === 2
? function (request, parent) {
const result = originalResolveLookupPaths.call(
this,
request,
parent
);

if (!result) return result
if (!result) {
return result;
}

for (let i = 0; i < result.length; i++) {
if (path.basename(result[i]) === 'node_modules') {
result.splice(i + 1, 0, result[i] + '.asar')
i++
}
}
for (let i = 0; i < result.length; i++) {
if (path.basename(result[i]) === "node_modules") {
result.splice(i + 1, 0, `${result[i]}.asar`);
i++;
}
}

return result
} : function (request, parent, newReturn) {
const result = originalResolveLookupPaths.call(this, request, parent, newReturn)
return result;
}
: function (request, parent, newReturn) {
const result = originalResolveLookupPaths.call(
this,
request,
parent,
newReturn
);

const paths = newReturn ? result : result[1]
for (let i = 0; i < paths.length; i++) {
if (path.basename(paths[i]) === 'node_modules') {
paths.splice(i + 1, 0, paths[i] + '.asar')
i++
}
}
const paths = newReturn ? result : result[1];

return result
}
for (let i = 0; i < paths.length; i++) {
if (path.basename(paths[i]) === "node_modules") {
paths.splice(i + 1, 0, `${paths[i]}.asar`);
i++;
}
}

return result;
};
21 changes: 12 additions & 9 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>electron-asar-encrypt-demo</title>
</head>
<body>
</body>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>App</title>
<meta
name="viewport"
content="width=device-width, height=device-height, initial-scale=1"
/>
</head>
<body>
<h1>Edit app/renderer/index.html to change this screen</h1>
</body>
</html>
Loading