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

Add Safari 12+ extension #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ lovely-forks*.zip
build/
manifest.json
tmp/
.DS_Store
# Xcode
#
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
52 changes: 52 additions & 0 deletions safari/Lovely forks Extension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Lovely forks Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
<key>SFSafariContentScript</key>
<array>
<dict>
<key>Script</key>
<string>webext/data/contentscript.js</string>
</dict>
</array>
<key>SFSafariStyleSheet</key>
<array>
<dict>
<key>Style Sheet</key>
<string>webext/data/style.css</string>
</dict>
</array>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Level</key>
<string>All</string>
</dict>
</dict>
</dict>
</plist>
14 changes: 14 additions & 0 deletions safari/Lovely forks Extension/Lovely_forks_Extension.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
24 changes: 24 additions & 0 deletions safari/Lovely forks Extension/SafariWebExtensionHandler.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// SafariWebExtensionHandler.swift
// Lovely forks Extension
//
// Created by Conner Owen on 7/7/20.
//

import SafariServices
import os.log

class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {

func beginRequest(with context: NSExtensionContext) {
let item = context.inputItems[0] as! NSExtensionItem
let message = item.userInfo?[SFExtensionMessageKey]
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)

let response = NSExtensionItem()
response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ]

context.completeRequest(returningItems: [response], completionHandler: nil)
}

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"description":"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VOdjBBaGtoNHlxTGFJT1U5eWNWTHJqdUpobnBHN0JRUzgifV0sImZvcm1hdCI6InRyZWVoYXNoIiwiaGFzaF9ibG9ja19zaXplIjo0MDk2fV0sIml0ZW1faWQiOiJpYWxicGNpcGFsYWpuYWtmb25ka2ZscGthZ2JrZG9pYiIsIml0ZW1fdmVyc2lvbiI6IjMuNC4wIiwicHJvdG9jb2xfdmVyc2lvbiI6MX0","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"nFgdAEr56UJFFbnjC7O_JOlpwDZz5qn3Do4zFlSNkb66BAuGld9zBtIhFV1mXCprb5yiSZxcna12zBHGIE3J2ukgRQDMdup1Z3GR351MVZZxKBbq1kwkvP-4aRlGBnOqahZ2UN9mqpj8RqlHaE0A4Y7tEdglpxFcx1QQyy0pe_lkMckC-pLVbINsunshFjZk3g5V-5NRfp38FkfEyRKBq_rK34aWXUyx1udu5pJnr4q7Z6uY_SOOaucn9M3h9FqmSo2DLgPENts3YLuUCIQ693aMm_hVr1_zX2H_hJ_d6PgjIKES5NQNN4BcEtKr2tZc9J8y5BkS-WPolqnbSRUvGQ"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"BnrZimlYpGyBriSMy6t93Fm4QiPqY0ktfvwo4e-Nm4uUY3HpUfxSdzYKsNPZEG7KN-uj5NH9Gpxjc8GgVjKUFCMeFfbT5OaZGqhKKFnaIqX1vawa-cnijfjr1BzWSvgzGRrHzzH9MpkQxQWWLTTohtugy_TnFLQM6HRNpk8ibpoJgLrzfyz3LFJ9-h6u5LFhT2Mi2UqxRKVXfnGacsrmQXYITQmfDmomGkIdeC2PSL_Fwzw85hdt61KlxgOmLfCqfkChp75jzMhU2GwtMcWP5hxcszfUfYXZ5FJeuK3kw76bUrxnh-fRBSFpa5UbuBSZt7sDXPDVZA7i3hBZ4mpFKQ"}]}}]
Loading