Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

home state

Back to all declarations

defaultProfile

func() home.profileData
Open
OID
059edf…7885:3
defaultProfile details

Inspect func

defaultBadges

func() []home.badge
Open
OID
059edf…7885:5
defaultBadges details

Inspect func

defaultHome

func() string

defaultHome needs base, so init sets base first.

Open
OID
059edf…7885:6
defaultHome details

Inspect func

defaultWork

untyped string

Value

"## Work on Gno\n\nContributor to gnolang/gno since April 2024 ([my merged PRs](https://github.com/gnolang/gno/pulls?q=is%3Apr+author%3Aomarsy+is%3Amerged)). Some highlights:\n\n| PR | What it did |\n| --- | --- |\n| [#3185](https://github.com/gnolang/gno/pull/31"...

defaultBlog

untyped string

Value

"## Blog\n\n:blog:\n"

defaultGuestbook

untyped string

Value

"## Guestbook\n\nLeave a line. One entry per address.\n\n:guestbook:\n"

homeTab

untyped string

Value

"home"

workTab

untyped string

Value

"work"

blogTab

untyped string

Value

"blog"

guestbookTab

untyped string

Value

"guestbook"

maxTabs

untyped bigint

Value

(8 <untyped> bigint)

maxTabName

untyped bigint

Value

(20 <untyped> bigint)

maxPageBytes

untyped bigint

// so all pages together stay under 128 KB

Value

(16384 <untyped> bigint)

maxLineRunes

untyped bigint

Value

(140 <untyped> bigint)

maxBadges

untyped bigint

Value

(6 <untyped> bigint)

maxSlugBytes

untyped bigint

Value

(60 <untyped> bigint)

maxTitleRunes

untyped bigint

Value

(100 <untyped> bigint)

pageSize

untyped bigint

Value

(20 <untyped> bigint)

latestPosts

untyped bigint

Value

(3 <untyped> bigint)

seqWidth

untyped bigint

Value

(10 <untyped> bigint)

errUnauthorized

untyped string

Value

"home: unauthorized"

errMasterKey

untyped string

Value

"home: needs the master key, not a session key"

errOwnerOnly

untyped string

Value

"home: owner only"

errPendingOnly

untyped string

Value

"home: pending owner only"

errInvalidInput

untyped string

Value

"home: invalid input: "

errSigned

untyped string

Value

"home: already signed"

errNoEntry

untyped string

Value

"home: no such entry"

errNoTab

untyped string

Value

"home: no such tab"

errNoPost

untyped string

Value

"home: no such post"

errTabsRequired

untyped string

Value

"home: home, blog and guestbook tabs are required"

errUgnotOnly

untyped string

Value

"home: send ugnot only"

profileData

type

Value

home.profileData

badge

type

Value

home.badge

nowLine

type

Value

home.nowLine

entry

type

Value

home.entry

post

type

post dates are UTC days of the block time, "2006-01-02".

Value

home.post

tipStats

type

Value

home.tipStats

owner

.uverse.address

Value

<gnolang.StringValue>

pendingOwner

.uverse.address

// set by TransferOwnership, cleared by AcceptOwnership

Value

<gnolang.StringValue>

base

string

// "/r/\<name>/home"; every generated link starts with it

Value

"/r/g12yg9nh4ncma44emgm8msxe8aavzywt0p95tanv/home"

pages

map[string]string

// markdown per tab

Open
OID
059edf…7885:103
pages details

Inspect map

waves

int

// wave count; anyone can wave again

Value

0

order

*v0.Tree

// zero-padded sequence -> address

Open
OID
059edf…7885:106
order details

Inspect pointer

postOrder

*v0.Tree

// zero-padded sequence -> slug

Open
OID
059edf…7885:110
postOrder details

Inspect pointer

postSeq

int

// last post sequence; never reused

Value

0

updated

int64

// block height of the last owner write

Value

661744

setDefaults

func()

setDefaults writes the initial state (content.gno holds the personal part).

Open
OID
059edf…7885:28
setDefaults details

Inspect func

assertOwner

func()

assertOwner is the owner guard.

Open
OID
059edf…7885:30
assertOwner details

Inspect func

Render

func(path string) string

Render shows one tab, or one post at blog/\<slug>. An unknown path shows Home and an unknown post shows Blog. The path is only compared against tab names or looked up as a slug, and never written into the page.

Open
OID
059edf…7885:32
Render details

Inspect func

frame

func(tab string, md string) string

frame puts the tab bar above a page and the footer below it.

Open
OID
059edf…7885:33
frame details

Inspect func

tabLabel

func(t string) string

tabLabel capitalizes a tab name; names are ASCII by validName.

Open
OID
059edf…7885:35
tabLabel details

Inspect func

tabBar

func(current string) string

tabBar draws every tab as a linked pill, the current one in brand green. The current tab is linked too, because gnoweb shows an unlinked image as a block and the row would break. Blog stays out until there is a post.

Open
OID
059edf…7885:36
tabBar details

Inspect func

parsePage

func(query string) int

parsePage reads page=N from the query; anything invalid is page 1.

Open
OID
059edf…7885:38
parsePage details

Inspect func

tipSuggestion

untyped string

Suggested amount on the Tip button (1 GNOT); visitors can change it.

Value

"1000000ugnot"

expand

func(md string, tab string, page int) string

expand replaces every widget token in one pass. strings.Replacer does not rescan its output, so visitor text inside a widget can never trigger a token. Only the tokens present in md are built, found with a single scan of md.

Open
OID
059edf…7885:39
expand details

Inspect func

plural

func(n int, word string) string

plural renders "1 wave", "2 waves".

Open
OID
059edf…7885:42
plural details

Inspect func

svgImage

func(alt string, svg string) string

svgImage embeds an SVG as a base64 data URI, the one inline image form gnoweb keeps.

Open
OID
059edf…7885:43
svgImage details

Inspect func

colBrand

untyped string

// gnoweb's links and buttons

Value

"#226C57"

colDeep

untyped string

// banner background, text on colSoft

Value

"#144134"

colAccent

untyped string

// banner accents, pill outlines

Value

"#60AB96"

colSoft

untyped string

// pale surface

Value

"#E7EFED"

colGhost

untyped string

gno.land's own greens, from gnoweb's palette. An image can't follow gnoweb's theme toggle, so each one reads on both its white and its near-black background.

Value

"#F0F0F0"

fontUI

untyped string

gno.land's own greens, from gnoweb's palette. An image can't follow gnoweb's theme toggle, so each one reads on both its white and its near-black background.

Value

"system-ui, -apple-system, Segoe UI, Helvetica, Arial, sans-serif"

bannerSVG

func(height int64) string

bannerSVG draws the 720x160 banner: the ghost, a coffee cup, the name and the tagline. The face depends on height % 4: calm, happy, wink, surprised.

Open
OID
059edf…7885:45
bannerSVG details

Inspect func

fontSize

func(s string, size int, perChar int) string

fontSize shrinks size so text fits the 440 px between x=260 and the banner's right edge. perChar is the rough glyph width at that size; runes from U+1100 on (CJK, emoji and the like) count double. Scaling the font, rather than setting textLength, never stretches text that already fits.

Open
OID
059edf…7885:46
fontSize details

Inspect func

tabH

untyped bigint

Pills come in two heights: tabs, and chips (badges and buttons). gnoweb draws a 16 px icon on a linked image, 8 px from its left edge: images in a row get an 8 px margin, and the icon's center sits that far above the image's bottom edge. It lands on the center line of a chip about 16 px high, so chips are 17 px, with iconGap pixels left clear for it. External and $help links get the icon; tabs and the guestbook button link inside the realm's own namespace and don't.

Value

(26 <untyped> bigint)

chipH

untyped bigint

Pills come in two heights: tabs, and chips (badges and buttons). gnoweb draws a 16 px icon on a linked image, 8 px from its left edge: images in a row get an 8 px margin, and the icon's center sits that far above the image's bottom edge. It lands on the center line of a chip about 16 px high, so chips are 17 px, with iconGap pixels left clear for it. External and $help links get the icon; tabs and the guestbook button link inside the realm's own namespace and don't.

Value

(17 <untyped> bigint)

iconGap

untyped bigint

Pills come in two heights: tabs, and chips (badges and buttons). gnoweb draws a 16 px icon on a linked image, 8 px from its left edge: images in a row get an 8 px margin, and the icon's center sits that far above the image's bottom edge. It lands on the center line of a chip about 16 px high, so chips are 17 px, with iconGap pixels left clear for it. External and $help links get the icon; tabs and the guestbook button link inside the realm's own namespace and don't.

Value

(30 <untyped> bigint)

seg

type

seg is one colored part of a pill.

Value

home.seg

pillSVG

func(h int, gap int, segs []home.seg) string

pillSVG draws a pill h pixels high from segments, left to right, with gap empty pixels before the first text. SVG can't measure text before drawing, so widths come from the rune count, wide runes (U+1100 on) counting double. The outline gives the pale parts an edge on a white page.

Open
OID
059edf…7885:49
pillSVG details

Inspect func

half

func(n int) string

half writes n/2 with its .5, for SVG coordinates.

Open
OID
059edf…7885:50
half details

Inspect func

badgesMD

func() string

badgesMD draws the badges as one paragraph. A new row starts after a hard line break (a backslash ending the line), so rows sit as close as wrapped ones.

Open
OID
059edf…7885:52
badgesMD details

Inspect func

button

func(action string, count string, url string, gap int) string

button is a linked chip: the action, then its count. $help links get gnoweb's transaction icon, hence the gap.

Open
OID
059edf…7885:54
button details

Inspect func

signMD

func() string

signMD counts hidden entries too: their authors did sign.

Open
OID
059edf…7885:57
signMD details

Inspect func

shortAddr

func(a .uverse.address) string

shortAddr keeps the ends of an address: g1jg8mtu…sqf5.

Open
OID
059edf…7885:58
shortAddr details

Inspect func

clampPage

func(page int, total int) (int, int)

clampPage returns the page to show, at most the last one, and the last page for total items.

Open
OID
059edf…7885:60
clampPage details

Inspect func

pageNav

func(tab string, page int, last int) string

pageNav links the pages around page on tab: Newer, then Older.

Open
OID
059edf…7885:61
pageNav details

Inspect func

signForm

untyped string

Value

"<gno-form exec=\"Sign\">\n <gno-input name=\"msg\" type=\"text\" placeholder=\"Say hi in 140 characters\" required=\"true\" />\n</gno-form>"

visitorText

func(msg string) string

visitorText makes a stored message safe as one markdown list item. sanitize.InlineText escapes links, images, HTML and emphasis; the escaped @ and the &#103; entity for the g of g1 keep gnoweb from turning "@name" or a typed g1 address into a profile link. Neither replacement produces the other's pattern, so the order doesn't matter.

Open
OID
059edf…7885:62
visitorText details

Inspect func

guestbookMD

func(page int) string

guestbookMD shows the form and one page of entries, newest first. Hidden entries still count toward the offset, so a page can show fewer than 20.

Open
OID
059edf…7885:63
guestbookMD details

Inspect func

postList

func(offset int, count int) string

postList lists count posts from offset, newest first: one item each with the publish date as a code chip and the linked title.

Open
OID
059edf…7885:64
postList details

Inspect func

blogMD

func(page int) string

blogMD lists one page of posts.

Open
OID
059edf…7885:65
blogMD details

Inspect func

postsMD

func() string

postsMD is the Latest posts section, or nothing while there are no posts, so no empty heading shows.

Open
OID
059edf…7885:66
postsMD details

Inspect func

postMD

func(p *home.post) string

postMD is a post's page. The body is shown as written: no tokens.

Open
OID
059edf…7885:67
postMD details

Inspect func

maxSignBytes

untyped bigint

Value

(560 <untyped> bigint)

invalid

func(field string) string
Open
OID
059edf…7885:68
invalid details

Inspect func

checkLine

func(field string, s string, min int, max int)

checkLine enforces valid UTF-8, a rune count in \[min, max], and no control characters (so no newline either): the text may end up inside an SVG, where they would break the XML.

Open
OID
059edf…7885:70
checkLine details

Inspect func

assertMasterKey

func()

assertMasterKey refuses a transaction signed by a session key. Delegated keys may edit content, but not move ownership or hide an entry for good.

Open
OID
059edf…7885:71
assertMasterKey details

Inspect func

checkBadgeURL

func(u string)

checkBadgeURL wants a printable-ASCII https:// URL (non-ASCII must be percent-encoded) with no quotes, backslashes, backticks, parentheses, square brackets, \< or >, so the markdown link can't end early or become javascript:.

Open
OID
059edf…7885:72
checkBadgeURL details

Inspect func

parseBadges

func(spec string) []home.badge

parseBadges reads one badge per line, "label | value | url". Blank lines between two badges start a new row; other blank lines are skipped.

Open
OID
059edf…7885:73
parseBadges details

Inspect func

hasVisible

func(s string) bool

hasVisible reports whether s has a character that draws something: not a space, a format character (zero-width, bidi), a combining mark, or one of the blank-looking fillers (Hangul fillers, braille blank).

Open
OID
059edf…7885:74
hasVisible details

Inspect func

validName

func(s string, max int) bool

validName wants 1 to max characters from a-z, 0-9 and "-": safe in a link, a tab label, and a path gnoweb passes to Render.

Open
OID
059edf…7885:75
validName details

Inspect func

checkPage

func(tab string, md string)

checkPage enforces the tab name, the page size, and the tab count.

Open
OID
059edf…7885:76
checkPage details

Inspect func

checkPost

func(slug string, title string, body string)

checkPost enforces the slug, a one-line title, and the body size. Title and body must each show something.

Open
OID
059edf…7885:77
checkPost details

Inspect func

seqKey

func(n int) string

seqKey zero-pads n so that keys sort in number order.

Open
OID
059edf…7885:78
seqKey details

Inspect func

SetNow

func(text string)

SetNow sets the one-line status shown on Home; empty clears it.

Open
OID
059edf…7885:80
SetNow details

Inspect func

SetProfile

func(name string, tagline string)

SetProfile sets the name and tagline drawn on the banner.

Open
OID
059edf…7885:81
SetProfile details

Inspect func

SetBadges

func(spec string)

SetBadges replaces every badge. One badge per line: "label | value | url"; a blank line starts a new row.

Open
OID
059edf…7885:82
SetBadges details

Inspect func

SetPage

func(tab string, md string)

SetPage creates or replaces any tab's markdown, Blog and Guestbook included. A new tab goes just before Guestbook, which stays last.

Open
OID
059edf…7885:83
SetPage details

Inspect func

RemovePage

func(tab string)

RemovePage removes any tab except home, blog and guestbook.

Open
OID
059edf…7885:84
RemovePage details

Inspect func

SetPost

func(slug string, title string, body string)

SetPost publishes a post, or edits the post at slug. An edit keeps the post's place in the list and its publish date.

Open
OID
059edf…7885:85
SetPost details

Inspect func

RemovePost

func(slug string)

RemovePost deletes a post for good; its slug can be used again.

Open
OID
059edf…7885:86
RemovePost details

Inspect func

Hide

func(author .uverse.address)

Hide hides an author's guestbook entry for good. The entry stays stored, so the author can't sign again, and nobody's deposit is refunded. Hiding a hidden entry does nothing.

Open
OID
059edf…7885:87
Hide details

Inspect func

TransferOwnership

func(newOwner .uverse.address)

TransferOwnership records newOwner as pending; nothing changes until that address calls AcceptOwnership. Naming the current owner cancels.

Open
OID
059edf…7885:88
TransferOwnership details

Inspect func

AcceptOwnership

func()

AcceptOwnership completes a transfer. Only the pending owner may call it, and a realm address can't pass the account guard, so it never can.

Open
OID
059edf…7885:89
AcceptOwnership details

Inspect func

Wave

func()

Wave adds one to the wave count. It's a plain counter: anyone can wave again, and a wave stores nothing but the count.

Open
OID
059edf…7885:90
Wave details

Inspect func

Sign

func(msg string)

Sign leaves one guestbook entry per address. The message is stored trimmed and sanitized when rendered, and must contain a visible character.

Open
OID
059edf…7885:91
Sign details

Inspect func

Tip

func()

Tip forwards exactly the ugnot sent with this call to the owner. The account guard is inlined so the audit harness sees it next to OriginSend. It forwards what was sent, never the realm's balance: the OriginSend banker refuses to spend more than was sent.

Open
OID
059edf…7885:92
Tip details

Inspect func
defaultProfile : func() home.profileData Inspect
defaultBadges : func() []home.badge Inspect
defaultHome : func() string Inspect
defaultWork : untyped string ="## Work on Gno\n\nContributor to gnolang/gno since April 2024 ([my merged PRs](https://github.com/gnolang/gno/pulls?q=is%3Apr+author%3Aomarsy+is%3Amerged)). Some highlights:\n\n| PR | What it did |\n| --- | --- |\n| [#3185](https://github.com/gnolang/gno/pull/31"...
defaultBlog : untyped string ="## Blog\n\n:blog:\n"
defaultGuestbook : untyped string ="## Guestbook\n\nLeave a line. One entry per address.\n\n:guestbook:\n"
homeTab : untyped string ="home"
workTab : untyped string ="work"
blogTab : untyped string ="blog"
guestbookTab : untyped string ="guestbook"
maxTabs : untyped bigint =(8 <untyped> bigint)
maxTabName : untyped bigint =(20 <untyped> bigint)
maxPageBytes : untyped bigint =(16384 <untyped> bigint)
maxLineRunes : untyped bigint =(140 <untyped> bigint)
maxBadges : untyped bigint =(6 <untyped> bigint)
maxSlugBytes : untyped bigint =(60 <untyped> bigint)
maxTitleRunes : untyped bigint =(100 <untyped> bigint)
pageSize : untyped bigint =(20 <untyped> bigint)
latestPosts : untyped bigint =(3 <untyped> bigint)
seqWidth : untyped bigint =(10 <untyped> bigint)
errUnauthorized : untyped string ="home: unauthorized"
errMasterKey : untyped string ="home: needs the master key, not a session key"
errOwnerOnly : untyped string ="home: owner only"
errPendingOnly : untyped string ="home: pending owner only"
errInvalidInput : untyped string ="home: invalid input: "
errSigned : untyped string ="home: already signed"
errNoEntry : untyped string ="home: no such entry"
errNoTab : untyped string ="home: no such tab"
errNoPost : untyped string ="home: no such post"
errTabsRequired : untyped string ="home: home, blog and guestbook tabs are required"
errUgnotOnly : untyped string ="home: send ugnot only"
profileData : type =home.profileData
badge : type =home.badge
nowLine : type =home.nowLine
entry : type =home.entry
post : type =home.post
tipStats : type =home.tipStats
owner : .uverse.address =<gnolang.StringValue>
pendingOwner : .uverse.address =<gnolang.StringValue>
base : string ="/r/g12yg9nh4ncma44emgm8msxe8aavzywt0p95tanv/home"
profile : home.profileData Inspect
badges : []home.badge (len=6) Inspect
now : home.nowLine Inspect
tabs : []string (len=4) Inspect
pages : map[string]string Inspect
waves : int =0
entries : *v0.Tree Inspect
order : *v0.Tree Inspect
posts : *v0.Tree Inspect
postOrder : *v0.Tree Inspect
postSeq : int =0
tips : home.tipStats Inspect
updated : int64 =661744
init.53 : func() Inspect
setDefaults : func() Inspect
callerOf : func() .uverse.address Inspect
assertOwner : func() Inspect
Owner : func() .uverse.address Inspect
Render : func(path string) string Inspect
frame : func(tab string, md string) string Inspect
tabURL : func(t string) string Inspect
tabLabel : func(t string) string Inspect
tabBar : func(current string) string Inspect
parsePage : func(query string) int Inspect
tipSuggestion : untyped string ="1000000ugnot"
expand : func(md string, tab string, page int) string Inspect
itoa : func(n int) string Inspect
plural : func(n int, word string) string Inspect
svgImage : func(alt string, svg string) string Inspect
colBrand : untyped string ="#226C57"
colDeep : untyped string ="#144134"
colAccent : untyped string ="#60AB96"
colSoft : untyped string ="#E7EFED"
colGhost : untyped string ="#F0F0F0"
fontUI : untyped string ="system-ui, -apple-system, Segoe UI, Helvetica, Arial, sans-serif"
bannerMD : func() string Inspect
bannerSVG : func(height int64) string Inspect
fontSize : func(s string, size int, perChar int) string Inspect
tabH : untyped bigint =(26 <untyped> bigint)
chipH : untyped bigint =(17 <untyped> bigint)
iconGap : untyped bigint =(30 <untyped> bigint)
seg : type =home.seg
segOn : func(s string) home.seg Inspect
segSoft : func(s string) home.seg Inspect
pillSVG : func(h int, gap int, segs []home.seg) string Inspect
half : func(n int) string Inspect
badgesMD : func() string Inspect
nowMD : func() string Inspect
button : func(action string, count string, url string, gap int) string Inspect
wavesMD : func() string Inspect
tipMD : func() string Inspect
signMD : func() string Inspect
shortAddr : func(a .uverse.address) string Inspect
clampPage : func(page int, total int) (int, int) Inspect
pageNav : func(tab string, page int, last int) string Inspect
signForm : untyped string ="<gno-form exec=\"Sign\">\n <gno-input name=\"msg\" type=\"text\" placeholder=\"Say hi in 140 characters\" required=\"true\" />\n</gno-form>"
visitorText : func(msg string) string Inspect
guestbookMD : func(page int) string Inspect
postList : func(offset int, count int) string Inspect
blogMD : func(page int) string Inspect
postsMD : func() string Inspect
postMD : func(p *home.post) string Inspect
maxSignBytes : untyped bigint =(560 <untyped> bigint)
invalid : func(field string) string Inspect
checkLine : func(field string, s string, min int, max int) Inspect
assertMasterKey : func() Inspect
checkBadgeURL : func(u string) Inspect
parseBadges : func(spec string) []home.badge Inspect
hasVisible : func(s string) bool Inspect
validName : func(s string, max int) bool Inspect
checkPage : func(tab string, md string) Inspect
checkPost : func(slug string, title string, body string) Inspect
seqKey : func(n int) string Inspect
touch : func() Inspect
SetNow : func(text string) Inspect
SetProfile : func(name string, tagline string) Inspect
SetBadges : func(spec string) Inspect
SetPage : func(tab string, md string) Inspect
RemovePage : func(tab string) Inspect
SetPost : func(slug string, title string, body string) Inspect
RemovePost : func(slug string) Inspect
Hide : func(author .uverse.address) Inspect
TransferOwnership : func(newOwner .uverse.address) Inspect
AcceptOwnership : func() Inspect
Wave : func() Inspect
Sign : func(msg string) Inspect
Tip : func() Inspect