mirror of https://github.com/osnr/TabFS.git
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() {
|
||||
console.log('start tryConnect');
|
||||
port = chrome.runtime.connectNative('com.rsnous.tabfs');
|
||||
console.log('start tryConnect - did connectNative');
|
||||
port.onMessage.addListener(onMessage);
|
||||
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,
|
||||
// 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.
|
||||
// Is there a better way to do this?
|
||||
if (chrome.runtime.getURL('/').startsWith('safari-web-extension://')) { // Safari-only
|
||||
chrome.runtime.sendNativeMessage('com.rsnous.tabfs', {op: 'safari_did_connect'}, function(resp) {
|
||||
console.log('didConnect resp');
|
||||
console.log(resp);
|
||||
});
|
||||
}
|
||||
console.log('tryConnect - did sNM');
|
||||
}
|
||||
|
||||
if (!TESTING) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import Foundation
|
||||
|
||||
import SafariServices.SFSafariApplication
|
||||
import os.log
|
||||
|
||||
let extensionBundleIdentifier = "com.rsnous.TabFS-Extension"
|
||||
|
||||
|
@ -24,6 +25,9 @@ class FSProcessManager {
|
|||
func start() {
|
||||
fs = Process()
|
||||
fs.executableURL = URL(fileURLWithPath: "/Users/osnr/Code/tabfs/fs/tabfs")
|
||||
|
||||
os_log(.default, "url: %{public}@", fs.executableURL as! NSURL)
|
||||
|
||||
fs.arguments = []
|
||||
|
||||
let inputPipe = Pipe(), outputPipe = Pipe()
|
||||
|
@ -34,7 +38,7 @@ class FSProcessManager {
|
|||
|
||||
fsInput = inputPipe.fileHandleForWriting
|
||||
fsOutput = outputPipe.fileHandleForReading
|
||||
//
|
||||
//
|
||||
// SFSafariApplication.dispatchMessage(
|
||||
// withName: "ToSafari",
|
||||
// toExtensionWithIdentifier: extensionBundleIdentifier,
|
||||
|
|
|
@ -20,10 +20,10 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|||
|
||||
if message["op"] as! String == "safari_did_connect" {
|
||||
FSProcessManager.shared.start()
|
||||
|
||||
let response = NSExtensionItem()
|
||||
response.userInfo = [ "message": [ "aResponse to": "moop" ] ]
|
||||
context.completeRequest(returningItems: [response], completionHandler: nil)
|
||||
//
|
||||
// let response = NSExtensionItem()
|
||||
// response.userInfo = [ "message": [ "aResponse to": "moop" ] ]
|
||||
// context.completeRequest(returningItems: [response], completionHandler: nil)
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.all</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Binary file not shown.
|
@ -30,8 +30,8 @@
|
|||
filePath = "TabFS Extension/FSProcessManager.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "25"
|
||||
endingLineNumber = "25"
|
||||
startingLineNumber = "26"
|
||||
endingLineNumber = "26"
|
||||
landmarkName = "start()"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
|
@ -56,7 +56,7 @@
|
|||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "111CBF7A-E3E9-4303-9961-9812F8781A39"
|
||||
shouldBeEnabled = "No"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "TabFS Extension/SafariWebExtensionHandler.swift"
|
||||
|
|
Loading…
Reference in New Issue