Skip to content

Commit 4499367

Browse files
authored
Merge branch 'main' into peerproxy
2 parents 56572d4 + a053fe8 commit 4499367

File tree

15 files changed

+94
-150
lines changed

15 files changed

+94
-150
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# For interesting types of variables, check out the terraform docs:
2+
# https://www.terraform.io/language/values/variables#declaring-an-input-variable
3+
variable "message" {
4+
type = string
5+
}
6+
7+
# We can use a "null_resource" to test resources without a cloud provider:
8+
# https://www.terraform.io/language/resources/provisioners/null_resource
9+
resource "null_resource" "minimal_resource" {
10+
11+
# Note that Terraform's `provisioner` concept is generally an anti-pattern -
12+
# more info here: https://www.terraform.io/language/resources/provisioners/syntax
13+
# But it's helpful here for testing a resource.
14+
provisioner "local-exec" {
15+
command = "echo ${var.message}"
16+
}
17+
}

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ replace github.com/pion/ice/v2 => github.com/kylecarbs/ice/v2 v2.1.8-0.202202211
2222

2323
require (
2424
cdr.dev/slog v1.4.1
25-
cloud.google.com/go/compute v1.3.0
25+
cloud.google.com/go/compute v1.4.0
2626
github.com/briandowns/spinner v1.18.1
2727
github.com/coder/retry v1.3.0
2828
github.com/creack/pty v1.1.17
@@ -49,7 +49,7 @@ require (
4949
github.com/pion/datachannel v1.5.2
5050
github.com/pion/logging v0.2.2
5151
github.com/pion/transport v0.13.0
52-
github.com/pion/webrtc/v3 v3.1.23
52+
github.com/pion/webrtc/v3 v3.1.24
5353
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
5454
github.com/quasilyte/go-ruleguard/dsl v0.3.17
5555
github.com/spf13/cobra v1.3.0
@@ -63,7 +63,7 @@ require (
6363
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
6464
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
6565
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
66-
google.golang.org/api v0.69.0
66+
google.golang.org/api v0.70.0
6767
google.golang.org/protobuf v1.27.1
6868
nhooyr.io/websocket v1.8.7
6969
storj.io/drpc v0.0.29
@@ -112,8 +112,8 @@ require (
112112
github.com/opencontainers/go-digest v1.0.0 // indirect
113113
github.com/opencontainers/image-spec v1.0.2 // indirect
114114
github.com/opencontainers/runc v1.1.0 // indirect
115-
github.com/pion/dtls/v2 v2.1.2 // indirect
116-
github.com/pion/ice/v2 v2.1.20 // indirect
115+
github.com/pion/dtls/v2 v2.1.3 // indirect
116+
github.com/pion/ice/v2 v2.2.1 // indirect
117117
github.com/pion/interceptor v0.1.7 // indirect
118118
github.com/pion/mdns v0.0.5 // indirect
119119
github.com/pion/randutil v0.1.0 // indirect
@@ -138,7 +138,7 @@ require (
138138
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
139139
golang.org/x/text v0.3.7 // indirect
140140
google.golang.org/appengine v1.6.7 // indirect
141-
google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c // indirect
141+
google.golang.org/genproto v0.0.0-20220222154240-daf995802d7b // indirect
142142
google.golang.org/grpc v1.44.0 // indirect
143143
gopkg.in/yaml.v2 v2.4.0 // indirect
144144
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect

go.sum

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g
4242
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
4343
cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow=
4444
cloud.google.com/go/compute v1.2.0/go.mod h1:xlogom/6gr8RJGBe7nT2eGsQYAFUbbv8dbC29qE3Xmw=
45-
cloud.google.com/go/compute v1.3.0 h1:mPL/MzDDYHsh5tHRS9mhmhWlcgClCrCa6ApQCU6wnHI=
4645
cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=
46+
cloud.google.com/go/compute v1.4.0 h1:tzSyCe254NKkL8zshJUSoVvI9mcgbFdSpCC44uUNjT0=
47+
cloud.google.com/go/compute v1.4.0/go.mod h1:TcrKl8VipL9ZM0wEjdooJ1eet/6YsEV/E/larxxkAdg=
4748
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
4849
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
4950
cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY=
@@ -1036,8 +1037,9 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
10361037
github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
10371038
github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E=
10381039
github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ=
1039-
github.com/pion/dtls/v2 v2.1.2 h1:22Q1Jk9L++Yo7BIf9130MonNPfPVb+YgdYLeyQotuAA=
10401040
github.com/pion/dtls/v2 v2.1.2/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
1041+
github.com/pion/dtls/v2 v2.1.3 h1:3UF7udADqous+M2R5Uo2q/YaP4EzUoWKdfX2oscCUio=
1042+
github.com/pion/dtls/v2 v2.1.3/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
10411043
github.com/pion/interceptor v0.1.7 h1:HThW0tIIKT9RRoDWGURe8rlZVOx0fJHxBHpA0ej0+bo=
10421044
github.com/pion/interceptor v0.1.7/go.mod h1:Lh3JSl/cbJ2wP8I3ccrjh1K/deRGRn3UlSPuOTiHb6U=
10431045
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
@@ -1069,8 +1071,8 @@ github.com/pion/turn/v2 v2.0.8 h1:KEstL92OUN3k5k8qxsXHpr7WWfrdp7iJZHx99ud8muw=
10691071
github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw=
10701072
github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
10711073
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
1072-
github.com/pion/webrtc/v3 v3.1.23 h1:suyNiF9o2/6SBsyWA1UweraUWYkaHCNJdt/16b61I5w=
1073-
github.com/pion/webrtc/v3 v3.1.23/go.mod h1:L5S/oAhL0Fzt/rnftVQRrP80/j5jygY7XRZzWwFx6P4=
1074+
github.com/pion/webrtc/v3 v3.1.24 h1:s9PuwisrgHe1FTqfwK4p3T7rXtAHaUNhycbdMjADT28=
1075+
github.com/pion/webrtc/v3 v3.1.24/go.mod h1:mO/yv7fBN3Lp7YNlnYcTj1jtpvNvssJG+7eh6itZ4xM=
10741076
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
10751077
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
10761078
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
@@ -1743,8 +1745,9 @@ google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFd
17431745
google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
17441746
google.golang.org/api v0.66.0/go.mod h1:I1dmXYpX7HGwz/ejRxwQp2qj5bFAz93HiCU1C1oYd9M=
17451747
google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g=
1746-
google.golang.org/api v0.69.0 h1:yHW5s2SFyDapr/43kYtIQmoaaFVW4baLMLwqV4auj2A=
17471748
google.golang.org/api v0.69.0/go.mod h1:boanBiw+h5c3s+tBPgEzLDRHfFLWV0qXxRHz3ws7C80=
1749+
google.golang.org/api v0.70.0 h1:67zQnAE0T2rB0A3CwLSas0K+SbVzSxP+zTLkQLexeiw=
1750+
google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA=
17481751
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
17491752
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
17501753
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -1833,8 +1836,9 @@ google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ6
18331836
google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
18341837
google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
18351838
google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
1836-
google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE=
18371839
google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
1840+
google.golang.org/genproto v0.0.0-20220222154240-daf995802d7b h1:wHqTlwZVR0x5EG2S6vKlCq63+Tl/vBoQELitHxqxDOo=
1841+
google.golang.org/genproto v0.0.0-20220222154240-daf995802d7b/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
18381842
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
18391843
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
18401844
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=

site/components/Form/FormCloseButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const FormCloseButton: React.FC<FormCloseButtonProps> = ({ onClose }) =>
2323
return () => {
2424
document.body.removeEventListener("keydown", handleKeyPress, false)
2525
}
26-
}, [])
26+
}, [onClose])
2727

2828
return (
2929
<IconButton className={styles.closeButton} onClick={onClose} size="medium">

site/components/Navbar/UserDropdown.tsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ export const UserDropdown: React.FC<UserDropdownProps> = ({ user, onSignOut }: U
3535
<div>
3636
<MenuItem onClick={handleDropdownClick}>
3737
<div className={styles.inner}>
38-
{user && (
39-
<Badge overlap="circle">
40-
<UserAvatar user={user} />
41-
</Badge>
42-
)}
38+
<Badge overlap="circle">
39+
<UserAvatar user={user} />
40+
</Badge>
4341
{anchorEl ? (
4442
<KeyboardArrowUp className={`${styles.arrowIcon} ${styles.arrowIconUp}`} />
4543
) : (
@@ -65,20 +63,18 @@ export const UserDropdown: React.FC<UserDropdownProps> = ({ user, onSignOut }: U
6563
variant="user-dropdown"
6664
onClose={onPopoverClose}
6765
>
68-
{user && (
69-
<div className={styles.userInfo}>
70-
<UserProfileCard user={user} />
66+
<div className={styles.userInfo}>
67+
<UserProfileCard user={user} />
7168

72-
<Divider className={styles.divider} />
69+
<Divider className={styles.divider} />
7370

74-
<MenuItem className={styles.menuItem} onClick={onSignOut}>
75-
<ListItemIcon className={styles.icon}>
76-
<LogoutIcon />
77-
</ListItemIcon>
78-
<ListItemText primary="Sign Out" />
79-
</MenuItem>
80-
</div>
81-
)}
71+
<MenuItem className={styles.menuItem} onClick={onSignOut}>
72+
<ListItemIcon className={styles.icon}>
73+
<LogoutIcon />
74+
</ListItemIcon>
75+
<ListItemText primary="Sign Out" />
76+
</MenuItem>
77+
</div>
8278
</BorderedMenu>
8379
</>
8480
)

site/components/Redirect.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export interface RedirectProps {
1313
* Helper component to perform a client-side redirect
1414
*/
1515
export const Redirect: React.FC<RedirectProps> = ({ to }) => {
16-
const router = useRouter()
16+
const { replace } = useRouter()
1717

1818
useEffect(() => {
19-
void router.replace(to)
20-
}, [])
19+
void replace(to)
20+
}, [replace, to])
2121

2222
return null
2323
}

site/components/SignIn/SignInForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const SignInForm: React.FC<SignInProps> = ({
123123

124124
const getRedirectFromRouter = (router: NextRouter) => {
125125
const defaultRedirect = "/"
126-
if (router.query?.redirect) {
126+
if (router.query.redirect) {
127127
return firstOrItem(router.query.redirect, defaultRedirect)
128128
} else {
129129
return defaultRedirect

site/contexts/UserContext.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ const UserContext = React.createContext<UserContext>({
2525

2626
export const useUser = (redirectOnError = false): UserContext => {
2727
const ctx = useContext(UserContext)
28-
const router = useRouter()
28+
const { push, asPath } = useRouter()
2929

3030
const requestError = ctx.error
3131
useEffect(() => {
3232
if (redirectOnError && requestError) {
3333
// 'void' means we are ignoring handling the promise returned
3434
// from router.push (and lets the linter know we're OK with that!)
35-
void router.push({
35+
void push({
3636
pathname: "/login",
3737
query: {
38-
redirect: router.asPath,
38+
redirect: asPath,
3939
},
4040
})
4141
}
42-
}, [redirectOnError, requestError])
42+
// Disabling exhaustive deps here because it can cause an
43+
// infinite useEffect loop. Should (hopefully) go away
44+
// when we switch to an alternate routing strategy.
45+
}, [redirectOnError, requestError]) // eslint-disable-line react-hooks/exhaustive-deps
4346

4447
return ctx
4548
}
File renamed without changes.

site/jest.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ module.exports = {
2424
displayName: "lint",
2525
runner: "jest-runner-eslint",
2626
testMatch: ["<rootDir>/**/*.js", "<rootDir>/**/*.ts", "<rootDir>/**/*.tsx"],
27-
testPathIgnorePatterns: ["/.next/", "/out/", "/_jest/", "jest.config.js", "jest-runner.*.js", "next.config.js"],
27+
testPathIgnorePatterns: [
28+
"/.next/",
29+
"/out/",
30+
"/_jest/",
31+
"dev.ts",
32+
"jest.config.js",
33+
"jest-runner.*.js",
34+
"next.config.js",
35+
],
2836
},
2937
],
3038
collectCoverageFrom: [

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@storybook/react": "6.4.19",
2929
"@testing-library/react": "12.1.3",
3030
"@types/express": "4.17.13",
31-
"@types/jest": "27.4.0",
31+
"@types/jest": "27.4.1",
3232
"@types/node": "14.18.12",
3333
"@types/react": "17.0.39",
3434
"@types/react-dom": "17.0.11",

site/pages/projects/[organization]/[project]/create.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react"
1+
import React, { useCallback } from "react"
22
import { makeStyles } from "@material-ui/core/styles"
33
import { useRouter } from "next/router"
44
import useSWR from "swr"
@@ -10,14 +10,24 @@ import { FullScreenLoader } from "../../../../components/Loader/FullScreenLoader
1010
import { CreateWorkspaceForm } from "../../../../forms/CreateWorkspaceForm"
1111

1212
const CreateWorkspacePage: React.FC = () => {
13-
const router = useRouter()
13+
const { push, query } = useRouter()
1414
const styles = useStyles()
1515
const { me } = useUser(/* redirectOnError */ true)
16-
const { organization, project: projectName } = router.query
16+
const { organization, project: projectName } = query
1717
const { data: project, error: projectError } = useSWR<API.Project, Error>(
1818
`/api/v2/projects/${organization}/${projectName}`,
1919
)
2020

21+
const onCancel = useCallback(async () => {
22+
await push(`/projects/${organization}/${projectName}`)
23+
}, [push, organization, projectName])
24+
25+
const onSubmit = async (req: API.CreateWorkspaceRequest) => {
26+
const workspace = await API.Workspace.create(req)
27+
await push(`/workspaces/me/${workspace.name}`)
28+
return workspace
29+
}
30+
2131
if (projectError) {
2232
return <ErrorSummary error={projectError} />
2333
}
@@ -26,16 +36,6 @@ const CreateWorkspacePage: React.FC = () => {
2636
return <FullScreenLoader />
2737
}
2838

29-
const onCancel = async () => {
30-
await router.push(`/projects/${organization}/${projectName}`)
31-
}
32-
33-
const onSubmit = async (req: API.CreateWorkspaceRequest) => {
34-
const workspace = await API.Workspace.create(req)
35-
await router.push(`/workspaces/me/${workspace.name}`)
36-
return workspace
37-
}
38-
3939
return (
4040
<div className={styles.root}>
4141
<CreateWorkspaceForm onCancel={onCancel} onSubmit={onSubmit} project={project} />

site/pages/projects/create.tsx

Lines changed: 0 additions & 58 deletions
This file was deleted.

site/pages/workspaces/[user]/[workspace].tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ const WorkspacesPage: React.FC = () => {
2727
// So if the user is the same as 'me', use 'me' as the parameter
2828
const normalizedUserParam = me && userParam === me.id ? "me" : userParam
2929

30-
// The SWR API expects us to 'throw' if the query isn't ready yet, so these casts to `any` are OK
31-
// because the API expects exceptions.
32-
return `/api/v2/workspaces/${(normalizedUserParam as any).toString()}/${(workspaceParam as any).toString()}`
30+
// The SWR API expects us to 'throw' if the query isn't ready yet:
31+
if (normalizedUserParam === null || workspaceParam === null) {
32+
throw "Data not yet available to make API call"
33+
}
34+
35+
return `/api/v2/workspaces/${normalizedUserParam}/${workspaceParam}`
3336
})
3437

3538
if (workspaceError) {

0 commit comments

Comments
 (0)