@hanzo/browser-extension 1.7.6 → 1.9.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -18
- package/dist/browser-extension/README.md +1 -1
- package/dist/browser-extension/background-firefox.js +4180 -499
- package/dist/browser-extension/background.js +6932 -2419
- package/dist/browser-extension/browser-control.js +652 -18
- package/dist/browser-extension/chrome/background.js +6932 -2419
- package/dist/browser-extension/chrome/content-script.js +1642 -123
- package/dist/browser-extension/chrome/icon128.png +0 -0
- package/dist/browser-extension/chrome/icon16.png +0 -0
- package/dist/browser-extension/chrome/icon48.png +0 -0
- package/dist/browser-extension/chrome/manifest.json +20 -11
- package/dist/browser-extension/chrome/popup.css +352 -110
- package/dist/browser-extension/chrome/popup.html +159 -48
- package/dist/browser-extension/chrome/popup.js +1418 -46
- package/dist/browser-extension/chrome/sidebar.css +772 -156
- package/dist/browser-extension/chrome/sidebar.html +268 -85
- package/dist/browser-extension/chrome/sidebar.js +25846 -84
- package/dist/browser-extension/cli.js +2 -2
- package/dist/browser-extension/content-script.js +1642 -123
- package/dist/browser-extension/firefox/background.js +4180 -499
- package/dist/browser-extension/firefox/content-script.js +1642 -123
- package/dist/browser-extension/firefox/icon128.png +0 -0
- package/dist/browser-extension/firefox/icon16.png +0 -0
- package/dist/browser-extension/firefox/icon48.png +0 -0
- package/dist/browser-extension/firefox/manifest.json +24 -13
- package/dist/browser-extension/firefox/popup.css +352 -110
- package/dist/browser-extension/firefox/popup.html +159 -48
- package/dist/browser-extension/firefox/popup.js +1418 -46
- package/dist/browser-extension/firefox/sidebar.css +772 -156
- package/dist/browser-extension/firefox/sidebar.html +268 -85
- package/dist/browser-extension/firefox/sidebar.js +25846 -84
- package/dist/browser-extension/icon128.png +0 -0
- package/dist/browser-extension/icon16.png +0 -0
- package/dist/browser-extension/icon48.png +0 -0
- package/dist/browser-extension/manifest.json +20 -11
- package/dist/browser-extension/package.json +1 -1
- package/dist/browser-extension/popup.js +1418 -46
- package/dist/browser-extension/safari/Info.plist +3 -3
- package/dist/browser-extension/safari/background.js +6932 -2419
- package/dist/browser-extension/safari/content-script.js +1642 -123
- package/dist/browser-extension/safari/icon128.png +0 -0
- package/dist/browser-extension/safari/icon16.png +0 -0
- package/dist/browser-extension/safari/icon48.png +0 -0
- package/dist/browser-extension/safari/popup.css +352 -110
- package/dist/browser-extension/safari/popup.html +159 -48
- package/dist/browser-extension/safari/popup.js +1418 -46
- package/dist/browser-extension/safari/sidebar.css +772 -156
- package/dist/browser-extension/safari/sidebar.html +268 -85
- package/dist/browser-extension/safari/sidebar.js +25846 -84
- package/dist/browser-extension/sidebar.js +25846 -84
- package/dist/browser-extension/webgpu-ai.js +78 -5
- package/images/icon128.png +0 -0
- package/images/icon16.png +0 -0
- package/images/icon48.png +0 -0
- package/manifest.json +7 -2
- package/package.json +27 -10
- package/src/chat-widget.tsx +96 -0
- package/src/gui-primitives.tsx +116 -0
- package/src/icon128.png +0 -0
- package/src/icon16.png +0 -0
- package/src/icon32.png +0 -0
- package/src/icon48.png +0 -0
- package/src/manifest-firefox.json +23 -12
- package/src/manifest.json +19 -10
- package/src/package.json +1 -1
- package/src/popup.css +352 -110
- package/src/popup.html +159 -48
- package/src/popup.js +196 -0
- package/src/sidebar.css +772 -156
- package/src/sidebar.html +268 -85
- package/src/sidebar.js +885 -0
- package/.github/workflows/docs.yml +0 -44
- package/.github/workflows/release.yml +0 -55
- package/README.md +0 -126
- package/dist/browser-extension/ai-worker.js +0 -30
- package/dist/browser-extension/cdp-bridge-server.js +0 -444
- package/dist/browser-extension/chrome/icon32.png +0 -0
- package/dist/browser-extension/firefox/icon32.png +0 -0
- package/dist/browser-extension/hanzo-browser-extension-firefox-1.1.0.zip +0 -0
- package/dist/browser-extension/icon32.png +0 -0
- package/dist/browser-extension/popup.css +0 -468
- package/dist/browser-extension/popup.html +0 -191
- package/dist/browser-extension/safari/icon32.png +0 -0
- package/dist/browser-extension/sidebar.css +0 -718
- package/dist/browser-extension/sidebar.html +0 -184
- package/dist/cdp-bridge-server.js +0 -411
- package/dist/hanzo-ai-chrome-1.7.2.zip +0 -0
- package/dist/hanzo-ai-chrome-1.7.3.zip +0 -0
- package/dist/hanzo-ai-firefox-1.7.2.zip +0 -0
- package/dist/hanzo-ai-firefox-1.7.3.zip +0 -0
- package/dist/safari/Hanzo AI/Hanzo AI.xcodeproj/project.pbxproj +0 -1047
- package/dist/safari/Hanzo AI/Hanzo AI.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/universal-icon-1024@1x.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/Contents.json +0 -6
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +0 -21
- package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/LargeIcon.imageset/icon128.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Resources/Base.lproj/Main.html +0 -20
- package/dist/safari/Hanzo AI/Shared (App)/Resources/Icon.png +0 -0
- package/dist/safari/Hanzo AI/Shared (App)/Resources/Script.js +0 -24
- package/dist/safari/Hanzo AI/Shared (App)/Resources/Style.css +0 -61
- package/dist/safari/Hanzo AI/Shared (App)/ViewController.swift +0 -81
- package/dist/safari/Hanzo AI/Shared (Extension)/SafariWebExtensionHandler.swift +0 -42
- package/dist/safari/Hanzo AI/iOS (App)/AppDelegate.swift +0 -24
- package/dist/safari/Hanzo AI/iOS (App)/Base.lproj/LaunchScreen.storyboard +0 -36
- package/dist/safari/Hanzo AI/iOS (App)/Base.lproj/Main.storyboard +0 -38
- package/dist/safari/Hanzo AI/iOS (App)/Info.plist +0 -27
- package/dist/safari/Hanzo AI/iOS (App)/SceneDelegate.swift +0 -18
- package/dist/safari/Hanzo AI/iOS (Extension)/Info.plist +0 -13
- package/dist/safari/Hanzo AI/macOS (App)/AppDelegate.swift +0 -21
- package/dist/safari/Hanzo AI/macOS (App)/Base.lproj/Main.storyboard +0 -124
- package/dist/safari/Hanzo AI/macOS (App)/Info.plist +0 -8
- package/dist/safari/Hanzo AI/macOS (Extension)/Info.plist +0 -13
- package/docs/_config.yml +0 -13
- package/docs/_layouts/default.html +0 -435
- package/docs/index.md +0 -54
- package/hanzo-ai-chrome-v1.7.6.zip +0 -0
- package/hanzo-ai-firefox-v1.7.6.zip +0 -0
- package/install-extension.sh +0 -75
- package/test/claude-integration.test.ts +0 -251
- package/test/server-frameworks-edge-cases.test.ts +0 -145
- package/test/server-frameworks.test.ts +0 -395
- package/test-cdp-connection.js +0 -140
- package/tsconfig.json +0 -19
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"images" : [
|
|
3
|
-
{
|
|
4
|
-
"size" : "1024x1024",
|
|
5
|
-
"idiom" : "universal",
|
|
6
|
-
"filename" : "universal-icon-1024@1x.png",
|
|
7
|
-
"platform" : "ios"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"size" : "1024x1024",
|
|
11
|
-
"appearances" : [
|
|
12
|
-
{
|
|
13
|
-
"appearance" : "luminosity",
|
|
14
|
-
"value" : "dark"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"idiom" : "universal",
|
|
18
|
-
"filename" : "universal-icon-1024@1x.png",
|
|
19
|
-
"platform" : "ios"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"size" : "1024x1024",
|
|
23
|
-
"appearances" : [
|
|
24
|
-
{
|
|
25
|
-
"appearance" : "luminosity",
|
|
26
|
-
"value" : "tinted"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"idiom" : "universal",
|
|
30
|
-
"filename" : "universal-icon-1024@1x.png",
|
|
31
|
-
"platform" : "ios"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"size" : "16x16",
|
|
35
|
-
"idiom" : "mac",
|
|
36
|
-
"filename" : "mac-icon-16@1x.png",
|
|
37
|
-
"scale" : "1x"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"size" : "16x16",
|
|
41
|
-
"idiom" : "mac",
|
|
42
|
-
"filename" : "mac-icon-16@2x.png",
|
|
43
|
-
"scale" : "2x"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"size" : "32x32",
|
|
47
|
-
"idiom" : "mac",
|
|
48
|
-
"filename" : "mac-icon-32@1x.png",
|
|
49
|
-
"scale" : "1x"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"size" : "32x32",
|
|
53
|
-
"idiom" : "mac",
|
|
54
|
-
"filename" : "mac-icon-32@2x.png",
|
|
55
|
-
"scale" : "2x"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"size" : "128x128",
|
|
59
|
-
"idiom" : "mac",
|
|
60
|
-
"filename" : "mac-icon-128@1x.png",
|
|
61
|
-
"scale" : "1x"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"size" : "128x128",
|
|
65
|
-
"idiom" : "mac",
|
|
66
|
-
"filename" : "mac-icon-128@2x.png",
|
|
67
|
-
"scale" : "2x"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"size" : "256x256",
|
|
71
|
-
"idiom" : "mac",
|
|
72
|
-
"filename" : "mac-icon-256@1x.png",
|
|
73
|
-
"scale" : "1x"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"size" : "256x256",
|
|
77
|
-
"idiom" : "mac",
|
|
78
|
-
"filename" : "mac-icon-256@2x.png",
|
|
79
|
-
"scale" : "2x"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"size" : "512x512",
|
|
83
|
-
"idiom" : "mac",
|
|
84
|
-
"filename" : "mac-icon-512@1x.png",
|
|
85
|
-
"scale" : "1x"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"size" : "512x512",
|
|
89
|
-
"idiom" : "mac",
|
|
90
|
-
"filename" : "mac-icon-512@2x.png",
|
|
91
|
-
"scale" : "2x"
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"info" : {
|
|
95
|
-
"version" : 1,
|
|
96
|
-
"author" : "xcode"
|
|
97
|
-
}
|
|
98
|
-
}
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png
DELETED
|
Binary file
|
package/dist/safari/Hanzo AI/Shared (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png
DELETED
|
Binary file
|
|
Binary file
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"images" : [
|
|
3
|
-
{
|
|
4
|
-
"idiom" : "universal",
|
|
5
|
-
"scale" : "1x",
|
|
6
|
-
"filename" : "icon128.png"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"idiom" : "universal",
|
|
10
|
-
"scale" : "2x"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"idiom" : "universal",
|
|
14
|
-
"scale" : "3x"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"info" : {
|
|
18
|
-
"version" : 1,
|
|
19
|
-
"author" : "xcode"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
|
|
6
|
-
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
8
|
-
|
|
9
|
-
<link rel="stylesheet" href="../Style.css">
|
|
10
|
-
<script src="../Script.js" defer></script>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<img src="../Icon.png" width="128" height="128" alt="Hanzo AI Icon">
|
|
14
|
-
<p class="platform-ios">You can turn on Hanzo AI’s Safari extension in Settings.</p>
|
|
15
|
-
<p class="platform-mac state-unknown">You can turn on Hanzo AI’s extension in Safari Extensions preferences.</p>
|
|
16
|
-
<p class="platform-mac state-on">Hanzo AI’s extension is currently on. You can turn it off in Safari Extensions preferences.</p>
|
|
17
|
-
<p class="platform-mac state-off">Hanzo AI’s extension is currently off. You can turn it on in Safari Extensions preferences.</p>
|
|
18
|
-
<button class="platform-mac open-preferences">Quit and Open Safari Extensions Preferences…</button>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
Binary file
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
function show(platform, enabled, useSettingsInsteadOfPreferences) {
|
|
2
|
-
document.body.classList.add(`platform-${platform}`);
|
|
3
|
-
|
|
4
|
-
if (useSettingsInsteadOfPreferences) {
|
|
5
|
-
document.getElementsByClassName('platform-mac state-on')[0].innerText = "Hanzo AI’s extension is currently on. You can turn it off in the Extensions section of Safari Settings.";
|
|
6
|
-
document.getElementsByClassName('platform-mac state-off')[0].innerText = "Hanzo AI’s extension is currently off. You can turn it on in the Extensions section of Safari Settings.";
|
|
7
|
-
document.getElementsByClassName('platform-mac state-unknown')[0].innerText = "You can turn on Hanzo AI’s extension in the Extensions section of Safari Settings.";
|
|
8
|
-
document.getElementsByClassName('platform-mac open-preferences')[0].innerText = "Quit and Open Safari Settings…";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (typeof enabled === "boolean") {
|
|
12
|
-
document.body.classList.toggle(`state-on`, enabled);
|
|
13
|
-
document.body.classList.toggle(`state-off`, !enabled);
|
|
14
|
-
} else {
|
|
15
|
-
document.body.classList.remove(`state-on`);
|
|
16
|
-
document.body.classList.remove(`state-off`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function openPreferences() {
|
|
21
|
-
webkit.messageHandlers.controller.postMessage("open-preferences");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
document.querySelector("button.open-preferences").addEventListener("click", openPreferences);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
* {
|
|
2
|
-
-webkit-user-select: none;
|
|
3
|
-
-webkit-user-drag: none;
|
|
4
|
-
cursor: default;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:root {
|
|
8
|
-
color-scheme: light dark;
|
|
9
|
-
|
|
10
|
-
--spacing: 20px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
html {
|
|
14
|
-
height: 100%;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
body {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
|
|
23
|
-
gap: var(--spacing);
|
|
24
|
-
margin: 0 calc(var(--spacing) * 2);
|
|
25
|
-
height: 100%;
|
|
26
|
-
|
|
27
|
-
font: -apple-system-short-body;
|
|
28
|
-
text-align: center;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
body:not(.platform-mac, .platform-ios) :is(.platform-mac, .platform-ios) {
|
|
32
|
-
display: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body.platform-ios .platform-mac {
|
|
36
|
-
display: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
body.platform-mac .platform-ios {
|
|
40
|
-
display: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
body.platform-ios .platform-mac {
|
|
44
|
-
display: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
body:not(.state-on, .state-off) :is(.state-on, .state-off) {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
body.state-on :is(.state-off, .state-unknown) {
|
|
52
|
-
display: none;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
body.state-off :is(.state-on, .state-unknown) {
|
|
56
|
-
display: none;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
button {
|
|
60
|
-
font-size: 1em;
|
|
61
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// ViewController.swift
|
|
3
|
-
// Shared (App)
|
|
4
|
-
//
|
|
5
|
-
// Created by z on 05/03/2026.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import WebKit
|
|
9
|
-
|
|
10
|
-
#if os(iOS)
|
|
11
|
-
import UIKit
|
|
12
|
-
typealias PlatformViewController = UIViewController
|
|
13
|
-
#elseif os(macOS)
|
|
14
|
-
import Cocoa
|
|
15
|
-
import SafariServices
|
|
16
|
-
typealias PlatformViewController = NSViewController
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
let extensionBundleIdentifier = "ai.hanzo.browser-extension.Extension"
|
|
20
|
-
|
|
21
|
-
class ViewController: PlatformViewController, WKNavigationDelegate, WKScriptMessageHandler {
|
|
22
|
-
|
|
23
|
-
@IBOutlet var webView: WKWebView!
|
|
24
|
-
|
|
25
|
-
override func viewDidLoad() {
|
|
26
|
-
super.viewDidLoad()
|
|
27
|
-
|
|
28
|
-
self.webView.navigationDelegate = self
|
|
29
|
-
|
|
30
|
-
#if os(iOS)
|
|
31
|
-
self.webView.scrollView.isScrollEnabled = false
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
self.webView.configuration.userContentController.add(self, name: "controller")
|
|
35
|
-
|
|
36
|
-
self.webView.loadFileURL(Bundle.main.url(forResource: "Main", withExtension: "html")!, allowingReadAccessTo: Bundle.main.resourceURL!)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
|
40
|
-
#if os(iOS)
|
|
41
|
-
webView.evaluateJavaScript("show('ios')")
|
|
42
|
-
#elseif os(macOS)
|
|
43
|
-
webView.evaluateJavaScript("show('mac')")
|
|
44
|
-
|
|
45
|
-
SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in
|
|
46
|
-
guard let state = state, error == nil else {
|
|
47
|
-
// Insert code to inform the user that something went wrong.
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
DispatchQueue.main.async {
|
|
52
|
-
if #available(macOS 13, *) {
|
|
53
|
-
webView.evaluateJavaScript("show('mac', \(state.isEnabled), true)")
|
|
54
|
-
} else {
|
|
55
|
-
webView.evaluateJavaScript("show('mac', \(state.isEnabled), false)")
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
#endif
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
|
63
|
-
#if os(macOS)
|
|
64
|
-
if (message.body as! String != "open-preferences") {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
|
|
69
|
-
guard error == nil else {
|
|
70
|
-
// Insert code to inform the user that something went wrong.
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
DispatchQueue.main.async {
|
|
75
|
-
NSApp.terminate(self)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
#endif
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// SafariWebExtensionHandler.swift
|
|
3
|
-
// Shared (Extension)
|
|
4
|
-
//
|
|
5
|
-
// Created by z on 05/03/2026.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import SafariServices
|
|
9
|
-
import os.log
|
|
10
|
-
|
|
11
|
-
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|
12
|
-
|
|
13
|
-
func beginRequest(with context: NSExtensionContext) {
|
|
14
|
-
let request = context.inputItems.first as? NSExtensionItem
|
|
15
|
-
|
|
16
|
-
let profile: UUID?
|
|
17
|
-
if #available(iOS 17.0, macOS 14.0, *) {
|
|
18
|
-
profile = request?.userInfo?[SFExtensionProfileKey] as? UUID
|
|
19
|
-
} else {
|
|
20
|
-
profile = request?.userInfo?["profile"] as? UUID
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let message: Any?
|
|
24
|
-
if #available(iOS 15.0, macOS 11.0, *) {
|
|
25
|
-
message = request?.userInfo?[SFExtensionMessageKey]
|
|
26
|
-
} else {
|
|
27
|
-
message = request?.userInfo?["message"]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)", String(describing: message), profile?.uuidString ?? "none")
|
|
31
|
-
|
|
32
|
-
let response = NSExtensionItem()
|
|
33
|
-
if #available(iOS 15.0, macOS 11.0, *) {
|
|
34
|
-
response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ]
|
|
35
|
-
} else {
|
|
36
|
-
response.userInfo = [ "message": [ "echo": message ] ]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
context.completeRequest(returningItems: [ response ], completionHandler: nil)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// AppDelegate.swift
|
|
3
|
-
// iOS (App)
|
|
4
|
-
//
|
|
5
|
-
// Created by z on 05/03/2026.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import UIKit
|
|
9
|
-
|
|
10
|
-
@main
|
|
11
|
-
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
12
|
-
|
|
13
|
-
var window: UIWindow?
|
|
14
|
-
|
|
15
|
-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
16
|
-
// Override point for customization after application launch.
|
|
17
|
-
return true
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
|
21
|
-
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19085" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
|
3
|
-
<dependencies>
|
|
4
|
-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19082"/>
|
|
5
|
-
<capability name="Image references" minToolsVersion="12.0"/>
|
|
6
|
-
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
7
|
-
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
8
|
-
</dependencies>
|
|
9
|
-
<scenes>
|
|
10
|
-
<!--View Controller-->
|
|
11
|
-
<scene sceneID="EHf-IW-A2E">
|
|
12
|
-
<objects>
|
|
13
|
-
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
|
14
|
-
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
|
15
|
-
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
16
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
17
|
-
<subviews>
|
|
18
|
-
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6HG-Um-bch">
|
|
19
|
-
<rect key="frame" x="142" y="385" width="128" height="128"/>
|
|
20
|
-
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
|
21
|
-
<imageReference key="image" image="LargeIcon"/>
|
|
22
|
-
</imageView>
|
|
23
|
-
</subviews>
|
|
24
|
-
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
|
25
|
-
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
|
26
|
-
</view>
|
|
27
|
-
</viewController>
|
|
28
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
29
|
-
</objects>
|
|
30
|
-
<point key="canvasLocation" x="53" y="375"/>
|
|
31
|
-
</scene>
|
|
32
|
-
</scenes>
|
|
33
|
-
<resources>
|
|
34
|
-
<image name="LargeIcon" width="128" height="128"/>
|
|
35
|
-
</resources>
|
|
36
|
-
</document>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
|
3
|
-
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
|
4
|
-
<dependencies>
|
|
5
|
-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
|
|
6
|
-
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
7
|
-
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
8
|
-
</dependencies>
|
|
9
|
-
<scenes>
|
|
10
|
-
<!--View Controller-->
|
|
11
|
-
<scene sceneID="tne-QT-ifu">
|
|
12
|
-
<objects>
|
|
13
|
-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
|
|
14
|
-
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
|
15
|
-
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
16
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
17
|
-
<subviews>
|
|
18
|
-
<wkWebView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RDB-ib-igF">
|
|
19
|
-
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
20
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
21
|
-
<wkWebViewConfiguration key="configuration">
|
|
22
|
-
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
|
|
23
|
-
<wkPreferences key="preferences"/>
|
|
24
|
-
</wkWebViewConfiguration>
|
|
25
|
-
</wkWebView>
|
|
26
|
-
</subviews>
|
|
27
|
-
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
|
28
|
-
</view>
|
|
29
|
-
<connections>
|
|
30
|
-
<outlet property="webView" destination="RDB-ib-igF" id="avx-RC-qRB"/>
|
|
31
|
-
</connections>
|
|
32
|
-
</viewController>
|
|
33
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
|
34
|
-
</objects>
|
|
35
|
-
<point key="canvasLocation" x="53" y="375"/>
|
|
36
|
-
</scene>
|
|
37
|
-
</scenes>
|
|
38
|
-
</document>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SFSafariWebExtensionConverterVersion</key>
|
|
6
|
-
<string>26.2</string>
|
|
7
|
-
<key>UIApplicationSceneManifest</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>UIApplicationSupportsMultipleScenes</key>
|
|
10
|
-
<false/>
|
|
11
|
-
<key>UISceneConfigurations</key>
|
|
12
|
-
<dict>
|
|
13
|
-
<key>UIWindowSceneSessionRoleApplication</key>
|
|
14
|
-
<array>
|
|
15
|
-
<dict>
|
|
16
|
-
<key>UISceneConfigurationName</key>
|
|
17
|
-
<string>Default Configuration</string>
|
|
18
|
-
<key>UISceneDelegateClassName</key>
|
|
19
|
-
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
|
20
|
-
<key>UISceneStoryboardFile</key>
|
|
21
|
-
<string>Main</string>
|
|
22
|
-
</dict>
|
|
23
|
-
</array>
|
|
24
|
-
</dict>
|
|
25
|
-
</dict>
|
|
26
|
-
</dict>
|
|
27
|
-
</plist>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// SceneDelegate.swift
|
|
3
|
-
// iOS (App)
|
|
4
|
-
//
|
|
5
|
-
// Created by z on 05/03/2026.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import UIKit
|
|
9
|
-
|
|
10
|
-
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
11
|
-
|
|
12
|
-
var window: UIWindow?
|
|
13
|
-
|
|
14
|
-
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
|
15
|
-
guard let _ = (scene as? UIWindowScene) else { return }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>NSExtension</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>NSExtensionPointIdentifier</key>
|
|
8
|
-
<string>com.apple.Safari.web-extension</string>
|
|
9
|
-
<key>NSExtensionPrincipalClass</key>
|
|
10
|
-
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</plist>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// AppDelegate.swift
|
|
3
|
-
// macOS (App)
|
|
4
|
-
//
|
|
5
|
-
// Created by z on 05/03/2026.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Cocoa
|
|
9
|
-
|
|
10
|
-
@main
|
|
11
|
-
class AppDelegate: NSObject, NSApplicationDelegate {
|
|
12
|
-
|
|
13
|
-
func applicationDidFinishLaunching(_ notification: Notification) {
|
|
14
|
-
// Override point for customization after application launch.
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
|
18
|
-
return true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|