Skip to content

Commit 94521ef

Browse files
authored
chore/Deprecate browser mount (#752)
* chore/Deprecate browser mount No longer supported. * Remove device-side go code * Removed diskChannel and localFile * Removed RemoteVirtualMediaState.WebRTC Also removed dead go code (to make that lint happy!)
1 parent 66cccfe commit 94521ef

File tree

12 files changed

+15
-530
lines changed

12 files changed

+15
-530
lines changed

block_device.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,12 @@ func (r remoteImageBackend) ReadAt(p []byte, off int64) (n int, err error) {
2222
return 0, errors.New("image not mounted")
2323
}
2424
source := currentVirtualMediaState.Source
25-
mountedImageSize := currentVirtualMediaState.Size
2625
virtualMediaStateMutex.RUnlock()
2726

28-
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
27+
_, cancel := context.WithTimeout(context.Background(), 5*time.Second)
2928
defer cancel()
3029

31-
readLen := int64(len(p))
32-
if off+readLen > mountedImageSize {
33-
readLen = mountedImageSize - off
34-
}
35-
var data []byte
3630
switch source {
37-
case WebRTC:
38-
data, err = webRTCDiskReader.Read(ctx, off, readLen)
39-
if err != nil {
40-
return 0, err
41-
}
42-
n = copy(p, data)
43-
return n, nil
4431
case HTTP:
4532
return httpRangeReader.ReadAt(p, off)
4633
default:

fuse.go

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

jsonrpc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,6 @@ var rpcHandlers = map[string]RPCHandler{
11031103
"getVirtualMediaState": {Func: rpcGetVirtualMediaState},
11041104
"getStorageSpace": {Func: rpcGetStorageSpace},
11051105
"mountWithHTTP": {Func: rpcMountWithHTTP, Params: []string{"url", "mode"}},
1106-
"mountWithWebRTC": {Func: rpcMountWithWebRTC, Params: []string{"filename", "size", "mode"}},
11071106
"mountWithStorage": {Func: rpcMountWithStorage, Params: []string{"filename", "mode"}},
11081107
"listStorageFiles": {Func: rpcListStorageFiles},
11091108
"deleteStorageFile": {Func: rpcDeleteStorageFile, Params: []string{"filename"}},

remote_mount.go

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

ui/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@tailwindcss/typography": "^0.5.16",
6161
"@tailwindcss/vite": "^4.1.12",
6262
"@types/react": "^19.1.11",
63-
"@types/react-dom": "^19.1.7",
63+
"@types/react-dom": "^19.1.8",
6464
"@types/semver": "^7.7.0",
6565
"@types/validator": "^13.15.2",
6666
"@typescript-eslint/eslint-plugin": "^8.41.0",

ui/src/components/popovers/MountPopover.tsx

Lines changed: 3 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
21
import { PlusCircleIcon } from "@heroicons/react/20/solid";
3-
import { useMemo, forwardRef, useEffect, useCallback } from "react";
2+
import { forwardRef, useEffect, useCallback } from "react";
43
import {
5-
LuArrowUpFromLine,
6-
LuCheckCheck,
74
LuLink,
85
LuPlus,
96
LuRadioReceiver,
@@ -14,38 +11,17 @@ import { useLocation } from "react-router-dom";
1411
import { Button } from "@components/Button";
1512
import Card, { GridCard } from "@components/Card";
1613
import { formatters } from "@/utils";
17-
import { RemoteVirtualMediaState, useMountMediaStore, useRTCStore } from "@/hooks/stores";
14+
import { RemoteVirtualMediaState, useMountMediaStore } from "@/hooks/stores";
1815
import { SettingsPageHeader } from "@components/SettingsPageheader";
1916
import { JsonRpcResponse, useJsonRpc } from "@/hooks/useJsonRpc";
2017
import { useDeviceUiNavigation } from "@/hooks/useAppNavigation";
2118
import notifications from "@/notifications";
2219

2320
const MountPopopover = forwardRef<HTMLDivElement, object>((_props, ref) => {
24-
const { diskDataChannelStats } = useRTCStore();
2521
const { send } = useJsonRpc();
2622
const { remoteVirtualMediaState, setModalView, setRemoteVirtualMediaState } =
2723
useMountMediaStore();
2824

29-
const bytesSentPerSecond = useMemo(() => {
30-
if (diskDataChannelStats.size < 2) return null;
31-
32-
const secondLastItem =
33-
Array.from(diskDataChannelStats)[diskDataChannelStats.size - 2];
34-
const lastItem = Array.from(diskDataChannelStats)[diskDataChannelStats.size - 1];
35-
36-
if (!secondLastItem || !lastItem) return 0;
37-
38-
const lastTime = lastItem[0];
39-
const secondLastTime = secondLastItem[0];
40-
const timeDelta = lastTime - secondLastTime;
41-
42-
const lastBytesSent = lastItem[1].bytesSent;
43-
const secondLastBytesSent = secondLastItem[1].bytesSent;
44-
const bytesDelta = lastBytesSent - secondLastBytesSent;
45-
46-
return bytesDelta / timeDelta;
47-
}, [diskDataChannelStats]);
48-
4925
const syncRemoteVirtualMediaState = useCallback(() => {
5026
send("getVirtualMediaState", {}, (response: JsonRpcResponse) => {
5127
if ("error" in response) {
@@ -94,42 +70,6 @@ const MountPopopover = forwardRef<HTMLDivElement, object>((_props, ref) => {
9470
const { source, filename, size, url, path } = remoteVirtualMediaState;
9571

9672
switch (source) {
97-
case "WebRTC":
98-
return (
99-
<>
100-
<div className="space-y-1">
101-
<div className="flex items-center gap-x-2">
102-
<LuCheckCheck className="h-5 text-green-500" />
103-
<h3 className="text-base font-semibold text-black dark:text-white">
104-
Streaming from Browser
105-
</h3>
106-
</div>
107-
<Card className="w-auto px-2 py-1">
108-
<div className="w-full truncate text-sm text-black dark:text-white">
109-
{formatters.truncateMiddle(filename, 50)}
110-
</div>
111-
</Card>
112-
</div>
113-
<div className="my-2 flex flex-col items-center gap-y-2">
114-
<div className="w-full text-sm text-slate-900 dark:text-slate-100">
115-
<div className="flex items-center justify-between">
116-
<span>{formatters.bytes(size ?? 0)}</span>
117-
<div className="flex items-center gap-x-1">
118-
<LuArrowUpFromLine
119-
className="h-4 text-blue-700 dark:text-blue-500"
120-
strokeWidth={2}
121-
/>
122-
<span>
123-
{bytesSentPerSecond !== null
124-
? `${formatters.bytes(bytesSentPerSecond)}/s`
125-
: "N/A"}
126-
</span>
127-
</div>
128-
</div>
129-
</div>
130-
</div>
131-
</>
132-
);
13373
case "HTTP":
13474
return (
13575
<div className="">
@@ -202,18 +142,7 @@ const MountPopopover = forwardRef<HTMLDivElement, object>((_props, ref) => {
202142
description="Mount an image to boot from or install an operating system."
203143
/>
204144

205-
{remoteVirtualMediaState?.source === "WebRTC" ? (
206-
<Card>
207-
<div className="flex items-center gap-x-1.5 px-2.5 py-2 text-sm">
208-
<ExclamationTriangleIcon className="h-4 text-yellow-500" />
209-
<div className="flex w-full items-center text-black">
210-
<div>Closing this tab will unmount the image</div>
211-
</div>
212-
</div>
213-
</Card>
214-
) : null}
215-
216-
<div
145+
<div
217146
className="animate-fadeIn opacity-0 space-y-2"
218147
style={{
219148
animationDuration: "0.7s",

0 commit comments

Comments
 (0)