master
Ted Unangst 5 years ago
commit 391a32f792

@ -4,6 +4,8 @@ changelog
+ Fix bug preventing import of keys + Fix bug preventing import of keys
+ Option to switch map links to Apple.
-- 0.8.2 -- 0.8.2
++ Import command to preserve those embarssassing old posts from Twitter. ++ Import command to preserve those embarssassing old posts from Twitter.

@ -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. posts or actor URLs, in which case their recent outbox is imported.
.Ss Account .Ss Account
It's all about you. 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 .Sh ENVIRONMENT
.Nm .Nm
is designed to work with most browsers, but for optimal results it is is designed to work with most browsers, but for optimal results it is

@ -48,6 +48,7 @@ type WhatAbout struct {
type UserOptions struct { type UserOptions struct {
SkinnyCSS bool `json:",omitempty"` SkinnyCSS bool `json:",omitempty"`
Avatar string `json:",omitempty"` Avatar string `json:",omitempty"`
MapLink string `json:",omitempty"`
} }
type KeyInfo struct { type KeyInfo struct {

@ -10,6 +10,8 @@
<p><textarea name="whatabout">{{ .User.About }}</textarea> <p><textarea name="whatabout">{{ .User.About }}</textarea>
<p><label class="button" for="skinny">skinny layout:</label> <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> <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> <p><button>update settings</button>
</form> </form>
</div> </div>

@ -1,6 +1,7 @@
<article class="honk {{ .Honk.Style }}" data-convoy="{{ .Honk.Convoy }}"> <article class="honk {{ .Honk.Style }}" data-convoy="{{ .Honk.Convoy }}">
{{ $bonkcsrf := .BonkCSRF }} {{ $bonkcsrf := .BonkCSRF }}
{{ $IsPreview := .IsPreview }} {{ $IsPreview := .IsPreview }}
{{ $maplink := .MapLink }}
{{ with .Honk }} {{ with .Honk }}
<header> <header>
{{ if $bonkcsrf }} {{ if $bonkcsrf }}
@ -60,7 +61,7 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
{{ if .Duration }}<br>Duration: {{ .Duration }}{{ end }} {{ if .Duration }}<br>Duration: {{ .Duration }}{{ end }}
{{ end }} {{ end }}
{{ with .Place }} {{ 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 }} {{ end }}
{{ range .Donks }} {{ range .Donks }}
{{ if .Local }} {{ if .Local }}

@ -1,8 +1,9 @@
<div>{{ .TopHID }}</div> <div>{{ .TopHID }}</div>
{{ $BonkCSRF := .HonkCSRF }} {{ $BonkCSRF := .HonkCSRF }}
{{ $MapLink := .MapLink }}
<div><p>{{ .ServerMessage }}</div> <div><p>{{ .ServerMessage }}</div>
<div> <div>
{{ range .Honks }} {{ range .Honks }}
{{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }} {{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF }}
{{ end }} {{ end }}
</div> </div>

@ -22,8 +22,9 @@
<div> <div>
{{ $BonkCSRF := .HonkCSRF }} {{ $BonkCSRF := .HonkCSRF }}
{{ $IsPreview := .IsPreview }} {{ $IsPreview := .IsPreview }}
{{ $MapLink := .MapLink }}
{{ range .Honks }} {{ range .Honks }}
{{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }} {{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }}
{{ end }} {{ end }}
</div> </div>
</div> </div>

@ -59,6 +59,18 @@ func getuserstyle(u *login.UserInfo) template.CSS {
return "" 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{} { func getInfo(r *http.Request) map[string]interface{} {
u := login.GetUserInfo(r) u := login.GetUserInfo(r)
templinfo := make(map[string]interface{}) templinfo := make(map[string]interface{})
@ -940,6 +952,7 @@ func tracker() {
savetracks(tracks) savetracks(tracks)
} }
readyalready <- true readyalready <- true
return
} }
} }
} }
@ -1031,6 +1044,7 @@ func honkpage(w http.ResponseWriter, u *login.UserInfo, honks []*Honk, templinfo
} }
reverbolate(userid, honks) reverbolate(userid, honks)
templinfo["Honks"] = honks templinfo["Honks"] = honks
templinfo["MapLink"] = getmaplink(u)
if templinfo["TopHID"] == nil { if templinfo["TopHID"] == nil {
if len(honks) > 0 { if len(honks) > 0 {
templinfo["TopHID"] = honks[0].ID templinfo["TopHID"] = honks[0].ID
@ -1055,6 +1069,9 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
if r.FormValue("skinny") == "skinny" { if r.FormValue("skinny") == "skinny" {
options.SkinnyCSS = true options.SkinnyCSS = true
} }
if r.FormValue("maps") == "apple" {
options.MapLink = "apple"
}
j, err := jsonify(options) j, err := jsonify(options)
if err == nil { if err == nil {
_, err = db.Exec("update users set about = ?, options = ? where username = ?", whatabout, j, u.Username) _, err = db.Exec("update users set about = ?, options = ? where username = ?", whatabout, j, u.Username)
@ -1270,6 +1287,7 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) {
templinfo := getInfo(r) templinfo := getInfo(r)
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
templinfo["Honks"] = honks templinfo["Honks"] = honks
templinfo["MapLink"] = getmaplink(u)
templinfo["Noise"] = noise templinfo["Noise"] = noise
templinfo["SavedPlace"] = honk.Place templinfo["SavedPlace"] = honk.Place
templinfo["ServerMessage"] = "honk edit" templinfo["ServerMessage"] = "honk edit"
@ -1556,6 +1574,7 @@ func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) {
templinfo := getInfo(r) templinfo := getInfo(r)
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
templinfo["Honks"] = honks templinfo["Honks"] = honks
templinfo["MapLink"] = getmaplink(userinfo)
templinfo["InReplyTo"] = r.FormValue("rid") templinfo["InReplyTo"] = r.FormValue("rid")
templinfo["Noise"] = r.FormValue("noise") templinfo["Noise"] = r.FormValue("noise")
templinfo["SavedFile"] = donkxid templinfo["SavedFile"] = donkxid
@ -1804,8 +1823,9 @@ func savehfcs(w http.ResponseWriter, r *http.Request) {
filt.Expiration = time.Now().UTC().Add(dur) filt.Expiration = time.Now().UTC().Add(dur)
} }
if filt.Actor == "" && filt.Text == "" { if filt.Actor == "" && filt.Text == "" && !filt.IsAnnounce {
log.Printf("blank filter") log.Printf("blank filter")
http.Error(w, "can't save a blank filter", http.StatusInternalServerError)
return return
} }
@ -2025,6 +2045,7 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
} }
reverbolate(userid, honks) reverbolate(userid, honks)
templinfo["Honks"] = honks templinfo["Honks"] = honks
templinfo["MapLink"] = getmaplink(u)
w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Content-Type", "text/html; charset=utf-8")
err := readviews.Execute(w, "honkfrags.html", templinfo) err := readviews.Execute(w, "honkfrags.html", templinfo)
if err != nil { if err != nil {

Loading…
Cancel
Save