all repos — honk @ c9f54bab7607c97f20d415e03de59410f3cb0065

my fork of honk

merge
Ted Unangst tedu@tedunangst.com
Mon, 18 Nov 2019 15:18:27 -0500
commit

c9f54bab7607c97f20d415e03de59410f3cb0065

parent

70a3a848025ed86b6bd25dd5fa5f0675952eecc3

M docs/changelog.txtdocs/changelog.txt

@@ -4,6 +4,8 @@ -- next

+ Fix bug preventing import of keys ++ Option to switch map links to Apple. + -- 0.8.2 ++ Import command to preserve those embarssassing old posts from Twitter.
M docs/honk.1docs/honk.1

@@ -164,6 +164,15 @@ It also allows the import of external objects via URL, either individual

posts or actor URLs, in which case their recent outbox is imported. .Ss Account It's all about you. +.Pp +Some options to customize the site appearance: +.Bl -tag -width skinny +.It skinny +Use a narrower column for the main display. +.It apple +Prefer Apple links for maps. +The default is OpenStreetMap. +.El .Sh ENVIRONMENT .Nm is designed to work with most browsers, but for optimal results it is
M honk.gohonk.go

@@ -48,6 +48,7 @@

type UserOptions struct { SkinnyCSS bool `json:",omitempty"` Avatar string `json:",omitempty"` + MapLink string `json:",omitempty"` } type KeyInfo struct {
M views/account.htmlviews/account.html

@@ -10,6 +10,8 @@ <p>about me:

<p><textarea name="whatabout">{{ .User.About }}</textarea> <p><label class="button" for="skinny">skinny layout:</label> <input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span> +<p><label class="button" for="maps">apple map links:</label> +<input tabindex=1 type="checkbox" id="maps" name="maps" value="apple" {{ if eq "apple" .User.Options.MapLink }}checked{{ end }}><span></span> <p><button>update settings</button> </form> </div>
M views/honk.htmlviews/honk.html

@@ -1,6 +1,7 @@

<article class="honk {{ .Honk.Style }}" data-convoy="{{ .Honk.Convoy }}"> {{ $bonkcsrf := .BonkCSRF }} {{ $IsPreview := .IsPreview }} +{{ $maplink := .MapLink }} {{ with .Honk }} <header> {{ if $bonkcsrf }}

@@ -60,7 +61,7 @@ <p>Time: {{ .StartTime.Local.Format "03:04PM EDT Mon Jan 02"}}

{{ if .Duration }}<br>Duration: {{ .Duration }}{{ end }} {{ end }} {{ with .Place }} -<p>Location: {{ with .Url }}<a href="{{ . }}" rel=noreferrer>{{ end }}{{ .Name }}{{ if .Url }}</a>{{ end }}{{ if or .Latitude .Longitude }} <a href="https://www.openstreetmap.org/?mlat={{ .Latitude }}&mlon={{ .Longitude}}#map=16/{{ .Latitude }}/{{ .Longitude }}" rel=noreferrer>{{ .Latitude }} {{ .Longitude }}</a>{{ end }} +<p>Location: {{ with .Url }}<a href="{{ . }}" rel=noreferrer>{{ end }}{{ .Name }}{{ if .Url }}</a>{{ end }}{{ if or .Latitude .Longitude }} <a href="{{ if eq $maplink "apple" }}https://maps.apple.com/?q={{ or .Name "here" }}&z=16&ll={{ .Latitude }},{{ .Longitude }}{{ else }}https://www.openstreetmap.org/?mlat={{ .Latitude }}&mlon={{ .Longitude}}#map=16/{{ .Latitude }}/{{ .Longitude }}{{ end }}" rel=noreferrer>{{ .Latitude }} {{ .Longitude }}</a>{{ end }} {{ end }} {{ range .Donks }} {{ if .Local }}
M views/honkfrags.htmlviews/honkfrags.html

@@ -1,8 +1,9 @@

<div>{{ .TopHID }}</div> {{ $BonkCSRF := .HonkCSRF }} +{{ $MapLink := .MapLink }} <div><p>{{ .ServerMessage }}</div> <div> {{ range .Honks }} -{{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }} +{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF }} {{ end }} </div>
M views/honkpage.htmlviews/honkpage.html

@@ -22,8 +22,9 @@ <div id="honksonpage">

<div> {{ $BonkCSRF := .HonkCSRF }} {{ $IsPreview := .IsPreview }} +{{ $MapLink := .MapLink }} {{ range .Honks }} -{{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }} +{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }} {{ end }} </div> </div>
M web.goweb.go

@@ -59,6 +59,18 @@ }

return "" } +func getmaplink(u *login.UserInfo) string { + if u == nil { + return "osm" + } + user, _ := butwhatabout(u.Username) + ml := user.Options.MapLink + if ml == "" { + ml = "osm" + } + return ml +} + func getInfo(r *http.Request) map[string]interface{} { u := login.GetUserInfo(r) templinfo := make(map[string]interface{})

@@ -940,6 +952,7 @@ if len(tracks) > 0 {

savetracks(tracks) } readyalready <- true + return } } }

@@ -1031,6 +1044,7 @@ userid = u.UserID

} reverbolate(userid, honks) templinfo["Honks"] = honks + templinfo["MapLink"] = getmaplink(u) if templinfo["TopHID"] == nil { if len(honks) > 0 { templinfo["TopHID"] = honks[0].ID

@@ -1054,6 +1068,9 @@ db := opendatabase()

var options UserOptions if r.FormValue("skinny") == "skinny" { options.SkinnyCSS = true + } + if r.FormValue("maps") == "apple" { + options.MapLink = "apple" } j, err := jsonify(options) if err == nil {

@@ -1270,6 +1287,7 @@ reverbolate(u.UserID, honks)

templinfo := getInfo(r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["Honks"] = honks + templinfo["MapLink"] = getmaplink(u) templinfo["Noise"] = noise templinfo["SavedPlace"] = honk.Place templinfo["ServerMessage"] = "honk edit"

@@ -1556,6 +1574,7 @@ reverbolate(userinfo.UserID, honks)

templinfo := getInfo(r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["Honks"] = honks + templinfo["MapLink"] = getmaplink(userinfo) templinfo["InReplyTo"] = r.FormValue("rid") templinfo["Noise"] = r.FormValue("noise") templinfo["SavedFile"] = donkxid

@@ -1804,8 +1823,9 @@ if dur := parseDuration(r.FormValue("filtduration")); dur > 0 {

filt.Expiration = time.Now().UTC().Add(dur) } - if filt.Actor == "" && filt.Text == "" { + if filt.Actor == "" && filt.Text == "" && !filt.IsAnnounce { log.Printf("blank filter") + http.Error(w, "can't save a blank filter", http.StatusInternalServerError) return }

@@ -2025,6 +2045,7 @@ templinfo["TopHID"] = wanted

} reverbolate(userid, honks) templinfo["Honks"] = honks + templinfo["MapLink"] = getmaplink(u) w.Header().Set("Content-Type", "text/html; charset=utf-8") err := readviews.Execute(w, "honkfrags.html", templinfo) if err != nil {