mirror of
https://github.com/skidoodle/safebin.git
synced 2026-04-28 11:17:42 +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:
|
hooks:
|
||||||
- go mod tidy
|
- go mod tidy
|
||||||
|
|
||||||
|
snapshot:
|
||||||
|
version_template: "{{ .Version }}"
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- env:
|
- env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
@@ -13,7 +16,8 @@ builds:
|
|||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
ldflags:
|
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:
|
flags:
|
||||||
- -trimpath
|
- -trimpath
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -9,10 +9,11 @@ COPY . .
|
|||||||
|
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG VERSION=dev
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH 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 \
|
-trimpath \
|
||||||
-o /app/safebin .
|
-o /app/safebin .
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import (
|
|||||||
"go.etcd.io/bbolt"
|
"go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Version = "dev"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultHost = "0.0.0.0"
|
DefaultHost = "0.0.0.0"
|
||||||
DefaultPort = 8080
|
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{
|
err := app.Tmpl.ExecuteTemplate(writer, "layout", map[string]any{
|
||||||
"MaxMB": app.Conf.MaxMB,
|
"MaxMB": app.Conf.MaxMB,
|
||||||
"Host": request.Host,
|
"Host": request.Host,
|
||||||
|
"Version": Version,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -29,6 +29,15 @@
|
|||||||
<div class="dim cli-label">CLI Usage</div>
|
<div class="dim cli-label">CLI Usage</div>
|
||||||
<pre class="cli-pre">curl -F file=@yourfile {{.Host}}</pre>
|
<pre class="cli-pre">curl -F file=@yourfile {{.Host}}</pre>
|
||||||
</section>
|
</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>
|
</div>
|
||||||
<input type="file" id="file-input" class="hidden" />
|
<input type="file" id="file-input" class="hidden" />
|
||||||
<script src="/static/app.js"></script>
|
<script src="/static/app.js"></script>
|
||||||
|
|||||||
@@ -237,10 +237,26 @@ button {
|
|||||||
display: none !important;
|
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) {
|
@media (max-width: 400px) {
|
||||||
.github-btn span {
|
.github-btn span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.github-btn {
|
.github-btn {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user