Skip to content

Commit e87c1e0

Browse files
authored
Merge branch v1.4.1-dev
2 parents 206073e + e9709c9 commit e87c1e0

File tree

8 files changed

+80
-10
lines changed

8 files changed

+80
-10
lines changed

client/dist/assets/index-frFFfzwD.js

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

client/dist/assets/index-ltCTJfrV.js

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

client/dist/assets/uuid-yQnnJER4.js

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

client/dist/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>IME</title>
8-
<script type="module" crossorigin src="/assets/index-frFFfzwD.js"></script>
8+
<script type="module" crossorigin src="/assets/index-ltCTJfrV.js"></script>
99
<link rel="modulepreload" crossorigin href="/assets/vendor-Kn5e7kNx.js">
1010
<link rel="modulepreload" crossorigin href="/assets/@emotion/react-Kx1cdyI0.js">
1111
<link rel="modulepreload" crossorigin href="/assets/@hello-pangea/dnd-vwAq6ZmI.js">
@@ -15,6 +15,7 @@
1515
<link rel="modulepreload" crossorigin href="/assets/@mui/lab-G_V84HSj.js">
1616
<link rel="modulepreload" crossorigin href="/assets/@mui/material-eZTwIkIF.js">
1717
<link rel="modulepreload" crossorigin href="/assets/monaco-editor-0-33SIEX.js">
18+
<link rel="modulepreload" crossorigin href="/assets/uuid-yQnnJER4.js">
1819
<link rel="modulepreload" crossorigin href="/assets/path-browserify-r28WiYlX.js">
1920
<link rel="stylesheet" crossorigin href="/assets/monaco-editor-wQSzLa1i.css">
2021
<link rel="stylesheet" crossorigin href="/assets/index-8W2TN5ac.css">

client/package-lock.json

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

client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
"react-dom": "^18.2.0",
2727
"react-monaco-editor": "^0.55.0",
2828
"rollup-plugin-sourcemaps": "^0.6.3",
29+
"uuid": "^9.0.1",
2930
"vite-plugin-node-polyfills": "^0.19.0"
3031
},
3132
"devDependencies": {
3233
"@types/loadable__component": "^5.13.8",
3334
"@types/path-browserify": "^1.0.2",
3435
"@types/react": "^18.2.43",
3536
"@types/react-dom": "^18.2.17",
37+
"@types/uuid": "^9.0.8",
3638
"@typescript-eslint/eslint-plugin": "^6.14.0",
3739
"@typescript-eslint/parser": "^6.14.0",
3840
"@vitejs/plugin-react": "^4.2.1",

client/src/components/Files/FileListing.tsx

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { useCallback, useContext, useEffect, useState } from "react";
22
import Directory from "./Directory";
33
import "./styles/FileListing.css";
4-
54
import FileComponent from "./File";
65
import { LoadFilesContext } from "./context/FilesContext";
76
import useUserSettingsContext from "../ModalContent/UserSettingsForm/hooks/useUserSettingsContext";
7+
import useToastContext from "../Toast/hooks/useToastContext";
8+
import { v4 as uuidv4 } from "uuid";
9+
import { ADDRESS, PORT } from "../../env/address";
810

911
type MultiDimensionalArray = (string | number)[] | MultiDimensionalArray[];
1012
type DirectoryObject = {
@@ -61,6 +63,45 @@ function FileListing() {
6163
[userSettings]
6264
);
6365

66+
const { toast } = useToastContext();
67+
68+
useEffect(() => {
69+
const interval = setInterval(() => {
70+
const uuid = uuidv4();
71+
console.log("session");
72+
fetch(`http://${ADDRESS}:${PORT}/api/session`, {
73+
method: "POST",
74+
headers: { "Content-Type": "application/json" },
75+
body: JSON.stringify({ id: uuid }),
76+
})
77+
.then((response) => {
78+
if (response.ok) {
79+
return response.json();
80+
} else {
81+
toast.error("disconnected from server.");
82+
throw new Error("disconnected from server.");
83+
}
84+
})
85+
.then((data) => {
86+
if (data.id !== uuid) {
87+
toast.error("internal server error.");
88+
throw new Error("internal server error.")
89+
} else {
90+
console.log("session ok");
91+
}
92+
})
93+
.catch(() => {
94+
toast.error("disconnected from server.");
95+
throw new Error("disconnected from server.");
96+
});
97+
}, 3000);
98+
99+
return () => {
100+
clearInterval(interval);
101+
};
102+
// eslint-disable-next-line react-hooks/exhaustive-deps
103+
}, []);
104+
64105
useEffect(() => {
65106
loadFiles();
66107
}, [loadFiles]);

server/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ app.post("/api/uploadProject", upload.single("file"), async (req, res) => {
309309
}
310310
});
311311

312+
app.post("/api/session", (req, res) => {
313+
const {id} = req.body;
314+
res.send({id: id});
315+
});
316+
312317
app.listen(PORT, () => {
313318
console.log("Server started on port", PORT);
314319
});

0 commit comments

Comments
 (0)