From: Ruben Beltran del Rio Date: Wed, 13 Sep 2023 16:39:01 +0000 (+0200) Subject: Add safari code X-Git-Url: https://git.r.bdr.sh/rbdr/junction/commitdiff_plain/4a191e8036581893bf5f4cfb284770d1bfe9a807?ds=inline Add safari code --- diff --git a/Makefile b/Makefile index 14c1f2d..75433ea 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ docker-build: build: create-build-folder cd extension && pnpm build -package: package-for-firefox package-for-chrome +package: package-for-firefox package-for-chrome package-for-safari package-for-firefox: build cd extension && zip -r ../build/junction.xpi manifest.json junction.js build/content_script.js icons/ sounds/ @@ -17,5 +17,9 @@ package-for-firefox: build package-for-chrome: build cd extension && zip -r ../build/junction.zip manifest.json junction.js build/content_script.js icons/ sounds/ +package-for-safari: build + xcodebuild build -project safari/Junction.xcodeproj -scheme Junction -configuration Release -derivedDataPath ./build/_xcode + cp -r ./build/_xcode/Build/Products/Release/Junction.app ./build/ + create-build-folder: mkdir -p build diff --git a/safari/Junction Extension/Info.plist b/safari/Junction Extension/Info.plist new file mode 100644 index 0000000..9ee504d --- /dev/null +++ b/safari/Junction Extension/Info.plist @@ -0,0 +1,13 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.web-extension + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler + + + diff --git a/safari/Junction Extension/Junction_Extension.entitlements b/safari/Junction Extension/Junction_Extension.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/safari/Junction Extension/Junction_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/safari/Junction Extension/SafariWebExtensionHandler.swift b/safari/Junction Extension/SafariWebExtensionHandler.swift new file mode 100644 index 0000000..58f680c --- /dev/null +++ b/safari/Junction Extension/SafariWebExtensionHandler.swift @@ -0,0 +1,38 @@ +// +// SafariWebExtensionHandler.swift +// Junction Extension +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import SafariServices +import os.log + +class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { + + func beginRequest(with context: NSExtensionContext) { + let request = context.inputItems.first as? NSExtensionItem + + let profile: UUID? + if #available(iOS 17.0, macOS 14.0, *) { + profile = request?.userInfo?[SFExtensionProfileKey] as? UUID + } else { + profile = request?.userInfo?["profile"] as? UUID + } + + let message: Any? + if #available(iOS 17.0, macOS 14.0, *) { + message = request?.userInfo?[SFExtensionMessageKey] + } else { + message = request?.userInfo?["message"] + } + + os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)", String(describing: message), profile?.uuidString ?? "none") + + let response = NSExtensionItem() + response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ] + + context.completeRequest(returningItems: [ response ], completionHandler: nil) + } + +} diff --git a/safari/Junction.xcodeproj/project.pbxproj b/safari/Junction.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8a0fb97 --- /dev/null +++ b/safari/Junction.xcodeproj/project.pbxproj @@ -0,0 +1,829 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + B541F6352AB20E2000A08651 /* junction.js in Resources */ = {isa = PBXBuildFile; fileRef = B541F6312AB20E1F00A08651 /* junction.js */; }; + B541F6362AB20E2000A08651 /* icons in Resources */ = {isa = PBXBuildFile; fileRef = B541F6322AB20E1F00A08651 /* icons */; }; + B541F6372AB20E2000A08651 /* sounds in Resources */ = {isa = PBXBuildFile; fileRef = B541F6332AB20E1F00A08651 /* sounds */; }; + B541F6382AB20E2000A08651 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = B541F6342AB20E1F00A08651 /* manifest.json */; }; + B57836502AB21406006488FE /* build in Resources */ = {isa = PBXBuildFile; fileRef = B578364F2AB21406006488FE /* build */; }; + B5E6E79D2AB20D7700D7B76B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E79C2AB20D7700D7B76B /* AppDelegate.swift */; }; + B5E6E7A12AB20D7700D7B76B /* Main.html in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E79F2AB20D7700D7B76B /* Main.html */; }; + B5E6E7A32AB20D7700D7B76B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E7A22AB20D7700D7B76B /* Icon.png */; }; + B5E6E7A52AB20D7700D7B76B /* Style.css in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E7A42AB20D7700D7B76B /* Style.css */; }; + B5E6E7A72AB20D7700D7B76B /* Script.js in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E7A62AB20D7700D7B76B /* Script.js */; }; + B5E6E7A92AB20D7700D7B76B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E7A82AB20D7700D7B76B /* ViewController.swift */; }; + B5E6E7AC2AB20D7700D7B76B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E7AA2AB20D7700D7B76B /* Main.storyboard */; }; + B5E6E7AE2AB20D7800D7B76B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B5E6E7AD2AB20D7800D7B76B /* Assets.xcassets */; }; + B5E6E7BA2AB20D7800D7B76B /* JunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E7B92AB20D7800D7B76B /* JunctionTests.swift */; }; + B5E6E7C42AB20D7800D7B76B /* JunctionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E7C32AB20D7800D7B76B /* JunctionUITests.swift */; }; + B5E6E7C62AB20D7800D7B76B /* JunctionUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E7C52AB20D7800D7B76B /* JunctionUITestsLaunchTests.swift */; }; + B5E6E7CC2AB20D7800D7B76B /* Junction Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = B5E6E7CB2AB20D7800D7B76B /* Junction Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + B5E6E7D12AB20D7800D7B76B /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E6E7D02AB20D7800D7B76B /* SafariWebExtensionHandler.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + B5E6E7B62AB20D7800D7B76B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B5E6E7912AB20D7700D7B76B /* Project object */; + proxyType = 1; + remoteGlobalIDString = B5E6E7982AB20D7700D7B76B; + remoteInfo = Junction; + }; + B5E6E7C02AB20D7800D7B76B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B5E6E7912AB20D7700D7B76B /* Project object */; + proxyType = 1; + remoteGlobalIDString = B5E6E7982AB20D7700D7B76B; + remoteInfo = Junction; + }; + B5E6E7CD2AB20D7800D7B76B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B5E6E7912AB20D7700D7B76B /* Project object */; + proxyType = 1; + remoteGlobalIDString = B5E6E7CA2AB20D7800D7B76B; + remoteInfo = "Junction Extension"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + B5E6E7EA2AB20D7800D7B76B /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + B5E6E7CC2AB20D7800D7B76B /* Junction Extension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + B541F6312AB20E1F00A08651 /* junction.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = junction.js; path = ../../../extension/junction.js; sourceTree = ""; }; + B541F6322AB20E1F00A08651 /* icons */ = {isa = PBXFileReference; lastKnownFileType = folder; name = icons; path = ../../../extension/icons; sourceTree = ""; }; + B541F6332AB20E1F00A08651 /* sounds */ = {isa = PBXFileReference; lastKnownFileType = folder; name = sounds; path = ../../../extension/sounds; sourceTree = ""; }; + B541F6342AB20E1F00A08651 /* manifest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = manifest.json; path = ../../../extension/manifest.json; sourceTree = ""; }; + B578364F2AB21406006488FE /* build */ = {isa = PBXFileReference; lastKnownFileType = folder; name = build; path = ../../../extension/build; sourceTree = ""; }; + B5E6E7992AB20D7700D7B76B /* Junction.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Junction.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B5E6E79C2AB20D7700D7B76B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + B5E6E7A02AB20D7700D7B76B /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = Base; path = ../Base.lproj/Main.html; sourceTree = ""; }; + B5E6E7A22AB20D7700D7B76B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + B5E6E7A42AB20D7700D7B76B /* Style.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = Style.css; sourceTree = ""; }; + B5E6E7A62AB20D7700D7B76B /* Script.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Script.js; sourceTree = ""; }; + B5E6E7A82AB20D7700D7B76B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + B5E6E7AB2AB20D7700D7B76B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + B5E6E7AD2AB20D7800D7B76B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B5E6E7AF2AB20D7800D7B76B /* Junction.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Junction.entitlements; sourceTree = ""; }; + B5E6E7B02AB20D7800D7B76B /* Junction.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Junction.entitlements; sourceTree = ""; }; + B5E6E7B52AB20D7800D7B76B /* JunctionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JunctionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + B5E6E7B92AB20D7800D7B76B /* JunctionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JunctionTests.swift; sourceTree = ""; }; + B5E6E7BF2AB20D7800D7B76B /* JunctionUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JunctionUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + B5E6E7C32AB20D7800D7B76B /* JunctionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JunctionUITests.swift; sourceTree = ""; }; + B5E6E7C52AB20D7800D7B76B /* JunctionUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JunctionUITestsLaunchTests.swift; sourceTree = ""; }; + B5E6E7CB2AB20D7800D7B76B /* Junction Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Junction Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + B5E6E7D02AB20D7800D7B76B /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; + B5E6E7E32AB20D7800D7B76B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B5E6E7E42AB20D7800D7B76B /* Junction_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Junction_Extension.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B5E6E7962AB20D7700D7B76B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7B22AB20D7800D7B76B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7BC2AB20D7800D7B76B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7C82AB20D7800D7B76B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B5E6E7902AB20D7700D7B76B = { + isa = PBXGroup; + children = ( + B5E6E79B2AB20D7700D7B76B /* Junction */, + B5E6E7B82AB20D7800D7B76B /* JunctionTests */, + B5E6E7C22AB20D7800D7B76B /* JunctionUITests */, + B5E6E7CF2AB20D7800D7B76B /* Junction Extension */, + B5E6E79A2AB20D7700D7B76B /* Products */, + ); + sourceTree = ""; + }; + B5E6E79A2AB20D7700D7B76B /* Products */ = { + isa = PBXGroup; + children = ( + B5E6E7992AB20D7700D7B76B /* Junction.app */, + B5E6E7B52AB20D7800D7B76B /* JunctionTests.xctest */, + B5E6E7BF2AB20D7800D7B76B /* JunctionUITests.xctest */, + B5E6E7CB2AB20D7800D7B76B /* Junction Extension.appex */, + ); + name = Products; + sourceTree = ""; + }; + B5E6E79B2AB20D7700D7B76B /* Junction */ = { + isa = PBXGroup; + children = ( + B5E6E79C2AB20D7700D7B76B /* AppDelegate.swift */, + B5E6E7A82AB20D7700D7B76B /* ViewController.swift */, + B5E6E7AA2AB20D7700D7B76B /* Main.storyboard */, + B5E6E7AD2AB20D7800D7B76B /* Assets.xcassets */, + B5E6E7AF2AB20D7800D7B76B /* Junction.entitlements */, + B5E6E7B02AB20D7800D7B76B /* Junction.entitlements */, + B5E6E79E2AB20D7700D7B76B /* Resources */, + ); + path = Junction; + sourceTree = ""; + }; + B5E6E79E2AB20D7700D7B76B /* Resources */ = { + isa = PBXGroup; + children = ( + B5E6E79F2AB20D7700D7B76B /* Main.html */, + B5E6E7A22AB20D7700D7B76B /* Icon.png */, + B5E6E7A42AB20D7700D7B76B /* Style.css */, + B5E6E7A62AB20D7700D7B76B /* Script.js */, + ); + path = Resources; + sourceTree = ""; + }; + B5E6E7B82AB20D7800D7B76B /* JunctionTests */ = { + isa = PBXGroup; + children = ( + B5E6E7B92AB20D7800D7B76B /* JunctionTests.swift */, + ); + path = JunctionTests; + sourceTree = ""; + }; + B5E6E7C22AB20D7800D7B76B /* JunctionUITests */ = { + isa = PBXGroup; + children = ( + B5E6E7C32AB20D7800D7B76B /* JunctionUITests.swift */, + B5E6E7C52AB20D7800D7B76B /* JunctionUITestsLaunchTests.swift */, + ); + path = JunctionUITests; + sourceTree = ""; + }; + B5E6E7CF2AB20D7800D7B76B /* Junction Extension */ = { + isa = PBXGroup; + children = ( + B5E6E7D02AB20D7800D7B76B /* SafariWebExtensionHandler.swift */, + B5E6E7E32AB20D7800D7B76B /* Info.plist */, + B5E6E7E42AB20D7800D7B76B /* Junction_Extension.entitlements */, + B5E6E7D22AB20D7800D7B76B /* Resources */, + ); + path = "Junction Extension"; + sourceTree = ""; + }; + B5E6E7D22AB20D7800D7B76B /* Resources */ = { + isa = PBXGroup; + children = ( + B578364F2AB21406006488FE /* build */, + B541F6322AB20E1F00A08651 /* icons */, + B541F6312AB20E1F00A08651 /* junction.js */, + B541F6342AB20E1F00A08651 /* manifest.json */, + B541F6332AB20E1F00A08651 /* sounds */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B5E6E7982AB20D7700D7B76B /* Junction */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5E6E7EB2AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "Junction" */; + buildPhases = ( + B5E6E7952AB20D7700D7B76B /* Sources */, + B5E6E7962AB20D7700D7B76B /* Frameworks */, + B5E6E7972AB20D7700D7B76B /* Resources */, + B5E6E7EA2AB20D7800D7B76B /* Embed Foundation Extensions */, + ); + buildRules = ( + ); + dependencies = ( + B5E6E7CE2AB20D7800D7B76B /* PBXTargetDependency */, + ); + name = Junction; + productName = Junction; + productReference = B5E6E7992AB20D7700D7B76B /* Junction.app */; + productType = "com.apple.product-type.application"; + }; + B5E6E7B42AB20D7800D7B76B /* JunctionTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5E6E7EE2AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "JunctionTests" */; + buildPhases = ( + B5E6E7B12AB20D7800D7B76B /* Sources */, + B5E6E7B22AB20D7800D7B76B /* Frameworks */, + B5E6E7B32AB20D7800D7B76B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + B5E6E7B72AB20D7800D7B76B /* PBXTargetDependency */, + ); + name = JunctionTests; + productName = JunctionTests; + productReference = B5E6E7B52AB20D7800D7B76B /* JunctionTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + B5E6E7BE2AB20D7800D7B76B /* JunctionUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5E6E7F12AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "JunctionUITests" */; + buildPhases = ( + B5E6E7BB2AB20D7800D7B76B /* Sources */, + B5E6E7BC2AB20D7800D7B76B /* Frameworks */, + B5E6E7BD2AB20D7800D7B76B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + B5E6E7C12AB20D7800D7B76B /* PBXTargetDependency */, + ); + name = JunctionUITests; + productName = JunctionUITests; + productReference = B5E6E7BF2AB20D7800D7B76B /* JunctionUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; + B5E6E7CA2AB20D7800D7B76B /* Junction Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5E6E7E72AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "Junction Extension" */; + buildPhases = ( + B5E6E7C72AB20D7800D7B76B /* Sources */, + B5E6E7C82AB20D7800D7B76B /* Frameworks */, + B5E6E7C92AB20D7800D7B76B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Junction Extension"; + productName = "Junction Extension"; + productReference = B5E6E7CB2AB20D7800D7B76B /* Junction Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B5E6E7912AB20D7700D7B76B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + B5E6E7982AB20D7700D7B76B = { + CreatedOnToolsVersion = 15.0; + }; + B5E6E7B42AB20D7800D7B76B = { + CreatedOnToolsVersion = 15.0; + TestTargetID = B5E6E7982AB20D7700D7B76B; + }; + B5E6E7BE2AB20D7800D7B76B = { + CreatedOnToolsVersion = 15.0; + TestTargetID = B5E6E7982AB20D7700D7B76B; + }; + B5E6E7CA2AB20D7800D7B76B = { + CreatedOnToolsVersion = 15.0; + }; + }; + }; + buildConfigurationList = B5E6E7942AB20D7700D7B76B /* Build configuration list for PBXProject "Junction" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B5E6E7902AB20D7700D7B76B; + productRefGroup = B5E6E79A2AB20D7700D7B76B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B5E6E7982AB20D7700D7B76B /* Junction */, + B5E6E7B42AB20D7800D7B76B /* JunctionTests */, + B5E6E7BE2AB20D7800D7B76B /* JunctionUITests */, + B5E6E7CA2AB20D7800D7B76B /* Junction Extension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B5E6E7972AB20D7700D7B76B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E6E7A32AB20D7700D7B76B /* Icon.png in Resources */, + B5E6E7AC2AB20D7700D7B76B /* Main.storyboard in Resources */, + B5E6E7A72AB20D7700D7B76B /* Script.js in Resources */, + B5E6E7A12AB20D7700D7B76B /* Main.html in Resources */, + B5E6E7AE2AB20D7800D7B76B /* Assets.xcassets in Resources */, + B5E6E7A52AB20D7700D7B76B /* Style.css in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7B32AB20D7800D7B76B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7BD2AB20D7800D7B76B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7C92AB20D7800D7B76B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B57836502AB21406006488FE /* build in Resources */, + B541F6362AB20E2000A08651 /* icons in Resources */, + B541F6352AB20E2000A08651 /* junction.js in Resources */, + B541F6382AB20E2000A08651 /* manifest.json in Resources */, + B541F6372AB20E2000A08651 /* sounds in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B5E6E7952AB20D7700D7B76B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E6E7A92AB20D7700D7B76B /* ViewController.swift in Sources */, + B5E6E79D2AB20D7700D7B76B /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7B12AB20D7800D7B76B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E6E7BA2AB20D7800D7B76B /* JunctionTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7BB2AB20D7800D7B76B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E6E7C62AB20D7800D7B76B /* JunctionUITestsLaunchTests.swift in Sources */, + B5E6E7C42AB20D7800D7B76B /* JunctionUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5E6E7C72AB20D7800D7B76B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E6E7D12AB20D7800D7B76B /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + B5E6E7B72AB20D7800D7B76B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B5E6E7982AB20D7700D7B76B /* Junction */; + targetProxy = B5E6E7B62AB20D7800D7B76B /* PBXContainerItemProxy */; + }; + B5E6E7C12AB20D7800D7B76B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B5E6E7982AB20D7700D7B76B /* Junction */; + targetProxy = B5E6E7C02AB20D7800D7B76B /* PBXContainerItemProxy */; + }; + B5E6E7CE2AB20D7800D7B76B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B5E6E7CA2AB20D7800D7B76B /* Junction Extension */; + targetProxy = B5E6E7CD2AB20D7800D7B76B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + B5E6E79F2AB20D7700D7B76B /* Main.html */ = { + isa = PBXVariantGroup; + children = ( + B5E6E7A02AB20D7700D7B76B /* Base */, + ); + name = Main.html; + sourceTree = ""; + }; + B5E6E7AA2AB20D7700D7B76B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + B5E6E7AB2AB20D7700D7B76B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + B5E6E7E52AB20D7800D7B76B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + B5E6E7E62AB20D7800D7B76B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + B5E6E7E82AB20D7800D7B76B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Junction Extension/Junction_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Junction Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Junction Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Junction.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + B5E6E7E92AB20D7800D7B76B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Junction Extension/Junction_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Junction Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Junction Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Junction.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + B5E6E7EC2AB20D7800D7B76B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Junction/Junction.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = Junction; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Junction; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + B5E6E7ED2AB20D7800D7B76B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Junction/Junction.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = Junction; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Junction; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + B5E6E7EF2AB20D7800D7B76B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.JunctionTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Junction.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Junction"; + }; + name = Debug; + }; + B5E6E7F02AB20D7800D7B76B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.JunctionTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Junction.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Junction"; + }; + name = Release; + }; + B5E6E7F22AB20D7800D7B76B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.JunctionUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = Junction; + }; + name = Debug; + }; + B5E6E7F32AB20D7800D7B76B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S68NHQVJXW; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.JunctionUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = Junction; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B5E6E7942AB20D7700D7B76B /* Build configuration list for PBXProject "Junction" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5E6E7E52AB20D7800D7B76B /* Debug */, + B5E6E7E62AB20D7800D7B76B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B5E6E7E72AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "Junction Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5E6E7E82AB20D7800D7B76B /* Debug */, + B5E6E7E92AB20D7800D7B76B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B5E6E7EB2AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "Junction" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5E6E7EC2AB20D7800D7B76B /* Debug */, + B5E6E7ED2AB20D7800D7B76B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B5E6E7EE2AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "JunctionTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5E6E7EF2AB20D7800D7B76B /* Debug */, + B5E6E7F02AB20D7800D7B76B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B5E6E7F12AB20D7800D7B76B /* Build configuration list for PBXNativeTarget "JunctionUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5E6E7F22AB20D7800D7B76B /* Debug */, + B5E6E7F32AB20D7800D7B76B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = B5E6E7912AB20D7700D7B76B /* Project object */; +} diff --git a/safari/Junction.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/safari/Junction.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/safari/Junction.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/safari/Junction.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/safari/Junction.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/safari/Junction.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/safari/Junction.xcodeproj/project.xcworkspace/xcuserdata/rbdr.xcuserdatad/UserInterfaceState.xcuserstate b/safari/Junction.xcodeproj/project.xcworkspace/xcuserdata/rbdr.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..9acc744 Binary files /dev/null and b/safari/Junction.xcodeproj/project.xcworkspace/xcuserdata/rbdr.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/safari/Junction.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcschemes/xcschememanagement.plist b/safari/Junction.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..72da880 --- /dev/null +++ b/safari/Junction.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Junction.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/safari/Junction/AppDelegate.swift b/safari/Junction/AppDelegate.swift new file mode 100644 index 0000000..0e990a0 --- /dev/null +++ b/safari/Junction/AppDelegate.swift @@ -0,0 +1,21 @@ +// +// AppDelegate.swift +// Junction +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import Cocoa + +@main +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ notification: Notification) { + // Override point for customization after application launch. + } + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + +} diff --git a/safari/Junction/Assets.xcassets/AccentColor.colorset/Contents.json b/safari/Junction/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/safari/Junction/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/Contents.json b/safari/Junction/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..64dc11e --- /dev/null +++ b/safari/Junction/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "icon_16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "icon_16x16@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "icon_32x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "icon_32x32@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "icon_128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "icon_128x128@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "icon_256x256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "icon_256x256@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "icon_512x512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "icon_512x512@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 0000000..0bcb999 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 0000000..a45aa17 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 0000000..737d986 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 0000000..b748f7b Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 0000000..59d8be3 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 0000000..2f37b07 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 0000000..b748f7b Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 0000000..b0cf195 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 0000000..2f37b07 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 0000000..f056447 Binary files /dev/null and b/safari/Junction/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/safari/Junction/Assets.xcassets/Contents.json b/safari/Junction/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/safari/Junction/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/Junction/Assets.xcassets/LargeIcon.imageset/Contents.json b/safari/Junction/Assets.xcassets/LargeIcon.imageset/Contents.json new file mode 100644 index 0000000..a19a549 --- /dev/null +++ b/safari/Junction/Assets.xcassets/LargeIcon.imageset/Contents.json @@ -0,0 +1,20 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/Junction/Base.lproj/Main.html b/safari/Junction/Base.lproj/Main.html new file mode 100644 index 0000000..081cc41 --- /dev/null +++ b/safari/Junction/Base.lproj/Main.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + Junction Icon +

You can turn on Junction’s extension in Safari Extensions preferences.

+

Junction’s extension is currently on. You can turn it off in Safari Extensions preferences.

+

Junction’s extension is currently off. You can turn it on in Safari Extensions preferences.

+ + + diff --git a/safari/Junction/Base.lproj/Main.storyboard b/safari/Junction/Base.lproj/Main.storyboard new file mode 100644 index 0000000..6de6cf1 --- /dev/null +++ b/safari/Junction/Base.lproj/Main.storyboard @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/safari/Junction/Junction.entitlements b/safari/Junction/Junction.entitlements new file mode 100644 index 0000000..625af03 --- /dev/null +++ b/safari/Junction/Junction.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + + diff --git a/safari/Junction/Resources/Icon.png b/safari/Junction/Resources/Icon.png new file mode 100644 index 0000000..f056447 Binary files /dev/null and b/safari/Junction/Resources/Icon.png differ diff --git a/safari/Junction/Resources/Script.js b/safari/Junction/Resources/Script.js new file mode 100644 index 0000000..f551e6b --- /dev/null +++ b/safari/Junction/Resources/Script.js @@ -0,0 +1,22 @@ +function show(enabled, useSettingsInsteadOfPreferences) { + if (useSettingsInsteadOfPreferences) { + document.getElementsByClassName('state-on')[0].innerText = "Junction’s extension is currently on. You can turn it off in the Extensions section of Safari Settings."; + document.getElementsByClassName('state-off')[0].innerText = "Junction’s extension is currently off. You can turn it on in the Extensions section of Safari Settings."; + document.getElementsByClassName('state-unknown')[0].innerText = "You can turn on Junction’s extension in the Extensions section of Safari Settings."; + document.getElementsByClassName('open-preferences')[0].innerText = "Quit and Open Safari Settings…"; + } + + if (typeof enabled === "boolean") { + document.body.classList.toggle(`state-on`, enabled); + document.body.classList.toggle(`state-off`, !enabled); + } else { + document.body.classList.remove(`state-on`); + document.body.classList.remove(`state-off`); + } +} + +function openPreferences() { + webkit.messageHandlers.controller.postMessage("open-preferences"); +} + +document.querySelector("button.open-preferences").addEventListener("click", openPreferences); diff --git a/safari/Junction/Resources/Style.css b/safari/Junction/Resources/Style.css new file mode 100644 index 0000000..cbde9e6 --- /dev/null +++ b/safari/Junction/Resources/Style.css @@ -0,0 +1,45 @@ +* { + -webkit-user-select: none; + -webkit-user-drag: none; + cursor: default; +} + +:root { + color-scheme: light dark; + + --spacing: 20px; +} + +html { + height: 100%; +} + +body { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + gap: var(--spacing); + margin: 0 calc(var(--spacing) * 2); + height: 100%; + + font: -apple-system-short-body; + text-align: center; +} + +body:not(.state-on, .state-off) :is(.state-on, .state-off) { + display: none; +} + +body.state-on :is(.state-off, .state-unknown) { + display: none; +} + +body.state-off :is(.state-on, .state-unknown) { + display: none; +} + +button { + font-size: 1em; +} diff --git a/safari/Junction/ViewController.swift b/safari/Junction/ViewController.swift new file mode 100644 index 0000000..91f4596 --- /dev/null +++ b/safari/Junction/ViewController.swift @@ -0,0 +1,57 @@ +// +// ViewController.swift +// Junction +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import Cocoa +import SafariServices +import WebKit + +let extensionBundleIdentifier = "systems.tranquil.Junction.Extension" + +class ViewController: NSViewController, WKNavigationDelegate, WKScriptMessageHandler { + + @IBOutlet var webView: WKWebView! + + override func viewDidLoad() { + super.viewDidLoad() + + self.webView.navigationDelegate = self + + self.webView.configuration.userContentController.add(self, name: "controller") + + self.webView.loadFileURL(Bundle.main.url(forResource: "Main", withExtension: "html")!, allowingReadAccessTo: Bundle.main.resourceURL!) + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in + guard let state = state, error == nil else { + // Insert code to inform the user that something went wrong. + return + } + + DispatchQueue.main.async { + if #available(macOS 13, *) { + webView.evaluateJavaScript("show(\(state.isEnabled), true)") + } else { + webView.evaluateJavaScript("show(\(state.isEnabled), false)") + } + } + } + } + + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { + if (message.body as! String != "open-preferences") { + return; + } + + SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in + DispatchQueue.main.async { + NSApplication.shared.terminate(nil) + } + } + } + +} diff --git a/safari/JunctionTests/JunctionTests.swift b/safari/JunctionTests/JunctionTests.swift new file mode 100644 index 0000000..f1e1774 --- /dev/null +++ b/safari/JunctionTests/JunctionTests.swift @@ -0,0 +1,36 @@ +// +// JunctionTests.swift +// JunctionTests +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import XCTest +@testable import Junction + +final class JunctionTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/safari/JunctionUITests/JunctionUITests.swift b/safari/JunctionUITests/JunctionUITests.swift new file mode 100644 index 0000000..f973f37 --- /dev/null +++ b/safari/JunctionUITests/JunctionUITests.swift @@ -0,0 +1,41 @@ +// +// JunctionUITests.swift +// JunctionUITests +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import XCTest + +final class JunctionUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/safari/JunctionUITests/JunctionUITestsLaunchTests.swift b/safari/JunctionUITests/JunctionUITestsLaunchTests.swift new file mode 100644 index 0000000..3f11944 --- /dev/null +++ b/safari/JunctionUITests/JunctionUITestsLaunchTests.swift @@ -0,0 +1,32 @@ +// +// JunctionUITestsLaunchTests.swift +// JunctionUITests +// +// Created by Ruben Beltran del Rio on 9/13/23. +// + +import XCTest + +final class JunctionUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +}