-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from pacholoamit/fix/disk-analysis-ms-defende…
…r-exclusion fix/disk analysis ms defender exclusion
- Loading branch information
Showing
19 changed files
with
270 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ | |
"vite-plugin-eslint": "^1.8.1" | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:allow-arch","os:allow-hostname","os:allow-os-type","os:allow-platform","window:allow-start-dragging"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default"]}} | ||
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:allow-arch","os:allow-hostname","os:allow-os-type","os:allow-platform","window:allow-start-dragging","autostart:allow-is-enabled"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default"]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use anyhow::Ok; | ||
use tauri::{menu::MenuItemBuilder, App, Manager}; | ||
|
||
pub fn create_tray(app: &mut App) -> anyhow::Result<()> { | ||
let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?; | ||
|
||
let icon = app.default_window_icon().unwrap().clone(); | ||
|
||
let menu = tauri::menu::MenuBuilder::new(app).items(&[&quit]).build()?; | ||
|
||
let _tray = tauri::tray::TrayIconBuilder::with_id("tray") | ||
.tooltip("Pachtop") | ||
.icon(icon) | ||
.menu(&menu) | ||
.on_menu_event(move |app, event| match event.id().as_ref() { | ||
"quit" => { | ||
app.exit(0); | ||
} | ||
"example" => todo!(), | ||
_ => {} | ||
}) | ||
.on_tray_icon_event(|tray, event| match event { | ||
tauri::tray::TrayIconEvent::Click { button, .. } => match button { | ||
tauri::tray::MouseButton::Left => { | ||
let app = tray.app_handle(); | ||
if let Some(window) = app.get_webview_window("main") { | ||
let _ = window.show(); | ||
let _ = window.set_focus(); | ||
} | ||
} | ||
tauri::tray::MouseButton::Middle => todo!(), | ||
_ => {} | ||
}, | ||
tauri::tray::TrayIconEvent::Leave { .. } => todo!(), | ||
_ => {} | ||
}) | ||
.build(app)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useState } from "react"; | ||
|
||
import { commands } from "@/lib"; | ||
import store from "@/lib/store"; | ||
import notification from "@/utils/notification"; | ||
import { Button, Code, Modal, Space, Stack, Text, Title } from "@mantine/core"; | ||
import { useDisclosure } from "@mantine/hooks"; | ||
|
||
const ExclusionModal = () => { | ||
const [opened, { open, close }] = useDisclosure(true); | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
const handleAddExclusion = async () => { | ||
setIsLoading(true); | ||
try { | ||
await commands.add_pachtop_exclusion(); | ||
|
||
notification.success({ | ||
title: "Pachtop added to exclusion list", | ||
message: "Pachtop has been added to the exclusion list in Microsoft Defender.", | ||
}); | ||
await store.then((s) => s.isDefenderExclusionEnabled.set(true)); | ||
} catch (err) { | ||
notification.error({ | ||
title: "Failed to add Pachtop to exclusion list", | ||
message: "Please try again or add Pachtop to the exclusion list manually by re-opening the app", | ||
}); | ||
|
||
return close(); | ||
} finally { | ||
setIsLoading(false); | ||
close(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Modal opened={opened} onClose={close} withCloseButton={false} centered> | ||
<Stack> | ||
<Title order={3}>Add Pachtop to Exclusion list!</Title> | ||
<Text size={"sm"}>This is a setup screen specifically for windows users, So you should feel special.</Text> | ||
<Text size={"sm"}> | ||
In order for Pachtop to be blazingly fast & performant, we need to add Pachtop to the exclusion list in | ||
Microsoft Defender. | ||
</Text> | ||
<Space /> | ||
<Button variant="white" onClick={handleAddExclusion} loading={isLoading}> | ||
Make Pachtop blazingly fast 🚀 | ||
</Button> | ||
</Stack> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ExclusionModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useState } from "react"; | ||
|
||
import useEffectAsync from "@/hooks/useEffectAsync"; | ||
import store from "@/lib/store"; | ||
|
||
const useIsFirstRun = () => { | ||
const [isFirstRun, setIsFirstRun] = useState(false); | ||
|
||
useEffectAsync(async () => { | ||
const firstRun = await store.then((s) => s.isFirstRun.get()); | ||
setIsFirstRun(firstRun); | ||
}, []); | ||
|
||
return isFirstRun; | ||
}; | ||
|
||
export default useIsFirstRun; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.