Compare commits
10 Commits
b246b68924
...
broken-tea
| Author | SHA1 | Date | |
|---|---|---|---|
| 305693a697 | |||
| 685d8b9cd3 | |||
| 29403b961a | |||
| a3ee50174b | |||
| 88149088f0 | |||
| 5becded0a2 | |||
| a25a7cc635 | |||
| 9c510359b5 | |||
| 85a86d1239 | |||
| ff33d22a32 |
@@ -4,11 +4,11 @@ go 1.26.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
charm.land/bubbles/v2 v2.0.0
|
charm.land/bubbles/v2 v2.0.0
|
||||||
charm.land/bubbletea/v2 v2.0.1
|
charm.land/bubbletea/v2 v2.0.2
|
||||||
charm.land/lipgloss/v2 v2.0.0
|
charm.land/lipgloss/v2 v2.0.1
|
||||||
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0
|
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0
|
||||||
github.com/caddyserver/certmagic v0.25.2
|
github.com/caddyserver/certmagic v0.25.2
|
||||||
github.com/charmbracelet/colorprofile v0.4.2
|
github.com/charmbracelet/colorprofile v0.4.3
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/libdns/cloudflare v0.2.2
|
github.com/libdns/cloudflare v0.2.2
|
||||||
github.com/stretchr/testify v1.11.1
|
github.com/stretchr/testify v1.11.1
|
||||||
@@ -47,7 +47,7 @@ require (
|
|||||||
golang.org/x/mod v0.33.0 // indirect
|
golang.org/x/mod v0.33.0 // indirect
|
||||||
golang.org/x/net v0.50.0 // indirect
|
golang.org/x/net v0.50.0 // indirect
|
||||||
golang.org/x/sync v0.19.0 // indirect
|
golang.org/x/sync v0.19.0 // indirect
|
||||||
golang.org/x/sys v0.41.0 // indirect
|
golang.org/x/sys v0.42.0 // indirect
|
||||||
golang.org/x/text v0.34.0 // indirect
|
golang.org/x/text v0.34.0 // indirect
|
||||||
golang.org/x/tools v0.42.0 // indirect
|
golang.org/x/tools v0.42.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ charm.land/bubbles/v2 v2.0.0 h1:tE3eK/pHjmtrDiRdoC9uGNLgpopOd8fjhEe31B/ai5s=
|
|||||||
charm.land/bubbles/v2 v2.0.0/go.mod h1:rCHoleP2XhU8um45NTuOWBPNVHxnkXKTiZqcclL/qOI=
|
charm.land/bubbles/v2 v2.0.0/go.mod h1:rCHoleP2XhU8um45NTuOWBPNVHxnkXKTiZqcclL/qOI=
|
||||||
charm.land/bubbletea/v2 v2.0.1 h1:B8e9zzK7x9JJ+XvHGF4xnYu9Xa0E0y0MyggY6dbaCfQ=
|
charm.land/bubbletea/v2 v2.0.1 h1:B8e9zzK7x9JJ+XvHGF4xnYu9Xa0E0y0MyggY6dbaCfQ=
|
||||||
charm.land/bubbletea/v2 v2.0.1/go.mod h1:3LRff2U4WIYXy7MTxfbAQ+AdfM3D8Xuvz2wbsOD9OHQ=
|
charm.land/bubbletea/v2 v2.0.1/go.mod h1:3LRff2U4WIYXy7MTxfbAQ+AdfM3D8Xuvz2wbsOD9OHQ=
|
||||||
|
charm.land/bubbletea/v2 v2.0.2 h1:4CRtRnuZOdFDTWSff9r8QFt/9+z6Emubz3aDMnf/dx0=
|
||||||
|
charm.land/bubbletea/v2 v2.0.2/go.mod h1:3LRff2U4WIYXy7MTxfbAQ+AdfM3D8Xuvz2wbsOD9OHQ=
|
||||||
charm.land/lipgloss/v2 v2.0.0 h1:sd8N/B3x892oiOjFfBQdXBQp3cAkvjGaU5TvVZC3ivo=
|
charm.land/lipgloss/v2 v2.0.0 h1:sd8N/B3x892oiOjFfBQdXBQp3cAkvjGaU5TvVZC3ivo=
|
||||||
charm.land/lipgloss/v2 v2.0.0/go.mod h1:w6SnmsBFBmEFBodiEDurGS/sdUY/u1+v72DqUzc6J14=
|
charm.land/lipgloss/v2 v2.0.0/go.mod h1:w6SnmsBFBmEFBodiEDurGS/sdUY/u1+v72DqUzc6J14=
|
||||||
|
charm.land/lipgloss/v2 v2.0.1 h1:6Xzrn49+Py1Um5q/wZG1gWgER2+7dUyZ9XMEufqPSys=
|
||||||
|
charm.land/lipgloss/v2 v2.0.1/go.mod h1:KjPle2Qd3YmvP1KL5OMHiHysGcNwq6u83MUjYkFvEkM=
|
||||||
code.pfad.fr/check v1.1.0 h1:GWvjdzhSEgHvEHe2uJujDcpmZoySKuHQNrZMfzfO0bE=
|
code.pfad.fr/check v1.1.0 h1:GWvjdzhSEgHvEHe2uJujDcpmZoySKuHQNrZMfzfO0bE=
|
||||||
code.pfad.fr/check v1.1.0/go.mod h1:NiUH13DtYsb7xp5wll0U4SXx7KhXQVCtRgdC96IPfoM=
|
code.pfad.fr/check v1.1.0/go.mod h1:NiUH13DtYsb7xp5wll0U4SXx7KhXQVCtRgdC96IPfoM=
|
||||||
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0 h1:3xszIhck4wo9CoeRq9vnkar4PhY7kz9QrR30qj2XszA=
|
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0 h1:3xszIhck4wo9CoeRq9vnkar4PhY7kz9QrR30qj2XszA=
|
||||||
@@ -20,6 +24,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
|
|||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/charmbracelet/colorprofile v0.4.2 h1:BdSNuMjRbotnxHSfxy+PCSa4xAmz7szw70ktAtWRYrY=
|
github.com/charmbracelet/colorprofile v0.4.2 h1:BdSNuMjRbotnxHSfxy+PCSa4xAmz7szw70ktAtWRYrY=
|
||||||
github.com/charmbracelet/colorprofile v0.4.2/go.mod h1:0rTi81QpwDElInthtrQ6Ni7cG0sDtwAd4C4le060fT8=
|
github.com/charmbracelet/colorprofile v0.4.2/go.mod h1:0rTi81QpwDElInthtrQ6Ni7cG0sDtwAd4C4le060fT8=
|
||||||
|
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
|
||||||
|
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 h1:eyFRbAmexyt43hVfeyBofiGSEmJ7krjLOYt/9CF5NKA=
|
github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 h1:eyFRbAmexyt43hVfeyBofiGSEmJ7krjLOYt/9CF5NKA=
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8/go.mod h1:SQpCTRNBtzJkwku5ye4S3HEuthAlGy2n9VXZnWkEW98=
|
github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8/go.mod h1:SQpCTRNBtzJkwku5ye4S3HEuthAlGy2n9VXZnWkEW98=
|
||||||
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
||||||
@@ -124,6 +130,8 @@ golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
|||||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
||||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
|
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||||
|
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg=
|
golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg=
|
||||||
golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM=
|
golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM=
|
||||||
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
||||||
|
|||||||
+3
-2
@@ -11,8 +11,9 @@
|
|||||||
"digest"
|
"digest"
|
||||||
],
|
],
|
||||||
"automerge": true,
|
"automerge": true,
|
||||||
"baseBranchPatterns": [
|
"groupName": "all-dependencies",
|
||||||
"staging"
|
"matchPackageNames": [
|
||||||
|
"*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ type interaction struct {
|
|||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
mode types.InteractiveMode
|
mode types.InteractiveMode
|
||||||
programMu sync.Mutex
|
programMu sync.Mutex
|
||||||
|
width int
|
||||||
|
height int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *interaction) SetMode(m types.InteractiveMode) {
|
func (i *interaction) SetMode(m types.InteractiveMode) {
|
||||||
@@ -71,8 +73,14 @@ func (i *interaction) Send(message string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (i *interaction) SetWH(w, h int) {
|
func (i *interaction) SetWH(w, h int) {
|
||||||
if i.program != nil {
|
i.programMu.Lock()
|
||||||
i.program.Send(tea.WindowSizeMsg{
|
i.width = w
|
||||||
|
i.height = h
|
||||||
|
prog := i.program
|
||||||
|
i.programMu.Unlock()
|
||||||
|
|
||||||
|
if prog != nil {
|
||||||
|
prog.Send(tea.WindowSizeMsg{
|
||||||
Width: w,
|
Width: w,
|
||||||
Height: h,
|
Height: h,
|
||||||
})
|
})
|
||||||
@@ -158,8 +166,13 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *interaction) Redraw() {
|
func (i *interaction) Redraw() {
|
||||||
if i.program != nil {
|
i.programMu.Lock()
|
||||||
i.program.Send(tea.WindowSizeMsg{})
|
prog := i.program
|
||||||
|
w, h := i.width, i.height
|
||||||
|
i.programMu.Unlock()
|
||||||
|
|
||||||
|
if prog != nil {
|
||||||
|
prog.Send(tea.WindowSizeMsg{Width: w, Height: h})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,18 +259,29 @@ func (i *interaction) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i.programMu.Lock()
|
i.programMu.Lock()
|
||||||
i.program = tea.NewProgram(
|
w, h := i.width, i.height
|
||||||
m,
|
i.programMu.Unlock()
|
||||||
|
|
||||||
|
opts := []tea.ProgramOption{
|
||||||
tea.WithInput(i.channel),
|
tea.WithInput(i.channel),
|
||||||
tea.WithOutput(i.channel),
|
tea.WithOutput(i.channel),
|
||||||
tea.WithColorProfile(colorprofile.TrueColor),
|
tea.WithColorProfile(colorprofile.TrueColor),
|
||||||
tea.WithoutSignals(),
|
tea.WithoutSignals(),
|
||||||
tea.WithoutSignalHandler(),
|
tea.WithoutSignalHandler(),
|
||||||
tea.WithFPS(30),
|
tea.WithFPS(30),
|
||||||
)
|
tea.WithEnvironment([]string{"TERM=xterm-256color", "COLORTERM=truecolor"}),
|
||||||
|
}
|
||||||
|
if w > 0 && h > 0 {
|
||||||
|
opts = append(opts, tea.WithWindowSize(w, h))
|
||||||
|
}
|
||||||
|
|
||||||
|
prog := tea.NewProgram(m, opts...)
|
||||||
|
|
||||||
|
i.programMu.Lock()
|
||||||
|
i.program = prog
|
||||||
i.programMu.Unlock()
|
i.programMu.Unlock()
|
||||||
|
|
||||||
_, err := i.program.Run()
|
_, err := prog.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Cannot close tea: %s \n", err)
|
log.Printf("Cannot close tea: %s \n", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-1
@@ -232,13 +232,34 @@ func (s *session) handleWindowChange(req *ssh.Request) error {
|
|||||||
return req.Reply(true, nil)
|
return req.Reply(true, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *session) handlePtyReq(req *ssh.Request) error {
|
||||||
|
var ptyPayload struct {
|
||||||
|
Term string
|
||||||
|
Width uint32
|
||||||
|
Height uint32
|
||||||
|
PxW uint32
|
||||||
|
PxH uint32
|
||||||
|
Modes string
|
||||||
|
}
|
||||||
|
if err := ssh.Unmarshal(req.Payload, &ptyPayload); err == nil {
|
||||||
|
if ptyPayload.Width > 0 && ptyPayload.Height > 0 {
|
||||||
|
s.interaction.SetWH(int(ptyPayload.Width), int(ptyPayload.Height))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return req.Reply(true, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *session) HandleGlobalRequest(GlobalRequest <-chan *ssh.Request) error {
|
func (s *session) HandleGlobalRequest(GlobalRequest <-chan *ssh.Request) error {
|
||||||
for req := range GlobalRequest {
|
for req := range GlobalRequest {
|
||||||
switch req.Type {
|
switch req.Type {
|
||||||
case "shell", "pty-req":
|
case "shell":
|
||||||
if err := req.Reply(true, nil); err != nil {
|
if err := req.Reply(true, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
case "pty-req":
|
||||||
|
if err := s.handlePtyReq(req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
case "window-change":
|
case "window-change":
|
||||||
if err := s.handleWindowChange(req); err != nil {
|
if err := s.handleWindowChange(req); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user