Skip to content

Commit

Permalink
editor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Jul 24, 2024
1 parent 25d0de2 commit 6dc71cc
Show file tree
Hide file tree
Showing 21 changed files with 1,529 additions and 1,081 deletions.
2 changes: 1 addition & 1 deletion assets/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}

.reader {
font-size: 150%;
font-size: 133%;
line-height: 1;
white-space: pre-wrap;
hyphens: manual;
Expand Down
4 changes: 4 additions & 0 deletions docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- [ ] Complete `internal/archive/archive.go to support all archive types. need to supprt legacy zip via hwzip and arc.
- [ ] Automatic cleanup of tmp/defacto2-server if drive space is low.
- [ ] When extracting archives for MS-DOS, flag invalid filenames and suggest a repack.
- [ ] Render HTML in an iframe instead of readme? Example, http://localhost:1323/f/ad3075
- [ ] Handle magazines title on artifact page, http://localhost:1323/f/a55ed, this is hard to read, "Issue 4\nThe Pirate Syndicate +\nThe Pirate World"
- [ ] If artifact is a text file displayed in readme, then delete image preview, these are often super long, large and not needed.

- [ ] - http://www.platohistory.org/
- [ ] - https://portcommodore.com/dokuwiki/doku.php?id=larry:comp:bbs:about_cbbs
Expand All @@ -23,6 +26,7 @@ Magic files to add:

- Excel, http://localhost:1323/f/b02fcc
- Multipart zip, http://localhost:1323/f/a9247de, http://localhost:1323/f/a619619
- Convert ms-dos filenames to valid utf-8 names, see http://localhost:1323/f/b323bda

### Bug fixes

Expand Down
34 changes: 34 additions & 0 deletions handler/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,40 @@ func ReadmeSuggest(filename, group string, content ...string) string {
return ""
}

// Readmes returns a list of readme text files found in the file archive.
func Readmes(content ...string) []string {
finds := []string{}
skip := []string{"scene.org", "scene.org.txt"}
for _, name := range content {
if name == "" {
continue
}
s := strings.ToLower(name)
if slices.Contains(skip, s) {
continue
}
ext := filepath.Ext(s)
if slices.Contains(priority(), ext) {
finds = append(finds, name)
continue
}
if slices.Contains(candidate(), ext) {
finds = append(finds, name)
}
}
return finds
}

// priority returns a list of readme text file extensions in priority order.
func priority() []string {
return []string{".nfo", ".txt", ".unp", ".doc"}
}

// candidate returns a list of other, common text file extensions in priority order.
func candidate() []string {
return []string{".diz", ".asc", ".1st", ".dox", ".me", ".cap", ".ans", ".pcb"}
}

// RecordRels returns the groups associated with a release and joins them with a plus sign.
func RecordRels(a, b any) string {
av, bv, s := "", "", ""
Expand Down
Loading

0 comments on commit 6dc71cc

Please sign in to comment.