Merge 798b894a78 into release/next-js

This commit is contained in:
janeway-bot 2021-05-11 06:00:50 +04:00 committed by GitHub
commit 3989b3eef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 157 additions and 71 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90dd5f5b2821f1a057c053b141e1143f019193c8dd7da41b39b0a3799e0fda5a
size 10999106
oid sha256:88ca6b0c73ebc1bf824e240b2b07a5b37d51aa4f46c29dffc6cca567edafa90b
size 11134397

View File

@ -1394,8 +1394,6 @@
^+ this
?: =(~ dom)
~|(%acme-empty-certificate-order !!)
?: ?=(?(%earl %pawn) (clan:title our.bow))
this
=. ..emit (queue-next-order 1 | dom)
=. ..emit cancel-current-order
:: notify %dill

View File

@ -738,7 +738,8 @@
::
?. (is-chat-graph target)
[[(note:sh-out "no such chat")]~ put-ses]
=. viewing (~(put in viewing) target)
=. audience target
=. viewing (~(put in viewing) target)
=^ cards state
?: (~(has by bound) target)
[~ state]

View File

@ -188,8 +188,11 @@
?: ?=([%'~landscape' %js %session ~] site.req-line)
%+ require-authorization-simple:app
inbound-request
%- js-response:gen
(as-octt:mimes:html "window.ship = '{+:(scow %p our.bowl)}';")
%. %- as-octs:mimes:html
(rap 3 'window.ship = "' (rsh 3 (scot %p our.bowl)) '";' ~)
%* . js-response:gen
cache %.n
==
::
=/ [payload=simple-payload:http public=?] (get-file req-line is-file)
?: public payload
@ -222,6 +225,7 @@
[~ %js] (js-response:gen file)
[~ %css] (css-response:gen file)
[~ %png] (png-response:gen file)
[~ %ico] (ico-response:gen file)
::
[~ %html]
%. file
@ -238,11 +242,9 @@
[not-found:gen %.n]
:_ public.u.content
=/ mime-type=@t (rsh 3 (crip <p.u.data>))
:: Should maybe inspect to see how long cache should hold
::
=/ headers
:~ content-type+mime-type
max-1-da:gen
max-1-wk:gen
'service-worker-allowed'^'/'
==
[[200 headers] `q.u.data]

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v7.k043v.fjsi2.bpm4g.0ekbj.566c4 :: DO NOT MOVE FROM LINE 8
++ hash 0v3.p4se6.4k5i0.8v0le.v5vn4.mdotq
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.js"></script>
<script src="/~landscape/js/bundle/index.0a121973708299f6b966.js"></script>
<script src="/~landscape/js/bundle/index.cf99c60bac0540e99792.js"></script>
</body>
</html>

View File

@ -191,9 +191,14 @@
^- (unit (unit cage))
?. (team:title our.bowl src.bowl) ~
?+ path [~ ~]
[%x %tiles ~] ``noun+!>([tiles tile-ordering])
[%x %first-time ~] ``noun+!>(first-time)
[%x %keys ~] ``noun+!>(~(key by tiles))
[%x %tiles ~] ``noun+!>([tiles tile-ordering])
[%x %first-time ~] ``noun+!>(first-time)
[%x %keys ~] ``noun+!>(~(key by tiles))
::
[%x %runtime-lag ~]
:^ ~ ~ %json
!> ^- json
b+.^(? //(scot %p our.bowl)//(scot %da now.bowl)/zen/lag)
==
::
++ on-arvo

View File

@ -50,18 +50,17 @@
==
::
++ index
|= i=^index
|= ind=^index
^- json
?: =(~ i) s+'/'
=/ j=^tape ""
|-
?~ i [%s (crip j)]
=/ k=json (numb i.i)
?> ?=(%n -.k)
%_ $
i t.i
j (weld j (weld "/" (trip +.k)))
==
:- %s
?: =(~ ind)
'/'
%+ roll ind
|= [cur=@ acc=@t]
^- @t
=/ num (numb cur)
?> ?=(%n -.num)
(rap 3 acc '/' p.num ~)
::
++ uid
|= u=^uid

View File

@ -23,13 +23,13 @@
%+ turn ~(tap by associations)
|= [=md-resource [group=resource =^metadatum]]
^- [cord json]
:-
%- crip
;: weld
(trip (spat (en-path:resource group)))
(weld "/" (trip app-name.md-resource))
(trip (spat (en-path:resource resource.md-resource)))
==
:- %: rap 3
(spat (en-path:resource group))
'/'
app-name.md-resource
(spat (en-path:resource resource.md-resource))
~
==
%- pairs
:~ [%group s+(enjs-path:resource group)]
[%app-name s+app-name.md-resource]

View File

@ -118,11 +118,10 @@
::
:: If %.n please leave note as to why renegotiation necessary
::
:: - Fixing incorrectly held unversioned subscriptions
::
++ diplomatic
^- ?
%.n
%.y
::
++ default
|* [pull-hook=* =config]

View File

@ -77,12 +77,10 @@
:: +diplomatic: only renegotiate if versions changed
::
:: If %.n please leave note as to why renegotiation necessary
::
:: - Fixing incorrectly held unversioned subscriptions
::
++ diplomatic
^- ?
%.n
%.y
::
++ push-hook
~/ %push-hook

View File

@ -39,10 +39,10 @@
~! +:*handler
(handler inbound-request)
::
=/ redirect=cord
%- crip
"/~/login?redirect={(trip url.request.inbound-request)}"
[[307 ['location' redirect]~] ~]
=- [[307 ['location' -]~] ~]
%^ cat 3
'/~/login?redirect='
url.request.inbound-request
::
:: +require-authorization-simple:
:: redirect to the login page when unauthenticated
@ -56,10 +56,10 @@
~! this
simple-payload
::
=/ redirect=cord
%- crip
"/~/login?redirect={(trip url.request.inbound-request)}"
[[307 ['location' redirect]~] ~]
=- [[307 ['location' -]~] ~]
%^ cat 3
'/~/login?redirect='
url.request.inbound-request
::
++ give-simple-payload
|= [eyre-id=@ta =simple-payload:http]
@ -86,36 +86,52 @@
:_ `octs
[200 [['content-type' 'text/html'] ?:(cache [max-1-wk ~] ~)]]
::
++ js-response
|= =octs
^- simple-payload:http
[[200 [['content-type' 'text/javascript'] max-1-da ~]] `octs]
::
++ json-response
|= =json
^- simple-payload:http
[[200 ['content-type' 'application/json']~] `(json-to-octs json)]
::
++ css-response
=| cache=?
|= =octs
^- simple-payload:http
[[200 [['content-type' 'text/css'] max-1-da ~]] `octs]
:_ `octs
[200 [['content-type' 'text/css'] ?:(cache [max-1-wk ~] ~)]]
::
++ manx-response
|= man=manx
++ js-response
=| cache=?
|= =octs
^- simple-payload:http
[[200 ['content-type' 'text/html']~] `(manx-to-octs man)]
:_ `octs
[200 [['content-type' 'text/javascript'] ?:(cache [max-1-wk ~] ~)]]
::
++ png-response
=| cache=?
|= =octs
^- simple-payload:http
[[200 [['content-type' 'image/png'] max-1-wk ~]] `octs]
:_ `octs
[200 [['content-type' 'image/png'] ?:(cache [max-1-wk ~] ~)]]
::
++ ico-response
|= =octs
^- simple-payload:http
[[200 [['content-type' 'image/x-icon'] max-1-wk ~]] `octs]
::
++ woff2-response
=| cache=?
|= =octs
^- simple-payload:http
[[200 [['content-type' 'font/woff2'] max-1-wk ~]] `octs]
::
++ json-response
=| cache=_|
|= =json
^- simple-payload:http
:_ `(json-to-octs json)
[200 [['content-type' 'application/json'] ?:(cache [max-1-da ~] ~)]]
::
++ manx-response
=| cache=_|
|= man=manx
^- simple-payload:http
:_ `(manx-to-octs man)
[200 [['content-type' 'text/html'] ?:(cache [max-1-da ~] ~)]]
::
++ not-found
^- simple-payload:http
[[404 ~] ~]
@ -123,10 +139,10 @@
++ login-redirect
|= =request:http
^- simple-payload:http
=/ redirect=cord
%- crip
"/~/login?redirect={(trip url.request)}"
[[307 ['location' redirect]~] ~]
=- [[307 ['location' -]~] ~]
%^ cat 3
'/~/login?redirect='
url.request
::
++ redirect
|= redirect=cord

12
pkg/arvo/mar/ico.hoon Normal file
View File

@ -0,0 +1,12 @@
|_ dat=@
++ grow
|%
++ mime [/image/x-icon (as-octs:mimes:html dat)]
--
++ grab
|%
++ mime |=([p=mite q=octs] q.q)
++ noun @
--
++ grad %mime
--

View File

@ -7,4 +7,10 @@ export default class LocalApi extends BaseApi<StoreState> {
this.store.handleEvent({ data: { baseHash } });
});
}
getRuntimeLag() {
return this.scry<boolean>('launch', '/runtime-lag').then((runtimeLag) => {
this.store.handleEvent({ data: { runtimeLag } });
});
}
}

View File

@ -37,6 +37,13 @@ export default class LaunchReducer {
state.baseHash = baseHash;
});
}
const runtimeLag = _.get(json, 'runtimeLag', null);
if (runtimeLag !== null) {
useLaunchState.getState().set(state => {
state.runtimeLag = runtimeLag;
});
}
}
}

View File

@ -10,7 +10,8 @@ export interface LaunchState extends BaseState<LaunchState> {
weather: WeatherState | null | Record<string, never> | boolean,
userLocation: string | null;
baseHash: string | null;
}
runtimeLag: boolean;
};
const useLaunchState = createState<LaunchState>('Launch', {
firstTime: true,
@ -18,7 +19,8 @@ const useLaunchState = createState<LaunchState>('Launch', {
tiles: {},
weather: null,
userLocation: null,
baseHash: null
baseHash: null,
runtimeLag: false,
});
export default useLaunchState;

View File

@ -13,6 +13,10 @@ interface LocalUpdateBaseHash {
baseHash: string;
}
interface LocalUpdateRuntimeLag {
runtimeLag: boolean;
}
interface LocalUpdateBackgroundConfig {
backgroundConfig: BackgroundConfig;
}
@ -51,6 +55,7 @@ export type BackgroundConfig = BackgroundConfigUrl | BackgroundConfigColor | und
export type LocalUpdate =
| LocalUpdateSetDark
| LocalUpdateBaseHash
| LocalUpdateRuntimeLag
| LocalUpdateBackgroundConfig
| LocalUpdateHideAvatars
| LocalUpdateHideNicknames

View File

@ -103,6 +103,7 @@ class App extends React.Component {
this.updateTheme(this.themeWatcher);
}, 500);
this.api.local.getBaseHash();
this.api.local.getRuntimeLag(); //TODO consider polling periodically
this.api.settings.getAll();
gcpManager.start();
Mousetrap.bindGlobal(['command+/', 'ctrl+/'], (e) => {

View File

@ -50,7 +50,7 @@ interface LaunchAppProps {
export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
const { connection } = props;
const baseHash = useLaunchState(state => state.baseHash);
const { baseHash, runtimeLag } = useLaunchState(state => state);
const [hashText, setHashText] = useState(baseHash);
const [exitingTut, setExitingTut] = useState(false);
const seen = useSettingsState(s => s?.tutorial?.seen) ?? true;
@ -84,7 +84,10 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
}, 2000);
}}
>
<Box backgroundColor="washedGray" p={2}>
<Box
backgroundColor={runtimeLag ? 'yellow' : 'washedGray'}
p={2}
>
<Text mono bold>{hashText || baseHash}</Text>
</Box>
</Box>

View File

@ -1,4 +1,4 @@
import { Box, Center, Col, LoadingSpinner, Text } from '@tlon/indigo-react';
import { Box, Center, Col, LoadingSpinner, Text, Icon } from '@tlon/indigo-react';
import {
IndexedNotification,
@ -14,6 +14,7 @@ import React, { useCallback, useEffect, useRef } from 'react';
import GlobalApi from '~/logic/api/global';
import { getNotificationKey } from '~/logic/lib/hark';
import { useLazyScroll } from '~/logic/lib/useLazyScroll';
import useLaunchState from '~/logic/state/launch';
import { daToUnix, MOMENT_CALENDAR_DATE } from '~/logic/lib/util';
import useHarkState from '~/logic/state/hark';
import { Invites } from './invites';
@ -57,6 +58,8 @@ export default function Inbox(props: {
};
}, []);
const runtimeLag = useLaunchState(state => state.runtimeLag);
const ready = useHarkState(
s => Object.keys(s.unreads.graph).length > 0
);
@ -114,6 +117,14 @@ export default function Inbox(props: {
return (
<Col p={1} ref={scrollRef} position="relative" height="100%" overflowY="auto" overflowX="hidden">
{runtimeLag && (
<Box bg="yellow" borderRadius={2} p={2} m={2}>
<Icon verticalAlign="middle" mr={2} icon="Tutorial" />
<Text verticalAlign="middle">
Update your binary to continue receiving updates.
</Text>
</Box>
)}
<Invites pendingJoin={props.pendingJoin} api={api} />
{[...notificationsByDayMap.keys()].sort().reverse().map((day, index) => {
const timeboxes = notificationsByDayMap.get(day)!;

View File

@ -13,6 +13,7 @@ import { Sigil } from '~/logic/lib/sigil';
import { uxToHex } from '~/logic/lib/util';
import useContactState from '~/logic/state/contact';
import useHarkState from '~/logic/state/hark';
import useLaunchState from '~/logic/state/launch';
import useInviteState from '~/logic/state/invite';
import useLocalState, { selectLocalState } from '~/logic/state/local';
import useSettingsState, { selectCalmState } from '~/logic/state/settings';
@ -27,6 +28,7 @@ const localSel = selectLocalState(['toggleOmnibox']);
const StatusBar = (props) => {
const { api, ship } = props;
const history = useHistory();
const runtimeLag = useLaunchState(state => state.runtimeLag);
const ourContact = useContactState(state => state.contacts[`~${ship}`]);
const notificationsCount = useHarkState(state => state.notificationsCount);
const doNotDisturb = useHarkState(state => state.doNotDisturb);
@ -83,6 +85,11 @@ const StatusBar = (props) => {
<Icon icon='Dashboard' color='black' />
</Button>
<StatusBarItem float={floatLeap} mr={2} onClick={() => toggleOmnibox()}>
{!doNotDisturb && runtimeLag && (
<Box display='block' right='-8px' top='-8px' position='absolute'>
<Icon color='yellow' icon='Bullet' />
</Box>
)}
{!doNotDisturb && (notificationsCount > 0 || invites.length > 0) && (
<Box display='block' right='-8px' top='-8px' position='absolute'>
<Icon color='blue' icon='Bullet' />

View File

@ -7,6 +7,7 @@ import { cite, uxToHex } from '~/logic/lib/util';
import withState from '~/logic/lib/withState';
import useContactState from '~/logic/state/contact';
import useHarkState from '~/logic/state/hark';
import useLaunchState from '~/logic/state/launch';
import useInviteState from '~/logic/state/invite';
interface OmniboxResultProps {
@ -58,6 +59,7 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
selected: string,
link: string,
invites: Invites,
lag: any,
notificationsCount: number,
text: string,
color: string
@ -66,7 +68,8 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
(this.state.hovered || selected === link) ? 'white' : 'black';
const bulletFill =
(this.state.hovered || selected === link) ? 'white' : 'blue';
const lagFill =
this.state.hovered || selected === link ? 'white' : 'yellow';
const inviteCount = [].concat(
...Object.values(invites).map(obj => Object.values(obj))
);
@ -103,6 +106,14 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
size='18px'
color={iconFill}
/>
{lag && (
<Icon
display='inline-block'
icon='Bullet'
style={{ position: 'absolute', top: -5, left: 5 }}
color={lagFill}
/>
)}
{(notificationsCount > 0 || inviteCount.length > 0) && (
<Icon
display='inline-block'
@ -211,6 +222,7 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
selected,
invites,
notificationsCount,
runtimeLag,
contacts,
setSelection
} = this.props;
@ -224,6 +236,7 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
link,
invites,
notificationsCount,
runtimeLag,
text,
color
);
@ -285,6 +298,7 @@ export class OmniboxResult extends Component<OmniboxResultProps, OmniboxResultSt
}
export default withState(OmniboxResult, [
[useLaunchState, ['runtimeLag']],
[useInviteState],
[useHarkState, ['notificationsCount']],
[useContactState]