From 1b4541a5c79e96848952f49f2013e3553c510406 Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Tue, 29 Nov 2022 09:44:46 -0500 Subject: [PATCH] remove registry icon --- config/settings.yml | 1 - src/Handler/Package/V0/Info.hs | 17 ++--------------- src/Settings.hs | 2 -- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/config/settings.yml b/config/settings.yml index 7a2a33c..f3d4114 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -36,7 +36,6 @@ tor-port: "_env:TOR_PORT:447" static-bin-dir: "_env:STATIC_BIN:/usr/local/bin/" error-log-root: "_env:ERROR_LOG_ROOT:/var/log/registry/" marketplace-name: "_env:MARKETPLACE_NAME:CHANGE ME" -icon-path: "_env:ICON_PATH:/var/www/html/resources" max-eos-version: "_env:MAX_VERSION:0.3.3.0" run-migration: "_env:RUN_MIGRATION:false" diff --git a/src/Handler/Package/V0/Info.hs b/src/Handler/Package/V0/Info.hs index 15d6365..7efcff3 100644 --- a/src/Handler/Package/V0/Info.hs +++ b/src/Handler/Package/V0/Info.hs @@ -6,19 +6,13 @@ import Foundation (Handler, RegistryCtx (..)) import Handler.Util (tickleMAU) import Model (Category (..), EntityField (..)) import Settings (AppSettings (..)) -import Startlude (Generic, Show, Text, pure, ($), (.), (<$>), MonadIO (liftIO), decodeUtf8, Maybe) +import Startlude (Generic, Show, Text, pure, ($), (.), (<$>)) import Yesod (ToContent (..), ToTypedContent (..), YesodPersist (runDB), getsYesod) import Yesod.Core.Types (JSONResponse (..)) -import System.FilePath (()) -import Data.ByteString (readFile) -import System.Directory (doesFileExist) -import Data.Maybe (Maybe(..)) - data InfoRes = InfoRes { name :: !Text , categories :: ![Text] - , icon :: Maybe Text -- base64 } deriving (Show, Generic) instance ToJSON InfoRes @@ -31,17 +25,10 @@ instance ToTypedContent InfoRes where getInfoR :: Handler (JSONResponse InfoRes) getInfoR = do name <- getsYesod $ marketplaceName . appSettings - iconFile <- getsYesod $ ( "icon") . iconPath . appSettings - existingIcon <- liftIO $ doesFileExist iconFile - icon <- if existingIcon - then do - icon' <- liftIO $ readFile iconFile - pure $ Just $ decodeUtf8 icon' - else pure $ Nothing allCategories <- runDB $ select $ do cats <- from $ table @Category orderBy [asc (cats ^. CategoryPriority)] pure cats tickleMAU - pure $ JSONResponse $ InfoRes name (categoryName . entityVal <$> allCategories) icon + pure $ JSONResponse $ InfoRes name (categoryName . entityVal <$> allCategories) diff --git a/src/Settings.hs b/src/Settings.hs index dc90d84..b8278f0 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -73,7 +73,6 @@ data AppSettings = AppSettings -- behind a reverse proxy. , appShouldLogAll :: !Bool -- ^ Should all log messages be displayed? - , iconPath :: !FilePath , errorLogRoot :: !FilePath , marketplaceName :: !Text , maxEosVersion :: !Version @@ -110,7 +109,6 @@ instance FromJSON AppSettings where appPort <- o .: "port" appShouldLogAll <- o .:? "should-log-all" .!= False errorLogRoot <- o .: "error-log-root" - iconPath <- o .: "icon-path" marketplaceName <- o .: "marketplace-name" maxEosVersion <- o .: "max-eos-version" registryHostname <- o .: "registry-hostname"