mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
update safari sub-repo to latest extension manifest
This commit is contained in:
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
@@ -2,23 +2,23 @@ function show(platform, enabled, useSettingsInsteadOfPreferences) {
|
||||
document.body.classList.add(`platform-${platform}`);
|
||||
|
||||
if (useSettingsInsteadOfPreferences) {
|
||||
document.getElementsByClassName('platform-mac state-on')[0].innerText = 'BetterSEQTA+’s extension is currently on. You can turn it off in the Extensions section of Safari Settings.';
|
||||
document.getElementsByClassName('platform-mac state-off')[0].innerText = 'BetterSEQTA+’s extension is currently off. You can turn it on in the Extensions section of Safari Settings.';
|
||||
document.getElementsByClassName('platform-mac state-unknown')[0].innerText = 'You can turn on BetterSEQTA+’s extension in the Extensions section of Safari Settings.';
|
||||
document.getElementsByClassName('platform-mac open-preferences')[0].innerText = 'Quit and Open Safari Settings…';
|
||||
document.getElementsByClassName('platform-mac state-on')[0].innerText = "BetterSEQTA+’s extension is currently on. You can turn it off in the Extensions section of Safari Settings.";
|
||||
document.getElementsByClassName('platform-mac state-off')[0].innerText = "BetterSEQTA+’s extension is currently off. You can turn it on in the Extensions section of Safari Settings.";
|
||||
document.getElementsByClassName('platform-mac state-unknown')[0].innerText = "You can turn on BetterSEQTA+’s extension in the Extensions section of Safari Settings.";
|
||||
document.getElementsByClassName('platform-mac 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);
|
||||
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');
|
||||
document.body.classList.remove(`state-on`);
|
||||
document.body.classList.remove(`state-off`);
|
||||
}
|
||||
}
|
||||
|
||||
function openPreferences() {
|
||||
webkit.messageHandlers.controller.postMessage('open-preferences');
|
||||
webkit.messageHandlers.controller.postMessage("open-preferences");
|
||||
}
|
||||
|
||||
document.querySelector('button.open-preferences').addEventListener('click', openPreferences);
|
||||
document.querySelector("button.open-preferences").addEventListener("click", openPreferences);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ViewController.swift
|
||||
// Shared (App)
|
||||
//
|
||||
// Created by Seth Burkart on 10/9/2023.
|
||||
// Created by Seth Burkart on 3/12/2023.
|
||||
//
|
||||
|
||||
import WebKit
|
||||
@@ -62,7 +62,7 @@ class ViewController: PlatformViewController, WKNavigationDelegate, WKScriptMess
|
||||
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
#if os(macOS)
|
||||
if (message.body as! String != "open-preferences") {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
|
||||
@@ -72,7 +72,7 @@ class ViewController: PlatformViewController, WKNavigationDelegate, WKScriptMess
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
NSApplication.shared.terminate(nil)
|
||||
NSApp.terminate(self)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,25 +2,37 @@
|
||||
// SafariWebExtensionHandler.swift
|
||||
// Shared (Extension)
|
||||
//
|
||||
// Created by Seth Burkart on 10/9/2023.
|
||||
// Created by Seth Burkart on 3/12/2023.
|
||||
//
|
||||
|
||||
import SafariServices
|
||||
import os.log
|
||||
|
||||
let SFExtensionMessageKey = "message"
|
||||
|
||||
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 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: [ "Response to": message ] ]
|
||||
response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ]
|
||||
|
||||
context.completeRequest(returningItems: [response], completionHandler: nil)
|
||||
context.completeRequest(returningItems: [ response ], completionHandler: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// AppDelegate.swift
|
||||
// iOS (App)
|
||||
//
|
||||
// Created by Seth Burkart on 10/9/2023.
|
||||
// Created by Seth Burkart on 3/12/2023.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SFSafariWebExtensionConverterVersion</key>
|
||||
<string>14.3.1</string>
|
||||
<string>15.0</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SceneDelegate.swift
|
||||
// iOS (App)
|
||||
//
|
||||
// Created by Seth Burkart on 10/9/2023.
|
||||
// Created by Seth Burkart on 3/12/2023.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// AppDelegate.swift
|
||||
// macOS (App)
|
||||
//
|
||||
// Created by Seth Burkart on 10/9/2023.
|
||||
// Created by Seth Burkart on 3/12/2023.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SFSafariWebExtensionConverterVersion</key>
|
||||
<string>14.3.1</string>
|
||||
<string>15.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Reference in New Issue
Block a user