1 Commits

Author SHA1 Message Date
x f0336b21b8 feat: show version on website
Signed-off-by: skidoodle <contact@albert.lol>
2026-01-19 01:31:28 +01:00
6 changed files with 39 additions and 4 deletions
+5 -1
View File
@@ -4,6 +4,9 @@ before:
hooks:
- go mod tidy
snapshot:
version_template: "{{ .Version }}"
builds:
- env:
- CGO_ENABLED=0
@@ -13,7 +16,8 @@ builds:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
- -s -w
- -X github.com/skidoodle/safebin/internal/app.Version={{.Version}}
flags:
- -trimpath
+2 -1
View File
@@ -9,10 +9,11 @@ COPY . .
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
RUN --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build \
-ldflags="-s -w" \
-ldflags="-s -w -X github.com/skidoodle/safebin/internal/app.Version=$VERSION" \
-trimpath \
-o /app/safebin .
+4
View File
@@ -13,6 +13,10 @@ import (
"go.etcd.io/bbolt"
)
var (
Version = "dev"
)
const (
DefaultHost = "0.0.0.0"
DefaultPort = 8080
+1
View File
@@ -41,6 +41,7 @@ func (app *App) HandleHome(writer http.ResponseWriter, request *http.Request) {
err := app.Tmpl.ExecuteTemplate(writer, "layout", map[string]any{
"MaxMB": app.Conf.MaxMB,
"Host": request.Host,
"Version": Version,
})
if err != nil {
+9
View File
@@ -29,6 +29,15 @@
<div class="dim cli-label">CLI Usage</div>
<pre class="cli-pre">curl -F file=@yourfile {{.Host}}</pre>
</section>
<footer class="footer">
<div class="dim">
{{if eq .Version "dev"}}
<a href="https://github.com/skidoodle/safebin" target="_blank" rel="noopener noreferrer">dev</a>
{{else}}
<a href="https://github.com/skidoodle/safebin/releases/tag/v{{.Version}}" target="_blank" rel="noopener noreferrer">v{{.Version}}</a>
{{end}}
</div>
</footer>
</div>
<input type="file" id="file-input" class="hidden" />
<script src="/static/app.js"></script>
+16
View File
@@ -237,10 +237,26 @@ button {
display: none !important;
}
.footer {
margin-top: 20px;
text-align: center;
opacity: 0.5;
}
.footer a {
color: inherit;
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
@media (max-width: 400px) {
.github-btn span {
display: none;
}
.github-btn {
padding: 6px;
}