From c5a53c79da1bef6f2faf402c0e91f16cd6f98124 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Fri, 28 Jul 2023 12:51:17 -0400 Subject: [PATCH 1/8] show lemmy back end version --- routes.go | 1 + templates/settings.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/routes.go b/routes.go index 02e38ed..da65011 100644 --- a/routes.go +++ b/routes.go @@ -687,6 +687,7 @@ func Settings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { Render(w, "index.html", state) return } + state.GetSite() switch r.Method { case "POST": for _, name := range []string{"DefaultSortType", "DefaultListingType", "DefaultCommentSortType"} { diff --git a/templates/settings.html b/templates/settings.html index 969f969..43091e5 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -125,7 +125,7 @@
- + {{ if .XHR }}{{ end }}
From f5a423f2d547daaba452063e741af7c3dfc72299 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Fri, 28 Jul 2023 13:04:41 -0400 Subject: [PATCH 2/8] remove mailto links from title --- routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes.go b/routes.go index da65011..754739b 100644 --- a/routes.go +++ b/routes.go @@ -152,7 +152,7 @@ var funcMap = template.FuncMap{ return body } text := html2text.HTML2TextWithOptions(buf.String(), html2text.WithLinksInnerText()) - re := regexp.MustCompile(`\`) + re := regexp.MustCompile(`\<(https?:\/\/|mailto)(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)\>`) return re.ReplaceAllString(text, "") }, "contains": strings.Contains, From c935ffabea981e88446097585364dcb617873357 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Fri, 28 Jul 2023 13:36:03 -0400 Subject: [PATCH 3/8] add version to make --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a7e0a0c..1b88d82 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: mlmym -mlmym: +mlmym: VERSION go build -v -o mlmym dev: From 624b7e48470eed2dfcc015a483388f05d2c84457 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Fri, 28 Jul 2023 17:00:58 -0400 Subject: [PATCH 4/8] add fedilink. fixes #57 --- templates/comment.html | 1 + templates/post.html | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/comment.html b/templates/comment.html index 631132c..c33d77a 100644 --- a/templates/comment.html +++ b/templates/comment.html @@ -52,6 +52,7 @@ {{ end }}
  • permalink
  • +
  • fedilink
  • {{ if ne .Op "source"}}
  • source
  • {{ else }} diff --git a/templates/post.html b/templates/post.html index 5bdd3ab..b3696be 100644 --- a/templates/post.html +++ b/templates/post.html @@ -60,6 +60,7 @@
    {{ if .Post.NSFW }}NSFW{{end}} {{ .Counts.Comments }} comments + fedilink {{ if and .State.Session (eq .State.Session.UserID .Post.CreatorID) }} {{ if not .Post.Deleted }}edit{{end}}
    + {{ if not .State.HideThumbnails }} + {{ end }}
    {{ rmmarkdown .Post.Name }} diff --git a/templates/settings.html b/templates/settings.html index 43091e5..badbaa0 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -125,7 +125,13 @@
    - + + +
    +
    + {{ if .XHR }}{{ end }}
    From d8292bb9bea7ed6e689639d28db9f44655f839f3 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Tue, 8 Aug 2023 17:57:47 -0400 Subject: [PATCH 7/8] fix thumbnail default --- routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes.go b/routes.go index 5eb9c94..0503178 100644 --- a/routes.go +++ b/routes.go @@ -270,7 +270,7 @@ func Initialize(Host string, r *http.Request) (State, error) { if hide := getCookie(r, "HideThumbnails"); hide != "" { state.HideThumbnails = hide != "0" } else { - state.HideThumbnails = os.Getenv("HIDE_THUMBNAILS") != "0" + state.HideThumbnails = os.Getenv("HIDE_THUMBNAILS") != "" } state.ParseQuery(r.URL.RawQuery) if state.Sort == "" { From a96b5b1cd20801b79455835db995d8fa10509215 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Tue, 8 Aug 2023 18:03:03 -0400 Subject: [PATCH 8/8] fix dark default --- routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes.go b/routes.go index 0503178..d72d653 100644 --- a/routes.go +++ b/routes.go @@ -263,7 +263,7 @@ func Initialize(Host string, r *http.Request) (State, error) { if dark := getCookie(r, "Dark"); dark != "" { state.Dark = dark != "0" } else { - state.Dark = os.Getenv("DARK") != "0" + state.Dark = os.Getenv("DARK") != "" } state.ShowNSFW = getCookie(r, "ShowNSFW") != "" state.HideInstanceNames = getCookie(r, "HideInstanceNames") != ""