Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gnoweb): rework & Implement new gnoweb design #3195

Merged
merged 129 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
af2112b
wip: rework gnoweb
gfanton Nov 25, 2024
f4f3a86
wip: create gnoweb app, sync gnodev with gnoweb
gfanton Nov 25, 2024
f3dbbf3
chore: cleanup
gfanton Nov 25, 2024
5dd673d
wip: re-add status json page
gfanton Nov 25, 2024
997ab46
chore: cleanup
gfanton Nov 25, 2024
a112a63
chore: clenaup
gfanton Nov 25, 2024
5e13369
fix: height
gfanton Nov 25, 2024
a97d66d
feat: rework gnoweb
gfanton Nov 25, 2024
e53bbb4
chore: cleanup
gfanton Nov 25, 2024
611e315
chore: cleanup
gfanton Nov 25, 2024
2eaee06
chore: cleanup
gfanton Nov 25, 2024
550055e
chore: telemetry link
alexiscolin Dec 3, 2024
3f4a4bb
fix: fonts url
alexiscolin Dec 3, 2024
60243f6
wip: source files
gfanton Dec 3, 2024
d08528b
feat: enable copy btn
alexiscolin Dec 4, 2024
7c48c36
Merge branch 'feat/gnoweb-rework' of github.com:gfanton/gno into feat…
alexiscolin Dec 4, 2024
f7d708a
chore: clean logs
alexiscolin Dec 4, 2024
f6687ed
feat: copy feedback
alexiscolin Dec 4, 2024
d2345da
fix: client signer
gfanton Dec 4, 2024
b6e36a9
fix: test
gfanton Dec 4, 2024
3b6369e
dir template
alexiscolin Dec 5, 2024
a95b5de
Merge branch 'feat/gnoweb-rework' of github.com:gfanton/gno into feat…
alexiscolin Dec 5, 2024
801f1ba
feat: add line/kb counter in source
alexiscolin Dec 5, 2024
d1fe542
Merge remote-tracking branch 'origin/master' into feat/gnoweb-rework
gfanton Dec 5, 2024
037e451
feat: status template
alexiscolin Dec 5, 2024
8cea3ea
style: remove space
alexiscolin Dec 6, 2024
555ac1c
content: update footer links
alexiscolin Dec 6, 2024
7a80b4f
fix: cleanup col markdown for now
gfanton Dec 6, 2024
b39b8a1
fix: dir & cleanup
gfanton Dec 6, 2024
b1e06f3
chore: cleanup
gfanton Dec 6, 2024
8db8d7e
Merge branch 'master' into feat/gnoweb-rework
gfanton Dec 6, 2024
dd88c32
chore: lint
gfanton Dec 6, 2024
d4b1210
feat: handle args
gfanton Dec 6, 2024
6e9622f
fix: replace air by reflex
gfanton Dec 6, 2024
cff3730
chore: fixup comments
gfanton Dec 6, 2024
58da650
fix: test
gfanton Dec 6, 2024
fc8ac17
chore: lint
gfanton Dec 6, 2024
c20a99b
chore: lint
gfanton Dec 6, 2024
c2b691c
Merge branch 'master' into feat/gnoweb-rework
gfanton Dec 6, 2024
7a38df7
chore: update deprecated link
gfanton Dec 6, 2024
33b333b
fix: redirect
gfanton Dec 6, 2024
43f7880
fix: html & analytics
gfanton Dec 6, 2024
cf4b3d8
fix: gnoweb fmt
gfanton Dec 7, 2024
a683c96
fix: url test
gfanton Dec 7, 2024
547c4e8
chore: lint
gfanton Dec 7, 2024
45276d6
Merge branch 'master' into feat/gnoweb-rework
gfanton Dec 7, 2024
58d9efc
feat: merge ts files
alexiscolin Dec 7, 2024
b95890a
fix: double script
alexiscolin Dec 8, 2024
e044ad9
fix: min-height footer
alexiscolin Dec 8, 2024
0a5c720
fix: remove deprecated flags
gfanton Dec 8, 2024
84ea845
Merge remote-tracking branch 'origin/master' into feat/gnoweb-rework
gfanton Dec 8, 2024
a970aa9
use commands.ExitCodeError instead of os.Exit
thehowl Dec 9, 2024
36bbcb0
improve alias.go godoc
thehowl Dec 9, 2024
3fcbdb6
AppConfig godoc; Remote -> NodeRemote
thehowl Dec 9, 2024
0e8bf5e
avoid init function
thehowl Dec 9, 2024
0ed44b3
more renames, more godoc
thehowl Dec 9, 2024
f0bde45
create per-test cfg/logger
thehowl Dec 9, 2024
2e9f3cb
formater -> formatter
thehowl Dec 9, 2024
4c3f6a1
DefaultHost -> DefaultChainDomain
thehowl Dec 9, 2024
3445f52
ChainID typo fix
thehowl Dec 9, 2024
b93ae3d
remove unused KindUser
thehowl Dec 9, 2024
d3a0af7
change Kind to method
thehowl Dec 9, 2024
203c5fe
simplify regex
thehowl Dec 9, 2024
d4d8645
took -> elapsed
thehowl Dec 9, 2024
28dac08
ChainId -> ChainID
thehowl Dec 9, 2024
bc52d9b
remove empty send
thehowl Dec 9, 2024
d97f08f
some renaming
thehowl Dec 9, 2024
949e90b
Merge pull request #16 from thehowl/dev/morgan/gnoweb-rework-pr
gfanton Dec 10, 2024
db88955
fix: remove buffer pool
gfanton Dec 10, 2024
9e90280
fix: deadcode
gfanton Dec 11, 2024
ac19ef6
style: update italic and list
alexiscolin Dec 11, 2024
cbd3cd9
fix: add main test to actually test the setup
gfanton Dec 11, 2024
db59650
chore: lint
gfanton Dec 11, 2024
4b1dd8a
chore: add minimal readme
gfanton Dec 11, 2024
3ef80b2
fix: disable gnoweb setup if noweb is specified
gfanton Dec 12, 2024
00e6ec4
chore: lint
gfanton Dec 12, 2024
657ad8b
feat: add gnoweb generate to ci
gfanton Dec 12, 2024
89724ab
chore: lts version
gfanton Dec 12, 2024
cbc4f9b
chore: make generate
gfanton Dec 12, 2024
f93398f
feat: highlight md
alexiscolin Dec 12, 2024
5140676
chore: minify css
alexiscolin Dec 12, 2024
50ab259
chore: move markdown package
gfanton Dec 12, 2024
0a310bf
chore(gnoweb): update dev rule to build in a diffierent cache directory
gfanton Dec 12, 2024
e04b399
feat: move highlighting package inside our markdown package
gfanton Dec 12, 2024
d3ad8dd
fix: update markdown so it doesn't rebuild the source
gfanton Dec 12, 2024
0d5f98f
feat: add title
alexiscolin Dec 12, 2024
12e6ba3
fix: highlighting
gfanton Dec 12, 2024
7993dc7
fix: no web
gfanton Dec 12, 2024
5997c24
fix: make ci generate check more strict
gfanton Dec 12, 2024
23d83d9
chore: make gnoweb less verbose
gfanton Dec 12, 2024
b135f5a
chore: lint
gfanton Dec 12, 2024
023ca5b
chore: update readme
alexiscolin Dec 12, 2024
3962d83
chore: ChainID -> ChainId
gfanton Dec 12, 2024
92b8c87
chore: cleanup make
gfanton Dec 12, 2024
92af050
chore: update test output
gfanton Dec 12, 2024
fb93d14
Merge branch 'master' into feat/gnoweb-rework
gfanton Dec 12, 2024
142f74e
chore: clenaup readme
gfanton Dec 12, 2024
c981ce2
fix: analytics tests
gfanton Dec 12, 2024
870d481
feat: add custom faucet url
gfanton Dec 12, 2024
ecd873f
chore: update faucet url
gfanton Dec 12, 2024
edceea3
fix: remove gotuna
gfanton Dec 12, 2024
c9719ef
style: responsive
alexiscolin Dec 15, 2024
ebb31c4
style: expend RWD toc
alexiscolin Dec 15, 2024
297ff25
fix: help ts
alexiscolin Dec 15, 2024
55175c1
style: titles color
alexiscolin Dec 15, 2024
285500e
fix: toc
alexiscolin Dec 16, 2024
333c16e
fix: responsive
alexiscolin Dec 16, 2024
59977f4
style: hover state
alexiscolin Dec 16, 2024
4bff16c
style: footer logo
alexiscolin Dec 16, 2024
76cc149
style: toc place
alexiscolin Dec 16, 2024
4b98679
style: improve menu hover
alexiscolin Dec 16, 2024
dc926de
style: fix
alexiscolin Dec 16, 2024
9583f7c
feat: source permalink
alexiscolin Dec 16, 2024
72d56b6
feat: dont minify in dev mode and use source map
gfanton Dec 16, 2024
da04f31
style: select
alexiscolin Dec 16, 2024
6944006
style: input
alexiscolin Dec 16, 2024
f6814c8
fix: remove useless docker command
gfanton Dec 16, 2024
0d2f330
chore: minor rename
gfanton Dec 16, 2024
64d94d5
chore: update readme
gfanton Dec 16, 2024
57f3c1f
Merge branch 'master' into feat/gnoweb-rework
gfanton Dec 16, 2024
a19ffc8
style: align toc
alexiscolin Dec 16, 2024
8dd177e
fix: copy
alexiscolin Dec 16, 2024
906141f
style: toc btn
alexiscolin Dec 16, 2024
fa2c622
feat: add verbose mode
gfanton Dec 16, 2024
4c0ced6
fix: generate
gfanton Dec 16, 2024
0e57b67
fix: generate
gfanton Dec 16, 2024
c77701c
style: fix em and pre line permalink in realm
alexiscolin Dec 16, 2024
62136f1
Merge branch 'master' into feat/gnoweb-rework
alexiscolin Dec 16, 2024
7ddd33f
chore: generate
alexiscolin Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions contribs/gnodev/cmd/gnodev/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ type devCfg struct {
txsFile string

// Web Configuration
noWeb bool
webHTML bool
webListenerAddr string
webRemoteHelperAddr string
webWithHTML bool

// Node Configuration
minimal bool
Expand Down Expand Up @@ -123,6 +124,20 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
"gno root directory",
)

fs.BoolVar(
&c.noWeb,
"no-web",
defaultDevOptions.noWeb,
"disable gnoweb",
)

fs.BoolVar(
&c.webHTML,
"web-html",
defaultDevOptions.webHTML,
"gnoweb: enable unsafe HTML parsing in markdown rendering",
)

fs.StringVar(
&c.webListenerAddr,
"web-listener",
Expand All @@ -137,13 +152,6 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
"gnoweb: web server help page's remote addr (default to <node-rpc-listener>)",
)

fs.BoolVar(
&c.webWithHTML,
"web-with-html",
defaultDevOptions.webWithHTML,
"gnoweb: enable HTML parsing in markdown rendering",
)

fs.StringVar(
&c.nodeRPCListenerAddr,
"node-rpc-listener",
Expand Down Expand Up @@ -323,7 +331,10 @@ func execDev(cfg *devCfg, args []string, io commands.IO) (err error) {
defer server.Close()

// Setup gnoweb
webhandler := setupGnoWebServer(logger.WithGroup(WebLogName), cfg, devNode)
webhandler, err := setupGnoWebServer(logger.WithGroup(WebLogName), cfg, devNode)
if err != nil {
return fmt.Errorf("unable to setup gnoweb server: %w", err)
}

// Setup unsafe APIs if enabled
if cfg.unsafeAPI {
Expand Down Expand Up @@ -351,14 +362,18 @@ func execDev(cfg *devCfg, args []string, io commands.IO) (err error) {
mux.Handle("/", webhandler)
}

go func() {
err := server.ListenAndServe()
cancel(err)
}()

logger.WithGroup(WebLogName).
Info("gnoweb started",
"lisn", fmt.Sprintf("http://%s", server.Addr))
// Serve gnoweb
// XXX: we should skip all the previous web setup if gnoweb is disable
gfanton marked this conversation as resolved.
Show resolved Hide resolved
if !cfg.noWeb {
go func() {
err := server.ListenAndServe()
cancel(err)
}()

logger.WithGroup(WebLogName).
Info("gnoweb started",
"lisn", fmt.Sprintf("http://%s", server.Addr))
}

watcher, err := watcher.NewPackageWatcher(loggerEvents, emitterServer)
if err != nil {
Expand All @@ -377,7 +392,7 @@ func execDev(cfg *devCfg, args []string, io commands.IO) (err error) {
return runEventLoop(ctx, logger, book, rt, devNode, watcher)
}

var helper string = `For more in-depth documentation, visit the GNO Tooling CLI documentation:
var helper string = `For more in-depth documentation, visit the GNO Tooling CLI documentation:
https://docs.gno.land/gno-tooling/cli/gno-tooling-gnodev

P Previous TX - Go to the previous tx
Expand Down
27 changes: 15 additions & 12 deletions contribs/gnodev/cmd/gnodev/setup_web.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
package main

import (
"fmt"
"log/slog"
"net/http"

gnodev "github.com/gnolang/gno/contribs/gnodev/pkg/dev"
"github.com/gnolang/gno/gno.land/pkg/gnoweb"
gnoweb "github.com/gnolang/gno/gno.land/pkg/gnoweb"

Check failure on line 9 in contribs/gnodev/cmd/gnodev/setup_web.go

View workflow job for this annotation

GitHub Actions / Run Main (gnodev) / Go Linter / lint

could not import github.com/gnolang/gno/gno.land/pkg/gnoweb (-: # github.com/gnolang/gno/gno.land/pkg/gnoweb

Check failure on line 9 in contribs/gnodev/cmd/gnodev/setup_web.go

View workflow job for this annotation

GitHub Actions / Run Main (gnodev) / Go Linter / lint

could not import github.com/gnolang/gno/gno.land/pkg/gnoweb (-: # github.com/gnolang/gno/gno.land/pkg/gnoweb

Check failure on line 9 in contribs/gnodev/cmd/gnodev/setup_web.go

View workflow job for this annotation

GitHub Actions / Run Main (gnodev) / Go Linter / lint

could not import github.com/gnolang/gno/gno.land/pkg/gnoweb (-: # github.com/gnolang/gno/gno.land/pkg/gnoweb

Check failure on line 9 in contribs/gnodev/cmd/gnodev/setup_web.go

View workflow job for this annotation

GitHub Actions / Run Main (gnodev) / Go Linter / lint

could not import github.com/gnolang/gno/gno.land/pkg/gnoweb (-: # github.com/gnolang/gno/gno.land/pkg/gnoweb
gfanton marked this conversation as resolved.
Show resolved Hide resolved
)

// setupGnowebServer initializes and starts the Gnoweb server.
func setupGnoWebServer(logger *slog.Logger, cfg *devCfg, dnode *gnodev.Node) http.Handler {
webConfig := gnoweb.NewDefaultConfig()
func setupGnoWebServer(logger *slog.Logger, cfg *devCfg, dnode *gnodev.Node) (http.Handler, error) {
remote := dnode.GetRemoteAddress()

webConfig.HelpChainID = cfg.chainId
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = cfg.webRemoteHelperAddr
webConfig.WithHTML = cfg.webWithHTML
appcfg := gnoweb.NewDefaultAppConfig()
appcfg.UnsafeHTML = cfg.webHTML
appcfg.NodeRemote = remote
appcfg.ChainID = cfg.chainId
if cfg.webRemoteHelperAddr != "" {
appcfg.RemoteHelp = cfg.webRemoteHelperAddr
}

// If `HelpRemote` is empty default it to `RemoteAddr`
if webConfig.HelpRemote == "" {
webConfig.HelpRemote = webConfig.RemoteAddr
router, err := gnoweb.NewRouter(logger, appcfg)
if err != nil {
return nil, fmt.Errorf("unable to create router app: %w", err)
}

app := gnoweb.MakeApp(logger, webConfig)
return app.Router
return router, nil
}
10 changes: 3 additions & 7 deletions contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (

require (
dario.cat/mergo v1.0.1 // indirect
github.com/alecthomas/chroma/v2 v2.8.0 // indirect
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
Expand All @@ -48,7 +48,7 @@ require (
github.com/creack/pty v1.1.21 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand All @@ -58,10 +58,6 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/gotuna/gotuna v0.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
Expand All @@ -82,7 +78,7 @@ require (
github.com/rs/xid v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.5.4 // indirect
github.com/yuin/goldmark v1.7.2 // indirect
github.com/yuin/goldmark-emoji v1.0.2 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
Expand Down
28 changes: 10 additions & 18 deletions contribs/gnodev/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions gno.land/cmd/gnoweb/CONTRIBUTING.md

This file was deleted.

13 changes: 0 additions & 13 deletions gno.land/cmd/gnoweb/README.md

This file was deleted.

Loading
Loading