mirror of
https://github.com/urbit/developers.urbit.org.git
synced 2024-08-17 09:40:33 +03:00
update eyre scry ref
This commit is contained in:
parent
3f47172d8a
commit
7fa387f607
@ -3,9 +3,12 @@ title = "Scry Reference"
|
||||
weight = 4
|
||||
+++
|
||||
|
||||
Here are all of Eyre's scry endpoints. There's not too many and they mostly deal with either CORS settings or aspects of the state of connections.
|
||||
Here are all of Eyre's scry endpoints. There's not too many and they mostly
|
||||
deal with either CORS settings or aspects of the state of connections.
|
||||
|
||||
The first few have a `care` of `x` and are a scry like `.^({TYPE} %ex /=//=/{SOME-PATH})` (note the empty `desk`). The rest have no `care` and the tag replaces the `desk` like `.^({TYPE} %e /={SOMETHING}=)`.
|
||||
The first few have a `care` of `x` and are a scry like `.^([type] %ex
|
||||
/=//=/[some-path])` (note the empty `desk`). The rest have no `care` and the
|
||||
tag replaces the `desk` like `.^([type] %e /=[something]=)`.
|
||||
|
||||
All examples are run from the dojo.
|
||||
|
||||
@ -13,7 +16,7 @@ All examples are run from the dojo.
|
||||
|
||||
An `x` scry with a `path` of `/cors` will return Eyre's CORS origin registry. The type returned is a [cors-registry](/reference/arvo/eyre/data-types#cors-registry) which contains the `set`s of approved, rejected and requested origins.
|
||||
|
||||
### Example {% #example-1 %}
|
||||
#### Example {% #example-1 %}
|
||||
|
||||
```
|
||||
> .^(cors-registry:eyre %ex /=//=/cors)
|
||||
@ -23,35 +26,48 @@ An `x` scry with a `path` of `/cors` will return Eyre's CORS origin registry. Th
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `/cors/requests`
|
||||
|
||||
An `x` scry with a `path` of `/cors/requests` will return the `set` of pending origin requests. These are origins that were in an `Origin: ...` HTTP header but weren't in the existing approved or rejected sets. The type returned is a `(set origin:eyre)`.
|
||||
An `x` scry with a `path` of `/cors/requests` will return the `set` of pending
|
||||
origin requests. These are origins that were in an `Origin: ...` HTTP header
|
||||
but weren't in the existing approved or rejected sets. The type returned is a
|
||||
`(set origin:eyre)`.
|
||||
|
||||
### Example {% #example-2 %}
|
||||
#### Example {% #example-2 %}
|
||||
|
||||
```
|
||||
> .^(requests=(set origin:eyre) %ex /=//=/cors/requests)
|
||||
requests={~~http~3a.~2f.~2f.baz~.example}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `/cors/approved`
|
||||
|
||||
An `x` scry with a `path` of `/cors/approved` will return the `set` of approved CORS origins. The type returned is a `(set origin:eyre)`.
|
||||
|
||||
### Example {% #example-3 %}
|
||||
#### Example {% #example-3 %}
|
||||
|
||||
```
|
||||
> .^(approved=(set origin:eyre) %ex /=//=/cors/approved)
|
||||
approved={~~http~3a.~2f.~2f.foo~.example}
|
||||
```
|
||||
|
||||
## `/cors/approved/{ORIGIN}`
|
||||
---
|
||||
|
||||
An `x` scry whose `path` is `/cors/approved/{ORIGIN}` tests whether the given origin URL is in the `approved` set of the CORS registry. The type returned is a simple `?`.
|
||||
## `/cors/approved/[origin]`
|
||||
|
||||
The origin URL is a `@t`, but since `@t` may not be valid in a path, it must be encoded in a `@ta` using `+scot` like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
An `x` scry whose `path` is `/cors/approved/[origin]` tests whether the given
|
||||
origin URL is in the `approved` set of the CORS registry. The type returned is
|
||||
a simple `?`.
|
||||
|
||||
### Examples {% #examples-1 %}
|
||||
The origin URL is a `@t`, but since `@t` may not be valid in a path, it must be
|
||||
encoded in a `@ta` using `+scot` like `(scot %t 'foo')` rather than just
|
||||
`'foo'`.
|
||||
|
||||
#### Examples {% #examples-1 %}
|
||||
|
||||
```
|
||||
> .^(? %ex /=//=/cors/approved/(scot %t 'http://foo.example'))
|
||||
@ -63,24 +79,32 @@ The origin URL is a `@t`, but since `@t` may not be valid in a path, it must be
|
||||
%.n
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `/cors/rejected`
|
||||
|
||||
An `x` scry with a `path` of `/cors/rejected` will return the `set` of rejected CORS origins. The type returned is a `(set origin:eyre)`.
|
||||
An `x` scry with a `path` of `/cors/rejected` will return the `set` of rejected
|
||||
CORS origins. The type returned is a `(set origin:eyre)`.
|
||||
|
||||
### Example {% #example-4 %}
|
||||
#### Example {% #example-4 %}
|
||||
|
||||
```
|
||||
> .^(rejected=(set origin:eyre) %ex /=//=/cors/rejected)
|
||||
rejected={~~http~3a.~2f.~2f.bar~.example}
|
||||
```
|
||||
|
||||
## `/cors/rejected/{ORIGIN}`
|
||||
---
|
||||
|
||||
An `x` scry whose `path` is `/cors/rejected/{ORIGIN}` tests whether the given origin URL is in the `rejected` set of the CORS registry. The type returned is a simple `?`.
|
||||
## `/cors/rejected/[origin]`
|
||||
|
||||
The origin URL must be a cord-encoded `@t` rather than just the plain `@t`, so you'll have to do something like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
An `x` scry whose `path` is `/cors/rejected/[origin]` tests whether the given
|
||||
origin URL is in the `rejected` set of the CORS registry. The type returned is
|
||||
a simple `?`.
|
||||
|
||||
### Examples {% #examples-2 %}
|
||||
The origin URL must be a cord-encoded `@t` rather than just the plain `@t`, so
|
||||
you'll have to do something like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
|
||||
#### Examples {% #examples-2 %}
|
||||
|
||||
```
|
||||
> .^(? %ex /=//=/cors/rejected/(scot %t 'http://bar.example'))
|
||||
@ -92,13 +116,18 @@ The origin URL must be a cord-encoded `@t` rather than just the plain `@t`, so y
|
||||
%.n
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `/authenticated/cookie`
|
||||
|
||||
An `x` scry whose `path` is `/authenticated/cookie/{COOKIE}` tests whether the given cookie is currently valid. The type returned is a `?`.
|
||||
An `x` scry whose `path` is `/authenticated/cookie/[cookie]` tests whether the
|
||||
given cookie is currently valid. The type returned is a `?`.
|
||||
|
||||
The cookie must be the full cookie including the `urbauth-{SHIP}=` part. The cookie must be a cord-encoded `@t` rather than just a plain `@t`, so you'll have to do something like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
The cookie must be the full cookie including the `urbauth-{SHIP}=` part. The
|
||||
cookie must be a knot-encoded `@t` rather than just a plain `@t`, so you'll
|
||||
have to do something like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
|
||||
### Examples {% #examples-3 %}
|
||||
#### Examples {% #examples-3 %}
|
||||
|
||||
```
|
||||
> .^(? %ex /=//=/authenticated/cookie/(scot %t 'urbauth-~zod=0vvndn8.bfsjj.j3614.k40ha.8fomi'))
|
||||
@ -110,11 +139,27 @@ The cookie must be the full cookie including the `urbauth-{SHIP}=` part. The coo
|
||||
%.n
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `/cache/[aeon]/[url]`
|
||||
|
||||
An `%x` `/cache` scry will return the cached value for the given `[url]` at the
|
||||
given `[aeon]` if it exists.
|
||||
|
||||
The `[url]` must be a knot-encoded `@t` rather than just a plain `@t`, so
|
||||
you'll have to do something like `(scot %t 'foo')` rather than just `'foo'`.
|
||||
|
||||
---
|
||||
|
||||
## `%bindings`
|
||||
|
||||
A scry with `bindings` in place of the `desk` in the `beak` will return Eyre's URL path bindings. The type returned is a `(list [binding:eyre duct action:eyre])` (see the [$binding](/reference/arvo/eyre/data-types#binding) & [$action](/reference/arvo/eyre/data-types#action) sections of the Data Types document for details).
|
||||
A scry with `bindings` in place of the `desk` in the `beak` will return Eyre's
|
||||
URL path bindings. The type returned is a `(list [binding:eyre duct
|
||||
action:eyre])` (see the [$binding](/reference/arvo/eyre/data-types#binding) &
|
||||
[$action](/reference/arvo/eyre/data-types#action) sections of the Data Types
|
||||
document for details).
|
||||
|
||||
### Example {% #example-5 %}
|
||||
#### Example {% #example-5 %}
|
||||
|
||||
```
|
||||
> .^((list [binding:eyre duct action:eyre]) %e /=bindings=)
|
||||
@ -133,20 +178,29 @@ A scry with `bindings` in place of the `desk` in the `beak` will return Eyre's U
|
||||
|
||||
## `%connections`
|
||||
|
||||
A scry with `connections` in place of the `desk` in the `beak` will return all open HTTP connections that aren't fully complete. The type returned is a `(map duct outstanding-connection:eyre)` (see the [$outstanding-connection](/reference/arvo/eyre/data-types#outstanding-connection) section of the Data Types document for details).
|
||||
A scry with `connections` in place of the `desk` in the `beak` will return all
|
||||
open HTTP connections that aren't fully complete. The type returned is a `(map
|
||||
duct outstanding-connection:eyre)` (see the
|
||||
[$outstanding-connection](/reference/arvo/eyre/data-types#outstanding-connection)
|
||||
section of the Data Types document for details).
|
||||
|
||||
### Example {% #example-6 %}
|
||||
#### Example {% #example-6 %}
|
||||
|
||||
```
|
||||
> .^((map duct outstanding-connection:eyre) %e /=connections=)
|
||||
{}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `%authentication-state`
|
||||
|
||||
A scry with `authentication-state` in place of the `desk` in the `beak` will return authentication details of all current sessions. The type returned is a [$authentication-state](/reference/arvo/eyre/data-types#authentication-state). The `p` field is the cookie sans the `urbauth-{SHIP}=` part.
|
||||
A scry with `authentication-state` in place of the `desk` in the `beak` will
|
||||
return authentication details of all current sessions. The type returned is a
|
||||
[$authentication-state](/reference/arvo/eyre/data-types#authentication-state).
|
||||
The `p` field is the cookie sans the `urbauth-[ship]=` part.
|
||||
|
||||
### Example {% #example-7 %}
|
||||
#### Example {% #example-7 %}
|
||||
|
||||
```
|
||||
> .^(authentication-state:eyre %e /=authentication-state=)
|
||||
@ -157,11 +211,15 @@ A scry with `authentication-state` in place of the `desk` in the `beak` will ret
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `%channel-state`
|
||||
|
||||
A scry with `channel-state` in place of the `desk` in the `beak` will return details of the state of each channel. The type returned is a [channel-state](/reference/arvo/eyre/data-types#channel-state).
|
||||
A scry with `channel-state` in place of the `desk` in the `beak` will return
|
||||
details of the state of each channel. The type returned is a
|
||||
[channel-state](/reference/arvo/eyre/data-types#channel-state).
|
||||
|
||||
### Example {% #example-8 %}
|
||||
#### Example {% #example-8 %}
|
||||
|
||||
```
|
||||
> .^(channel-state:eyre %e /=channel-state=)
|
||||
@ -182,13 +240,18 @@ A scry with `channel-state` in place of the `desk` in the `beak` will return det
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `%host`
|
||||
|
||||
A scry with `host` in place of the `desk` in the `beak` will return host details of the ship. The type returned is a `hart:eyre`.
|
||||
A scry with `host` in place of the `desk` in the `beak` will return host
|
||||
details of the ship. The type returned is a `hart:eyre`.
|
||||
|
||||
### Example {% #example-9 %}
|
||||
#### Example {% #example-9 %}
|
||||
|
||||
```
|
||||
> .^(hart:eyre %e /=host=)
|
||||
[p=%.n q=[~ 8.080] r=[%.y p=<|localhost|>]]
|
||||
```
|
||||
|
||||
---
|
||||
|
Loading…
Reference in New Issue
Block a user