mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-23 05:52:12 +00:00
show mlmym version
This commit is contained in:
parent
3ce346d815
commit
3ebf9b3793
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
mlmym
|
||||
VERSION
|
||||
*.toml
|
||||
*.txt
|
||||
|
|
|
@ -4,6 +4,7 @@ WORKDIR /app
|
|||
COPY go.* ./
|
||||
RUN go mod download
|
||||
COPY . ./
|
||||
RUN git describe --tag > VERSION
|
||||
RUN go build -v -o mlmym
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
@ -14,4 +15,5 @@ RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -
|
|||
COPY --from=builder /app/mlmym /app/mlmym
|
||||
COPY --from=builder /app/templates /app/templates
|
||||
COPY --from=builder /app/public /app/public
|
||||
COPY --from=builder /app/VERSION /app/VERSION
|
||||
CMD ["./mlmym", "--addr", "0.0.0.0:8080"]
|
||||
|
|
23
Makefile
23
Makefile
|
@ -1,17 +1,18 @@
|
|||
.PHONY: dev reload serve style
|
||||
.PHONY: dev reload serve VERSION
|
||||
|
||||
all:
|
||||
$(MAKE) -j3 --no-print-directory dev
|
||||
all: mlmym
|
||||
|
||||
dev: reload serve style
|
||||
mlmym:
|
||||
go build -v -o mlmym
|
||||
|
||||
dev:
|
||||
$(MAKE) -j2 --no-print-directory reload serve
|
||||
|
||||
reload:
|
||||
#websocketd --port=8080 watchexec -w public echo reload &>/dev/null
|
||||
websocketd --loglevel=fatal --port=8009 watchexec --no-vcs-ignore -e html,css,js -d 500 -w public 'echo "$$WATCHEXEC_WRITTEN_PATH"'
|
||||
websocketd --loglevel=fatal --port=8009 watchexec -e html,css,js -d 500 'echo "$$WATCHEXEC_WRITTEN_PATH"'
|
||||
|
||||
serve:
|
||||
#python -m http.server --directory ./public 8081 &>/dev/null
|
||||
DEBUG=true watchexec -e go -r "go run . --addr 0.0.0.0:8008 -w"
|
||||
VERSION:
|
||||
git describe --tag > $@
|
||||
|
||||
style:
|
||||
npm run watchcss > /dev/null 2>&1
|
||||
serve: VERSION
|
||||
DEBUG=true watchexec --no-vcs-ignore -e go -r "go run . --addr 0.0.0.0:8008 -w"
|
||||
|
|
4
main.go
4
main.go
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/yuin/goldmark/extension"
|
||||
)
|
||||
|
||||
var version string
|
||||
var watch = flag.Bool("w", false, "watch for file changes")
|
||||
var addr = flag.String("addr", ":80", "http service address")
|
||||
var md goldmark.Markdown
|
||||
|
@ -68,6 +69,9 @@ func init() {
|
|||
if os.Getenv("DEBUG") != "" {
|
||||
test()
|
||||
}
|
||||
if data, err := os.ReadFile("VERSION"); err == nil {
|
||||
version = string(data)
|
||||
}
|
||||
}
|
||||
func test() {
|
||||
links := [][]string{
|
||||
|
|
|
@ -1057,6 +1057,9 @@ form.create input[type=file], form.create select {
|
|||
font-size: 13px;
|
||||
margin: 10px;
|
||||
}
|
||||
.preferences div:last-child label {
|
||||
text-align: left;
|
||||
}
|
||||
.preferences label{
|
||||
display: inline-block;
|
||||
width: 130px;
|
||||
|
|
|
@ -198,9 +198,10 @@ func RegReplace(input string, match string, replace string) string {
|
|||
|
||||
func Initialize(Host string, r *http.Request) (State, error) {
|
||||
state := State{
|
||||
Host: Host,
|
||||
Page: 1,
|
||||
Status: http.StatusOK,
|
||||
Host: Host,
|
||||
Page: 1,
|
||||
Status: http.StatusOK,
|
||||
Version: version,
|
||||
}
|
||||
lemmyDomain := os.Getenv("LEMMY_DOMAIN")
|
||||
if lemmyDomain != "" {
|
||||
|
|
1
state.go
1
state.go
|
@ -64,6 +64,7 @@ type Session struct {
|
|||
}
|
||||
|
||||
type State struct {
|
||||
Version string
|
||||
Client *lemmy.Client
|
||||
HTTPClient *http.Client
|
||||
Session *Session
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<input type="checkbox" name="hideInstanceNames" {{ if .HideInstanceNames }}checked{{end}}>
|
||||
</div>
|
||||
<div>
|
||||
<label></label>
|
||||
<label>mlmym: {{ .Version }}</label>
|
||||
<input type="submit" value="save">
|
||||
{{ if .XHR }}<input id="closesettings" type="submit" value="close">{{ end }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue