Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.4
version: v2.5
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ To change application settings, copy the default settings JSON file and use the
gone -config mySettings.json
```

To disable a feature, set the path to an empty value. For example, to disallow file uploads:

```
"upload": "",
```

# Clients

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Security Policy

gone is in alpha and has not yet been subject to security audit and may lack adequate user input validation.
This software is in beta and has not yet been subject to formal security audit. It may lack adequate user input validation or other features.

Therefore, gone is only intended for use on a secure network with trusted devices, such as a private LAN.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/drduh/gone

go 1.25.1
go 1.25.2
1 change: 1 addition & 0 deletions handlers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func Index(app *config.App) http.HandlerFunc {
Index: app.Index,
Limits: app.Limits,
Paths: app.Paths,
ShowBuild: app.ShowBuild,
Storage: app.Storage,
Theme: theme,
Uptime: app.Uptime(),
Expand Down
2 changes: 1 addition & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func getHandler(app *config.App) http.Handler {
}
}

handle("/", handlers.Index(app))
handle(app.Root, handlers.Index(app))

if app.Assets != "" {
assets := "assets"
Expand Down
6 changes: 6 additions & 0 deletions settings/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ type Error struct {
// Index HTML index page properties
type Index struct {

// Whether to display build, uptime and version in footer
ShowBuild bool `json:"showBuild"`

// Whether to enable Content Security Policy (CSP)
CSP bool `json:"csp"`

Expand Down Expand Up @@ -193,6 +196,9 @@ type Paths struct {
// Random output ("/random/")
Random string `json:"random"`

// Default root path ("/")
Root string `json:"root"`

// Embedded/static file ("/static")
Static string `json:"static"`

Expand Down
2 changes: 2 additions & 0 deletions settings/defaultSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"index": {
"csp": true,
"showBuild": true,
"title": "gone",
"cookie": {
"id": "goneTheme",
Expand Down Expand Up @@ -77,6 +78,7 @@
"list": "/list",
"message": "/msg",
"random": "/random/",
"root": "/",
"static": "/static",
"upload": "/upload",
"wall": "/wall"
Expand Down
3 changes: 2 additions & 1 deletion storage/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ func (f *File) Serve(w http.ResponseWriter) {
func (s *Storage) ServeMessages(w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/plain")
w.Header().Set("Content-Disposition", "attachment; filename=messages.txt")
msgFormat := "%d (%s) - %s\n"
for _, msg := range s.Messages {
_, err := fmt.Fprintf(w, "%d. %s\n", msg.Count, msg.Data)
_, err := fmt.Fprintf(w, msgFormat, msg.Count, msg.Allow, msg.Data)
if err != nil {
return
}
Expand Down
2 changes: 2 additions & 0 deletions templates/data/footer.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<!-- footer.tmpl -->
{{ define "footer" }}
<div class="footer">
{{ if .ShowBuild }}
<div class="message">{{ .Version.id }}
<span class="owner"> {{ template "version" . }} </span>
</div>
{{ end }}
{{ if .Style.AllowPick }} {{ template "selectTheme" . }} {{ end }}
</div>
</body>
Expand Down
5 changes: 4 additions & 1 deletion templates/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
// Index contains the main HTML page elements.
type Index struct {

// Whether to display build, uptime and version in footer
ShowBuild bool

// Selected CSS theme
Theme string

Expand All @@ -20,7 +23,7 @@ type Index struct {
// Application version/build information
Version map[string]string

// Form field placeholder for duration
// Placeholder text for duration form field
DefaultDuration string

// Authentication configuration
Expand Down
Loading