aboutsummaryrefslogtreecommitdiff
path: root/v0.9.5/patches
diff options
context:
space:
mode:
Diffstat (limited to 'v0.9.5/patches')
-rw-r--r--v0.9.5/patches/02_bloated_i18n_implementation.patch153
-rw-r--r--v0.9.5/patches/03_bloated_i18n_implementation.patch157
2 files changed, 153 insertions, 157 deletions
diff --git a/v0.9.5/patches/02_bloated_i18n_implementation.patch b/v0.9.5/patches/02_bloated_i18n_implementation.patch
deleted file mode 100644
index 4e22e8c..0000000
--- a/v0.9.5/patches/02_bloated_i18n_implementation.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-diff --git a/bloat.go b/bloat.go
-index e89675f..ca4a76f 100644
---- a/bloat.go
-+++ b/bloat.go
-@@ -14,3 +14,148 @@
- // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- package main
-+
-+import (
-+ "net/http"
-+ "regexp"
-+ "log"
-+ "humungus.tedunangst.com/r/webs/login"
-+)
-+
-+type i18n struct {
-+ Home string
-+ Atme string
-+ First string
-+ Combos string
-+ Chatter string
-+ Tags string
-+ Events string
-+ Longago string
-+ Saved string
-+ Honkers string
-+ Hcfs string
-+ Account string
-+ Morestuff string
-+ Myhonks string
-+ About string
-+ Front string
-+ Funzone string
-+ Xzone string
-+ Help string
-+ Search string
-+ Login string
-+
-+ Newhonk string
-+}
-+
-+func getLangCookie(r *http.Request) string {
-+ langCookie, err := r.Cookie("lang")
-+ if err != nil {
-+ return "en"
-+ }
-+ return langCookie.Value
-+}
-+
-+
-+
-+func setLangCookie (w http.ResponseWriter, r *http.Request) {
-+ var lang string
-+ lang = r.FormValue("lang")
-+ var IsLetter = regexp.MustCompile(`^([a-z]+)$`).MatchString
-+
-+ if !IsLetter(lang) {
-+ lang = "wrong" // so !=2 is triggered
-+ if debugMode {
-+ log.Printf("lang cookie value is not letters")
-+ }
-+ }
-+
-+ if len(lang) != 2 {
-+ if debugMode {
-+ log.Printf("lang cookie value is too long or too short. defaulting to eng")
-+ }
-+ lang = "en"
-+ }
-+
-+ maxage := 3600 * 24 * 30 * 12
-+ if !debugMode {
-+ http.SetCookie(w, &http.Cookie{
-+ Name: "lang",
-+ Value: lang,
-+ MaxAge: maxage,
-+ Secure: true,
-+ HttpOnly: true,
-+ })
-+ } else {
-+ http.SetCookie(w, &http.Cookie{
-+ Name: "lang",
-+ Value: lang,
-+ MaxAge: maxage,
-+ Secure: false,
-+ HttpOnly: true,
-+ })
-+ }
-+
-+
-+ u := login.GetUserInfo(r)
-+ if u == nil {
-+ http.Redirect(w, r, "/", http.StatusSeeOther)
-+ }
-+}
-+
-+func setLangStr (lang string) interface{} {
-+ switch lang {
-+ case "fr" :
-+ tlStr := i18n{
-+ "accueil",
-+ "mentions",
-+ "premier (first)",
-+ "combos",
-+ "discutaille",
-+ "balises",
-+ "événements",
-+ "il y a longtemps",
-+ "sauvegardés",
-+ "klaxonneurs",
-+ "filtrer (hcfs)",
-+ "compte",
-+ "plus de choses",
-+ "profil",
-+ "à propos",
-+ "tout le réseau connu",
-+ "zone fun",
-+ "récup",
-+ "aide",
-+ "rechercher",
-+ "connexion",
-+ "klaxonner",
-+ }
-+ return tlStr
-+ default:
-+ tlStr := i18n{
-+ "home",
-+ "@me",
-+ "first",
-+ "combos",
-+ "chatter",
-+ "tags",
-+ "events",
-+ "long ago",
-+ "saved",
-+ "honkers",
-+ "filters",
-+ "account",
-+ "more stuff",
-+ "my honks",
-+ "about",
-+ "front",
-+ "funzone",
-+ "xzone",
-+ "help",
-+ "search",
-+ "login",
-+ "new honk",
-+ }
-+ return tlStr
-+ }
-+}
diff --git a/v0.9.5/patches/03_bloated_i18n_implementation.patch b/v0.9.5/patches/03_bloated_i18n_implementation.patch
index dff14f3..a788f0f 100644
--- a/v0.9.5/patches/03_bloated_i18n_implementation.patch
+++ b/v0.9.5/patches/03_bloated_i18n_implementation.patch
@@ -1,5 +1,5 @@
diff --git a/web.go b/web.go
-index 11adf5b..8e42bae 100644
+index 11adf5b..7c0c184 100644
--- a/web.go
+++ b/web.go
@@ -85,6 +85,9 @@ func getInfo(r *http.Request) map[string]interface{} {
@@ -21,7 +21,57 @@ index 11adf5b..8e42bae 100644
if u == nil || r.URL.Path == "/front" {
switch r.URL.Path {
case "/events":
-@@ -733,6 +736,8 @@ func showhonker(w http.ResponseWriter, r *http.Request) {
+@@ -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)
@@ -30,7 +80,21 @@ index 11adf5b..8e42bae 100644
honkpage(w, u, honks, templinfo)
}
-@@ -1109,8 +1114,9 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
+@@ -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")
@@ -42,7 +106,92 @@ index 11adf5b..8e42bae 100644
ava := re_avatar.FindString(whatabout)
if ava != "" {
whatabout = re_avatar.ReplaceAllString(whatabout, "")
-@@ -2436,6 +2442,7 @@ func serve() {
+@@ -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)