diff options
author | Miquel Lionel <lionelmiquel@sfr.fr> | 2021-02-18 17:25:32 +0100 |
---|---|---|
committer | Miquel Lionel <lionel@les-miquelots.net> | 2021-02-18 17:25:32 +0100 |
commit | 4e513641d311f1a3895a13efb45179e7b88e5b6d (patch) | |
tree | 6f9bdd76b46072f7a2fbe42ce5f4cbbd8491a561 /patches | |
parent | c9129233298e6586e2242fd6892cd84531390b83 (diff) | |
download | honk_custom-4e513641d311f1a3895a13efb45179e7b88e5b6d.tar.gz honk_custom-4e513641d311f1a3895a13efb45179e7b88e5b6d.zip |
now this branch will work on tip
Diffstat (limited to 'patches')
-rw-r--r-- | patches/01_prettier_rssfeed.patch | 16 | ||||
-rw-r--r-- | patches/03_bloated_i18n_implementation.patch | 201 |
2 files changed, 217 insertions, 0 deletions
diff --git a/patches/01_prettier_rssfeed.patch b/patches/01_prettier_rssfeed.patch new file mode 100644 index 0000000..80e8d9e --- /dev/null +++ b/patches/01_prettier_rssfeed.patch @@ -0,0 +1,16 @@ +diff --git a/web.go b/web.go +index 11adf5b..502e15f 100644 +--- a/web.go ++++ b/web.go +@@ -190,9 +190,9 @@ func showrss(w http.ResponseWriter, r *http.Request) { + name += " " + } + feed := rss.Feed{ +- Title: name + "honk", ++ Title: "@" + name + " - honking from " + serverName, + Link: home, +- Description: name + "honk rss", ++ Description: "RSS Feed of honks from " + name + "@" + serverName, + Image: &rss.Image{ + URL: base + "icon.png", + Title: name + "honk rss", diff --git a/patches/03_bloated_i18n_implementation.patch b/patches/03_bloated_i18n_implementation.patch new file mode 100644 index 0000000..a788f0f --- /dev/null +++ b/patches/03_bloated_i18n_implementation.patch @@ -0,0 +1,201 @@ +diff --git a/web.go b/web.go +index 11adf5b..7c0c184 100644 +--- a/web.go ++++ b/web.go +@@ -85,6 +85,9 @@ func getInfo(r *http.Request) map[string]interface{} { + templinfo["IconName"] = iconName + templinfo["UserInfo"] = u + templinfo["UserSep"] = userSep ++ templinfo["Lang"] = getLangCookie(r) ++ templinfo["i18n"] = setLangStr(getLangCookie(r)) ++ + if u != nil { + var combos []string + combocache.Get(u.UserID, &combos) +@@ -99,7 +102,7 @@ func homepage(w http.ResponseWriter, r *http.Request) { + var honks []*Honk + var userid int64 = -1 + +- templinfo["ServerMessage"] = serverMsg ++ templinfo["ServerMessage"] = serverMsg + if u == nil || r.URL.Path == "/front" { + switch r.URL.Path { + case "/events": +@@ -113,17 +116,32 @@ func homepage(w http.ResponseWriter, r *http.Request) { + userid = u.UserID + switch r.URL.Path { + case "/atme": +- templinfo["ServerMessage"] = "at me!" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "pour moi!" ++ default: ++ templinfo["ServerMessage"] = "at me!" ++ } + templinfo["PageName"] = "atme" + honks = gethonksforme(userid, 0) + honks = osmosis(honks, userid, false) + case "/longago": +- templinfo["ServerMessage"] = "long ago and far away!" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "il y a longtemps" ++ default: ++ templinfo["ServerMessage"] = "long ago and far away!" ++ } + templinfo["PageName"] = "longago" + honks = gethonksfromlongago(userid, 0) + honks = osmosis(honks, userid, false) + case "/events": +- templinfo["ServerMessage"] = "some recent and upcoming events" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "quelques événements récents et à venir" ++ default: ++ templinfo["ServerMessage"] = "some recent and upcoming events" ++ } + templinfo["PageName"] = "events" + honks = geteventhonks(userid) + honks = osmosis(honks, userid, true) +@@ -132,7 +150,12 @@ func homepage(w http.ResponseWriter, r *http.Request) { + honks = gethonksforuserfirstclass(userid, 0) + honks = osmosis(honks, userid, true) + case "/saved": +- templinfo["ServerMessage"] = "saved honks" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "klaxons enregistrés" ++ default: ++ templinfo["ServerMessage"] = "saved honks" ++ } + templinfo["PageName"] = "saved" + honks = getsavedhonks(userid, 0) + default: +@@ -733,6 +756,8 @@ func showhonker(w http.ResponseWriter, r *http.Request) { + templinfo["PageArg"] = name + templinfo["ServerMessage"] = msg + templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) ++ templinfo["Lang"] = getLangCookie(r) ++ + honkpage(w, u, honks, templinfo) + } + +@@ -744,7 +769,12 @@ func showcombo(w http.ResponseWriter, r *http.Request) { + templinfo := getInfo(r) + templinfo["PageName"] = "combo" + templinfo["PageArg"] = name +- templinfo["ServerMessage"] = "honks by combo: " + name ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "klaxons par groupes: " + name ++ default: ++ templinfo["ServerMessage"] = "honks by combo: " + name ++ } + templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) + honkpage(w, u, honks, templinfo) + } +@@ -1109,8 +1139,9 @@ func saveuser(w http.ResponseWriter, r *http.Request) { + options.MapLink = "" + } + options.Reaction = r.FormValue("reaction") +- +- sendupdate := false ++ setLangCookie(w, r) ++ ++ sendupdate := false + ava := re_avatar.FindString(whatabout) + if ava != "" { + whatabout = re_avatar.ReplaceAllString(whatabout, "") +@@ -2179,11 +2210,22 @@ func webhydra(w http.ResponseWriter, r *http.Request) { + case "atme": + honks = gethonksforme(userid, wanted) + honks = osmosis(honks, userid, false) +- templinfo["ServerMessage"] = "at me!" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "pour moi!" ++ default: ++ templinfo["ServerMessage"] = "at me!" ++ } + case "longago": + honks = gethonksfromlongago(userid, wanted) + honks = osmosis(honks, userid, false) +- templinfo["ServerMessage"] = "from long ago" ++ ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "il y a longtemps" ++ default: ++ templinfo["ServerMessage"] = "from long ago" ++ } + case "home": + honks = gethonksforuser(userid, wanted) + honks = osmosis(honks, userid, true) +@@ -2191,26 +2233,53 @@ func webhydra(w http.ResponseWriter, r *http.Request) { + case "first": + honks = gethonksforuserfirstclass(userid, wanted) + honks = osmosis(honks, userid, true) +- templinfo["ServerMessage"] = "first class only" ++ ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "première classe seulement" ++ default: ++ templinfo["ServerMessage"] = "first class only" ++ } + case "saved": + honks = getsavedhonks(userid, wanted) + templinfo["PageName"] = "saved" +- templinfo["ServerMessage"] = "saved honks" ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "klaxons enregistrés" ++ default: ++ templinfo["ServerMessage"] = "saved honks" ++ } + case "combo": + c := r.FormValue("c") + honks = gethonksbycombo(userid, c, wanted) + honks = osmosis(honks, userid, false) +- templinfo["ServerMessage"] = "honks by combo: " + c ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "klaxons par groupe: " + c ++ default: ++ templinfo["ServerMessage"] = "honks by combo: " + c ++ } + case "convoy": + c := r.FormValue("c") + honks = gethonksbyconvoy(userid, c, wanted) + honks = osmosis(honks, userid, false) +- templinfo["ServerMessage"] = "honks in convoy: " + c ++ switch templinfo["Lang"] { ++ case "fr": ++ templinfo["ServerMessage"] = "klaxons dans le convoi: " + c ++ default: ++ templinfo["ServerMessage"] = "honks in convoy: " + c ++ } + case "honker": + xid := r.FormValue("xid") + honks = gethonksbyxonker(userid, xid, wanted) +- msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, xid, xid) +- templinfo["ServerMessage"] = msg ++ switch templinfo["Lang"] { ++ case "fr": ++ msg := templates.Sprintf(`klaxons par le klaxonneur: <a href="%s" ref="noreferrer">%s</a>`, xid, xid) ++ templinfo["ServerMessage"] = msg ++ default: ++ msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, xid, xid) ++ templinfo["ServerMessage"] = msg ++ } + default: + http.NotFound(w, r) + } +@@ -2436,6 +2505,7 @@ func serve() { + getters.HandleFunc("/server", serveractor) + posters.HandleFunc("/server/inbox", serverinbox) + posters.HandleFunc("/inbox", serverinbox) ++ posters.HandleFunc("/langcookie", setLangCookie) + + getters.HandleFunc("/style.css", serveasset) + getters.HandleFunc("/local.css", serveasset) |