Compare commits
3 Commits
ac8be65fa0
...
46439d2488
Author | SHA1 | Date | |
---|---|---|---|
46439d2488 | |||
c29a7c1594 | |||
350727cd58 |
@ -1 +0,0 @@
|
||||
patch type="fixed" "use birthtime instead of mtime"
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,5 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## [0.3.0] - 2025-04-29
|
||||
|
||||
### Added
|
||||
|
||||
- add gopher support
|
||||
- shortcuts to list items in menu and management
|
||||
|
||||
### Fixed
|
||||
|
||||
- use birthtime instead of mtime
|
||||
|
||||
## [0.2.0] - 2025-01-20
|
||||
|
||||
### Added
|
||||
|
@ -25,7 +25,7 @@ const title = ` ___ __
|
||||
/ _/__ ___ / /__
|
||||
/ _/ -_) -_) (_-<
|
||||
/_/ \__/\__/_/___/
|
||||
neofeels 0.2.0`
|
||||
neofeels 0.3.0`
|
||||
|
||||
func NewMainMenu(index int) *MainMenu {
|
||||
return &MainMenu{
|
||||
|
50
ttbp/ttbp.go
50
ttbp/ttbp.go
@ -28,11 +28,13 @@ var (
|
||||
PathUser = os.Getenv("HOME")
|
||||
PathUserFeels = path.Join(PathUser, ".ttbp")
|
||||
PathUserHTML = path.Join(PathUser, "public_html")
|
||||
PathUserGopherhole = path.Join(PathUser, "public_gopher", "feels")
|
||||
PathUserConfig = path.Join(PathUserFeels, "config")
|
||||
PathUserEntries = path.Join(PathUserFeels, "entries")
|
||||
PathUserBuried = path.Join(PathUserFeels, "buried")
|
||||
PathUserBackups = path.Join(PathUserFeels, "backups")
|
||||
PathUserWWW = path.Join(PathUserFeels, "www")
|
||||
PathUserGopher = path.Join(PathUserFeels, "gopher")
|
||||
PathUserRc = path.Join(PathUserConfig, "ttbprc")
|
||||
PathUserNopub = path.Join(PathUserConfig, "nopub")
|
||||
PathUserHTMLRender = path.Join(PathUserConfig, "html")
|
||||
@ -436,7 +438,49 @@ func Publish() {
|
||||
writer.WriteString(string(footer))
|
||||
writer.Flush()
|
||||
}
|
||||
// TODO: gopher
|
||||
if cfg.Gopher {
|
||||
os.RemoveAll(PathUserGopher) // remove all posts and start over
|
||||
if _, err := os.Stat(PathUserGopher); os.IsNotExist(err) {
|
||||
os.MkdirAll(PathUserGopher, 0755)
|
||||
os.Symlink(PathUserGopher, PathUserGopherhole)
|
||||
}
|
||||
file, err := os.Create(path.Join(PathUserGopher, "gophermap"))
|
||||
defer file.Close()
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
writer := bufio.NewWriter(file)
|
||||
user, _ := user.Current()
|
||||
writer.WriteString(fmt.Sprintf(`
|
||||
welcome to %s's gopherfeels.
|
||||
|
||||
.:: .::
|
||||
.: .::
|
||||
.:.: .: .:: .:: .:: .::::
|
||||
.:: .: .:: .: .:: .::.::
|
||||
.:: .::::: .::.::::: .:: .:: .:::
|
||||
.:: .: .: .:: .::
|
||||
.:: .:::: .:::: .:::.:: .::
|
||||
|
||||
this file is automatically generated by ttbp.
|
||||
|
||||
0(about ttbp)%s/~endorphant/ttbp.txt%stilde.town%s70
|
||||
1(back to user's home)%s/~%s
|
||||
|
||||
entries:
|
||||
|
||||
`, user.Username, "\t", "\t", "\t", "\t", user.Username))
|
||||
for _, post := range GetPostsForUser(user.Username) {
|
||||
if !post.Nopub && post.Words > 0 {
|
||||
dateString := post.Date.Format("20060102.txt")
|
||||
os.Symlink(path.Join(PathUserEntries, dateString), path.Join(PathUserGopher, dateString))
|
||||
writer.WriteString(fmt.Sprintf("0%s\t%s\n", post.Date.Format("2006-01-02"), dateString))
|
||||
}
|
||||
}
|
||||
writer.Flush()
|
||||
}
|
||||
}
|
||||
|
||||
func Unpublish() {
|
||||
@ -448,6 +492,10 @@ func Unpublish() {
|
||||
os.RemoveAll(PathUserWWW)
|
||||
os.RemoveAll(path.Join(PathUserHTML, cfg.PublishDir))
|
||||
}
|
||||
if cfg.Gopher {
|
||||
os.RemoveAll(PathUserGopher)
|
||||
os.RemoveAll(PathUserGopherhole)
|
||||
}
|
||||
}
|
||||
|
||||
func writePage(post Post, header, footer []byte) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user