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