2021-02-12 21:26:07 -05:00
|
|
|
package display
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2021-03-01 15:35:47 -05:00
|
|
|
"github.com/makeworld-the-better-one/amfora/render"
|
2021-02-12 21:26:07 -05:00
|
|
|
"github.com/makeworld-the-better-one/amfora/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
var aboutPage structs.Page
|
|
|
|
var versionPage structs.Page
|
|
|
|
var licensePage structs.Page
|
|
|
|
var thanksPage structs.Page
|
|
|
|
|
|
|
|
func aboutInit(version, commit, builtBy string) {
|
|
|
|
aboutPage = createAboutPage("about:about", `# Internal Pages
|
|
|
|
|
|
|
|
=> about:bookmarks
|
|
|
|
=> about:subscriptions
|
|
|
|
=> about:manage-subscriptions
|
|
|
|
=> about:newtab
|
|
|
|
=> about:version
|
|
|
|
=> about:license
|
|
|
|
=> about:thanks
|
|
|
|
`)
|
|
|
|
versionPage = createAboutPage("about:version",
|
|
|
|
fmt.Sprintf(
|
|
|
|
"# Amfora Version Info\n\nAmfora: %s\nCommit: %s\nBuilt by: %s",
|
|
|
|
version, commit, builtBy,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
licensePage = createAboutPage("about:license", string(license))
|
|
|
|
thanksPage = createAboutPage("about:thanks", string(thanks))
|
|
|
|
}
|
|
|
|
|
|
|
|
func createAboutPage(url string, content string) structs.Page {
|
2021-03-01 15:35:47 -05:00
|
|
|
renderContent, links := render.RenderGemini(content, textWidth(), false)
|
2021-02-12 21:26:07 -05:00
|
|
|
return structs.Page{
|
2021-02-27 21:18:03 -05:00
|
|
|
Raw: content,
|
|
|
|
Content: renderContent,
|
|
|
|
Links: links,
|
|
|
|
URL: url,
|
|
|
|
TermWidth: -1, // Force reformatting on first display
|
|
|
|
Mediatype: structs.TextGemini,
|
2021-02-12 21:26:07 -05:00
|
|
|
}
|
|
|
|
}
|