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

Update evernote extension #17889

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

magnusmoaner
Copy link

Description

Screencast

Checklist

- Added command to search for open tasks across notes
- Initial commit
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: evernote Issues related to the evernote extension labels Mar 15, 2025
@raycastbot
Copy link
Collaborator

Thank you for your first contribution! 🎉

🔔 @artpi you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability, the initial review may take up to 10-15 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 adds a new "Search Tasks" command to the Evernote extension, allowing users to search and view open tasks within their Evernote notes using the local database.

  • SQL query in /extensions/evernote/src/components/TasksList.tsx is vulnerable to injection attacks - search text should be parameterized
  • Debug console.log(data) statement in TasksList.tsx should be removed before production
  • Consider using showFailureToast from @raycast/utils in /extensions/evernote/src/search-tasks.tsx error handling
  • url and snippet fields are defined in TaskItem interface but not used in the SQL query
  • Missing metadata folder with screenshots for the new view command

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

3 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

"@raycast/utils": "^1.17.0"

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Remove extra blank line between dependencies

return permissionView;
}

console.log(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Remove debug console.log before production

Suggested change
console.log(data);

Comment on lines +19 to +65
useEffect(() => {
getApplications().then(async (applications) => {
const isEvernoteInstalled = applications.find(({ bundleId }) => bundleId === "com.evernote.Evernote");
if (!isEvernoteInstalled) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Evernote client is not installed.",
message: "Download",
primaryAction: {
title: "Go to https://evernote.com/download",
onAction: (toast) => {
open("https://evernote.com/download");
toast.hide();
},
},
});
return;
}
let baseDir: string | null = null;
if (evernoteDB) {
return;
}
for (const directory of knownEvernoteDirLocations) {
if (fs.existsSync(directory)) {
baseDir = directory;
break;
}
}
if (!baseDir || !fs.existsSync(baseDir)) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Cannot find Evernote database.",
message:
"The database should be in ~/Library/Application Support/Evernote/conduit-storage/https%3A%2F%2Fwww.evernote.com, but can be somewhere else.",
});
return;
}
const files = fs.readdirSync(baseDir);
console.log(files);
const dbFile = files.find((file) => file.endsWith("+RemoteGraph.sql"));
if (dbFile) {
setEvernoteDB(path.join(baseDir, dbFile));
}
});
}, [evernoteDB]);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: useEffect callback should be wrapped in try-catch to handle potential errors from getApplications() and fs operations

Suggested change
useEffect(() => {
getApplications().then(async (applications) => {
const isEvernoteInstalled = applications.find(({ bundleId }) => bundleId === "com.evernote.Evernote");
if (!isEvernoteInstalled) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Evernote client is not installed.",
message: "Download",
primaryAction: {
title: "Go to https://evernote.com/download",
onAction: (toast) => {
open("https://evernote.com/download");
toast.hide();
},
},
});
return;
}
let baseDir: string | null = null;
if (evernoteDB) {
return;
}
for (const directory of knownEvernoteDirLocations) {
if (fs.existsSync(directory)) {
baseDir = directory;
break;
}
}
if (!baseDir || !fs.existsSync(baseDir)) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Cannot find Evernote database.",
message:
"The database should be in ~/Library/Application Support/Evernote/conduit-storage/https%3A%2F%2Fwww.evernote.com, but can be somewhere else.",
});
return;
}
const files = fs.readdirSync(baseDir);
console.log(files);
const dbFile = files.find((file) => file.endsWith("+RemoteGraph.sql"));
if (dbFile) {
setEvernoteDB(path.join(baseDir, dbFile));
}
});
}, [evernoteDB]);
useEffect(() => {
getApplications().then(async (applications) => {
try {
const isEvernoteInstalled = applications.find(({ bundleId }) => bundleId === "com.evernote.Evernote");
if (!isEvernoteInstalled) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Evernote client is not installed.",
message: "Download",
primaryAction: {
title: "Go to https://evernote.com/download",
onAction: (toast) => {
open("https://evernote.com/download");
toast.hide();
},
},
});
return;
}
let baseDir: string | null = null;
if (evernoteDB) {
return;
}
for (const directory of knownEvernoteDirLocations) {
if (fs.existsSync(directory)) {
baseDir = directory;
break;
}
}
if (!baseDir || !fs.existsSync(baseDir)) {
await popToRoot();
await showToast({
style: Toast.Style.Failure,
title: "Cannot find Evernote database.",
message:
"The database should be in ~/Library/Application Support/Evernote/conduit-storage/https%3A%2F%2Fwww.evernote.com, but can be somewhere else.",
});
return;
}
const files = fs.readdirSync(baseDir);
console.log(files);
const dbFile = files.find((file) => file.endsWith("+RemoteGraph.sql"));
if (dbFile) {
setEvernoteDB(path.join(baseDir, dbFile));
}
} catch (error) {
await showToast({
style: Toast.Style.Failure,
title: "Error accessing Evernote database",
message: String(error)
});
}
});
}, [evernoteDB]);

Comment on lines +58 to +59
const files = fs.readdirSync(baseDir);
console.log(files);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: console.log statement should be removed before production

Suggested change
const files = fs.readdirSync(baseDir);
console.log(files);
const files = fs.readdirSync(baseDir);

Comment on lines +67 to +69
if (!evernoteDB) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: should show loading state instead of empty return when evernoteDB is null

Comment on lines +60 to +63
const dbFile = files.find((file) => file.endsWith("+RemoteGraph.sql"));
if (dbFile) {
setEvernoteDB(path.join(baseDir, dbFile));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: missing error handling if no database file is found - should show toast error

@pernielsentikaer
Copy link
Collaborator

Hi @magnusmoaner👋

Thanks for your contribution 🔥

Could you look into suggestions and add a CHANGELOG entry?

@artpi do you want to check this?

@pernielsentikaer pernielsentikaer self-assigned this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension: evernote Issues related to the evernote extension extension fix / improvement Label for PRs with extension's fix improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants