Skip to content

adding needed changes #18987

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

Merged
merged 22 commits into from
May 8, 2025
Merged

adding needed changes #18987

merged 22 commits into from
May 8, 2025

Conversation

chkpwd
Copy link
Contributor

@chkpwd chkpwd commented May 6, 2025

Description

This update introduces several improvements and fixes across the extension:

  • New Feature: The import command now performs all necessary setup and configuration actions automatically (d94ddeabc3c8).
  • New Feature: Added a new "overwrite preference" action to provide more control over import behaviors (ab363f78ab6d).
  • UI Enhancements: Introduced dynamic icon support for better visual feedback (7d077481b83a).
  • Refactors:
    • Renamed the primary action variable for clarity (c4faec441f78).
    • Set unused tasks to be disabled by default to reduce UI clutter (386fd572c2fa).
  • Fixes:
    • Improved the path resolution mechanism to work at runtime (781b6e5df02d).
    • Corrected logic in stripServiceName to better handle edge cases (8dcf2826f9eb).
    • Resolved import paths using preferences, making the extension more configurable (28259c72872e).
  • Chores:
    • Improved code organization by restructuring imports (0028da00ab27).
    • Added logs to notify if a target folder already exists (4befca5a81ae).
    • Updated function names and command casing for consistency and readability (1515dfa6e494, 23e7dcc9ba7a).

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: ente-auth Issues related to the ente-auth extension OP is author The OP of the PR is the author of the extension labels May 6, 2025
@raycastbot
Copy link
Collaborator

Thank you for the update! 🎉

You can expect an initial review within five business days.

Copy link
Contributor

@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 introduces significant improvements to the Ente Auth extension, focusing on path resolution, icon handling, and import/export functionality.

  • The changelog entry for bug fix needs {PR_MERGE_DATE} instead of hardcoded date 2024-11-14
  • The command title change from "Get TOTP" to "Get Totp" in package.json should be kept as "Get TOTP" since it's the unique ID
  • Remove example usage code at bottom of /src/helpers/icons.ts (lines 70-75)
  • showToast in /src/export.tsx should be replaced with showFailureToast from @raycast/utils for better error handling
  • The any type in icon matching function in /src/helpers/icons.ts should be properly typed for type safety

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

13 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings | Greptile

import path from "path";

export const DEFAULT_EXPORT_DIR_PATH = (): string => {
const exportPath = getPreferenceValues().exportPath || path.join(process.env.HOME || "", "Documents", "ente");
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: process.env.HOME may be undefined on Windows. Consider using os.homedir() as the primary source

Suggested change
const exportPath = getPreferenceValues().exportPath || path.join(process.env.HOME || "", "Documents", "ente");
const exportPath = getPreferenceValues().exportPath || path.join(os.homedir(), "Documents", "ente");


export const EXPORTPATH = getPreferenceValues().exportPath || `${DEFAULT_EXPORT_PATH}/ente_auth.txt`;
export const EXPORT_FILE_PATH = `${DEFAULT_EXPORT_DIR_PATH()}/ente_auth.txt`;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: DEFAULT_EXPORT_DIR_PATH() is called on every reference - consider memoizing the result

@@ -1,5 +1,8 @@
# Ente Auth Changelog

## [Bug fix] - 2024-11-14
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: The title should use the {PR_MERGE_DATE} placeholder instead of a hardcoded date. Change to ## [Bug fix] - {PR_MERGE_DATE}

Suggested change
## [Bug fix] - 2024-11-14
## [Bug fix] - {PR_MERGE_DATE}

@@ -25,14 +25,15 @@
"commands": [
{
"name": "index",
"title": "Get TOTP",
"title": "Get Totp",
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Title case inconsistency - 'TOTP' was changed to 'Totp' which is less standard

Suggested change
"title": "Get Totp",
"title": "Get TOTP",

} catch (error) {
showToast(Toast.Style.Failure, "Folder creation failed");
return <Detail markdown={`## Failed to create folder at \`${EXPORTPATH}\``} />;
return <Detail markdown={`## Failed to create folder at \`${DEFAULT_EXPORT_DIR_PATH}\``} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: DEFAULT_EXPORT_DIR_PATH is a function but missing () here - will display function definition instead of path

Suggested change
return <Detail markdown={`## Failed to create folder at \`${DEFAULT_EXPORT_DIR_PATH}\``} />;
return <Detail markdown={`## Failed to create folder at \`${DEFAULT_EXPORT_DIR_PATH()}\``} />;

Comment on lines 61 to 63
if (icons[key as keyof typeof icons].slug === serviceName) {
return icons[key as keyof typeof icons].svg;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Use Object.entries() or Object.keys() instead of for...in to avoid iterating over prototype chain

Comment on lines +9 to +11
if (!checkEnteBinary()) {
showToast(Toast.Style.Failure, "Ente binary not found");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The function continues execution after showing the binary not found error. This should return early to prevent further operations.

Suggested change
if (!checkEnteBinary()) {
showToast(Toast.Style.Failure, "Ente binary not found");
}
if (!checkEnteBinary()) {
showToast(Toast.Style.Failure, "Ente binary not found");
return;
}

Comment on lines +14 to +15
createEntePath(DEFAULT_EXPORT_DIR_PATH());
exportEnteAuthSecrets();
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: These operations could fail but their errors aren't being caught. They should be inside the try block or have their own error handling.

style: Toast.Style.Animated,
title: "Importing secrets",
});
const toast = await showToast({ style: Toast.Style.Animated, title: "Importing secrets" });
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Multiple toast notifications could cause race conditions. Consider using showFailureToast from @raycast/utils for error cases.

Comment on lines 29 to 31
if (getPreferenceValues().deleteExport == true) {
deleteEnteExport();
};
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: deleteEnteExport() could fail but errors are not handled. This should be in a try-catch block.

@chkpwd chkpwd force-pushed the feat/redo-imports branch from d94ddea to f04bf18 Compare May 6, 2025 16:02
@pernielsentikaer
Copy link
Collaborator

Hi @chkpwd👋

Thanks for your contribution 🔥

Could you look into the merge conflicts

@pernielsentikaer pernielsentikaer self-assigned this May 7, 2025
@chkpwd
Copy link
Contributor Author

chkpwd commented May 7, 2025

Hey @pernielsentikaer, thanks for all your hard work! Done.

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit b13d3fc into raycast:main May 8, 2025
Copy link
Contributor

github-actions bot commented May 8, 2025

Published to the Raycast Store:
https://raycast.com/chkpwd/ente-auth

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension: ente-auth Issues related to the ente-auth extension extension fix / improvement Label for PRs with extension's fix improvements OP is author The OP of the PR is the author of the extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants