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

fix ubuntu installation #546

Merged
merged 4 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
22 changes: 14 additions & 8 deletions lib/agent/plugins/control-panel/secure.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,20 @@ exports.open_config = function(device_key, cb) {
else if (os_name == 'mac')
return run_as_user('open', [link], cb);
// Open the logged user's default browser, the prey user doesn't have one

SoraKenji marked this conversation as resolved.
Show resolved Hide resolved
// For linux
system.spawn_as_logged_user('xdg-open', [link], {env: {DISPLAY: process.env.DISPLAY}}, (err, child) => {
setTimeout(() => {
child.kill();
}, 10000);
return cb() && cb(err);
cb();
system.get_logged_user((error, logged_user) => {
if(error) return;
exec(`sudo -u ${logged_user} ${common.root_path}/openwebbrowser.sh ${link} &`,
{
timeout: 200
}, (err, stderr, stdout) => {
if(err || stderr) return;
process.exit();
});
});
return;
});
}, 3000);
}
Expand All @@ -149,7 +155,7 @@ exports.reset_keys = function(cb) {
})
}

exports.decrypt_and_notify = function(encrypted_key, cb) {
exports.decrypt_and_notify = function(encrypted_key, cb) {
var decrypted_key;

try {
Expand All @@ -176,4 +182,4 @@ exports.decrypt_and_notify = function(encrypted_key, cb) {

exports.public_keys = function() { return public_keys; };
exports.notify_linked = notify_linked;
exports.notify_error = notify_error;
exports.notify_error = notify_error;
9 changes: 9 additions & 0 deletions openwebbrowser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

webbrowser=`xdg-settings get default-web-browser`
if [ "$webbrowser" == "firefox.desktop" ]; then
firefox -CreateProfile Prey
firefox -P Prey -url $1
else
xdg-open $1
fi