mirror of
https://github.com/makew0rld/amfora.git
synced 2024-11-08 23:55:25 +03:00
parent
b6ad49dfb0
commit
8ec9bb780c
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- URLs are NFC-normalized before any processing (#138)
|
||||
- Links to the wiki in the new tab
|
||||
- Cache times out after 30 minutes by default (#110)
|
||||
- `about:version` page (#126)
|
||||
|
||||
### Changed
|
||||
- Updated [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) to v0.11.0
|
||||
|
@ -52,7 +52,7 @@ func main() {
|
||||
|
||||
client.Init()
|
||||
|
||||
display.Init()
|
||||
display.Init(version, commit, builtBy)
|
||||
display.NewTab()
|
||||
display.NewTab() // Open extra tab and close it to fully initialize the app and wrapping
|
||||
display.CloseTab()
|
||||
|
@ -59,6 +59,7 @@ var layout = cview.NewFlex().
|
||||
SetDirection(cview.FlexRow)
|
||||
|
||||
var newTabPage structs.Page
|
||||
var versionPage structs.Page
|
||||
|
||||
var App = cview.NewApplication().
|
||||
EnableMouse(false).
|
||||
@ -77,7 +78,21 @@ var App = cview.NewApplication().
|
||||
}(tabs[curTab])
|
||||
})
|
||||
|
||||
func Init() {
|
||||
func Init(version, commit, builtBy string) {
|
||||
versionContent := fmt.Sprintf(
|
||||
"# Amfora Version Info\n\nAmfora: %s\nCommit: %s\nBuilt by: %s",
|
||||
version, commit, builtBy,
|
||||
)
|
||||
renderVersionContent, versionLinks := renderer.RenderGemini(versionContent, textWidth(), leftMargin(), false)
|
||||
versionPage = structs.Page{
|
||||
Raw: versionContent,
|
||||
Content: renderVersionContent,
|
||||
Links: versionLinks,
|
||||
URL: "about:version",
|
||||
Width: -1, // Force reformatting on first display
|
||||
Mediatype: structs.TextGemini,
|
||||
}
|
||||
|
||||
tabRow.SetChangedFunc(func() {
|
||||
App.Draw()
|
||||
})
|
||||
|
@ -187,6 +187,11 @@ func handleAbout(t *tab, u string) (string, bool) {
|
||||
setPage(t, &temp)
|
||||
t.applyBottomBar()
|
||||
return u, true
|
||||
case "about:version":
|
||||
temp := versionPage
|
||||
setPage(t, &temp)
|
||||
t.applyBottomBar()
|
||||
return u, true
|
||||
}
|
||||
|
||||
if u == "about:subscriptions" || (len(u) > 20 && u[:20] == "about:subscriptions?") {
|
||||
|
Loading…
Reference in New Issue
Block a user