-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: main
Are you sure you want to change the base?
Update evernote extension #17889
Conversation
- Added command to search for open tasks across notes - Initial commit
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 |
There was a problem hiding this 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 inTasksList.tsx
should be removed before production - Consider using
showFailureToast
from@raycast/utils
in/extensions/evernote/src/search-tasks.tsx
error handling url
andsnippet
fields are defined inTaskItem
interface but not used in the SQL query- Missing
metadata
folder with screenshots for the newview
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" | ||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
console.log(data); |
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]); |
There was a problem hiding this comment.
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
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]); |
const files = fs.readdirSync(baseDir); | ||
console.log(files); |
There was a problem hiding this comment.
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
const files = fs.readdirSync(baseDir); | |
console.log(files); | |
const files = fs.readdirSync(baseDir); |
if (!evernoteDB) { | ||
return; | ||
} |
There was a problem hiding this comment.
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
const dbFile = files.find((file) => file.endsWith("+RemoteGraph.sql")); | ||
if (dbFile) { | ||
setEvernoteDB(path.join(baseDir, dbFile)); | ||
} |
There was a problem hiding this comment.
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
Hi @magnusmoaner👋 Thanks for your contribution 🔥 Could you look into suggestions and add a CHANGELOG entry? @artpi do you want to check this? |
Description
Screencast
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder