1
Fork 0

Move .status.json to .status.

Keep a redirect for backwards compatibility.
This commit is contained in:
Juliusz Chroboczek 2024-01-17 22:17:54 +01:00
parent b92cf0480a
commit 3ad6f27b17
3 changed files with 10 additions and 6 deletions

View File

@ -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
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 following fields:
@ -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
values `present`, `op` and `record`. The `status` field is a dictionary
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

View File

@ -3906,7 +3906,7 @@ async function serverConnect() {
async function start() {
try {
let r = await fetch(".status.json")
let r = await fetch(".status")
if(!r.ok)
throw new Error(`${r.status} ${r.statusText}`);
groupStatus = await r.json()

View File

@ -318,10 +318,14 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return
}
_, kind, rest := splitPath(r.URL.Path)
if kind == ".status.json" && rest == "" {
dir, kind, rest := splitPath(r.URL.Path)
if kind == ".status" && rest == "" {
groupStatusHandler(w, r)
return
} else if kind == ".status.json" && rest == "" {
http.Redirect(w, r, dir+"/"+".status",
http.StatusPermanentRedirect)
return
} else if kind == ".whip" {
if rest == "" {
whipEndpointHandler(w, r)
@ -384,7 +388,7 @@ func groupBase(r *http.Request) (string, error) {
func groupStatusHandler(w http.ResponseWriter, r *http.Request) {
pth, kind, rest := splitPath(r.URL.Path)
if kind != ".status.json" || rest != "" {
if kind != ".status" || rest != "" {
http.Error(w, "Internal server error",
http.StatusInternalServerError)
}