Compare commits

...

4 commits

Author SHA1 Message Date
b7f9b2d830 zenithinstall - Merge branch 'milestone2' into zenith-install
docker_files updated to support assets in ~/Zenith/assets folder
		installer updated to support assets in ~/Zenith/assets folder
2024-07-12 17:11:48 -04:00
5339ea51c6
Merge pull request 'Fix assets placement for binary' (#91) from rav001 into milestone2
Reviewed-on: #91
2024-07-12 16:34:50 +00:00
f9dfd38613
Merge branch 'milestone2' into rav001 2024-07-12 16:34:36 +00:00
bf452242a5
Fix assets placement for binary 2024-07-12 11:30:12 -05:00
26 changed files with 153 additions and 120 deletions

3
.gitignore vendored
View file

@ -5,3 +5,6 @@ zenith.db
zenith.log zenith.log
zenith.db-shm zenith.db-shm
zenith.db-wal zenith.db-wal
installer/*.tar.gz
installer/*.tar.gz.prev
docker_files/zenith-docker_*

View file

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Upgraded to GHC 9.6.5 - Upgraded to GHC 9.6.5
- Implemented config and data folder
### Fixed ### Fixed

View file

@ -28,9 +28,9 @@ RUN echo "1234\n1234\n" | passwd zenusr
RUN mkdir /home/zenusr/Zenith RUN mkdir /home/zenusr/Zenith
RUN chown zenusr:zenusr -R /home/zenusr/Zenith RUN chown zenusr:zenusr -R /home/zenusr/Zenith
RUN mkdir /home/zenusr/assets #RUN mkdir /home/zenusr/Zenith/assets
COPY assets/* /home/zenusr/assets/ #COPY assets/* /home/zenusr/Zenith/assets/
RUN chown zenusr:zenusr -R /home/zenusr/assets #RUN chown zenusr:zenusr -R /home/zenusr/Zenith/assets
COPY scripts/bash_rc_adm /root/.bashrc COPY scripts/bash_rc_adm /root/.bashrc
COPY scripts/bash_rc_usr /home/zenusr/.bashrc COPY scripts/bash_rc_usr /home/zenusr/.bashrc

View file

@ -1,4 +1,4 @@
#/bin/bash #!/bin/bash
ZVERSION="0.6.0.0" ZVERSION="0.6.0.0"
echo echo
echo "Zenith Full Node Docker Image Setup" echo "Zenith Full Node Docker Image Setup"
@ -27,8 +27,10 @@ if systemctl is-active --quiet docker; then
docker load < zenith-docker_$ZVERSION.tar docker load < zenith-docker_$ZVERSION.tar
echo "... docker image zenith-docker:"$ZVERSION" loaded." echo "... docker image zenith-docker:"$ZVERSION" loaded."
echo "... creating Zenith folder" echo "... creating Zenith folder"
mkdir $HOME/Zenith mkdir -p $HOME/Zenith/assets
echo "... creating default configuration"
cp cfg/zenith.cfg $HOME/Zenith/ cp cfg/zenith.cfg $HOME/Zenith/
cp -r /assets/ $HOME/Zenith/assets
if ! [ -d $HOME/.local/bin ]; then if ! [ -d $HOME/.local/bin ]; then
echo "... creating $HOME/.local/bin folder" echo "... creating $HOME/.local/bin folder"
mkdir -p $HOME/.local/bin mkdir -p $HOME/.local/bin
@ -41,7 +43,7 @@ if systemctl is-active --quiet docker; then
echo "... copying runzenith to $HOME/.local/bin" echo "... copying runzenith to $HOME/.local/bin"
cp cfg/runzenith $HOME/.local/bin/ cp cfg/runzenith $HOME/.local/bin/
if echo $PATH | grep -q $HOME/.local/bin ; then if echo $PATH | grep -q $HOME/.local/bin ; then
echo PATH=$PATH:$HOME/.local/bin' | tee -a $HOME/.bashrc echo PATH=$PATH:$HOME/.local/bin | tee -a $HOME/.bashrc
echo "Reloading configuration ...." echo "Reloading configuration ...."
source $HOME/.bashrc source $HOME/.bashrc
fi fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -15,12 +15,11 @@ else
mkdir -p $HOME/Zenith mkdir -p $HOME/Zenith
echo "Copying default configuration ...." echo "Copying default configuration ...."
cp ./cfg/zenith.cfg $HOME/Zenith/ cp ./cfg/zenith.cfg $HOME/Zenith/
chown -R $USER $HOME/Zenith
echo "Creating assets folder ...." echo "Creating assets folder ...."
mkdir -p $HOME/assets mkdir -p $HOME/Zenith/assets
echo "Transfering assets to new folder ...." echo "Transfering assets to new folder ...."
cp ./assets/* $HOME/assets cp ./assets/* $HOME/Zenith/assets
chown -R $USER $HOME/assets chown -R $USER $HOME/Zenith
echo "Configuring library path ...." echo "Configuring library path ...."
if [ ! grep -q "LD_LIBRARY_PATH" "$HOME/.bashrc" ]; then if [ ! grep -q "LD_LIBRARY_PATH" "$HOME/.bashrc" ]; then
echo 'export LD_LIBRARY_PATH=/usr/local/lib' | tee -a $HOME/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/lib' | tee -a $HOME/.bashrc

View file

@ -25,6 +25,8 @@ import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
import Lens.Micro.TH import Lens.Micro.TH
import Monomer import Monomer
import qualified Monomer.Lens as L import qualified Monomer.Lens as L
import System.Directory (getHomeDirectory)
import System.FilePath ((</>))
import System.Hclip import System.Hclip
import Text.Printf import Text.Printf
import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText) import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText)
@ -141,6 +143,7 @@ data AppModel = AppModel
, _recipientValid :: !Bool , _recipientValid :: !Bool
, _amountValid :: !Bool , _amountValid :: !Bool
, _showId :: !(Maybe T.Text) , _showId :: !(Maybe T.Text)
, _home :: !FilePath
} deriving (Eq, Show) } deriving (Eq, Show)
makeLenses ''AppModel makeLenses ''AppModel
@ -440,7 +443,11 @@ buildUI wenv model = widgetTree
(fromIntegral $ qrCodeWidth qr)) (fromIntegral $ qrCodeWidth qr))
[fitWidth] [fitWidth]
Nothing -> Nothing ->
image_ "./assets/1F928_color.png" [fitEither]) `styleBasic` image_
(T.pack $
(model ^. home) </>
"Zenith/assets/1F928_color.png")
[fitEither]) `styleBasic`
[bgColor white, height 100, width 100] [bgColor white, height 100, width 100]
, filler , filler
] `styleBasic` ] `styleBasic`
@ -504,7 +511,9 @@ buildUI wenv model = widgetTree
, spacer , spacer
, label (showt $ model ^. timer) `styleBasic` [padding 3, textSize 8] , label (showt $ model ^. timer) `styleBasic` [padding 3, textSize 8]
, filler , filler
, image_ "./assets/1F993.png" [fitHeight] `styleBasic` , image_
(T.pack $ (model ^. home) </> "Zenith/assets/1F993.png")
[fitHeight] `styleBasic`
[height 24, width 24] `nodeVisible` [height 24, width 24] `nodeVisible`
(model ^. zebraOn) (model ^. zebraOn)
, label , label
@ -1242,6 +1251,10 @@ txtWrap = wrapText (WrapSettings False True NoFill FillAfterFirst) 32
runZenithGUI :: Config -> IO () runZenithGUI :: Config -> IO ()
runZenithGUI config = do runZenithGUI config = do
homeDir <- try getHomeDirectory :: IO (Either IOError FilePath)
case homeDir of
Left e -> print e
Right hD -> do
let host = c_zebraHost config let host = c_zebraHost config
let port = c_zebraPort config let port = c_zebraPort config
let dbFilePath = c_dbPath config let dbFilePath = c_dbPath config
@ -1260,11 +1273,13 @@ runZenithGUI config = do
walList <- getWallets pool $ zgb_net chainInfo walList <- getWallets pool $ zgb_net chainInfo
accList <- accList <-
if not (null walList) if not (null walList)
then runNoLoggingT $ getAccounts pool $ entityKey $ head walList then runNoLoggingT $
getAccounts pool $ entityKey $ head walList
else return [] else return []
addrList <- addrList <-
if not (null accList) if not (null accList)
then runNoLoggingT $ getAddresses pool $ entityKey $ head accList then runNoLoggingT $
getAddresses pool $ entityKey $ head accList
else return [] else return []
txList <- txList <-
if not (null addrList) if not (null addrList)
@ -1327,7 +1342,8 @@ runZenithGUI config = do
False False
False False
Nothing Nothing
startApp model handleEvent buildUI params hD
startApp model handleEvent buildUI (params hD)
Left e -> do Left e -> do
initDb dbFilePath initDb dbFilePath
let model = let model =
@ -1372,16 +1388,26 @@ runZenithGUI config = do
False False
False False
Nothing Nothing
startApp model handleEvent buildUI params hD
startApp model handleEvent buildUI (params hD)
where where
params = params hd =
[ appWindowTitle "Zenith - Zcash Full Node Wallet" [ appWindowTitle "Zenith - Zcash Full Node Wallet"
, appWindowState $ MainWindowNormal (1000, 700) , appWindowState $ MainWindowNormal (1000, 700)
, appTheme zenithTheme , appTheme zenithTheme
, appFontDef "Regular" "./assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf" , appFontDef
, appFontDef "Bold" "./assets/Atkinson-Hyperlegible-Bold-102.ttf" "Regular"
, appFontDef "Italic" "./assets/Atkinson-Hyperlegible-Italic-102.ttf" (T.pack $
, appFontDef "Remix" "./assets/remixicon.ttf" hd </>
"Zenith/assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf"
)
, appFontDef
"Bold"
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Bold-102.ttf")
, appFontDef
"Italic"
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Italic-102.ttf")
, appFontDef "Remix" (T.pack $ hd </> "Zenith/assets/remixicon.ttf")
, appDisableAutoScale True , appDisableAutoScale True
, appScaleFactor 2.0 , appScaleFactor 2.0
, appInitEvent AppInit , appInitEvent AppInit

View file

@ -47,6 +47,8 @@ library
, brick , brick
, bytestring , bytestring
, data-default , data-default
, directory
, filepath
, esqueleto , esqueleto
, resource-pool , resource-pool
, binary , binary