mirror of
https://github.com/osnr/TabFS.git
synced 2024-05-01 13:32:44 +02:00
trying to just run straight from sandbox instead of xpc -- kinda works! blocked on libfuse
This commit is contained in:
parent
a465ad6a8f
commit
33e5911cb2
|
@ -713,19 +713,24 @@ async function onMessage(req) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function tryConnect() {
|
function tryConnect() {
|
||||||
|
console.log('start tryConnect');
|
||||||
port = chrome.runtime.connectNative('com.rsnous.tabfs');
|
port = chrome.runtime.connectNative('com.rsnous.tabfs');
|
||||||
|
console.log('start tryConnect - did connectNative');
|
||||||
port.onMessage.addListener(onMessage);
|
port.onMessage.addListener(onMessage);
|
||||||
port.onDisconnect.addListener(p => {console.log('disconnect', p)});
|
port.onDisconnect.addListener(p => {console.log('disconnect', p)});
|
||||||
|
|
||||||
|
console.log('tryConnect - about to sNM');
|
||||||
// Safari is very weird -- it has this native app that we have to talk to,
|
// Safari is very weird -- it has this native app that we have to talk to,
|
||||||
// so we poke that app to wake it up, get it to start the TabFS process,
|
// so we poke that app to wake it up, get it to start the TabFS process,
|
||||||
// and get it to start calling us whenever TabFS wants to do an FS call.
|
// and get it to start calling us whenever TabFS wants to do an FS call.
|
||||||
// Is there a better way to do this?
|
// Is there a better way to do this?
|
||||||
if (chrome.runtime.getURL('/').startsWith('safari-web-extension://')) { // Safari-only
|
if (chrome.runtime.getURL('/').startsWith('safari-web-extension://')) { // Safari-only
|
||||||
chrome.runtime.sendNativeMessage('com.rsnous.tabfs', {op: 'safari_did_connect'}, function(resp) {
|
chrome.runtime.sendNativeMessage('com.rsnous.tabfs', {op: 'safari_did_connect'}, function(resp) {
|
||||||
|
console.log('didConnect resp');
|
||||||
console.log(resp);
|
console.log(resp);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log('tryConnect - did sNM');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TESTING) {
|
if (!TESTING) {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import SafariServices.SFSafariApplication
|
import SafariServices.SFSafariApplication
|
||||||
|
import os.log
|
||||||
|
|
||||||
let extensionBundleIdentifier = "com.rsnous.TabFS-Extension"
|
let extensionBundleIdentifier = "com.rsnous.TabFS-Extension"
|
||||||
|
|
||||||
|
@ -24,6 +25,9 @@ class FSProcessManager {
|
||||||
func start() {
|
func start() {
|
||||||
fs = Process()
|
fs = Process()
|
||||||
fs.executableURL = URL(fileURLWithPath: "/Users/osnr/Code/tabfs/fs/tabfs")
|
fs.executableURL = URL(fileURLWithPath: "/Users/osnr/Code/tabfs/fs/tabfs")
|
||||||
|
|
||||||
|
os_log(.default, "url: %{public}@", fs.executableURL as! NSURL)
|
||||||
|
|
||||||
fs.arguments = []
|
fs.arguments = []
|
||||||
|
|
||||||
let inputPipe = Pipe(), outputPipe = Pipe()
|
let inputPipe = Pipe(), outputPipe = Pipe()
|
||||||
|
@ -34,7 +38,7 @@ class FSProcessManager {
|
||||||
|
|
||||||
fsInput = inputPipe.fileHandleForWriting
|
fsInput = inputPipe.fileHandleForWriting
|
||||||
fsOutput = outputPipe.fileHandleForReading
|
fsOutput = outputPipe.fileHandleForReading
|
||||||
//
|
//
|
||||||
// SFSafariApplication.dispatchMessage(
|
// SFSafariApplication.dispatchMessage(
|
||||||
// withName: "ToSafari",
|
// withName: "ToSafari",
|
||||||
// toExtensionWithIdentifier: extensionBundleIdentifier,
|
// toExtensionWithIdentifier: extensionBundleIdentifier,
|
||||||
|
|
|
@ -20,10 +20,10 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
||||||
|
|
||||||
if message["op"] as! String == "safari_did_connect" {
|
if message["op"] as! String == "safari_did_connect" {
|
||||||
FSProcessManager.shared.start()
|
FSProcessManager.shared.start()
|
||||||
|
//
|
||||||
let response = NSExtensionItem()
|
// let response = NSExtensionItem()
|
||||||
response.userInfo = [ "message": [ "aResponse to": "moop" ] ]
|
// response.userInfo = [ "message": [ "aResponse to": "moop" ] ]
|
||||||
context.completeRequest(returningItems: [response], completionHandler: nil)
|
// context.completeRequest(returningItems: [response], completionHandler: nil)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.files.user-selected.read-only</key>
|
<key>com.apple.security.files.all</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
Binary file not shown.
|
@ -30,8 +30,8 @@
|
||||||
filePath = "TabFS Extension/FSProcessManager.swift"
|
filePath = "TabFS Extension/FSProcessManager.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "25"
|
startingLineNumber = "26"
|
||||||
endingLineNumber = "25"
|
endingLineNumber = "26"
|
||||||
landmarkName = "start()"
|
landmarkName = "start()"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
uuid = "111CBF7A-E3E9-4303-9961-9812F8781A39"
|
uuid = "111CBF7A-E3E9-4303-9961-9812F8781A39"
|
||||||
shouldBeEnabled = "No"
|
shouldBeEnabled = "Yes"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "TabFS Extension/SafariWebExtensionHandler.swift"
|
filePath = "TabFS Extension/SafariWebExtensionHandler.swift"
|
||||||
|
|
Loading…
Reference in a new issue