- Export the func
- Remove commented-out code
- Use log, not fmt for debug messages
- Remove named return parameters
- Use standard var naming schemes
- Fix spacing in queries and remove unnecessary chars
Previously, loading something like /invite/fFdblk😄 would return a 500,
due to a mix of collations in MySQL while SELECTing for an invite with
an ID of 'fFdblk😄'. This restricts the route to [a-zA-Z0-9] chars, to
prevent this.
Posts without an explicit title render the date as the post header in
lists of posts (like on the blog index and tag pages). This updates
localdate.js to properly adjust those dates, too.
This gets rid of the gorilla/context dependency, which might have been
causing a memory leak.
We noticed some serious memory leakage on Write.as that seemed to point
to this library. One heap snapshot:
flat flat% sum% cum cum%
259.13MB 30.41% 30.41% 268.13MB 31.46% net/textproto.(*Reader).ReadMIMEHeader
105.71MB 12.40% 42.81% 105.71MB 12.40% github.com/gorilla/context.Set
78.53MB 9.21% 52.03% 125.53MB 14.73% github.com/gorilla/sessions.(*Registry).Get
55.51MB 6.51% 58.54% 82.52MB 9.68% net/http.(*Request).WithContext
38.01MB 4.46% 63.00% 38.01MB 4.46% github.com/gorilla/mux.extractVars
35MB 4.11% 67.11% 53MB 6.22% context.WithCancel
34.50MB 4.05% 71.16% 34.50MB 4.05% context.WithValue
27MB 3.17% 74.32% 27MB 3.17% net/http.cloneURL
26MB 3.05% 77.38% 26MB 3.05% github.com/gorilla/sessions.NewSession
18MB 2.11% 79.49% 18MB 2.11% context.(*cancelCtx).Done
16.50MB 1.94% 81.42% 16.50MB 1.94% syscall.anyToSockaddr
14MB 1.64% 83.07% 47MB 5.52% github.com/gorilla/sessions.(*CookieStore).New
13.50MB 1.58% 84.65% 51.51MB 6.04% github.com/gorilla/mux.(*Route).Match
11.67MB 1.37% 86.02% 13.21MB 1.55% regexp.(*Regexp).replaceAll
9.72MB 1.14% 87.16% 22.94MB 2.69% regexp.(*Regexp).ReplaceAllString
9.50MB 1.11% 88.28% 115.21MB 13.52% github.com/gorilla/sessions.GetRegistry
With the help of these articles, we tracked it down to this dependency,
and upgraded the library, which seems to have completely fixed the issue
so far:
https://rover.rocks/golang-memory-leak/https://medium.com/@walterwu_22843/golang-memory-leak-while-handling-huge-amount-of-http-request-35cc970cb75e
This should fix#133
changes accounted for
- the tar directory structure had changed to use a subdirectory
- there are now multiple linux targets released
bugs
- the service must be stopped before replacing the binary
- migrations were not being run during an upgrade
Previously, anyone could access the editor even if they weren't logged
in. They couldn't do much in that case (publishing would fail), but it
could potentially cause some confusion.
Now, users will be sent to the login page, and then redirected back to
the editor once successfully logged in.
This makes it possible to complete OAuth signup without creating a
password on the WriteFreely instance.
A user can then add a password to their account through their Account
Settings page without any admin action (all of this logic is already in
place).
Ref T715 T712
This uses the given username as the Display Name / Collection Title if a
user doesn't give one -- as might happen when authenticating with
Write.as.
Ref T712
Having a `Username` field populated in the page data tells the base
template to display navigation that only a logged in user should see. So
this renames the field to `LoginUsername`, similar to our login.tmpl
page.
Ref T712
All usernames should be lowercase, so this generates any username suffix
(in cases of collision) with only lowercase letters. It also removes
vowels to prevent bad 5-letter words from forming.
Ref T712