mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
remove registry icon
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user