2021-10-08 12:39:31 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
|
|
|
|
//
|
2021-02-09 11:53:33 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-01-25 17:31:09 +00:00
|
|
|
package roomsrv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
|
2022-11-07 09:18:13 +00:00
|
|
|
"github.com/ssbc/go-muxrpc/v2"
|
2021-01-25 17:31:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type manifestHandler string
|
|
|
|
|
2021-03-11 17:40:33 +00:00
|
|
|
func (h manifestHandler) HandleAsync(ctx context.Context, req *muxrpc.Request) (interface{}, error) {
|
|
|
|
return json.RawMessage(h), nil
|
2021-01-25 17:31:09 +00:00
|
|
|
}
|
|
|
|
|
2021-01-26 17:33:29 +00:00
|
|
|
func init() {
|
|
|
|
if !json.Valid([]byte(manifest)) {
|
|
|
|
manifestMap := make(map[string]interface{})
|
|
|
|
err := json.Unmarshal([]byte(manifest), &manifestMap)
|
|
|
|
fmt.Println(err)
|
|
|
|
panic("manifest blob is broken json")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:31:09 +00:00
|
|
|
// this is a very simple hardcoded manifest.json dump which oasis' ssb-client expects to do it's magic.
|
|
|
|
const manifest manifestHandler = `
|
|
|
|
{
|
|
|
|
"manifest": "sync",
|
|
|
|
|
|
|
|
"whoami":"async",
|
|
|
|
|
2021-04-05 09:33:28 +00:00
|
|
|
"gossip": {
|
|
|
|
"ping": "duplex"
|
|
|
|
},
|
|
|
|
|
2021-03-16 08:13:27 +00:00
|
|
|
"room": {
|
|
|
|
"registerAlias": "async",
|
|
|
|
"revokeAlias": "async",
|
2022-08-19 19:47:33 +00:00
|
|
|
"listAliases": "async",
|
2021-03-16 08:13:27 +00:00
|
|
|
|
|
|
|
"connect": "duplex",
|
2021-05-17 13:31:29 +00:00
|
|
|
"attendants": "source",
|
2022-10-31 15:42:32 +00:00
|
|
|
"members": "source",
|
2021-05-17 13:31:29 +00:00
|
|
|
"metadata": "async",
|
2021-03-16 08:13:27 +00:00
|
|
|
"ping": "sync"
|
|
|
|
},
|
|
|
|
|
2021-01-25 17:31:09 +00:00
|
|
|
"tunnel": {
|
|
|
|
"announce": "sync",
|
|
|
|
"leave": "sync",
|
|
|
|
"connect": "duplex",
|
|
|
|
"endpoints": "source",
|
|
|
|
"isRoom": "async",
|
2021-01-26 17:33:29 +00:00
|
|
|
"ping": "sync"
|
2021-01-25 17:31:09 +00:00
|
|
|
}
|
|
|
|
}`
|