yo can you make an chrome extension, which in discord gets the latest image uploaded by anyone, then extract the code from it and type, lemme give an example- like in the given image, i want it to extract the code and type and send it as fast as possible
I'll help you create a Chrome extension that can extract text from images posted in Discord. This extension will use Optical Character Recognition (OCR) to identify and extract text from images.
Create the Extension Files:
Load the Extension in Chrome:
chrome://extensions/
Using the Extension:
You can customize the extension further by modifying the settings in the popup or adjusting the code to better match Discord's interface structure.
Refused to load the script 'https://cdn.jsdelivr.net/npm/tesseract.js@4/dist/tesseract.min.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
i think chrome dosent allow loading scripts
You're right, and I apologize for the oversight. Chrome extensions have strict Content Security Policy (CSP) rules that prevent loading external scripts for security reasons. Let's modify our approach to work within these constraints.
Instead of loading Tesseract.js from a CDN, we'll need to include it as part of our extension. Here's how we can modify the extension to make it work:
Here are the changes:
These changes will allow the extension to use Tesseract.js without violating Chrome's Content Security Policy. The tesseract.min.js
and worker.min.js
files are now included as part of the extension, and we're using chrome.runtime.getURL()
to load them.
To implement these changes:
manifest.json
and background.js
files as shown above.tesseract.min.js
and worker.min.js
from the Tesseract.js GitHub repository and place them in your extension's root directory.This approach should resolve the Content Security Policy issue while still allowing the extension to perform OCR on images posted in Discord. The rest of the extension's functionality remains the same as before.