1
0
Fork 0

Fixed formatting

This commit is contained in:
マリウス 2023-01-01 22:05:50 -05:00
parent fc51e5794c
commit 5acfb29c3a
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
4 changed files with 55 additions and 27 deletions

View File

@ -47,14 +47,20 @@ func (sys *System) Connect(sysURL string) error {
return err
}
privateKeyBytes := x509.MarshalPKCS1PrivateKey(privateKey)
privateKeyPEM := string(pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: privateKeyBytes}))
privateKeyPEM := string(pem.EncodeToMemory(&pem.Block{
Type: "PRIVATE KEY",
Bytes: privateKeyBytes,
}))
// Public key
publicKeyBytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)
if err != nil {
return err
}
publicKeyPEM := string(pem.EncodeToMemory(&pem.Block{Type: "PUBLIC KEY", Bytes: publicKeyBytes}))
publicKeyPEM := string(pem.EncodeToMemory(&pem.Block{
Type: "PUBLIC KEY",
Bytes: publicKeyBytes,
}))
// Client ID
uuidV4, err := uuid.NewRandom()

View File

@ -31,7 +31,11 @@ func getLines(s string) (lines []string, widest int) {
}
// PlaceOverlay places fg on top of bg.
func PlaceOverlay(x, y int, fg, bg string, shadow bool, opts ...WhitespaceOption) string {
func PlaceOverlay(
x, y int,
fg, bg string,
shadow bool, opts ...WhitespaceOption,
) string {
fgLines, fgWidth := getLines(fg)
bgLines, bgWidth := getLines(bg)
bgHeight := len(bgLines)

View File

@ -24,19 +24,19 @@ type Theme struct {
Blurred lipgloss.Style
}
Item struct {
Focused lipgloss.Style
Blurred lipgloss.Style
Focused lipgloss.Style
Blurred lipgloss.Style
Selected lipgloss.Style
}
ItemDetail struct {
Focused lipgloss.Style
Blurred lipgloss.Style
Focused lipgloss.Style
Blurred lipgloss.Style
Selected lipgloss.Style
}
}
Post struct {
Author lipgloss.Style
Author lipgloss.Style
Subject lipgloss.Style
}
@ -45,25 +45,41 @@ type Theme struct {
}
}
func New(cfg *config.Config) (*Theme) {
func New(cfg *config.Config) *Theme {
t := new(Theme)
t.PostsList.List.Focused = t.fromConfig(&cfg.Theme.PostsList.List.Focused)
t.PostsList.List.Blurred = t.fromConfig(&cfg.Theme.PostsList.List.Blurred)
t.PostsList.Item.Focused = t.fromConfig(&cfg.Theme.PostsList.Item.Focused)
t.PostsList.Item.Blurred = t.fromConfig(&cfg.Theme.PostsList.Item.Blurred)
t.PostsList.Item.Selected = t.fromConfig(&cfg.Theme.PostsList.Item.Selected)
t.PostsList.ItemDetail.Focused = t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Focused)
t.PostsList.ItemDetail.Blurred = t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Blurred)
t.PostsList.ItemDetail.Selected = t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Selected)
t.DialogBox.Window.Focused = t.fromConfig(&cfg.Theme.DialogBox.Window.Focused)
t.DialogBox.Window.Blurred = t.fromConfig(&cfg.Theme.DialogBox.Window.Blurred)
t.DialogBox.Titlebar.Focused = t.fromConfig(&cfg.Theme.DialogBox.Titlebar.Focused)
t.DialogBox.Titlebar.Blurred = t.fromConfig(&cfg.Theme.DialogBox.Titlebar.Blurred)
t.DialogBox.Bottombar = t.fromConfig(&cfg.Theme.DialogBox.Bottombar)
t.Post.Author = t.fromConfig(&cfg.Theme.Post.Author)
t.Post.Subject = t.fromConfig(&cfg.Theme.Post.Subject)
t.Reply.Author = t.fromConfig(&cfg.Theme.Reply.Author)
t.PostsList.List.Focused =
t.fromConfig(&cfg.Theme.PostsList.List.Focused)
t.PostsList.List.Blurred =
t.fromConfig(&cfg.Theme.PostsList.List.Blurred)
t.PostsList.Item.Focused =
t.fromConfig(&cfg.Theme.PostsList.Item.Focused)
t.PostsList.Item.Blurred =
t.fromConfig(&cfg.Theme.PostsList.Item.Blurred)
t.PostsList.Item.Selected =
t.fromConfig(&cfg.Theme.PostsList.Item.Selected)
t.PostsList.ItemDetail.Focused =
t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Focused)
t.PostsList.ItemDetail.Blurred =
t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Blurred)
t.PostsList.ItemDetail.Selected =
t.fromConfig(&cfg.Theme.PostsList.ItemDetail.Selected)
t.DialogBox.Window.Focused =
t.fromConfig(&cfg.Theme.DialogBox.Window.Focused)
t.DialogBox.Window.Blurred =
t.fromConfig(&cfg.Theme.DialogBox.Window.Blurred)
t.DialogBox.Titlebar.Focused =
t.fromConfig(&cfg.Theme.DialogBox.Titlebar.Focused)
t.DialogBox.Titlebar.Blurred =
t.fromConfig(&cfg.Theme.DialogBox.Titlebar.Blurred)
t.DialogBox.Bottombar =
t.fromConfig(&cfg.Theme.DialogBox.Bottombar)
t.Post.Author =
t.fromConfig(&cfg.Theme.Post.Author)
t.Post.Subject =
t.fromConfig(&cfg.Theme.Post.Subject)
t.Reply.Author =
t.fromConfig(&cfg.Theme.Reply.Author)
return t
}
@ -77,4 +93,3 @@ func (t *Theme) fromConfig(itemCfg *config.ThemeItemConfig) lipgloss.Style {
Foreground(itemCfg.Foreground).
Background(itemCfg.Background)
}

View File

@ -24,7 +24,10 @@ func (m Model) buildView(cached bool) string {
m.textarea.SetWidth(m.viewcacheTextareaXY[2])
m.textarea.SetHeight(m.viewcacheTextareaXY[3])
return helpers.PlaceOverlay(m.viewcacheTextareaXY[0], m.viewcacheTextareaXY[1], m.textarea.View(), m.viewcache, false)
return helpers.PlaceOverlay(
m.viewcacheTextareaXY[0], m.viewcacheTextareaXY[1],
m.textarea.View(), m.viewcache,
false)
}
m.ctx.Logger.Debugln("View()")