mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-03 20:58:45 +03:00
dbug: support eyre eauth state & functionality
This commit is contained in:
parent
02a2d116fe
commit
816706892c
@ -361,17 +361,58 @@
|
||||
::
|
||||
[%eyre %authentication ~]
|
||||
%- some
|
||||
:- %a
|
||||
%+ turn
|
||||
%+ sort ~(tap by sessions:auth-state:v-eyre)
|
||||
|= [[@uv a=session:eyre] [@uv b=session:eyre]]
|
||||
(gth expiry-time.a expiry-time.b)
|
||||
|= [cookie=@uv session:eyre]
|
||||
=/ auth auth-state:v-eyre
|
||||
%- pairs
|
||||
:~ 'cookie'^s+(scot %uv cookie)
|
||||
'identity'^(render-identity:v-eyre identity)
|
||||
'expiry'^(time expiry-time)
|
||||
'channels'^(numb ~(wyt in channels))
|
||||
:~ :- 'sessions'
|
||||
:- %a
|
||||
%+ turn
|
||||
%+ sort ~(tap by sessions.auth)
|
||||
|= [[@uv a=session:eyre] [@uv b=session:eyre]]
|
||||
(gth expiry-time.a expiry-time.b)
|
||||
|= [cookie=@uv session:eyre]
|
||||
%- pairs
|
||||
:~ 'cookie'^s+(scot %uv cookie)
|
||||
'identity'^(render-identity:v-eyre identity)
|
||||
'expiry'^(time expiry-time)
|
||||
'channels'^(numb ~(wyt in channels))
|
||||
==
|
||||
::
|
||||
:- 'visitors'
|
||||
:- %a
|
||||
%+ turn
|
||||
%+ sort ~(tap by visitors.auth)
|
||||
|= [[@uv a=visitor:eyre] [@uv b=visitor:eyre]]
|
||||
?@ +.a &
|
||||
?@ +.b |
|
||||
(aor (scot %p ship.a) (scot %p ship.b))
|
||||
|= [nonce=@uv v=visitor:eyre]
|
||||
%- pairs
|
||||
:+ 'nonce'^s+(scot %uv nonce)
|
||||
'duct'^a+(turn duct.v path)
|
||||
?@ +.v ['sesh' s+(scot %uv sesh.v)]~
|
||||
:~ 'pend'^b+?=(^ pend.v)
|
||||
'ship'^(ship ship.v)
|
||||
'last'^s+last.v
|
||||
'toke'^?~(toke.v ~ s+(scot %uv u.toke.v))
|
||||
==
|
||||
::
|
||||
:- 'visiting'
|
||||
:- %a
|
||||
%- zing
|
||||
%+ turn
|
||||
%+ sort ~(tap by visiting.auth)
|
||||
|= [[a=@p *] [b=@p *]]
|
||||
(aor (scot %p a) (scot %p b))
|
||||
|= [who=@p m=(map @uv portkey)]
|
||||
%+ turn ~(tap by m)
|
||||
|= [nonce=@uv portkey]
|
||||
%- pairs
|
||||
:+ 'who'^(ship who)
|
||||
'nonce'^s+(scot %uv nonce)
|
||||
?- -.live
|
||||
%& ['made' (time p.live)]~
|
||||
%| ['goal' s+p.live]~
|
||||
==
|
||||
==
|
||||
::
|
||||
:: /eyre/channels.json
|
||||
@ -1001,6 +1042,7 @@
|
||||
?- -.identity
|
||||
%ours our.bowl
|
||||
%fake who.identity
|
||||
%real who.identity
|
||||
==
|
||||
::
|
||||
++ render-action
|
||||
|
File diff suppressed because one or more lines are too long
@ -12,7 +12,11 @@ class Store {
|
||||
commits: [],
|
||||
bindings: [],
|
||||
connections: [],
|
||||
authentication: [],
|
||||
authentication: {
|
||||
sessions: [],
|
||||
visitors: [],
|
||||
visiting: [],
|
||||
},
|
||||
channels: [],
|
||||
sidebarShown: true
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ export class Eyre extends Component {
|
||||
const { props } = this;
|
||||
if (props.bindings.length === 0) this.loadBindings();
|
||||
if (props.connections.length == 0) this.loadConnections();
|
||||
if (props.authentication.length == 0) this.loadAuthenticationState();
|
||||
if (props.authentication.sessions.length == 0) this.loadAuthenticationState();
|
||||
if (props.channels.length == 0) this.loadChannels();
|
||||
}
|
||||
|
||||
@ -155,7 +155,8 @@ export class Eyre extends Component {
|
||||
)};
|
||||
});
|
||||
|
||||
const sessionItems = props.authentication.map(s => {
|
||||
//TODO also make sure column headings get rendered
|
||||
const sessionItems = props.authentication.sessions.map(s => {
|
||||
return ({key: s.identity, jsx: (<div class="flex">
|
||||
<div class="flex-auto" style={{maxWidth: '5em'}}>
|
||||
{s.cookie.slice(0,6)}…
|
||||
@ -178,6 +179,53 @@ export class Eyre extends Component {
|
||||
</div>)});
|
||||
});
|
||||
|
||||
const visitingItems = props.authentication.visiting.map(v => {
|
||||
return ({key: '~'+v.who+':'+v.nonce, jsx: (<div class="flex">
|
||||
<div class="flex-auto">
|
||||
~{v.who}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
{v.nonce}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
{ v.goal ? 'pending, will return to '+v.goal :
|
||||
<form method="post" action="/~/logout?redirect=/~debug/eyre">
|
||||
logged in since {msToDa(v.made)}
|
||||
<input type="hidden" name="host" value={'~'+v.who} />
|
||||
<input type="hidden" name="sid" value={v.nonce} />
|
||||
<button type="submit" name="eauth">log out</button>
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
</div>)});
|
||||
});
|
||||
|
||||
const visitorsItems = props.authentication.visitors.map(v => {
|
||||
return ({key: v.nonce+':~'+v.ship, jsx: (<div class="flex">
|
||||
<div class="flex-auto">
|
||||
{v.nonce}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
{v.duct}
|
||||
</div>
|
||||
{ v.sesh ? <div class="flex-auto">session: {v.sesh.slice(0,6)}…</div> :
|
||||
<>
|
||||
<div class="flex-auto">
|
||||
{v.pend ? 'request pending' : 'no pending request'}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
{v.ship}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
redirect: {v.last}
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
{v.toke ? 'token received' : 'no token yet'}
|
||||
</div>
|
||||
</> }
|
||||
</div>)});
|
||||
});
|
||||
|
||||
return (<>
|
||||
<h4>Bindings</h4>
|
||||
<SearchableList placeholder="binding" items={bindingItems}>
|
||||
@ -194,15 +242,23 @@ export class Eyre extends Component {
|
||||
<button onClick={this.loadChannels}>refresh</button>
|
||||
</SearchableList>
|
||||
|
||||
<h4>Cookies</h4>
|
||||
<h4>Authentication</h4>
|
||||
<form method="post" action="/~/logout">
|
||||
<button type="submit">logout self</button>
|
||||
</form>
|
||||
<form method="post" action="/~/logout">
|
||||
<button type="submit" name="all">logout all selves</button>
|
||||
</form>
|
||||
<br/>
|
||||
<button onClick={this.loadAuthenticationState}>refresh</button>
|
||||
<h3>Sessions</h3>
|
||||
<SearchableList placeholder="identity" items={sessionItems}>
|
||||
<button onClick={this.loadAuthenticationState}>refresh</button>
|
||||
</SearchableList>
|
||||
<h3>Outgoing eauth</h3>
|
||||
<SearchableList placeholder="host" items={visitingItems}>
|
||||
</SearchableList>
|
||||
<h3>Incoming eauth</h3>
|
||||
<SearchableList placeholder="visitor" items={visitorsItems}>
|
||||
</SearchableList>
|
||||
</>);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user