Skip to content

Commit

Permalink
Merge pull request #169 from screego/stuff
Browse files Browse the repository at this point in the history
Migrate to vite & update deps
  • Loading branch information
jmattheis committed Sep 21, 2023
2 parents 6a55b68 + af3e1bb commit 9fd6626
Show file tree
Hide file tree
Showing 17 changed files with 1,151 additions and 9,359 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ require (
github.com/joho/godotenv v1.5.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/pion/randutil v0.1.0
github.com/pion/turn/v2 v2.1.3
github.com/pion/turn/v2 v2.1.4
github.com/prometheus/client_golang v1.16.0
github.com/rs/xid v1.5.0
github.com/rs/zerolog v1.29.1
github.com/rs/zerolog v1.30.0
github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.14
golang.org/x/crypto v0.11.0
golang.org/x/term v0.10.0
golang.org/x/text v0.11.0
golang.org/x/crypto v0.13.0
golang.org/x/term v0.12.0
golang.org/x/text v0.13.0
)

require (
Expand All @@ -43,7 +43,7 @@ require (
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/sys v0.12.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
25 changes: 12 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4=
github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8=
github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c=
github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g=
github.com/pion/turn/v2 v2.1.3 h1:pYxTVWG2gpC97opdRc5IGsQ1lJ9O/IlNhkzj7MMrGAA=
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
github.com/pion/turn/v2 v2.1.4 h1:2xn8rduI5W6sCZQkEnIUDAkrBQNl2eYIBCHMZ3QMmP8=
github.com/pion/turn/v2 v2.1.4/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -69,11 +69,10 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -90,8 +89,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -114,21 +113,21 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down
7 changes: 4 additions & 3 deletions ui/public/index.html → ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#FFFFFF" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Screego" />
<meta property="og:description" content="screen sharing for developers" />
<meta property="og:image" content="%PUBLIC_URL%/og-banner.png" />
<meta property="og:image" content="./og-banner.png" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />
<meta
name="description"
content="Screego - screen sharing for developers"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/apple-touch-icon.png" />
<link rel="apple-touch-icon" href="./apple-touch-icon.png" />
<title>Screego</title>
</head>
<body>
<noscript>Screego requires JavaScript (:</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
34 changes: 16 additions & 18 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,31 @@
"homepage": ".",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.1",
"@mui/styles": "^5.13.1",
"@types/jest": "^28.1.3",
"@types/node": "^20.2.1",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@mui/icons-material": "^5.14.9",
"@mui/material": "^5.14.10",
"@mui/styles": "^5.14.10",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react-swc": "^3.3.2",
"notistack": "^3.0.1",
"prettier": "^2.8.8",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hotkeys-hook": "^4.4.0",
"react-scripts": "5.0.1",
"typescript": "~5.0.4",
"react-hotkeys-hook": "^4.4.1",
"typescript": "~5.2.2",
"unique-names-generator": "^4.7.1",
"use-http": "^1.0.28"
"use-http": "^1.0.28",
"vite": "^4.4.9",
"vite-plugin-svgr": "^4.0.0",
"vite-tsconfig-paths": "^4.2.1"
},
"proxy": "http://localhost:5050",
"scripts": {
"start": "react-scripts start",
"start": "vite",
"format": "prettier \"src/**/*.{ts,tsx}\" --write",
"testformat": "prettier \"src/**/*.{ts,tsx}\" --list-different",
"build": "react-scripts --max-old-space-size=3000 build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"build": "tsc && vite build"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
3 changes: 1 addition & 2 deletions ui/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ var files, _ = fs.Sub(buildFiles, "build")
func Register(r *mux.Router) {
r.Handle("/", serveFile("index.html", "text/html"))
r.Handle("/index.html", serveFile("index.html", "text/html"))
r.Handle("/asset-manifest.json", serveFile("asset-manifest.json", "application/json"))
r.Handle("/static/{type}/{resource}", http.FileServer(http.FS(files)))
r.Handle("/assets/{resource}", http.FileServer(http.FS(files)))

r.Handle("/favicon.ico", serveFile("favicon.ico", "image/x-icon"))
r.Handle("/logo.svg", serveFile("logo.svg", "image/svg+xml"))
Expand Down
1 change: 0 additions & 1 deletion ui/src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {RoomManage} from './RoomManage';
import {useRoom} from './useRoom';
import {Room} from './Room';
Expand Down
1 change: 0 additions & 1 deletion ui/src/react-app-env.d.ts

This file was deleted.

142 changes: 0 additions & 142 deletions ui/src/serviceWorker.ts

This file was deleted.

5 changes: 0 additions & 5 deletions ui/src/setupTests.ts

This file was deleted.

7 changes: 1 addition & 6 deletions ui/src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@ const {port, hostname, protocol, pathname} = window.location;
const slashes = protocol.concat('//');
const path = pathname.endsWith('/') ? pathname : pathname.substring(0, pathname.lastIndexOf('/'));
const url = slashes.concat(port ? hostname.concat(':', port) : hostname) + path;
export const urlWithSlash =
process.env.NODE_ENV === 'development'
? 'http://localhost:5050/'
: url.endsWith('/')
? url
: url.concat('/');
export const urlWithSlash = url.endsWith('/') ? url : url.concat('/');
7 changes: 4 additions & 3 deletions ui/src/useConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {RoomMode, UIConfig} from './message';
import {useSnackbar} from 'notistack';
import React from 'react';
import {urlWithSlash} from './url';

export interface UseConfig extends UIConfig {
login: (username: string, password: string) => Promise<void>;
Expand All @@ -21,7 +22,7 @@ export const useConfig = (): UseConfig => {
});

const refetch = React.useCallback(async () => {
return fetch(`config`)
return fetch(`${urlWithSlash}config`)
.then((data) => data.json())
.then(setConfig);
}, [setConfig]);
Expand All @@ -30,7 +31,7 @@ export const useConfig = (): UseConfig => {
const body = new FormData();
body.set('user', username);
body.set('pass', password);
const result = await fetch(`login`, {method: 'POST', body});
const result = await fetch(`${urlWithSlash}login`, {method: 'POST', body});
const json = await result.json();
if (result.status !== 200) {
enqueueSnackbar('Login Failed: ' + json.message, {variant: 'error'});
Expand All @@ -41,7 +42,7 @@ export const useConfig = (): UseConfig => {
};

const logout = async () => {
const result = await fetch(`logout`, {method: 'POST'});
const result = await fetch(`${urlWithSlash}logout`, {method: 'POST'});
if (result.status !== 200) {
enqueueSnackbar('Logout Failed: ' + (await result.text()), {variant: 'error'});
} else {
Expand Down
5 changes: 2 additions & 3 deletions ui/src/useRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,8 @@ export const useRoom = (config: UIConfig): UseRoom => {
await client.current[event.payload.sid]?.setRemoteDescription(
event.payload.value
);
const answer = await client.current[
event.payload.sid
]?.createAnswer();
const answer =
await client.current[event.payload.sid]?.createAnswer();
await client.current[event.payload.sid]?.setLocalDescription(
answer
);
Expand Down
1 change: 1 addition & 0 deletions ui/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
Loading

0 comments on commit 9fd6626

Please sign in to comment.