95
14 days later

How does Safari Technology Preview able to use Safari extensions then? Is there a specific method that it uses? Aren't both of these browsers webkit?

    2 months later

    quarkw i think vlad once said that safari extensions aren't easy to integrate because of apple stuff.

      There were many posts like these, so this will be merged.

        Merged 3 posts from Safari extensions support.
          3 months later

          I was curious how safari handles extensions so I starting looking around. Not sure if any of this info is helpful:

          From lapcatsoftware.com
          --
          A modern "Safari app extension" has several parts, including the following:

          1. An app, distributed as an .app bundle. The app contains native Mac executable code inside the Contents/MacOS folder of its bundle.

          2. An app extension, distributed as an .appex bundle inside the Contents/PlugIns folder of the .app bundle. The app extension also contains native Mac executable code in the Contents/MacOS folder of its bundle.

          3. JavaScript and CSS, distributed as .js and .css files inside the Contents/Resources folder of the .appex bundle.

          On every launch, Safari runs 2, the native Mac executable code of the .appex bundle, regardless of whether the extension is enabled in Safari's Extensions Preferences. Safari does not load 3, the JavaScript and CSS, unless the extension is enabled.

          --

          It looks like the only extension data that safari store is in ~/Library/Containers/com.apple.Safari/Data/Library/Safari/AppExtensions/Extensions.plist which stores enabled status, allowed domains, etc.

          All extensions are read from the individual host app that wraps the safari extension .appex. Looking at what files safari access It looks like it access the extensions using the Mac binary file in XXX.appex/Contents/MacOS/XXX rather than its resources folder that contains all the js/html.

          Since it's calling Mac binary I'm not sure how safari is loading in its data and it might not be possible to load them into Orion. I haven't seen another browser not made by apple attempt such a thing. There is a Mac binary reader on GitHub that might provide some clues but I have get to look into it.

          There is also a tool in Xcode for converting Web Extension to safari. I haven't look into it much but it might provide some clues on how safari interacts with extensions.

            16 days later

            kenobi If you have some time on your hands, create a prototype app that loads a simple safari extension and we will take it from there.

            4 months later

            I think this is the most important feature request. If at all possible, addding Safari extensions will be a huge benefit to the target market of this app, converting Safari users over to Orion. 👍

              Orionic It is not possible to run Safari extensions (as they are closed source proprietery format).

                2 months later
                2 months later

                Vlad I don't know anything about the Safari extension API but would it be possible to like reverse engineer it?

                • Vlad replied to this.

                  Oneechan69 You are welcome to try and let us know if you or someone you know succeeds. Happy to incoprorate it.

                    Do you give suggestions like that to everyone?! I've read that a few times here and its ridiculous. Look, not everyone programs, and if they do, they may not be interested or don't have the time to try to program these things themselves.

                    I was just asking if you knew or thought it would be possible. Is it?

                    • Vlad replied to this.

                      Oneechan69 I do not know if it is possible, nobody in the world has done it ever. It would probably take hundreds of hours just to try.

                      We do have over 1,500 other issues on this site that we know what to do with, so if anyone figures this out we are happy to incorporate.

                        a year later

                        Also goes well with this issue as a side dish.

                        In order to currently import a Safari web extension, I need to:

                        1. Go into Finder
                        2. Go to my Applications folder
                        3. Find the app associated with the extension
                        4. Choose "Show Package Contents" in the right-click menu
                        5. Go to the "Contents" folder
                        6. Go to the "PlugIns" folder
                        7. Right-click the .appex file
                        8. Choose "Show Package Contents" in the right-click menu
                        9. Go to the "Contents" folder
                        10. Go to the "Resources" folder
                        11. Make sure there's a manifest.json file (validate that this is a web extension and not an app extension)
                        12. Get to Orion's extension manager screen
                        13. Choose "Add Extension"
                        14. Choose "Install from Disk..."
                        15. Drag-and-drop the manifest.json file into the pop-up menu
                        16. Choose "Open"
                        17. Choose "Add"

                        As you can see, it's kind of difficult to do this, and definitely annoying to do with every extension! It's not frustrating, just tedious. I can't just choose to add the .appex file - much less the .app file. I have to add the folder inside the .appex file. I'd really love for this to be automated instead of the manual mess it is right now; that is, you can choose .app and .appex files from the pop-up menu, and if there is a valid web extension to be found (or more than one in some cases), you can import it/them.

                        [This issue #6840 was merged into this main issue #6839, so this introductory paragraph looks weird. I (OP) am editing it to make this clearer.]

                        I've imported a few Safari web extensions following these directions. Particularly, Bitwarden, 1Password for Safari, and Refined GitHub. Bitwarden and Refined GitHub show up as Firefox extensions, while 1Password for Safari shows up as a Chrome extension.

                        1. Download one of these three web extensions from the Mac App Store (or seemingly any other web extension)
                        2. Go into Finder
                        3. Go to the Applications folder
                        4. Find the app associated with the extension
                        5. Choose "Show Package Contents" in the right-click menu
                        6. Go to the "Contents" folder
                        7. Go to the "PlugIns" folder
                        8. Right-click the .appex file
                        9. Choose "Show Package Contents" in the right-click menu
                        10. Go to the "Contents" folder
                        11. Go to the "Resources" folder
                        12. Make sure there's a manifest.json file (validate that this is a web extension and not an app extension)
                        13. Get to Orion's extension manager screen
                        14. Choose "Add Extension"
                        15. Choose "Install from Disk..."
                        16. Drag-and-drop the manifest.json file into the pop-up menu
                        17. Choose "Open"
                        18. Choose "Add"
                        19. Observe that it's labeled as a Firefox/Chrome extension in the manager

                        I expected these extensions to be labeled as a Safari extension.

                        Version 0.99.126.4.1-beta (WebKit 618.1.2)

                        Sonoma (14)