Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #355 from subspace/restrict-shell
Browse files Browse the repository at this point in the history
restrict osascript for frontend
  • Loading branch information
ozgunozerk authored Oct 4, 2022
2 parents 7020e6f + 2bd02ff commit 704f5fc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"trailingComma": "none",
"tabWidth": 2,
"semi": false,
"semi": true,
"attributeSeparator": "none",
"singleQuote": true
}
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
{
"name": "run-osascript",
"cmd": "osascript",
"args": true
"args": ["-e", { "validator": "tell application \"System Events\" to (get the name of every login item|delete login item \\S+|make login item at end with properties \\{path:\\S+, hidden:\\S+, name:\\S+\\})" }]
}
]
},
Expand Down
24 changes: 7 additions & 17 deletions src/components/mainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,14 @@ export default defineComponent({
data() {
return {
util,
launchOnStart: false,
disableAutoLaunch: false
launchOnStart: false
};
},
mounted() {
this.initMenu();
},
methods: {
async toggleClicked() {
if (this.disableAutoLaunch) {
Notify.create({
message: this.$t('menu.autoLaunchNotSupported'),
icon: 'info'
});
return;
}
console.log('toggle Clicked', this.launchOnStart);
if (this.launchOnStart) {
Notify.create({
Expand Down Expand Up @@ -115,7 +107,11 @@ export default defineComponent({
cancel: true
}).onOk(async () => {
try {
await util.resetAndClear({ plotDir, localStorage, config: this.$config });
await util.resetAndClear({
plotDir,
localStorage,
config: this.$config
});
await new Promise((resolve) => setTimeout(resolve, 1000));
await process.relaunch();
} catch (error) {
Expand All @@ -135,12 +131,7 @@ export default defineComponent({
}
},
async initMenu() {
if (await this.$autoLauncher.isEnabled()) {
this.launchOnStart = true;
} else {
this.launchOnStart = false;
this.disableAutoLaunch = true;
}
this.launchOnStart = await this.$autoLauncher.isEnabled();
},
async installNewUpdate() {
await event.emit('tauri://update');
Expand All @@ -150,5 +141,4 @@ export default defineComponent({
</script>

<style lang="scss">
</style>
1 change: 0 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"reset": "Reset Node!",
"autoStart": "Start on Boot",
"export_log": "Show Logs",
"autoLaunchNotSupported": "Launch on Boot is not supported on this system.",
"willAutoLaunch": "Subspace will launch automatically during boot",
"willNotAutoLaunch": "Subspace will not launch automatically during boot",
"reset_heading": "Are you sure you want to reset and start from scratch?",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/autoLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ interface AutoLauncherParams {
osAutoLauncher: MacOSAutoLauncher | WindowsAutoLauncher | LinuxAutoLauncher;
}

/**
* AutoLauncher class responsible for enabling and disabling auto launch for particular OS
/**
* AutoLauncher class responsible for enabling and disabling auto launch for particular OS
*/
class AutoLauncher {
private osAutoLauncher: MacOSAutoLauncher | WindowsAutoLauncher | LinuxAutoLauncher;
Expand Down

0 comments on commit 704f5fc

Please sign in to comment.