Skip to content

Commit

Permalink
Merge branch v1.4.1-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
snow4060 authored Mar 23, 2024
2 parents 206073e + e9709c9 commit e87c1e0
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 10 deletions.
8 changes: 0 additions & 8 deletions client/dist/assets/index-frFFfzwD.js

This file was deleted.

8 changes: 8 additions & 0 deletions client/dist/assets/index-ltCTJfrV.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/dist/assets/uuid-yQnnJER4.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IME</title>
<script type="module" crossorigin src="/assets/index-frFFfzwD.js"></script>
<script type="module" crossorigin src="/assets/index-ltCTJfrV.js"></script>
<link rel="modulepreload" crossorigin href="/assets/vendor-Kn5e7kNx.js">
<link rel="modulepreload" crossorigin href="/assets/@emotion/react-Kx1cdyI0.js">
<link rel="modulepreload" crossorigin href="/assets/@hello-pangea/dnd-vwAq6ZmI.js">
Expand All @@ -15,6 +15,7 @@
<link rel="modulepreload" crossorigin href="/assets/@mui/lab-G_V84HSj.js">
<link rel="modulepreload" crossorigin href="/assets/@mui/material-eZTwIkIF.js">
<link rel="modulepreload" crossorigin href="/assets/monaco-editor-0-33SIEX.js">
<link rel="modulepreload" crossorigin href="/assets/uuid-yQnnJER4.js">
<link rel="modulepreload" crossorigin href="/assets/path-browserify-r28WiYlX.js">
<link rel="stylesheet" crossorigin href="/assets/monaco-editor-wQSzLa1i.css">
<link rel="stylesheet" crossorigin href="/assets/index-8W2TN5ac.css">
Expand Down
20 changes: 20 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
"react-dom": "^18.2.0",
"react-monaco-editor": "^0.55.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"uuid": "^9.0.1",
"vite-plugin-node-polyfills": "^0.19.0"
},
"devDependencies": {
"@types/loadable__component": "^5.13.8",
"@types/path-browserify": "^1.0.2",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
43 changes: 42 additions & 1 deletion client/src/components/Files/FileListing.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useCallback, useContext, useEffect, useState } from "react";
import Directory from "./Directory";
import "./styles/FileListing.css";

import FileComponent from "./File";
import { LoadFilesContext } from "./context/FilesContext";
import useUserSettingsContext from "../ModalContent/UserSettingsForm/hooks/useUserSettingsContext";
import useToastContext from "../Toast/hooks/useToastContext";
import { v4 as uuidv4 } from "uuid";
import { ADDRESS, PORT } from "../../env/address";

type MultiDimensionalArray = (string | number)[] | MultiDimensionalArray[];
type DirectoryObject = {
Expand Down Expand Up @@ -61,6 +63,45 @@ function FileListing() {
[userSettings]
);

const { toast } = useToastContext();

useEffect(() => {
const interval = setInterval(() => {
const uuid = uuidv4();
console.log("session");
fetch(`http://${ADDRESS}:${PORT}/api/session`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id: uuid }),
})
.then((response) => {
if (response.ok) {
return response.json();
} else {
toast.error("disconnected from server.");
throw new Error("disconnected from server.");
}
})
.then((data) => {
if (data.id !== uuid) {
toast.error("internal server error.");
throw new Error("internal server error.")
} else {
console.log("session ok");
}
})
.catch(() => {
toast.error("disconnected from server.");
throw new Error("disconnected from server.");
});
}, 3000);

return () => {
clearInterval(interval);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
loadFiles();
}, [loadFiles]);
Expand Down
5 changes: 5 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ app.post("/api/uploadProject", upload.single("file"), async (req, res) => {
}
});

app.post("/api/session", (req, res) => {
const {id} = req.body;
res.send({id: id});
});

app.listen(PORT, () => {
console.log("Server started on port", PORT);
});
Expand Down

0 comments on commit e87c1e0

Please sign in to comment.