Commit 3ad6f27b authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move .status.json to .status.

Keep a redirect for backwards compatibility.
parent b92cf048
...@@ -33,7 +33,7 @@ at which the group is found. This may be obtained either by explicit ...@@ -33,7 +33,7 @@ at which the group is found. This may be obtained either by explicit
configuration by the user, or by parsing the `/public-groups.json` file configuration by the user, or by parsing the `/public-groups.json` file
which may contain an array of group statuses (see below). which may contain an array of group statuses (see below).
A client then performs an HTTP GET request on the file `.status.json` at A client then performs an HTTP GET request on the file `.status` at
the group's location. This yields a single JSON object, which contains the group's location. This yields a single JSON object, which contains
the following fields: the following fields:
...@@ -158,7 +158,7 @@ The `username` field is the username that the server assigned to this ...@@ -158,7 +158,7 @@ The `username` field is the username that the server assigned to this
user. The `permissions` field is an array of strings that may contain the user. The `permissions` field is an array of strings that may contain the
values `present`, `op` and `record`. The `status` field is a dictionary values `present`, `op` and `record`. The `status` field is a dictionary
that contains status information about the group, and updates the data that contains status information about the group, and updates the data
obtained from the `.status.json` URL described above. obtained from the `.status` URL described above.
## Maintaining group membership ## Maintaining group membership
......
...@@ -3906,7 +3906,7 @@ async function serverConnect() { ...@@ -3906,7 +3906,7 @@ async function serverConnect() {
async function start() { async function start() {
try { try {
let r = await fetch(".status.json") let r = await fetch(".status")
if(!r.ok) if(!r.ok)
throw new Error(`${r.status} ${r.statusText}`); throw new Error(`${r.status} ${r.statusText}`);
groupStatus = await r.json() groupStatus = await r.json()
......
...@@ -318,10 +318,14 @@ func groupHandler(w http.ResponseWriter, r *http.Request) { ...@@ -318,10 +318,14 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
_, kind, rest := splitPath(r.URL.Path) dir, kind, rest := splitPath(r.URL.Path)
if kind == ".status.json" && rest == "" { if kind == ".status" && rest == "" {
groupStatusHandler(w, r) groupStatusHandler(w, r)
return return
} else if kind == ".status.json" && rest == "" {
http.Redirect(w, r, dir+"/"+".status",
http.StatusPermanentRedirect)
return
} else if kind == ".whip" { } else if kind == ".whip" {
if rest == "" { if rest == "" {
whipEndpointHandler(w, r) whipEndpointHandler(w, r)
...@@ -384,7 +388,7 @@ func groupBase(r *http.Request) (string, error) { ...@@ -384,7 +388,7 @@ func groupBase(r *http.Request) (string, error) {
func groupStatusHandler(w http.ResponseWriter, r *http.Request) { func groupStatusHandler(w http.ResponseWriter, r *http.Request) {
pth, kind, rest := splitPath(r.URL.Path) pth, kind, rest := splitPath(r.URL.Path)
if kind != ".status.json" || rest != "" { if kind != ".status" || rest != "" {
http.Error(w, "Internal server error", http.Error(w, "Internal server error",
http.StatusInternalServerError) http.StatusInternalServerError)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment