aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile10
-rw-r--r--README.md3
-rw-r--r--main.go2
-rw-r--r--views/partials/posts.html10
4 files changed, 15 insertions, 10 deletions
diff --git a/Dockerfile b/Dockerfile
index 050cd0b..ae8930e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,16 @@
FROM golang:1.16-alpine AS builder
WORKDIR /build
COPY . .
-RUN go build .
+RUN apk --no-cache add make git
+
+# Use the 'build' make target when fiber branch is stable
+RUN make debug
FROM alpine:3.14
RUN apk --no-cache add imagemagick exiv2 ttf-opensans
WORKDIR /app
-COPY --from=builder /build/Server /app
+COPY --from=builder /build/fchan /app
COPY static/ /app/static/
+COPY views/ /app/views/
COPY databaseschema.psql /app
-CMD ["/app/Server"]
+CMD ["/app/fchan"]
diff --git a/README.md b/README.md
index 23d02fc..c573a30 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,8 @@ This currently helps enforce the Go style guide, but may be expanded upon in the
future.
Before you make a pull request, ensure everything you changed works as expected,
-and to fix errors reported by `go vet`.
+and to fix errors reported by `go vet` and make your code better with
+`staticcheck`.
## Server Installation and Configuration
diff --git a/main.go b/main.go
index 5025832..02beaf4 100644
--- a/main.go
+++ b/main.go
@@ -77,7 +77,7 @@ func main() {
//name, prefname, summary, auth requirements, restricted
if config.InstanceName != "" {
if _, err = db.CreateNewBoardDB(*CreateNewActor("", config.InstanceName, config.InstanceSummary, authReq, false)); err != nil {
- panic(err)
+ //panic(err)
}
if config.PublicIndexing == "true" {
diff --git a/views/partials/posts.html b/views/partials/posts.html
index f82d2d5..a248650 100644
--- a/views/partials/posts.html
+++ b/views/partials/posts.html
@@ -7,7 +7,7 @@
<hr>
{{ end }}
<div style="overflow: auto;">
- <div id="{{ short $board.Actor.Outbox .Id }}" style="overflow: visible; margin-bottom: 12px;">
+ <div id="{{ shortURL $board.Actor.Outbox .Id }}" style="overflow: visible; margin-bottom: 12px;">
{{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
[<a href="/delete?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Post</a>]
{{ end }}
@@ -47,17 +47,17 @@
<span class="subject"><b>{{ .Name }}</b></span>
<span class="name"><b>{{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }}</b></span>
<span class="tripcode"> {{ .TripCode }} </span>
- <span class="timestamp" data-utc="{{.Published | timeToUnix}}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox $opId }}#{{ short $board.Actor.Outbox .Id }}">No.</a> <a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ short $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
+ <span class="timestamp" data-utc="{{.Published | timeToUnix}}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ shortURL $board.Actor.Outbox $opId }}#{{ shortURL $board.Actor.Outbox .Id }}">No.</a> <a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ shortURL $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
<p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{ parseContent $board.Actor $opId .Content $thread }}</p>
{{ if .Replies }}
{{ $replies := .Replies }}
{{ if gt $replies.TotalItems 5 }}
{{ if gt $len 1 }}
- <span>{{ $replies.TotalItems }} replies{{ if gt $replies.TotalImgs 0}} and {{ $replies.TotalImgs }} images{{ end }}, Click <a id="view" post="{{.Id}}" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox .Id }}">here</a> to view all.</span>
+ <span>{{ $replies.TotalItems }} replies{{ if gt $replies.TotalImgs 0}} and {{ $replies.TotalImgs }} images{{ end }}, Click <a id="view" post="{{.Id}}" href="/{{ $board.Name }}/{{ shortURL $board.Actor.Outbox .Id }}">here</a> to view all.</span>
{{ end }}
{{ end }}
{{ range $replies.OrderedItems }}
- <div id="{{ short $board.Actor.Outbox .Id }}">
+ <div id="{{ shortURL $board.Actor.Outbox .Id }}">
<div style="display: inline-block; overflow: auto;">
<div style="float: left; display: block; margin-right: 5px;">&gt;&gt;</div>
<div class="post" style="overflow: auto; padding: 5px; margin-bottom: 2px;">
@@ -102,7 +102,7 @@
<span class="subject"><b>{{ .Name }}</b></span>
<span class="name"><b>{{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }}</b></span>
<span class="tripcode"> {{ .TripCode }} </span>
- <span class="timestamp" data-utc="{{ .Published | timeToUnix }}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox $opId }}#{{ short $board.Actor.Outbox .Id }}">No. </a><a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ short $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
+ <span class="timestamp" data-utc="{{ .Published | timeToUnix }}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ shortURL $board.Actor.Outbox $opId }}#{{ shortURL $board.Actor.Outbox .Id }}">No. </a><a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ shortURL $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
{{ $parentId := .Id }}
{{ if .Replies.OrderedItems }}
{{ range .Replies.OrderedItems }}