-
Notifications
You must be signed in to change notification settings - Fork 16
Added safari extension template #26
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
Open
donato-fiore
wants to merge
7
commits into
theos:master
Choose a base branch
from
donato-fiore:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a744370
Added safari extension template
donato-fiore 098f345
Update ios/safari_extension/SafariWebExtensionHandler.swift
donato-fiore c4104f6
Update ios/safari_extension/Makefile
donato-fiore 11fead5
Update ios/safari_extension/Resources/manifest.json
donato-fiore 2188ce9
Update files to match kirb's requests
donato-fiore 6253e6a
Add safari extension
donato-fiore e36a7d1
Adapt control.pl to support desired CFBundleIdentifier format and adj…
L1ghtmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
TARGET := iphone:clang:latest:15.0 | ||
INSTALL_TARGET_PROCESSES = @@PROJECTNAME@@ | ||
|
||
include @@THEOS@@/makefiles/common.mk | ||
|
||
APPEX_NAME = @@PROJECTNAME@@ | ||
|
||
@@PROJECTNAME@@_FILES = SafariWebExtensionHandler.swift | ||
@@PROJECTNAME@@_INSTALL_PATH = /Applications/@@PARENTPROJECTNAME@@.app/PlugIns | ||
@@PROJECTNAME@@_FRAMEWORKS = SafariServices | ||
|
||
include $(THEOS_MAKE_PATH)/appex.mk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name "iphone/safari_extension" | ||
constrain "control" to package | ||
constrain "theos" to link_theos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
NIC->variable("PARENTPROJECTNAME") = ""; | ||
|
||
while(NIC->variable("PARENTPROJECTNAME") eq "") { | ||
NIC->variable("PARENTPROJECTNAME") = NIC->prompt("PROJ", "Name of parent project (required)"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be worth specifying that by parent project name we mean an application name |
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>@@PROJECTNAME@@</string> | ||
<key>CFBundleExecutable</key> | ||
<string>@@PROJECTNAME@@</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.@@USER@@.@@PARENTPROJECTNAME@@.app.@@PROJECTNAME@@</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>@@PROJECTNAME@@</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>MinimumOSVersion</key> | ||
<string>15.0</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>SafariWebExtensionHandler</string> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.Safari.web-extension</string> | ||
</dict> | ||
</dict> | ||
</plist> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"manifest_version": 2, | ||
"default_locale": "en", | ||
|
||
"name": "@@PROJECTNAME@@", | ||
"description": "An awesome safari extension!", | ||
"version": "1.0", | ||
|
||
"icons": { | ||
"48": "images/icon-48.png", | ||
"96": "images/icon-96.png", | ||
"128": "images/icon-128.png", | ||
"256": "images/icon-256.png", | ||
"512": "images/icon-512.png" | ||
}, | ||
|
||
"browser_action": { | ||
"default_popup": "popup.html", | ||
"default_icon": { | ||
"16": "images/toolbar-icon-16.png", | ||
"19": "images/toolbar-icon-19.png", | ||
"32": "images/toolbar-icon-32.png", | ||
"38": "images/toolbar-icon-38.png", | ||
"48": "images/toolbar-icon-48.png", | ||
"72": "images/toolbar-icon-72.png" | ||
} | ||
}, | ||
|
||
"permissions": [ ] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:root { | ||
color-schema: light dark; | ||
} | ||
|
||
body { | ||
min-width: 100px; | ||
padding: 10px; | ||
|
||
font-family: system-ui; | ||
text-align: center; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="popup.css"> | ||
<script type="module" src="popup.js"></script> | ||
</head> | ||
<body> | ||
<h1 id="date"></h1> | ||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let dateElement = document.getElementById('date'); | ||
|
||
dateElement.textContent = new Date(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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] | ||
Logger().log("Received message from browser.runtime.sendNativeMessage: \(String(describing: message))") | ||
|
||
let response = NSExtensionItem() | ||
response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ] | ||
|
||
context.completeRequest(returningItems: [response], completionHandler: nil) | ||
} | ||
|
||
} |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.