wong2 / chatgpt-google-extension

This project is deprecated. Check my new project ChatHub:
https://github.com/chathub-dev/chathub
GNU General Public License v3.0
13.26k stars 1.49k forks source link

Extension for safari #110

Open Anri-Lombard opened 1 year ago

Anri-Lombard commented 1 year ago

If you could somehow add an extension for safari it would be awesome!

wong2 commented 1 year ago

Perhaps you can try: https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari

Anri-Lombard commented 1 year ago

On it ;)

Anri-Lombard commented 1 year ago

Not sure why, but I don't have permissions to push a branch to this repo ?!

wong2 commented 1 year ago

Yes, you need to fork this repo

Anri-Lombard commented 1 year ago

Just updating my Xcode, then I'll be able to convert the extension fully.

This issue relates to #109 just for reference.

Anri-Lombard commented 1 year ago

I built the extension and it works, but you need to be on the Apple Developer program to distribute it, which I am not.

Perhaps you can label the issue as "help wanted" or we can close it.

Anri-Lombard commented 1 year ago

I can push the build if it would help

wong2 commented 1 year ago

So you just followed this guide https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari

and everything just works?

Armandotrsg commented 1 year ago

@Anri-Lombard I have tried what the Apple developer's page says about converting the extension to Safari, but I don't seem to make it work for Mac. I keep getting the same error of being unable to load chatGPT once the I make the search. I'm not sure if you changed some configurations inside Xcode. Here's the project created using the command: xcrun safari-web-extension-converter /path/to/extension: ChatGPT for Google.zip

canny[bot] commented 1 year ago

This issue has been linked to a Canny post: Support Safari :tada:

Anri-Lombard commented 1 year ago

@Anri-Lombard I have tried what the Apple developer's page says about converting the extension to Safari, but I don't seem to make it work for Mac. I keep getting the same error of being unable to load chatGPT once the I make the search. I'm not sure if you changed some configurations inside Xcode. Here's the project created using the command: xcrun safari-web-extension-converter /path/to/extension: ChatGPT for Google.zip

The only difference is that I added the --copy-resources flag, after which it ran smoothly. Although, I can't test it out on my Mac since I'm not part of the developer program.

Armandotrsg commented 1 year ago

@Anri-Lombard I have tried what the Apple developer's page says about converting the extension to Safari, but I don't seem to make it work for Mac. I keep getting the same error of being unable to load chatGPT once the I make the search. I'm not sure if you changed some configurations inside Xcode. Here's the project created using the command: xcrun safari-web-extension-converter /path/to/extension: ChatGPT for Google.zip

The only difference is that I added the --copy-resources flag, after which it ran smoothly. Although, I can't test it out on my Mac since I'm not part of the developer program.

I have tried using that and I keep getting the same error, can you provide a .zip file with the Xcode project so I can test it out?

Anri-Lombard commented 1 year ago

ChatGPT for Google.zip

Sure, @Armandotrsg. Does this work for you?

Armandotrsg commented 1 year ago

ChatGPT for Google.zip

Sure, @Armandotrsg. Does this work for you?

I get the error when loading into safari that the service_worker script failed to load

lez-s commented 1 year ago

ChatGPT for Google.zip Sure, @Armandotrsg. Does this work for you?

I get the error when loading into safari that the service_worker script failed to load

Same problem here.

Anri-Lombard commented 1 year ago

Made some real progress on this today.

This is what I did and the results:

  1. I took the zip file I shared earlier and opened it in Xcode. Then I pressed the run button top left.
  2. It ran and gave this output, alongside opening the app on mac: Screenshot 2022-12-31 at 11 00 28 Screenshot 2022-12-31 at 10 51 55
  3. It opened in safari but was grey, so I activated it by going to the "Develop" tab and allowing unsigned extensions, which made it show on Safari: Screenshot 2022-12-31 at 10 52 53
  4. It asked for permission to access the site and I gave it access: Screenshot 2022-12-31 at 10 56 03
  5. The problem is that it does not display anything on the right, in fact, it just removes the information that was previously there and leaving the area blank: Screenshot 2022-12-31 at 11 04 18
  6. I also do not allow toggling of the settings: Screenshot 2022-12-31 at 10 56 27

Any help with 5 and 6 will make massive progress!

Anri-Lombard commented 1 year ago

You were correct about the script failing, so that might be the major error:

Screenshot 2022-12-31 at 11 07 16

Some additional info is provided by the inspection tools:

Screenshot 2022-12-31 at 11 14 00
wong2 commented 1 year ago

I made some progress today. It turns out the zip file https://github.com/wong2/chat-gpt-google-extension/issues/110#issuecomment-1363649293 is converted from the source code of this project, which is incorrect, you need to convert from the built files:

  1. npm run build
  2. xcrun safari-web-extension-converter build/chromium

Then I get these files: ChatGPT for Google.zip

Load it in safari as steps described by @Anri-Lombard, there's finally something shown

image

Although it's always this load failed error.

But the options page works normally:

image
Armandotrsg commented 1 year ago

You were correct about the script failing, so that might be the major error:

Screenshot 2022-12-31 at 11 07 16

Some additional info is provided by the inspection tools: Screenshot 2022-12-31 at 11 14 00

I have been doing the same and I keep getting the same error, I believe it's a problem when communicating to the ChatGPT API, because after quickly reviewing the code in the ./src/content-script/ChatGPTQuery.tsx I can see that the problem should be around these part of the code: `if (error === 'UNAUTHORIZED' || error === 'CLOUDFLARE') { return (

Please login and pass Cloudflare check at{' '} chat.openai.com {isBraveBrowser() && retry > 0 && (
Still not working? Follow{' '} Brave Troubleshooting
)}

)

} if (error) { return (

Failed to load response from ChatGPT:
{error}

)

}`

The error is neither "UNAUTHORIZED" nor "CLOUDFLARE" apparently

wong2 commented 1 year ago

@Armandotrsg Check my comments above.

lukesmart1 commented 1 year ago

I made some progress today. It turns out the zip file #110 (comment) is converted from the source code of this project, which is incorrect, you need to convert from the built files:

  1. npm run build
  2. xcrun safari-web-extension-converter build/chromium

Then I get these files: ChatGPT for Google.zip

Load it in safari as steps described by @Anri-Lombard, there's finally something shown image Although it's always this load failed error.

But the options page works normally: image

I just spent my whole morning attempting to convert this to safari only to discover that the creator is stuck on the same part as me. Is there any updates?

wong2 commented 1 year ago

@lukesmart1 Not yet. Unfortunately, Safari support is not my priority now.

Perifractic commented 1 year ago

+1 for Safari support 🙏

BladesKnight commented 1 year ago

+1 for Safari support please.

josStorer commented 1 year ago

@wong2 I created a safari build in my fork, which may help with this issue

I have tested it and it also supports Automated Build, you can check https://github.com/josStorer/chatGPT-search-engine-extension/commit/e9a6812ddd7c24f37300f8cd1034436ed74e9fa6 and https://github.com/josStorer/chatGPT-search-engine-extension/commit/01f8b64ca89e0d679ed1e35a775f8688dbf56732

In terms of setting the extension version number, my approach may be a bit hacky and needs some improvement

wong2 commented 1 year ago

@josStorer Thanks, but I think the installation of Safari extension is beyond the capability of most users.

berot3 commented 1 year ago

Just wanted to comment that I am looking for exactly this browser extension but wanted to have this on iPhone. Now afaik the only browser extensions are those for safari. I think it would be really awesome if you guys could make this possible! 👍🏻 Thanks for you work!