Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8767f7302 | |||
| 058453ecd8 | |||
| 66bc0d234b | |||
| e55b8afea7 | |||
| e050368b4c | |||
| 5fe540dbf4 | |||
| 3080fb8365 |
@@ -3,32 +3,28 @@ module tunnel_pls
|
|||||||
go 1.26.0
|
go 1.26.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
charm.land/bubbletea/v2 v2.0.0
|
|
||||||
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.1
|
github.com/caddyserver/certmagic v0.25.2
|
||||||
github.com/charmbracelet/bubbles v1.0.0
|
github.com/charmbracelet/bubbles v1.0.0
|
||||||
|
github.com/charmbracelet/bubbletea/v2 v2.0.1
|
||||||
github.com/charmbracelet/lipgloss v1.1.0
|
github.com/charmbracelet/lipgloss v1.1.0
|
||||||
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/muesli/termenv v0.16.0
|
github.com/muesli/termenv v0.16.0
|
||||||
github.com/stretchr/testify v1.11.1
|
github.com/stretchr/testify v1.11.1
|
||||||
golang.org/x/crypto v0.48.0
|
golang.org/x/crypto v0.48.0
|
||||||
google.golang.org/grpc v1.78.0
|
google.golang.org/grpc v1.79.1
|
||||||
google.golang.org/protobuf v1.36.11
|
google.golang.org/protobuf v1.36.11
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/atotto/clipboard v0.1.4 // indirect
|
github.com/atotto/clipboard v0.1.4 // indirect
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
github.com/caddyserver/zerossl v0.1.4 // indirect
|
github.com/caddyserver/zerossl v0.1.5 // indirect
|
||||||
github.com/charmbracelet/bubbletea v1.3.10 // indirect
|
|
||||||
github.com/charmbracelet/colorprofile v0.4.1 // indirect
|
github.com/charmbracelet/colorprofile v0.4.1 // indirect
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 // indirect
|
|
||||||
github.com/charmbracelet/x/ansi v0.11.6 // indirect
|
github.com/charmbracelet/x/ansi v0.11.6 // indirect
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
|
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
|
||||||
github.com/charmbracelet/x/term v0.2.2 // indirect
|
github.com/charmbracelet/x/term v0.2.2 // indirect
|
||||||
github.com/charmbracelet/x/termios v0.1.1 // indirect
|
|
||||||
github.com/charmbracelet/x/windows v0.2.2 // indirect
|
|
||||||
github.com/clipperhouse/displaywidth v0.9.0 // indirect
|
github.com/clipperhouse/displaywidth v0.9.0 // indirect
|
||||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||||
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
|
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
|
||||||
@@ -40,8 +36,8 @@ require (
|
|||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
github.com/mattn/go-runewidth v0.0.19 // indirect
|
||||||
github.com/mholt/acmez/v3 v3.1.4 // indirect
|
github.com/mholt/acmez/v3 v3.1.6 // indirect
|
||||||
github.com/miekg/dns v1.1.69 // indirect
|
github.com/miekg/dns v1.1.72 // indirect
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
@@ -53,12 +49,12 @@ require (
|
|||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/zap v1.27.1 // indirect
|
go.uber.org/zap v1.27.1 // indirect
|
||||||
go.uber.org/zap/exp v0.3.0 // indirect
|
go.uber.org/zap/exp v0.3.0 // indirect
|
||||||
golang.org/x/mod v0.32.0 // indirect
|
golang.org/x/mod v0.33.0 // indirect
|
||||||
golang.org/x/net v0.49.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.41.0 // indirect
|
||||||
golang.org/x/text v0.34.0 // indirect
|
golang.org/x/text v0.34.0 // indirect
|
||||||
golang.org/x/tools v0.41.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
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
charm.land/bubbletea/v2 v2.0.0 h1:p0d6CtWyJXJ9GfzMpUUqbP/XUUhhlk06+vCKWmox1wQ=
|
|
||||||
charm.land/bubbletea/v2 v2.0.0/go.mod h1:3LRff2U4WIYXy7MTxfbAQ+AdfM3D8Xuvz2wbsOD9OHQ=
|
|
||||||
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=
|
||||||
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0/go.mod h1:Weh6ZujgWmT8XxD3Qba7sJ6r5eyUMB9XSWynqdyOoLo=
|
git.fossy.my.id/bagas/tunnel-please-grpc v1.5.0/go.mod h1:Weh6ZujgWmT8XxD3Qba7sJ6r5eyUMB9XSWynqdyOoLo=
|
||||||
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
||||||
@@ -10,8 +8,12 @@ github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3v
|
|||||||
github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E=
|
github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E=
|
||||||
github.com/caddyserver/certmagic v0.25.1 h1:4sIKKbOt5pg6+sL7tEwymE1x2bj6CHr80da1CRRIPbY=
|
github.com/caddyserver/certmagic v0.25.1 h1:4sIKKbOt5pg6+sL7tEwymE1x2bj6CHr80da1CRRIPbY=
|
||||||
github.com/caddyserver/certmagic v0.25.1/go.mod h1:VhyvndxtVton/Fo/wKhRoC46Rbw1fmjvQ3GjHYSQTEY=
|
github.com/caddyserver/certmagic v0.25.1/go.mod h1:VhyvndxtVton/Fo/wKhRoC46Rbw1fmjvQ3GjHYSQTEY=
|
||||||
|
github.com/caddyserver/certmagic v0.25.2 h1:D7xcS7ggX/WEY54x0czj7ioTkmDWKIgxtIi2OcQclUc=
|
||||||
|
github.com/caddyserver/certmagic v0.25.2/go.mod h1:llW/CvsNmza8S6hmsuggsZeiX+uS27dkqY27wDIuBWg=
|
||||||
github.com/caddyserver/zerossl v0.1.4 h1:CVJOE3MZeFisCERZjkxIcsqIH4fnFdlYWnPYeFtBHRw=
|
github.com/caddyserver/zerossl v0.1.4 h1:CVJOE3MZeFisCERZjkxIcsqIH4fnFdlYWnPYeFtBHRw=
|
||||||
github.com/caddyserver/zerossl v0.1.4/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4=
|
github.com/caddyserver/zerossl v0.1.4/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4=
|
||||||
|
github.com/caddyserver/zerossl v0.1.5 h1:dkvOjBAEEtY6LIGAHei7sw2UgqSD6TrWweXpV7lvEvE=
|
||||||
|
github.com/caddyserver/zerossl v0.1.5/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4=
|
||||||
github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
|
github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
|
||||||
github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
|
github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
|
||||||
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
|
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
|
||||||
@@ -20,20 +22,14 @@ github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco
|
|||||||
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
|
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
||||||
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/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
||||||
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
|
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
|
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
|
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
|
||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20241212170349-ad4b7ae0f25f h1:UytXHv0UxnsDFmL/7Z9Q5SBYPwSuRLXHbwx+6LycZ2w=
|
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ=
|
||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20241212170349-ad4b7ae0f25f/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
|
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
|
||||||
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
||||||
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
|
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
|
||||||
github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY=
|
|
||||||
github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo=
|
|
||||||
github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM=
|
|
||||||
github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k=
|
|
||||||
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
|
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
|
||||||
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=
|
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=
|
||||||
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
|
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
|
||||||
@@ -74,8 +70,12 @@ github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byF
|
|||||||
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||||
github.com/mholt/acmez/v3 v3.1.4 h1:DyzZe/RnAzT3rpZj/2Ii5xZpiEvvYk3cQEN/RmqxwFQ=
|
github.com/mholt/acmez/v3 v3.1.4 h1:DyzZe/RnAzT3rpZj/2Ii5xZpiEvvYk3cQEN/RmqxwFQ=
|
||||||
github.com/mholt/acmez/v3 v3.1.4/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
|
github.com/mholt/acmez/v3 v3.1.4/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
|
||||||
|
github.com/mholt/acmez/v3 v3.1.6 h1:eGVQNObP0pBN4sxqrXeg7MYqTOWyoiYpQqITVWlrevk=
|
||||||
|
github.com/mholt/acmez/v3 v3.1.6/go.mod h1:5nTPosTGosLxF3+LU4ygbgMRFDhbAVpqMI4+a4aHLBY=
|
||||||
github.com/miekg/dns v1.1.69 h1:Kb7Y/1Jo+SG+a2GtfoFUfDkG//csdRPwRLkCsxDG9Sc=
|
github.com/miekg/dns v1.1.69 h1:Kb7Y/1Jo+SG+a2GtfoFUfDkG//csdRPwRLkCsxDG9Sc=
|
||||||
github.com/miekg/dns v1.1.69/go.mod h1:7OyjD9nEba5OkqQ/hB4fy3PIoxafSZJtducccIelz3g=
|
github.com/miekg/dns v1.1.69/go.mod h1:7OyjD9nEba5OkqQ/hB4fy3PIoxafSZJtducccIelz3g=
|
||||||
|
github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI=
|
||||||
|
github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs=
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
|
||||||
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
||||||
@@ -126,8 +126,12 @@ golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM
|
|||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
||||||
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
|
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
|
||||||
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
|
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
|
||||||
|
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
|
||||||
|
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
|
||||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||||
|
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
|
||||||
|
golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
|
||||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
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.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
@@ -140,12 +144,18 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
|||||||
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
||||||
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
||||||
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
||||||
|
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
|
||||||
|
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
|
||||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b h1:Mv8VFug0MP9e5vUxfBcE3vUkV6CImK3cMNMIDFjmzxU=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b h1:Mv8VFug0MP9e5vUxfBcE3vUkV6CImK3cMNMIDFjmzxU=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
|
||||||
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
|
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
|
||||||
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
|
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
|
||||||
|
google.golang.org/grpc v1.79.0 h1:6/+EFlxsMyoSbHbBoEDx94n/Ycx/bi0IhJ5Qh7b7LaA=
|
||||||
|
google.golang.org/grpc v1.79.0/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||||
|
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
|
||||||
|
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package interaction
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *model) comingSoonUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
func (m *model) comingSoonUpdate(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||||
_ = msg
|
|
||||||
m.showingComingSoon = false
|
m.showingComingSoon = false
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *model) comingSoonView() string {
|
func (m *model) comingSoonView() string {
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,22 +17,24 @@ func (m *model) handleCommandSelection(item commandItem) (tea.Model, tea.Cmd) {
|
|||||||
m.editingSlug = true
|
m.editingSlug = true
|
||||||
m.slugInput.SetValue(m.interaction.slug.String())
|
m.slugInput.SetValue(m.interaction.slug.String())
|
||||||
m.slugInput.Focus()
|
m.slugInput.Focus()
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
case "tunnel-type":
|
case "tunnel-type":
|
||||||
m.showingCommands = false
|
m.showingCommands = false
|
||||||
m.showingComingSoon = true
|
m.showingComingSoon = true
|
||||||
return m, tickCmd(5 * time.Second)
|
return m, tea.Batch(tickCmd(5*time.Second), tea.ClearScreen, textinput.Blink)
|
||||||
default:
|
default:
|
||||||
m.showingCommands = false
|
m.showingCommands = false
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *model) commandsUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
func (m *model) commandsUpdate(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||||
|
var cmd tea.Cmd
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case key.Matches(msg, m.keymap.quit), msg.String() == "esc":
|
case key.Matches(msg, m.keymap.quit), msg.String() == "esc":
|
||||||
m.showingCommands = false
|
m.showingCommands = false
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
case msg.String() == "enter":
|
case msg.String() == "enter":
|
||||||
selectedItem := m.commandList.SelectedItem()
|
selectedItem := m.commandList.SelectedItem()
|
||||||
if selectedItem != nil {
|
if selectedItem != nil {
|
||||||
@@ -39,8 +42,8 @@ func (m *model) commandsUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
|||||||
return m.handleCommandSelection(item)
|
return m.handleCommandSelection(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.commandList, _ = m.commandList.Update(msg)
|
m.commandList, cmd = m.commandList.Update(msg)
|
||||||
return m, nil
|
return m, cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *model) commandsView() string {
|
func (m *model) commandsView() string {
|
||||||
|
|||||||
@@ -4,19 +4,20 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *model) dashboardUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
func (m *model) dashboardUpdate(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||||
switch {
|
switch {
|
||||||
case key.Matches(msg, m.keymap.quit):
|
case key.Matches(msg, m.keymap.quit):
|
||||||
m.quitting = true
|
m.quitting = true
|
||||||
return m, tea.Quit
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink, tea.Quit)
|
||||||
case key.Matches(msg, m.keymap.command):
|
case key.Matches(msg, m.keymap.command):
|
||||||
m.showingCommands = true
|
m.showingCommands = true
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"tunnel_pls/session/slug"
|
"tunnel_pls/session/slug"
|
||||||
"tunnel_pls/types"
|
"tunnel_pls/types"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/help"
|
"github.com/charmbracelet/bubbles/help"
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
"github.com/muesli/termenv"
|
"github.com/muesli/termenv"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
@@ -120,7 +120,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tickMsg:
|
case tickMsg:
|
||||||
m.showingComingSoon = false
|
m.showingComingSoon = false
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
|
|
||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
m.width = msg.Width
|
m.width = msg.Width
|
||||||
@@ -137,9 +137,9 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
|
|
||||||
case tea.QuitMsg:
|
case tea.QuitMsg:
|
||||||
m.quitting = true
|
m.quitting = true
|
||||||
return m, tea.Quit
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink, tea.Quit)
|
||||||
|
|
||||||
case tea.KeyPressMsg:
|
case tea.KeyMsg:
|
||||||
if m.showingComingSoon {
|
if m.showingComingSoon {
|
||||||
return m.comingSoonUpdate(msg)
|
return m.comingSoonUpdate(msg)
|
||||||
}
|
}
|
||||||
@@ -160,28 +160,28 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
|
|
||||||
func (i *interaction) Redraw() {
|
func (i *interaction) Redraw() {
|
||||||
if i.program != nil {
|
if i.program != nil {
|
||||||
i.program.Send(tea.WindowSizeMsg{})
|
i.program.Send(tea.ClearScreen())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *model) View() tea.View {
|
func (m *model) View() string {
|
||||||
var content string
|
|
||||||
if m.quitting {
|
if m.quitting {
|
||||||
content = ""
|
return ""
|
||||||
} else if m.showingComingSoon {
|
|
||||||
content = m.comingSoonView()
|
|
||||||
} else if m.editingSlug {
|
|
||||||
content = m.slugView()
|
|
||||||
} else if m.showingCommands {
|
|
||||||
content = m.commandsView()
|
|
||||||
} else {
|
|
||||||
content = m.dashboardView()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v := tea.NewView(content)
|
if m.showingComingSoon {
|
||||||
v.AltScreen = true
|
return m.comingSoonView()
|
||||||
v.MouseMode = tea.MouseModeCellMotion
|
}
|
||||||
return v
|
|
||||||
|
if m.editingSlug {
|
||||||
|
return m.slugView()
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.showingCommands {
|
||||||
|
return m.commandsView()
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.dashboardView()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *interaction) Start() {
|
func (i *interaction) Start() {
|
||||||
@@ -249,6 +249,8 @@ func (i *interaction) Start() {
|
|||||||
m,
|
m,
|
||||||
tea.WithInput(i.channel),
|
tea.WithInput(i.channel),
|
||||||
tea.WithOutput(i.channel),
|
tea.WithOutput(i.channel),
|
||||||
|
tea.WithAltScreen(),
|
||||||
|
tea.WithMouseCellMotion(),
|
||||||
tea.WithoutSignals(),
|
tea.WithoutSignals(),
|
||||||
tea.WithoutSignalHandler(),
|
tea.WithoutSignalHandler(),
|
||||||
tea.WithFPS(30),
|
tea.WithFPS(30),
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"tunnel_pls/types"
|
"tunnel_pls/types"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
@@ -694,7 +694,7 @@ func TestInteraction_Integration(t *testing.T) {
|
|||||||
func TestModel_Update_KeyMessages(t *testing.T) {
|
func TestModel_Update_KeyMessages(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
key tea.KeyPressMsg
|
key tea.KeyMsg
|
||||||
showingComingSoon bool
|
showingComingSoon bool
|
||||||
editingSlug bool
|
editingSlug bool
|
||||||
showingCommands bool
|
showingCommands bool
|
||||||
@@ -702,25 +702,25 @@ func TestModel_Update_KeyMessages(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "key press while showing coming soon",
|
name: "key press while showing coming soon",
|
||||||
key: tea.KeyPressMsg{Code: tea.KeyEnter},
|
key: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
showingComingSoon: true,
|
showingComingSoon: true,
|
||||||
description: "should call comingSoonUpdate",
|
description: "should call comingSoonUpdate",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "key press while editing slug",
|
name: "key press while editing slug",
|
||||||
key: tea.KeyPressMsg{Code: tea.KeyEnter},
|
key: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
editingSlug: true,
|
editingSlug: true,
|
||||||
description: "should call slugUpdate",
|
description: "should call slugUpdate",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "key press while showing commands",
|
name: "key press while showing commands",
|
||||||
key: tea.KeyPressMsg{Code: tea.KeyEnter},
|
key: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
showingCommands: true,
|
showingCommands: true,
|
||||||
description: "should call commandsUpdate",
|
description: "should call commandsUpdate",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "key press in dashboard view",
|
name: "key press in dashboard view",
|
||||||
key: tea.KeyPressMsg{Code: 'c', Text: "c"},
|
key: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'c'}},
|
||||||
description: "should call dashboardUpdate",
|
description: "should call dashboardUpdate",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -777,7 +777,7 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
tunnelType types.TunnelType
|
tunnelType types.TunnelType
|
||||||
keyMsg tea.KeyPressMsg
|
keyMsg tea.KeyMsg
|
||||||
inputValue string
|
inputValue string
|
||||||
setupMocks func(*MockSessionRegistry, *MockSlug, *MockRandom)
|
setupMocks func(*MockSessionRegistry, *MockSlug, *MockRandom)
|
||||||
expectedEdit bool
|
expectedEdit bool
|
||||||
@@ -787,21 +787,21 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "escape key cancels editing",
|
name: "escape key cancels editing",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEsc},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEsc},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
||||||
expectedEdit: false,
|
expectedEdit: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ctrl+c cancels editing",
|
name: "ctrl+c cancels editing",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'c', Mod: tea.ModCtrl},
|
keyMsg: tea.KeyMsg{Type: tea.KeyCtrlC},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
||||||
expectedEdit: false,
|
expectedEdit: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enter key saves valid slug",
|
name: "enter key saves valid slug",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEnter},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
inputValue: "my-custom-slug",
|
inputValue: "my-custom-slug",
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
||||||
ms.On("String").Return("old-slug")
|
ms.On("String").Return("old-slug")
|
||||||
@@ -816,7 +816,7 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "enter key with error shows error message",
|
name: "enter key with error shows error message",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEnter},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
inputValue: "invalid",
|
inputValue: "invalid",
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
||||||
ms.On("String").Return("old-slug")
|
ms.On("String").Return("old-slug")
|
||||||
@@ -831,7 +831,7 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ctrl+r generates random slug",
|
name: "ctrl+r generates random slug",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'r', Mod: tea.ModCtrl},
|
keyMsg: tea.KeyMsg{Type: tea.KeyCtrlR},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
||||||
mr.On("String", 20).Return("random-generated-slug", nil)
|
mr.On("String", 20).Return("random-generated-slug", nil)
|
||||||
},
|
},
|
||||||
@@ -841,7 +841,7 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ctrl+r with error does nothing",
|
name: "ctrl+r with error does nothing",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'r', Mod: tea.ModCtrl},
|
keyMsg: tea.KeyMsg{Type: tea.KeyCtrlR},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {
|
||||||
mr.On("String", 20).Return("", assert.AnError)
|
mr.On("String", 20).Return("", assert.AnError)
|
||||||
},
|
},
|
||||||
@@ -850,14 +850,14 @@ func TestModel_SlugUpdate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "regular key updates input",
|
name: "regular key updates input",
|
||||||
tunnelType: types.TunnelTypeHTTP,
|
tunnelType: types.TunnelTypeHTTP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'a', Text: "a"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'a'}},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
||||||
expectedEdit: true,
|
expectedEdit: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tcp tunnel exits editing immediately",
|
name: "tcp tunnel exits editing immediately",
|
||||||
tunnelType: types.TunnelTypeTCP,
|
tunnelType: types.TunnelTypeTCP,
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'a', Text: "a"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'a'}},
|
||||||
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
setupMocks: func(msr *MockSessionRegistry, ms *MockSlug, mr *MockRandom) {},
|
||||||
expectedEdit: false,
|
expectedEdit: false,
|
||||||
},
|
},
|
||||||
@@ -1006,19 +1006,19 @@ func TestModel_SlugView(t *testing.T) {
|
|||||||
func TestModel_ComingSoonUpdate(t *testing.T) {
|
func TestModel_ComingSoonUpdate(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
keyMsg tea.KeyPressMsg
|
keyMsg tea.KeyMsg
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "any key dismisses coming soon",
|
name: "any key dismisses coming soon",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEnter},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "escape key dismisses",
|
name: "escape key dismisses",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEsc},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEsc},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "space key dismisses",
|
name: "space key dismisses",
|
||||||
keyMsg: tea.KeyPressMsg{Code: ' ', Text: " "},
|
keyMsg: tea.KeyMsg{Type: tea.KeySpace},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1097,7 +1097,7 @@ func TestModel_ComingSoonView(t *testing.T) {
|
|||||||
func TestModel_CommandsUpdate(t *testing.T) {
|
func TestModel_CommandsUpdate(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
keyMsg tea.KeyPressMsg
|
keyMsg tea.KeyMsg
|
||||||
selectedItem list.Item
|
selectedItem list.Item
|
||||||
expectCommands bool
|
expectCommands bool
|
||||||
expectEditSlug bool
|
expectEditSlug bool
|
||||||
@@ -1105,31 +1105,31 @@ func TestModel_CommandsUpdate(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "escape key closes commands",
|
name: "escape key closes commands",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEsc},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEsc},
|
||||||
expectCommands: false,
|
expectCommands: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "q key closes commands",
|
name: "q key closes commands",
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'q', Text: "q"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}},
|
||||||
expectCommands: false,
|
expectCommands: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enter on slug command starts editing",
|
name: "enter on slug command starts editing",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEnter},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
selectedItem: commandItem{name: "slug", desc: "Set custom subdomain"},
|
selectedItem: commandItem{name: "slug", desc: "Set custom subdomain"},
|
||||||
expectCommands: false,
|
expectCommands: false,
|
||||||
expectEditSlug: true,
|
expectEditSlug: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enter on tunnel-type shows coming soon",
|
name: "enter on tunnel-type shows coming soon",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyEnter},
|
keyMsg: tea.KeyMsg{Type: tea.KeyEnter},
|
||||||
selectedItem: commandItem{name: "tunnel-type", desc: "Change tunnel type"},
|
selectedItem: commandItem{name: "tunnel-type", desc: "Change tunnel type"},
|
||||||
expectCommands: false,
|
expectCommands: false,
|
||||||
expectComingSoon: true,
|
expectComingSoon: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arrow key navigates list",
|
name: "arrow key navigates list",
|
||||||
keyMsg: tea.KeyPressMsg{Code: tea.KeyDown},
|
keyMsg: tea.KeyMsg{Type: tea.KeyDown},
|
||||||
expectCommands: true,
|
expectCommands: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1261,28 +1261,28 @@ func TestModel_CommandsView(t *testing.T) {
|
|||||||
func TestModel_DashboardUpdate(t *testing.T) {
|
func TestModel_DashboardUpdate(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
keyMsg tea.KeyPressMsg
|
keyMsg tea.KeyMsg
|
||||||
expectQuit bool
|
expectQuit bool
|
||||||
expectCommands bool
|
expectCommands bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "q key quits",
|
name: "q key quits",
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'q', Text: "q"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}},
|
||||||
expectQuit: true,
|
expectQuit: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ctrl+c quits",
|
name: "ctrl+c quits",
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'c', Mod: tea.ModCtrl},
|
keyMsg: tea.KeyMsg{Type: tea.KeyCtrlC},
|
||||||
expectQuit: true,
|
expectQuit: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "c key opens commands",
|
name: "c key opens commands",
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'c', Text: "c"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'c'}},
|
||||||
expectCommands: true,
|
expectCommands: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "other keys do nothing",
|
name: "other keys do nothing",
|
||||||
keyMsg: tea.KeyPressMsg{Code: 'x', Text: "x"},
|
keyMsg: tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'x'}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
"tunnel_pls/internal/random"
|
"tunnel_pls/internal/random"
|
||||||
"tunnel_pls/types"
|
"tunnel_pls/types"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/help"
|
"github.com/charmbracelet/bubbles/help"
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
)
|
)
|
||||||
|
|
||||||
type commandItem struct {
|
type commandItem struct {
|
||||||
@@ -77,7 +77,7 @@ type keymap struct {
|
|||||||
type tickMsg time.Time
|
type tickMsg time.Time
|
||||||
|
|
||||||
func (m *model) Init() tea.Cmd {
|
func (m *model) Init() tea.Cmd {
|
||||||
return tea.RequestWindowSize
|
return tea.Batch(textinput.Blink, tea.WindowSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
func getResponsiveWidth(screenWidth, padding, minWidth, maxWidth int) int {
|
func getResponsiveWidth(screenWidth, padding, minWidth, maxWidth int) int {
|
||||||
|
|||||||
@@ -5,24 +5,26 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"tunnel_pls/types"
|
"tunnel_pls/types"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *model) slugUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
func (m *model) slugUpdate(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||||
|
var cmd tea.Cmd
|
||||||
|
|
||||||
if m.tunnelType != types.TunnelTypeHTTP {
|
if m.tunnelType != types.TunnelTypeHTTP {
|
||||||
m.editingSlug = false
|
m.editingSlug = false
|
||||||
m.slugError = ""
|
m.slugError = ""
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "esc", "ctrl+c":
|
case "esc", "ctrl+c":
|
||||||
m.editingSlug = false
|
m.editingSlug = false
|
||||||
m.slugError = ""
|
m.slugError = ""
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
case "enter":
|
case "enter":
|
||||||
inputValue := m.slugInput.Value()
|
inputValue := m.slugInput.Value()
|
||||||
if err := m.interaction.sessionRegistry.Update(m.interaction.user, types.SessionKey{
|
if err := m.interaction.sessionRegistry.Update(m.interaction.user, types.SessionKey{
|
||||||
@@ -37,18 +39,18 @@ func (m *model) slugUpdate(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
m.editingSlug = false
|
m.editingSlug = false
|
||||||
m.slugError = ""
|
m.slugError = ""
|
||||||
return m, nil
|
return m, tea.Batch(tea.ClearScreen, textinput.Blink)
|
||||||
default:
|
default:
|
||||||
if key.Matches(msg, m.keymap.random) {
|
if key.Matches(msg, m.keymap.random) {
|
||||||
newSubdomain, err := m.randomizer.String(20)
|
newSubdomain, err := m.randomizer.String(20)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return m, nil
|
return m, cmd
|
||||||
}
|
}
|
||||||
m.slugInput.SetValue(newSubdomain)
|
m.slugInput.SetValue(newSubdomain)
|
||||||
}
|
}
|
||||||
m.slugError = ""
|
m.slugError = ""
|
||||||
m.slugInput, _ = m.slugInput.Update(msg)
|
m.slugInput, cmd = m.slugInput.Update(msg)
|
||||||
return m, nil
|
return m, cmd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user