Skip to content

Commit

Permalink
Fix blank screen issue for quarantined mac app
Browse files Browse the repository at this point in the history
Some lazy IO (getting command line args) was being called from in
obelisk to set up the snap server. For some reason, this blocked
indefinitely if the app was launched with quarantine flags. We now set
the config directly and don't try to get command line args.
  • Loading branch information
tomsmalley committed Aug 29, 2019
1 parent 9d68723 commit 1d0e5d5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .obelisk/impl/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"owner": "obsidiansystems",
"repo": "obelisk",
"branch": "ts-extras",
"rev": "06e78f6be8de0060f1816a718444903b707b859b",
"sha256": "1lais75yw295gmqclfw26xckmlr0rr6hzc9aiylplpyvsp49c48a"
"rev": "2c77ec13f9355151b8d0f18b92226aff81384c8f",
"sha256": "0rw56d6yf6hjp7sf6h7jaw0bsdmsnh1wj03pc8s1hhrnv7s2hfna"
}
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ in obApp // rec {
/usr/bin/codesign --sign "$signer" "$tmpdir/${macAppName}.dmg"
mv "$tmpdir/${macAppName}.dmg" .
# Quarantine it (uncomment for testing app quarantining)
# xattr -w com.apple.quarantine "00a3;5d4331e1;Safari;1AE3D17F-B83D-4ADA-94EA-219A44467959" Pact.dmg
'';

server = args@{ hostName, adminEmail, routeHost, enableHttps, version }:
Expand Down
1 change: 1 addition & 0 deletions mac/mac.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ executable macApp
, servant
, servant-server
, snap-core
, snap-server
, temporary
, text
, wai-cors
Expand Down
9 changes: 7 additions & 2 deletions mac/src-bin/mac.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import qualified Network.Socket as Socket
import qualified Network.Wai.Handler.Warp as Warp
import qualified Network.Wai.Middleware.Cors as Wai
import qualified Servant.Server as Servant
import qualified Snap.Http.Server as Snap
import qualified System.Directory as Directory
import qualified System.Environment as Env
import qualified System.FilePath as FilePath
Expand Down Expand Up @@ -131,10 +132,14 @@ main = redirectPipes [stdout, stderr] $ do
route :: (IsString s, Semigroup s) => s
route = "http://localhost:" <> fromString (show port) <> "/"
-- We don't need to serve anything useful here under Frontend
b = runBackend' (Just $ fromIntegral port) staticAssets backend $ Frontend blank blank
b = runBackendWith
(runSnapWithConfig $ Snap.setPort (fromIntegral port) Snap.defaultConfig)
staticAssets
backend
(Frontend blank blank)
fileOpenedMVar :: MVar T.Text <- liftIO newEmptyMVar
-- Run the backend in a forked thread, and run jsaddle-wkwebview on the main thread
putStrLn "Starting backend"
putStrLn $ "Starting backend on port: " <> show port
Async.withAsync b $ \_ -> do
liftIO $ putStrLn "Starting jsaddle"
let handleOpen f = try (T.readFile f) >>= \case
Expand Down

0 comments on commit 1d0e5d5

Please sign in to comment.