From 1ec210bed137d40a8a6e7db5742d2839d9abc6ff Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Wed, 13 Jan 2021 13:32:29 -0700 Subject: [PATCH] small fixes --- src/Handler/Apps.hs | 13 +++++-------- src/Lib/Types/AppIndex.hs | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Handler/Apps.hs b/src/Handler/Apps.hs index b8b2738..c7261c5 100644 --- a/src/Handler/Apps.hs +++ b/src/Handler/Apps.hs @@ -72,8 +72,8 @@ getEmbassyOsVersion = userAgentOsVersion getAppsManifestR :: Handler TypedContent getAppsManifestR = do osVersion <- getEmbassyOsVersion - appResourceFile <- ( "apps" "apps.yaml") . resourcesDir . appSettings <$> getYesod appsDir <- ( "apps") . resourcesDir . appSettings <$> getYesod + let appResourceFile = appsDir "apps.yaml" manifest <- liftIO (Yaml.decodeFileEither appResourceFile) >>= \case Left e -> do $logError "COULD NOT PARSE APP INDEX! CORRECT IMMEDIATELY!" @@ -94,10 +94,9 @@ getAppsManifestR = do (v, _) <- case mostRecentVersion of Nothing -> notFound Just a -> pure $ unRegisteredAppVersion a - maybeStoreApp <- liftIO $ addFileTimestamp dir ext service v - case maybeStoreApp of - Nothing -> notFound - Just appWithTimestamp -> pure (appId, appWithTimestamp) + liftIO (addFileTimestamp dir ext service v) >>= \case + Nothing -> notFound + Just appWithTimestamp -> pure (appId, appWithTimestamp) getSysR :: Extension "" -> Handler TypedContent getSysR e = do @@ -106,9 +105,7 @@ getSysR e = do getAppManifestR :: AppIdentifier -> Handler TypedContent getAppManifestR appId = do - appSettings' <- appSettings <$> getYesod - let appsDir = ( "apps") . resourcesDir $ appSettings' - let appMgrDir = staticBinDir appSettings' + (appsDir, appMgrDir) <- getsYesod $ (( "apps") . resourcesDir &&& staticBinDir) . appSettings av <- getVersionFromQuery appsDir appExt >>= \case Nothing -> sendResponseStatus status400 ("Specified App Version Not Found" :: Text) Just v -> pure v diff --git a/src/Lib/Types/AppIndex.hs b/src/Lib/Types/AppIndex.hs index bf7a575..b817303 100644 --- a/src/Lib/Types/AppIndex.hs +++ b/src/Lib/Types/AppIndex.hs @@ -12,8 +12,8 @@ import qualified Data.List.NonEmpty as NE import Lib.Types.Emver import Orphans.Emver ( ) -import System.Directory -import Lib.Registry +import System.Directory +import Lib.Registry type AppIdentifier = Text