Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
78adf928
Commit
78adf928
authored
Dec 05, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复提权
parent
bcc14508
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
32 deletions
+28
-32
index.js
index.js
+28
-32
No files found.
index.js
View file @
78adf928
'
use strict
'
;
'
use strict
'
;
// 处理提权
function
handleElevate
()
{
// for debug
if
(
process
.
argv
[
1
]
==
'
.
'
)
{
process
.
argv
[
1
]
=
process
.
argv
[
2
];
process
.
argv
[
2
]
=
process
.
argv
[
3
];
}
if
(
process
.
argv
[
1
]
==
'
-e
'
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
app
.
dock
.
hide
();
}
let
elevate
=
JSON
.
parse
(
new
Buffer
(
process
.
argv
[
2
],
'
base64
'
).
toString
());
require
(
'
net
'
).
connect
(
elevate
[
'
ipc
'
],
function
()
{
process
.
send
=
(
message
,
sendHandle
,
options
,
callback
)
=>
this
.
write
(
JSON
.
stringify
(
message
)
+
require
(
'
os
'
).
EOL
,
callback
);
this
.
on
(
'
end
'
,
()
=>
process
.
emit
(
'
disconnect
'
));
require
(
'
readline
'
).
createInterface
({
input
:
this
}).
on
(
'
line
'
,
(
line
)
=>
process
.
emit
(
'
message
'
,
JSON
.
parse
(
line
)));
process
.
argv
=
elevate
[
'
arguments
'
][
1
];
require
(
"
./
"
+
elevate
[
'
arguments
'
][
0
]);
});
return
true
;
}
}
if
(
handleElevate
())
{
return
;
}
const
{
ipcMain
,
app
,
shell
,
BrowserWindow
}
=
require
(
'
electron
'
);
const
{
ipcMain
,
app
,
shell
,
BrowserWindow
}
=
require
(
'
electron
'
);
const
{
autoUpdater
}
=
require
(
"
electron-auto-updater
"
);
const
{
autoUpdater
}
=
require
(
"
electron-auto-updater
"
);
const
isDev
=
require
(
'
electron-is-dev
'
);
const
isDev
=
require
(
'
electron-is-dev
'
);
...
@@ -19,7 +46,7 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
...
@@ -19,7 +46,7 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
}
}
mainWindow
.
focus
()
mainWindow
.
focus
()
}
}
})
})
;
if
(
shouldQuit
)
{
if
(
shouldQuit
)
{
app
.
quit
()
app
.
quit
()
}
}
...
@@ -70,37 +97,6 @@ autoUpdater.on('update-downloaded', (event) => {
...
@@ -70,37 +97,6 @@ autoUpdater.on('update-downloaded', (event) => {
})
})
});
});
// 处理提权
function
handleElevate
()
{
// for debug
if
(
process
.
argv
[
1
]
==
'
.
'
)
{
process
.
argv
[
1
]
=
process
.
argv
[
2
];
process
.
argv
[
2
]
=
process
.
argv
[
3
];
}
if
(
process
.
argv
[
1
]
==
'
-e
'
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
app
.
dock
.
hide
();
}
let
elevate
=
JSON
.
parse
(
new
Buffer
(
process
.
argv
[
2
],
'
base64
'
));
let
socket
=
require
(
'
net
'
).
connect
(
elevate
[
'
ipc
'
],
function
()
{
process
.
send
=
(
message
,
sendHandle
,
options
,
callback
)
=>
this
.
write
(
JSON
.
stringify
(
message
)
+
require
(
'
os
'
).
EOL
,
callback
);
this
.
on
(
'
end
'
,
()
=>
process
.
emit
(
'
disconnect
'
));
require
(
'
readline
'
).
createInterface
({
input
:
this
}).
on
(
'
line
'
,
(
line
)
=>
process
.
emit
(
'
message
'
,
JSON
.
parse
(
line
)));
process
.
argv
=
elevate
[
'
arguments
'
][
1
];
require
(
"
./
"
+
elevate
[
'
arguments
'
][
0
]);
});
// socket.on("error", (error)=> {
// console.log(error);
// });
return
true
;
}
}
if
(
handleElevate
())
{
return
;
}
// Aria2c
// Aria2c
function
createAria2c
()
{
function
createAria2c
()
{
let
aria2c_path
;
let
aria2c_path
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment