mirror of
https://github.com/makew0rld/amfora.git
synced 2024-11-03 02:37:23 -05:00
1a2fba92c2
More info on corrupt reads and writes: https://github.com/makeworld-the-better-one/amfora/issues/61#issuecomment-735042805 The panic was occuring due to lines like: if u[:6] == "about:" These would cause panics for URIs that were shorter than 6, like "docs/". strings.HasPrefix was used instead to fix this.
35 lines
930 B
Go
35 lines
930 B
Go
package display
|
|
|
|
import (
|
|
"io/ioutil"
|
|
|
|
"github.com/makeworld-the-better-one/amfora/config"
|
|
)
|
|
|
|
//nolint
|
|
var defaultNewTabContent = `# New Tab
|
|
|
|
You've opened a new tab. Use the bar at the bottom to browse around. You can start typing in it by pressing the space key.
|
|
|
|
Press the ? key at any time to bring up the help, and see other keybindings. Most are what you expect.
|
|
|
|
You can customize this page by creating a gemtext file called newtab.gmi, in Amfora's configuration folder.
|
|
|
|
Happy browsing!
|
|
|
|
=> about:bookmarks Bookmarks
|
|
=> about:subscriptions Subscriptions
|
|
|
|
=> //gemini.circumlunar.space Project Gemini
|
|
=> https://github.com/makeworld-the-better-one/amfora Amfora homepage [HTTPS]
|
|
`
|
|
|
|
// Read the new tab content from a file if it exists or fallback to a default page.
|
|
func getNewTabContent() string {
|
|
data, err := ioutil.ReadFile(config.NewTabPath)
|
|
if err == nil {
|
|
return string(data)
|
|
}
|
|
return defaultNewTabContent
|
|
}
|