breadboard icon indicating copy to clipboard operation
breadboard copied to clipboard

When invalid key entered, don't add the provider

Open dglazkov opened this issue 1 year ago • 7 comments

Currently, we add the provider even if the key is invalid. It's okay, since the ACLs still work correctly and access is read-only. But it would be nice to have a better message about read-only access.

Thanks @Mearman for finding.

dglazkov avatar Jun 15 '24 19:06 dglazkov

Maybe something like "Optional: skip if you only want read-only access" next to the key

dglazkov avatar Jun 15 '24 19:06 dglazkov

being able to select read or write would be nice for the sharing of board server instances

Mearman avatar Jun 15 '24 19:06 Mearman

I wonder if we need a /validate or /acl endpoint to fetch with both URL & key so we can report it back?

paullewis avatar Jun 17 '24 08:06 paullewis

yup

dglazkov avatar Jun 18 '24 00:06 dglazkov

So, now there's an /info API endpoint on a board server. It returns data shaped like this:

export type ServerCapabilityAccess = "open" | "key";

export type ServerCapabilityInfo = {
  path: string;
  read: ServerCapabilityAccess;
  write: ServerCapabilityAccess;
};

export type ServerCapability = "boards" | "proxy";

export type ServerInfo = {
  title?: string;
  description?: string;
  capabilities?: Partial<Record<ServerCapability, ServerCapabilityInfo>>;
};

For example:

{
  "title": "Breadboard Live!",
  "capabilities": {
    "boards": {
      "read": "open",
      "write": "key",
      "path": "/boards"
    },
    "proxy": {
      "path": "/proxy"
    }
  },
  "description": "A server hosted by Dimitri Glazkov to let his friends and colleagues collaborate and build cool boards."
}

dglazkov avatar Jun 20 '24 05:06 dglazkov

@timswanson-google who is looking into this

dglazkov avatar Jul 23 '24 16:07 dglazkov

One additional note on the UX. Currently if you successfully add the board with the invalid key, and then attempt to create a board, there's no indication in the UI of what happened. The call to /boards on the board server returns a 400, and the UI doesn't do anything.

timswanson-google avatar Jul 23 '24 16:07 timswanson-google