mirror of
https://github.com/skidoodle/safebin.git
synced 2026-04-28 03:07:41 +02:00
feat: show version on website
Signed-off-by: skidoodle <contact@albert.lol>
This commit is contained in:
+5
-1
@@ -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
@@ -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 .
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ import (
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
var (
|
||||
Version = "dev"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultHost = "0.0.0.0"
|
||||
DefaultPort = 8080
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user