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

feat: changing permission verify strategy #1374

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

thegrannychaseroperation
Copy link
Contributor

When submitting this pull request, I confirm the following (please check the boxes):

  • I have read and understood the Contributor Guidelines.
  • I have checked that there are no duplicate pull requests related to this request.
  • I have considered, and confirm that this submission is valuable to others.
  • I accept that this submission may not be used and the pull request may be closed at the discretion of the maintainers.

Fill in the PR content:

@zamitto zamitto linked an issue Jan 6, 2025 that may be closed by this pull request
2 tasks
Comment on lines +144 to +147
this.mainWindow.webContents.setWindowOpenHandler((handler) => {
shell.openExternal(handler.url);
return { action: "deny" };
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for the featurebase widget link
it opens a new window when clicking the "see all changelogs" button

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR implements a more robust folder write permission verification system and enhances achievement notifications across the application.

  • Added test file write/delete verification in /src/main/events/hardware/check-folder-write-permission.ts to reliably check directory permissions
  • Improved achievement notifications by adding sound feedback and renderer process event handling in /src/main/services/notifications/index.ts
  • Added periodic update checks every 60 minutes in /src/renderer/src/components/header/auto-update-sub-header.tsx
  • Standardized error handling in /src/main/services/hydra-api.ts with better typing and error messages
  • Centralized z-index management through theme variables in /src/renderer/src/theme.css.ts

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

34 file(s) reviewed, 28 comment(s)
Edit PR Review Bot Settings | Greptile

python_rpc/main.py Outdated Show resolved Hide resolved
Comment on lines 6 to +9
const checkFolderWritePermission = async (
_event: Electron.IpcMainInvokeEvent,
path: string
) =>
new Promise((resolve) => {
fs.access(path, fs.constants.W_OK, (err) => {
resolve(!err);
});
});
testPath: string
) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: function is marked async but contains no await operations - should either use async fs operations or remove async keyword

});
testPath: string
) => {
const testFilePath = path.join(testPath, ".hydra-write-test");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider using a more unique filename with timestamp/uuid to avoid potential conflicts

Comment on lines +13 to +14
fs.writeFileSync(testFilePath, "");
fs.rmSync(testFilePath);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: using synchronous fs operations can block the main thread - consider using async writeFile/rm

Comment on lines +16 to +18
} catch (err) {
return false;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: error is silently swallowed - should at least log it for debugging purposes

@@ -45,6 +45,7 @@ Sentry.init({
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
release: await window.electron.getVersion(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using await at module level requires top-level await support. Consider moving Sentry initialization into an async function that runs after the app loads to ensure compatibility across all environments.

@@ -78,6 +78,7 @@ export function useUserDetails() {
...response,
username: userDetails?.username || "",
subscription: userDetails?.subscription || null,
featurebaseJwt: userDetails?.featurebaseJwt || "",
});
},
[updateUserDetails, userDetails?.username, userDetails?.subscription]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: dependency array is missing userDetails.featurebaseJwt but includes it in the spread object

)
}
/>
</div>

<div className={styles.gameOptionHeader}>
<h2>{t("downloads_secion_title")}</h2>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: typo in translation key 'downloads_secion_title' should be 'downloads_section_title'

Comment on lines 17 to 21
$toast-z-index: 5;
$bottom-panel-z-index: 3;
$title-bar-z-index: 4;
$title-bar-z-index: 1900000001;
$backdrop-z-index: 4;
$modal-z-index: 5;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: z-index values are inconsistent across components (5, 3, 1900000001, 4, 5). Consider using standardized increments like 100, 200, 300 for better maintainability

@@ -267,6 +267,7 @@ export interface UserDetails {
backgroundImageUrl: string | null;
profileVisibility: ProfileVisibility;
bio: string;
featurebaseJwt: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: featurebaseJwt is marked as required but should likely be optional since not all users may have this token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants