From 8269718126735e9ed82ca64c8184f84b8c9d9ab7 Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Thu, 16 Nov 2023 05:06:04 +0100 Subject: [PATCH] Directory Support --- PackageSources/js-bundle/package.json | 8 +- .../js-bundle/pdf-reader.code-workspace | 3 +- .../js-bundle/src/assets/licenses_node.md | 16 +- .../js-bundle/src/contexts/DataContext.tsx | 19 +- .../js-bundle/src/contexts/ThemeContext.tsx | 7 +- .../js-bundle/src/pages/ListPage/ListPage.tsx | 61 ++- .../js-bundle/src/pages/PDFPage/PDFPage.tsx | 21 +- .../js-bundle/src/routers/Router.tsx | 68 ++-- PackageSources/js-bundle/yarn.lock | 356 +++++++++--------- PackageSources/module/Constants.h | 5 + PackageSources/module/FileSystem.hpp | 111 ++++++ PackageSources/module/Module.cpp | 214 ++++------- PackageSources/module/Module.h | 1 - PackageSources/module/PDF-Reader.vcxproj | 16 +- .../module/PDF-Reader.vcxproj.filters | 6 +- PackageSources/module/Utils.hpp | 26 ++ 16 files changed, 531 insertions(+), 407 deletions(-) create mode 100644 PackageSources/module/Constants.h create mode 100644 PackageSources/module/FileSystem.hpp delete mode 100644 PackageSources/module/Module.h create mode 100644 PackageSources/module/Utils.hpp diff --git a/PackageSources/js-bundle/package.json b/PackageSources/js-bundle/package.json index 657d8ae..7b44a5c 100644 --- a/PackageSources/js-bundle/package.json +++ b/PackageSources/js-bundle/package.json @@ -1,6 +1,6 @@ { "name": "pdf-reader", - "version": "1.0.2", + "version": "1.0.5", "description": "", "main": "index.js", "type": "module", @@ -13,7 +13,7 @@ "dev": "npx rollup -c -w", "clean": "rimraf ../html_ui/InGamePanels/pdf-reader-panel/ && rimraf .rollup.cache", "build": "npm version patch && npx rollup -c", - "release": "yarn types && yarn lint && yarn run licenses && yarn clean && cross-env NODE_ENV=production npx rollup -c" + "release": "yarn types && yarn lint && yarn run licenses && yarn clean && npm version patch && cross-env NODE_ENV=production npx rollup -c" }, "engines": { "npm": "USE YARN", @@ -32,6 +32,7 @@ "@rollup/plugin-typescript": "^11.1.1", "@types/react": "^18.2.8", "@types/react-dom": "^18.2.4", + "@types/uuid": "^9.0.7", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", "autoprefixer": "^10.4.14", @@ -65,6 +66,7 @@ "@mui/material": "^5.14.17", "postcss-import": "^15.1.0", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "uuid": "^9.0.1" } } diff --git a/PackageSources/js-bundle/pdf-reader.code-workspace b/PackageSources/js-bundle/pdf-reader.code-workspace index e87e8e5..9eaf53b 100644 --- a/PackageSources/js-bundle/pdf-reader.code-workspace +++ b/PackageSources/js-bundle/pdf-reader.code-workspace @@ -21,7 +21,8 @@ "refrac", "simobject", "svgs", - "Topocentric" + "Topocentric", + "UNFOCUS" ], } } \ No newline at end of file diff --git a/PackageSources/js-bundle/src/assets/licenses_node.md b/PackageSources/js-bundle/src/assets/licenses_node.md index 611200d..8e82821 100644 --- a/PackageSources/js-bundle/src/assets/licenses_node.md +++ b/PackageSources/js-bundle/src/assets/licenses_node.md @@ -2,11 +2,12 @@ | :--------- | :--------- | :------------------------------- | :------------- | :-------------------- | :----------- | :------------------------------------------------------------------------ | :------------- | :---------------- | :-------------- | :---------------------------------------------------------- | | kessler | stuff | @emotion/react | perpetual | material | MIT | git+https://github.com/emotion-js/emotion.git#main | 11.11.1 | 11.11.1 | ^11.11.1 | Emotion Contributors | | kessler | stuff | @emotion/styled | perpetual | material | MIT | git+https://github.com/emotion-js/emotion.git#main | 11.11.0 | 11.11.0 | ^11.11.0 | n/a | -| kessler | stuff | @mui/icons-material | perpetual | material | MIT | git+https://github.com/mui/material-ui.git | 5.14.16 | 5.14.16 | ^5.14.16 | MUI Team | -| kessler | stuff | @mui/material | perpetual | material | MIT | git+https://github.com/mui/material-ui.git | 5.14.17 | 5.14.17 | ^5.14.17 | MUI Team | +| kessler | stuff | @mui/icons-material | perpetual | material | MIT | git+https://github.com/mui/material-ui.git | 5.14.18 | 5.14.18 | ^5.14.16 | MUI Team | +| kessler | stuff | @mui/material | perpetual | material | MIT | git+https://github.com/mui/material-ui.git | 5.14.18 | 5.14.18 | ^5.14.17 | MUI Team | | kessler | stuff | postcss-import | perpetual | material | MIT | git+https://github.com/postcss/postcss-import.git | 15.1.0 | 15.1.0 | ^15.1.0 | Maxime Thirouin | | kessler | stuff | react | perpetual | material | MIT | git+https://github.com/facebook/react.git | 18.2.0 | 18.2.0 | ^18.2.0 | n/a | | kessler | stuff | react-dom | perpetual | material | MIT | git+https://github.com/facebook/react.git | 18.2.0 | 18.2.0 | ^18.2.0 | n/a | +| kessler | stuff | uuid | perpetual | material | MIT | git+https://github.com/uuidjs/uuid.git | 9.0.1 | 9.0.1 | ^9.0.1 | n/a | | kessler | stuff | @microsoft/msfs-types | perpetual | material | MIT | git+https://github.com/microsoft/msfs-avionics-mirror.git | 1.14.6 | 1.14.6 | ^1.14.6 | Asobo Studio / Working Title Simulations | | kessler | stuff | @rollup/plugin-commonjs | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 25.0.7 | 25.0.7 | ^25.0.0 | Rich Harris | | kessler | stuff | @rollup/plugin-json | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 6.0.1 | 6.0.1 | ^6.0.0 | rollup | @@ -15,8 +16,9 @@ | kessler | stuff | @rollup/plugin-typescript | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 11.1.5 | 11.1.5 | ^11.1.1 | Oskar Segersvärd | | kessler | stuff | @types/react | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 18.2.37 | 18.2.37 | ^18.2.8 | n/a | | kessler | stuff | @types/react-dom | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 18.2.15 | 18.2.15 | ^18.2.4 | n/a | -| kessler | stuff | @typescript-eslint/eslint-plugin | perpetual | material | MIT | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.11.0 | 6.10.0 | ^6.10.0 | n/a | -| kessler | stuff | @typescript-eslint/parser | perpetual | material | BSD-2-Clause | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.11.0 | 6.10.0 | ^6.10.0 | n/a | +| kessler | stuff | @types/uuid | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 9.0.7 | 9.0.7 | ^9.0.7 | n/a | +| kessler | stuff | @typescript-eslint/eslint-plugin | perpetual | material | MIT | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.11.0 | 6.11.0 | ^6.10.0 | n/a | +| kessler | stuff | @typescript-eslint/parser | perpetual | material | BSD-2-Clause | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.11.0 | 6.11.0 | ^6.10.0 | n/a | | kessler | stuff | autoprefixer | perpetual | material | MIT | git+https://github.com/postcss/autoprefixer.git | 10.4.16 | 10.4.16 | ^10.4.14 | Andrey Sitnik | | kessler | stuff | cross-env | perpetual | material | MIT | git+https://github.com/kentcdodds/cross-env.git | 7.0.3 | 7.0.3 | ^7.0.3 | Kent C. Dodds (https://kentcdodds.com) | | kessler | stuff | eslint | perpetual | material | MIT | git+https://github.com/eslint/eslint.git | 8.53.0 | 8.53.0 | ^8.42.0 | Nicholas C. Zakas | @@ -26,10 +28,10 @@ | kessler | stuff | license-report | perpetual | material | MIT | git+https://github.com/ironSource/license-report.git | 6.5.0 | 6.5.0 | ^6.5.0 | Yaniv Kessler | | kessler | stuff | node-sass | perpetual | material | MIT | git+https://github.com/sass/node-sass.git | 9.0.0 | 9.0.0 | ^9.0.0 | Andrew Nesbitt andrewnez@gmail.com http://andrew.github.com | | kessler | stuff | postcss | perpetual | material | MIT | git+https://github.com/postcss/postcss.git | 8.4.31 | 8.4.31 | ^8.4.24 | Andrey Sitnik | -| kessler | stuff | prettier | perpetual | material | MIT | git+https://github.com/prettier/prettier.git | 3.1.0 | 3.0.3 | ^3.0.3 | James Long | +| kessler | stuff | prettier | perpetual | material | MIT | git+https://github.com/prettier/prettier.git | 3.1.0 | 3.1.0 | ^3.0.3 | James Long | | kessler | stuff | prettier-plugin-organize-imports | perpetual | material | MIT | git+https://github.com/simonhaenisch/prettier-plugin-organize-imports.git | 3.2.4 | 3.2.4 | ^3.2.4 | Simon Haenisch (https://github.com/simonhaenisch) | | kessler | stuff | rimraf | perpetual | material | ISC | git://github.com/isaacs/rimraf.git | 5.0.5 | 5.0.5 | ^5.0.1 | Isaac Z. Schlueter (http://blog.izs.me/) | -| kessler | stuff | rollup | perpetual | material | MIT | git+https://github.com/rollup/rollup.git | 4.4.0 | 4.4.0 | ^4.3.1 | Rich Harris | +| kessler | stuff | rollup | perpetual | material | MIT | git+https://github.com/rollup/rollup.git | 4.4.1 | 4.4.1 | ^4.3.1 | Rich Harris | | kessler | stuff | rollup-plugin-copy | perpetual | material | MIT | git+https://github.com/vladshcherbin/rollup-plugin-copy.git | 3.5.0 | 3.5.0 | ^3.4.0 | Vlad Shcherbin | | kessler | stuff | rollup-plugin-postcss | perpetual | material | MIT | git+https://github.com/egoist/rollup-plugin-postcss.git | 4.0.2 | 4.0.2 | ^4.0.2 | EGOIST <0x142857@gmail.com> | | kessler | stuff | rollup-plugin-react-svg | perpetual | material | MIT | git+https://github.com/boopathi/react-svg-loader.git | 3.0.3 | 3.0.3 | ^3.0.3 | boopathi | @@ -39,5 +41,5 @@ | kessler | stuff | tslib | perpetual | material | 0BSD | git+https://github.com/Microsoft/tslib.git | 2.6.2 | 2.6.2 | ^2.5.3 | Microsoft Corp. | | kessler | stuff | typed-scss-modules | perpetual | material | MIT | git+https://github.com/skovy/typed-scss-modules.git | 7.1.4 | 7.1.4 | ^7.1.0 | Spencer Miskoviak | | kessler | stuff | typescript | perpetual | material | Apache-2.0 | git+https://github.com/Microsoft/TypeScript.git | 5.2.2 | 5.2.2 | 5.2.2 | Microsoft Corp. | -| kessler | stuff | yarn | perpetual | material | BSD-2-Clause | https://registry.npmjs.org/yarn/-/yarn-1.22.19.tgz | 1.22.19 | 1.22.19 | ^1.22.19 | n/a | +| kessler | stuff | yarn | perpetual | material | BSD-2-Clause | git+https://github.com/yarnpkg/yarn.git | 1.22.21 | 1.22.21 | ^1.22.19 | n/a | diff --git a/PackageSources/js-bundle/src/contexts/DataContext.tsx b/PackageSources/js-bundle/src/contexts/DataContext.tsx index 13de8ca..325ec96 100644 --- a/PackageSources/js-bundle/src/contexts/DataContext.tsx +++ b/PackageSources/js-bundle/src/contexts/DataContext.tsx @@ -5,15 +5,16 @@ interface IDataContext { list?: IList[]; file?: string; isLoading?: boolean; - refresh?: () => void; + refresh?: (path?: string) => void; load?: (path: string) => void; } export interface IList { name: string; + type: 'file' | 'directory'; // Base64 PNG - thumb: string; - pages: number; + thumb?: string; + pages?: number; } export const DataContext = createContext({}); @@ -21,11 +22,9 @@ export const DataContext = createContext({}); export const useData = () => { const { list, file, isLoading, refresh, load } = useContext(DataContext); - if (list !== undefined && file !== undefined && isLoading !== undefined && refresh && load) { + if (list !== undefined && file !== undefined && isLoading !== undefined && refresh && load) return { list, file, isLoading, refresh, load }; - } else { - throw new Error("Couldn't find context. Is your component inside a DataProvider?"); - } + else throw new Error("Couldn't find context. Is your component inside a DataProvider?"); }; interface IDataContextProps { @@ -40,7 +39,7 @@ const DataContextProvider: FC> = ({ dataLis useEffect(() => { dataListener.on(DATA, dataCallback); setIsLoading(true); - setTimeout(() => dataListener.call('COMM_BUS_WASM_CALLBACK', COMMANDS, LIST), 1000); + setTimeout(() => refresh(), 1000); return () => dataListener?.off(DATA, dataCallback); }, []); @@ -64,9 +63,9 @@ const DataContextProvider: FC> = ({ dataLis setIsLoading(false); }, []); - const refresh = () => { + const refresh = (path = '') => { setIsLoading(true); - dataListener.call('COMM_BUS_WASM_CALLBACK', COMMANDS, LIST); + dataListener.call('COMM_BUS_WASM_CALLBACK', COMMANDS, JSON.stringify({ cmd: LIST, path })); }; const load = (path: string) => { diff --git a/PackageSources/js-bundle/src/contexts/ThemeContext.tsx b/PackageSources/js-bundle/src/contexts/ThemeContext.tsx index f02e2b0..1524e66 100644 --- a/PackageSources/js-bundle/src/contexts/ThemeContext.tsx +++ b/PackageSources/js-bundle/src/contexts/ThemeContext.tsx @@ -12,11 +12,8 @@ export const ThemeContext = createContext({}); export const useTheme = () => { const { theme, title, setTheme } = useContext(ThemeContext); - if (theme !== undefined && title !== undefined && setTheme) { - return { theme, title, setTheme }; - } else { - throw new Error("Couldn't find context. Is your component inside a ThemeProvider?"); - } + if (theme !== undefined && title !== undefined && setTheme) return { theme, title, setTheme }; + else throw new Error("Couldn't find context. Is your component inside a ThemeProvider?"); }; const ThemeProvider: FC = ({ children }) => { diff --git a/PackageSources/js-bundle/src/pages/ListPage/ListPage.tsx b/PackageSources/js-bundle/src/pages/ListPage/ListPage.tsx index f86588b..0331015 100644 --- a/PackageSources/js-bundle/src/pages/ListPage/ListPage.tsx +++ b/PackageSources/js-bundle/src/pages/ListPage/ListPage.tsx @@ -1,21 +1,49 @@ +import BackIcon from '@mui/icons-material/ArrowBack'; +import NavigateNextIcon from '@mui/icons-material/NavigateNext'; import ReplayIcon from '@mui/icons-material/Replay'; import { AppBar, Backdrop, Box, Button, Grid, Stack, Toolbar, Typography } from '@mui/material'; -import { FC } from 'react'; +import { FC, useState } from 'react'; import { useData } from '../../contexts/DataContext'; import { useRouter } from '../../routers/Router'; const ListPage: FC = () => { - const { navigate } = useRouter(); + const { navigate, getProps } = useRouter(); const { list, isLoading, refresh } = useData(); + const { path: _path } = getProps() as { path: string }; + + const [path, setPath] = useState(_path ?? '/'); return ( - - Files - - + + {path.split('/').slice(-2, -1)} + + + ) : ( + + Files + + )} + @@ -30,19 +58,32 @@ const ListPage: FC = () => { navigate('/file', { entry })} + onClick={() => { + if (entry.type === 'directory') { + setPath(`${path}${entry.name}/`); + refresh(`${path}${entry.name}/`); + } + if (entry.type === 'file') navigate('/file', { path, entry }); + }} container padding={1} height={73} > - - - + {entry.type === 'file' && ( + + + + )} {entry.name} + {entry.type === 'directory' && ( + + + + )} ))} diff --git a/PackageSources/js-bundle/src/pages/PDFPage/PDFPage.tsx b/PackageSources/js-bundle/src/pages/PDFPage/PDFPage.tsx index af6693b..fe6ef87 100644 --- a/PackageSources/js-bundle/src/pages/PDFPage/PDFPage.tsx +++ b/PackageSources/js-bundle/src/pages/PDFPage/PDFPage.tsx @@ -2,27 +2,29 @@ import BackIcon from '@mui/icons-material/ArrowBack'; import NavigateBeforeIcon from '@mui/icons-material/NavigateBefore'; import NavigateNextIcon from '@mui/icons-material/NavigateNext'; import { AppBar, Backdrop, Box, Button, TextField, Toolbar, Typography } from '@mui/material'; -import { FC, useEffect, useState } from 'react'; +import { FC, useEffect, useRef, useState } from 'react'; +import { v4 } from 'uuid'; import { IList, useData } from '../../contexts/DataContext'; import { useRouter } from '../../routers/Router'; const PDFPage: FC = () => { const { goBack, getProps } = useRouter(); - const { entry } = getProps() as { entry: IList }; + const { path, entry } = getProps() as { path: string; entry: IList }; const { file, isLoading, load } = useData(); + const guid = useRef(v4()); const [currentPage, setCurrentPage] = useState(1); const [pageJump, setPageJump] = useState('1'); useEffect(() => { - load(`${entry.name}\\${currentPage}.png`); + load(`${path}/${entry.name}/${currentPage}.png`); }, [currentPage]); return ( - diff --git a/PackageSources/js-bundle/src/routers/Router.tsx b/PackageSources/js-bundle/src/routers/Router.tsx index 7083725..c1d7fd4 100644 --- a/PackageSources/js-bundle/src/routers/Router.tsx +++ b/PackageSources/js-bundle/src/routers/Router.tsx @@ -1,12 +1,12 @@ import { ThemeProvider } from '@mui/material'; -import { Attributes, FC, ReactNode, createContext, useContext, useMemo, useRef, useState } from 'react'; +import { Attributes, FC, cloneElement, createContext, useContext, useRef, useState } from 'react'; import { useTheme } from '../contexts/ThemeContext'; import ListPage from '../pages/ListPage/ListPage'; import PDFPage from '../pages/PDFPage/PDFPage'; interface IRouterContext { navigate?: (route: string, props: (Partial> & Attributes) | undefined) => void; - goBack?: () => void; + goBack?: (props: (Partial> & Attributes) | undefined) => void; getProps?: () => (Partial> & Attributes) | undefined; } @@ -15,69 +15,59 @@ export const RouterContext = createContext({}); export const useRouter = () => { const { navigate, goBack, getProps } = useContext(RouterContext); - if (navigate && goBack && getProps) { - return { navigate, goBack, getProps }; - } else { - throw new Error("Couldn't find context. Is your component inside a Router?"); - } + if (navigate && goBack && getProps) return { navigate, goBack, getProps }; + else throw new Error("Couldn't find context. Is your component inside a Router?"); }; interface IRouterProps { globals: (Partial> & Attributes) | undefined; } +const routes = [ + { + path: '/', + element: , + }, + { + path: '/file', + element: , + }, +]; + const Router: FC = ({ globals }) => { const { theme } = useTheme(); - const routes = useMemo< - { - path: string; - element: ReactNode; - }[] - >( - () => [ - { - path: '/', - element: , - }, - { - path: '/file', - element: , - }, - ], - [] - ); - const history = useRef([{ page: routes[0].element, props: globals }]).current; - const [currentPage, setCurrentPage] = useState<{ - page: ReactNode; - props: (Partial> & Attributes) | undefined; - }>({ page: routes[0].element, props: globals }); + const [currentPage, setCurrentPage] = useState(0); const navigate = (route: string, _props: (Partial> & Attributes) | undefined) => { const page = routes.find((_page) => _page.path === route); if (page) { - history.push({ page: page.element, props: { ..._props, ...globals } }); - setCurrentPage({ page: page.element, props: { ..._props, ...globals } }); + history.push({ + page: cloneElement(page.element, { key: `${page.path}-${history.length}` }), + props: { ..._props, ...globals }, + }); + setCurrentPage((prev) => prev + 1); window.dispatchEvent(new Event('resize')); - } else { - console.warn('No route registered for', route); - } + } else console.warn('No route registered for', route); }; - const goBack = () => { + const goBack = (_props: (Partial> & Attributes) | undefined) => { if (history.length > 1) { history.pop(); - setCurrentPage(history[history.length - 1]); + history[history.length - 1].props = _props; + setCurrentPage((prev) => prev - 1); window.dispatchEvent(new Event('resize')); } else console.warn('Already on root page'); }; - const getProps = () => currentPage.props; + const getProps = () => history[currentPage].props; return ( - {currentPage.page} + + {history[currentPage].page} + ); }; diff --git a/PackageSources/js-bundle/yarn.lock b/PackageSources/js-bundle/yarn.lock index 07c6e31..ece9b85 100644 --- a/PackageSources/js-bundle/yarn.lock +++ b/PackageSources/js-bundle/yarn.lock @@ -424,7 +424,7 @@ "@floating-ui/core" "^1.4.2" "@floating-ui/utils" "^0.1.3" -"@floating-ui/react-dom@^2.0.2": +"@floating-ui/react-dom@^2.0.4": version "2.0.4" resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.0.4.tgz#b076fafbdfeb881e1d86ae748b7ff95150e9f3ec" integrity sha512-CF8k2rgKeh/49UrnIBs4BdxPUV6vize/Db1d/YbCLyp9GiVZ0BEwf5AiDSxJRCr6yOkGqTFHtmrULxkEfYZ7dQ== @@ -522,42 +522,42 @@ resolved "https://registry.yarnpkg.com/@microsoft/msfs-types/-/msfs-types-1.14.6.tgz#852bc0cc9c7b649c3241b8d46ff122bfd005028c" integrity sha512-p2dmrxMpnurr7lOFRKjLCysxR6bb+MWJmRvYQkaExq7qBc8bu98WgI14X8W+pf2g0rlH69cN+uP9Kvz/dnPDuw== -"@mui/base@5.0.0-beta.23": - version "5.0.0-beta.23" - resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.23.tgz#dd10dfc609d8937749521f940965f757fa3c0f2c" - integrity sha512-9L8SQUGAWtd/Qi7Qem26+oSSgpY7f2iQTuvcz/rsGpyZjSomMMO6lwYeQSA0CpWM7+aN7eGoSY/WV6wxJiIxXw== +"@mui/base@5.0.0-beta.24": + version "5.0.0-beta.24" + resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.24.tgz#1a0638388291828dacf9547b466bc21fbaad3a2a" + integrity sha512-bKt2pUADHGQtqWDZ8nvL2Lvg2GNJyd/ZUgZAJoYzRgmnxBL9j36MSlS3+exEdYkikcnvVafcBtD904RypFKb0w== dependencies: "@babel/runtime" "^7.23.2" - "@floating-ui/react-dom" "^2.0.2" - "@mui/types" "^7.2.8" - "@mui/utils" "^5.14.17" + "@floating-ui/react-dom" "^2.0.4" + "@mui/types" "^7.2.9" + "@mui/utils" "^5.14.18" "@popperjs/core" "^2.11.8" clsx "^2.0.0" prop-types "^15.8.1" -"@mui/core-downloads-tracker@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.17.tgz#68ec40ea00832fb685f09bd493648b1f68f5baf4" - integrity sha512-eE0uxrpJAEL2ZXkeGLKg8HQDafsiXY+6eNpP4lcv3yIjFfGbU6Hj9/P7Adt8jpU+6JIhmxvILGj2r27pX+zdrQ== +"@mui/core-downloads-tracker@^5.14.18": + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.18.tgz#f8b187dc89756fa5c0b7d15aea537a6f73f0c2d8" + integrity sha512-yFpF35fEVDV81nVktu0BE9qn2dD/chs7PsQhlyaV3EnTeZi9RZBuvoEfRym1/jmhJ2tcfeWXiRuHG942mQXJJQ== "@mui/icons-material@^5.14.16": - version "5.14.16" - resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.14.16.tgz#bd394183b0cfb068d4fa48292cd8d329be8d6b16" - integrity sha512-wmOgslMEGvbHZjFLru8uH5E+pif/ciXAvKNw16q6joK6EWVWU5rDYWFknDaZhCvz8ZE/K8ZnJQ+lMG6GgHzXbg== + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.14.18.tgz#9e92964cde8c7ba32cf50438a83403dc283f2328" + integrity sha512-o2z49R1G4SdBaxZjbMmkn+2OdT1bKymLvAYaB6pH59obM1CYv/0vAVm6zO31IqhwtYwXv6A7sLIwCGYTaVkcdg== dependencies: "@babel/runtime" "^7.23.2" "@mui/material@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.14.17.tgz#8e11098e52965be3e9ed117d6c107bbe511fac46" - integrity sha512-+y0VeOLWfEA4Z98We/UH6KCo8+f2HLZDK45FY+sJf8kSojLy3VntadKtC/u0itqnXXb1Pr4wKB2tSIBW02zY4Q== + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.14.18.tgz#d0a89be3e27afe90135d542ddbf160b3f34e869c" + integrity sha512-y3UiR/JqrkF5xZR0sIKj6y7xwuEiweh9peiN3Zfjy1gXWXhz5wjlaLdoxFfKIEBUFfeQALxr/Y8avlHH+B9lpQ== dependencies: "@babel/runtime" "^7.23.2" - "@mui/base" "5.0.0-beta.23" - "@mui/core-downloads-tracker" "^5.14.17" - "@mui/system" "^5.14.17" - "@mui/types" "^7.2.8" - "@mui/utils" "^5.14.17" + "@mui/base" "5.0.0-beta.24" + "@mui/core-downloads-tracker" "^5.14.18" + "@mui/system" "^5.14.18" + "@mui/types" "^7.2.9" + "@mui/utils" "^5.14.18" "@types/react-transition-group" "^4.4.8" clsx "^2.0.0" csstype "^3.1.2" @@ -565,51 +565,51 @@ react-is "^18.2.0" react-transition-group "^4.4.5" -"@mui/private-theming@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.14.17.tgz#2fdf9d7df54dcb27e8ae7e00f440eb8310376ec3" - integrity sha512-u4zxsCm9xmQrlhVPug+Ccrtsjv7o2+rehvrgHoh0siSguvVgVQq5O3Hh10+tp/KWQo2JR4/nCEwquSXgITS1+g== +"@mui/private-theming@^5.14.18": + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.14.18.tgz#98f97139ea21570493391ab377c1deb47fc6d1a2" + integrity sha512-WSgjqRlzfHU+2Rou3HlR2Gqfr4rZRsvFgataYO3qQ0/m6gShJN+lhVEvwEiJ9QYyVzMDvNpXZAcqp8Y2Vl+PAw== dependencies: "@babel/runtime" "^7.23.2" - "@mui/utils" "^5.14.17" + "@mui/utils" "^5.14.18" prop-types "^15.8.1" -"@mui/styled-engine@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.14.17.tgz#7f79d863604076db5278bd38a2eeac44cd2ed336" - integrity sha512-AqpVjBEA7wnBvKPW168bNlqB6EN7HxTjLOY7oi275AzD/b1C7V0wqELy6NWoJb2yya5sRf7ENf4iNi3+T5cOgw== +"@mui/styled-engine@^5.14.18": + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.14.18.tgz#82d427bc975b85cecdbab2fd9353ed6c2df7eae1" + integrity sha512-pW8bpmF9uCB5FV2IPk6mfbQCjPI5vGI09NOLhtGXPeph/4xIfC3JdIX0TILU0WcTs3aFQqo6s2+1SFgIB9rCXA== dependencies: "@babel/runtime" "^7.23.2" "@emotion/cache" "^11.11.0" csstype "^3.1.2" prop-types "^15.8.1" -"@mui/system@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.14.17.tgz#3e212d1e699d4c777bbe5c6584ae129b1ef7d8bc" - integrity sha512-Ccz3XlbCqka6DnbHfpL3o3TfOeWQPR+ewvNAgm8gnS9M0yVMmzzmY6z0w/C1eebb+7ZP7IoLUj9vojg/GBaTPg== +"@mui/system@^5.14.18": + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.14.18.tgz#0f671e8f0a5e8e965b79235d77c50098f54195b5" + integrity sha512-hSQQdb3KF72X4EN2hMEiv8EYJZSflfdd1TRaGPoR7CIAG347OxCslpBUwWngYobaxgKvq6xTrlIl+diaactVww== dependencies: "@babel/runtime" "^7.23.2" - "@mui/private-theming" "^5.14.17" - "@mui/styled-engine" "^5.14.17" - "@mui/types" "^7.2.8" - "@mui/utils" "^5.14.17" + "@mui/private-theming" "^5.14.18" + "@mui/styled-engine" "^5.14.18" + "@mui/types" "^7.2.9" + "@mui/utils" "^5.14.18" clsx "^2.0.0" csstype "^3.1.2" prop-types "^15.8.1" -"@mui/types@^7.2.8": - version "7.2.8" - resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.8.tgz#2ed4402f104d65fcd4f460ca358654c8935e2285" - integrity sha512-9u0ji+xspl96WPqvrYJF/iO+1tQ1L5GTaDOeG3vCR893yy7VcWwRNiVMmPdPNpMDqx0WV1wtEW9OMwK9acWJzQ== +"@mui/types@^7.2.9": + version "7.2.9" + resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.9.tgz#730ee83a37af292a5973962f78ce5c95f31213a7" + integrity sha512-k1lN/PolaRZfNsRdAqXtcR71sTnv3z/VCCGPxU8HfdftDkzi335MdJ6scZxvofMAd/K/9EbzCZTFBmlNpQVdCg== -"@mui/utils@^5.14.17": - version "5.14.17" - resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.14.17.tgz#8e2e7ca58865119eec8c6bdb359f539c25aaf576" - integrity sha512-yxnWgSS4J6DMFPw2Dof85yBkG02VTbEiqsikymMsnZnXDurtVGTIhlNuV24GTmFTuJMzEyTTU9UF+O7zaL8LEQ== +"@mui/utils@^5.14.18": + version "5.14.18" + resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.14.18.tgz#d2a46df9b06230423ba6b6317748b27185a56ac3" + integrity sha512-HZDRsJtEZ7WMSnrHV9uwScGze4wM/Y+u6pDVo+grUjt5yXzn+wI8QX/JwTHh9YSw/WpnUL80mJJjgCnWj2VrzQ== dependencies: "@babel/runtime" "^7.23.2" - "@types/prop-types" "^15.7.9" + "@types/prop-types" "^15.7.10" prop-types "^15.8.1" react-is "^18.2.0" @@ -733,65 +733,65 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.4.0.tgz#07f0bd33af84bfadb1a93fd86c3d0ea290ec2558" - integrity sha512-AD30wtT58hZZsXIeiksytR6Gm2gofUxn5KqrDBdyzekgxXB9bXN9dqWIEcPfYo9lA9MVRm0lC42LuYGsscRxiA== +"@rollup/rollup-android-arm-eabi@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.4.1.tgz#f276b0fa322270aa42d1f56c982db6ef8d6a4393" + integrity sha512-Ss4suS/sd+6xLRu+MLCkED2mUrAyqHmmvZB+zpzZ9Znn9S8wCkTQCJaQ8P8aHofnvG5L16u9MVnJjCqioPErwQ== -"@rollup/rollup-android-arm64@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.4.0.tgz#38a90aa6be6ee7a3b78cca8dd919bbca8c426570" - integrity sha512-PlqvhzFxy5FRTB3wLSsGgPhiakv9jrgfu8tjSojLJFP0CdhfZSRDOFvQ2emWLUEBOSCnjpL63XSuFVMwg59ZtA== +"@rollup/rollup-android-arm64@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.4.1.tgz#f0492f00d18e1067785f8e820e137c00528c5e62" + integrity sha512-sRSkGTvGsARwWd7TzC8LKRf8FiPn7257vd/edzmvG4RIr9x68KBN0/Ek48CkuUJ5Pj/Dp9vKWv6PEupjKWjTYA== -"@rollup/rollup-darwin-arm64@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.4.0.tgz#27efac74e681888e51386aa4efb2a24ea6df9c5b" - integrity sha512-BYmhn1Hebmkmdyn5mBFy7HptowyjtMALyTpywNSNZYigWwyv4L8WQVr0XvOQE7eE6WoKrupSVxtIcGZW8MgZUA== +"@rollup/rollup-darwin-arm64@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.4.1.tgz#40443db7f4559171d797581e0618ec1a4c8dcee9" + integrity sha512-nz0AiGrrXyaWpsmBXUGOBiRDU0wyfSXbFuF98pPvIO8O6auQsPG6riWsfQqmCCC5FNd8zKQ4JhgugRNAkBJ8mQ== -"@rollup/rollup-darwin-x64@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.4.0.tgz#0135c8d3c04ae8b19e1310097ac631b5d99bb495" - integrity sha512-7GXsMiX/giTDBMs/gL3rePLBRC6gV7DT7JQ0lNqoNDe5hm+Gm4NEWky9fwEmer64fIUbOsTiLUsyQ5fDXUbXPA== +"@rollup/rollup-darwin-x64@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.4.1.tgz#2868f37a9f9c2c22c091b6209f6ce7454437edf9" + integrity sha512-Ogqvf4/Ve/faMaiPRvzsJEqajbqs00LO+8vtrPBVvLgdw4wBg6ZDXdkDAZO+4MLnrc8mhGV6VJAzYScZdPLtJg== -"@rollup/rollup-linux-arm-gnueabihf@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.4.0.tgz#694f52dabf24a7c063e4ec647bf3fde19b276ca0" - integrity sha512-kavnkaV50Gu6vESlOAwUad92wYY9mUrcaPmhzOQZKlNFnzWAUYyD/uhHmWvY7Z2chtwhWlng0LvCRBF5QiPO7w== +"@rollup/rollup-linux-arm-gnueabihf@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.4.1.tgz#d78d7ad358d24058166ab5599de3dcb5ab951add" + integrity sha512-9zc2tqlr6HfO+hx9+wktUlWTRdje7Ub15iJqKcqg5uJZ+iKqmd2CMxlgPpXi7+bU7bjfDIuvCvnGk7wewFEhCg== -"@rollup/rollup-linux-arm64-gnu@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.4.0.tgz#185b6a28d8e2307708b18eee72f1361595091e45" - integrity sha512-2hBHEtCjnBTeuLvDAlHRCqsuFQSyAhTQs9vbZEVBTV8ap35pDI1ukPbIVFFCWNvL/KE7xRor5YZFvfyGCfvLnA== +"@rollup/rollup-linux-arm64-gnu@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.4.1.tgz#5d07588b40a04f5b6fbd9e0169c8dc32c1c2ed21" + integrity sha512-phLb1fN3rq2o1j1v+nKxXUTSJnAhzhU0hLrl7Qzb0fLpwkGMHDem+o6d+ZI8+/BlTXfMU4kVWGvy6g9k/B8L6Q== -"@rollup/rollup-linux-arm64-musl@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.4.0.tgz#4172c45a08928aa992c70d5af64cd87f5914fd50" - integrity sha512-u7zy0Ygzl7O5Gvr9TSNSQj+DBzvMJC7rXfyQNgZ13KwkhgJ8z0z+gt2AO4RPd01rZioMQ2/TA24XGGg4xqhd0Q== +"@rollup/rollup-linux-arm64-musl@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.4.1.tgz#d452e88a02755f449f6e98d4ce424d655ef42cfe" + integrity sha512-M2sDtw4tf57VPSjbTAN/lz1doWUqO2CbQuX3L9K6GWIR5uw9j+ROKCvvUNBY8WUbMxwaoc8mH9HmmBKsLht7+w== -"@rollup/rollup-linux-x64-gnu@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.4.0.tgz#18c0c94e44bc778297216eaac93ef49681bc7fd5" - integrity sha512-VvpAdh5SgewmWo8sa5QPYG8aSKH9hU2Kr5+3of0GzBI/8n8PBqhLyvF0DbO+zDW8j5IM8NDebv82MpHrZaD0Cw== +"@rollup/rollup-linux-x64-gnu@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.4.1.tgz#e8e8e87ab098784383a5ced4aa4bbfa7b2c92a4e" + integrity sha512-mHIlRLX+hx+30cD6c4BaBOsSqdnCE4ok7/KDvjHYAHoSuveoMMxIisZFvcLhUnyZcPBXDGZTuBoalcuh43UfQQ== -"@rollup/rollup-linux-x64-musl@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.4.0.tgz#a0d66ded3b3a9581702cfd20440fd986d56d5ec5" - integrity sha512-3g6jaXxXVFaDnFoMn2+E3ludGcXFfEr6lDn+S1lh9Qe0JcL9sPt1wGh0g2cKIlb6OakNOFopZqJ5Yub9F7gQlA== +"@rollup/rollup-linux-x64-musl@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.4.1.tgz#3e5da42626672e2d620ed12746158b0cf6143b23" + integrity sha512-tB+RZuDi3zxFx7vDrjTNGVLu2KNyzYv+UY8jz7e4TMEoAj7iEt8Qk6xVu6mo3pgjnsHj6jnq3uuRsHp97DLwOA== -"@rollup/rollup-win32-arm64-msvc@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.4.0.tgz#acabac95fff647d666a5d649909612aad72bd3d0" - integrity sha512-jnoDRkg5Ve6Y1qx2m1+ehouOLQ4ddc15/iQSfFjcDUL6bqLdJJ5c4CKfUy/C6W1oCU4la+hMkveE9GG7ECN7dg== +"@rollup/rollup-win32-arm64-msvc@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.4.1.tgz#0f0d0c6b75c53643fab8238c76889a95bca3b9cc" + integrity sha512-Hdn39PzOQowK/HZzYpCuZdJC91PE6EaGbTe2VCA9oq2u18evkisQfws0Smh9QQGNNRa/T7MOuGNQoLeXhhE3PQ== -"@rollup/rollup-win32-ia32-msvc@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.4.0.tgz#ee29090b93d69f84c3bc8da924c491ef6419b8da" - integrity sha512-SoLQmJanozFow8o50ul2a3R+J7nk4pEhrp83PzTSXs5OzOmIZbPSp5kihtQ3f6ypo4MCbmh0V8Ev0bJIEp4Azw== +"@rollup/rollup-win32-ia32-msvc@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.4.1.tgz#8bb9e8fbf0fdf96fe3bebcee23f5cfdbbd9a4a0a" + integrity sha512-tLpKb1Elm9fM8c5w3nl4N1eLTP4bCqTYw9tqUBxX8/hsxqHO3dxc2qPbZ9PNkdK4tg4iLEYn0pOUnVByRd2CbA== -"@rollup/rollup-win32-x64-msvc@4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.4.0.tgz#a74d4bb9cde9992688d93db7d94d95db1c2c1d8d" - integrity sha512-Zaz6itfQ5sQF5Cia49YDW1ZTr+YfIKzTSb9npLyvQn346n7ulRDOv2J7GnL0zcOJ3cqW7HzG/ZisyO6fH43J9g== +"@rollup/rollup-win32-x64-msvc@4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.4.1.tgz#8311b77e6cce322865ba12ada8c3779369610d18" + integrity sha512-eAhItDX9yQtZVM3yvXS/VR3qPqcnXvnLyx1pLXl4JzyNMBNO3KC986t/iAg2zcMzpAp9JSvxB5VZGnBiNoA98w== "@sindresorhus/is@^5.2.0": version "5.6.0" @@ -889,7 +889,7 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.2.tgz#5950e50960793055845e956c427fc2b0d70c5239" integrity sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw== -"@types/prop-types@*", "@types/prop-types@^15.7.9": +"@types/prop-types@*", "@types/prop-types@^15.7.10": version "15.7.10" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.10.tgz#892afc9332c4d62a5ea7e897fe48ed2085bbb08a" integrity sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A== @@ -937,16 +937,21 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.5.tgz#deed5ab7019756c9c90ea86139106b0346223f35" integrity sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg== +"@types/uuid@^9.0.7": + version "9.0.7" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" + integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== + "@typescript-eslint/eslint-plugin@^6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.10.0.tgz#cfe2bd34e26d2289212946b96ab19dcad64b661a" - integrity sha512-uoLj4g2OTL8rfUQVx2AFO1hp/zja1wABJq77P6IclQs6I/m9GLrm7jCdgzZkvWdDCQf1uEvoa8s8CupsgWQgVg== + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.11.0.tgz#52aae65174ff526576351f9ccd41cea01001463f" + integrity sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.10.0" - "@typescript-eslint/type-utils" "6.10.0" - "@typescript-eslint/utils" "6.10.0" - "@typescript-eslint/visitor-keys" "6.10.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/type-utils" "6.11.0" + "@typescript-eslint/utils" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -955,71 +960,71 @@ ts-api-utils "^1.0.1" "@typescript-eslint/parser@^6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.10.0.tgz#578af79ae7273193b0b6b61a742a2bc8e02f875a" - integrity sha512-+sZwIj+s+io9ozSxIWbNB5873OSdfeBEH/FR0re14WLI6BaKuSOnnwCJ2foUiu8uXf4dRp1UqHP0vrZ1zXGrog== + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.11.0.tgz#9640d9595d905f3be4f278bf515130e6129b202e" + integrity sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ== dependencies: - "@typescript-eslint/scope-manager" "6.10.0" - "@typescript-eslint/types" "6.10.0" - "@typescript-eslint/typescript-estree" "6.10.0" - "@typescript-eslint/visitor-keys" "6.10.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/typescript-estree" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.10.0.tgz#b0276118b13d16f72809e3cecc86a72c93708540" - integrity sha512-TN/plV7dzqqC2iPNf1KrxozDgZs53Gfgg5ZHyw8erd6jd5Ta/JIEcdCheXFt9b1NYb93a1wmIIVW/2gLkombDg== +"@typescript-eslint/scope-manager@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz#621f603537c89f4d105733d949aa4d55eee5cea8" + integrity sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A== dependencies: - "@typescript-eslint/types" "6.10.0" - "@typescript-eslint/visitor-keys" "6.10.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" -"@typescript-eslint/type-utils@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.10.0.tgz#1007faede067c78bdbcef2e8abb31437e163e2e1" - integrity sha512-wYpPs3hgTFblMYwbYWPT3eZtaDOjbLyIYuqpwuLBBqhLiuvJ+9sEp2gNRJEtR5N/c9G1uTtQQL5AhV0fEPJYcg== +"@typescript-eslint/type-utils@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.11.0.tgz#d0b8b1ab6c26b974dbf91de1ebc5b11fea24e0d1" + integrity sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA== dependencies: - "@typescript-eslint/typescript-estree" "6.10.0" - "@typescript-eslint/utils" "6.10.0" + "@typescript-eslint/typescript-estree" "6.11.0" + "@typescript-eslint/utils" "6.11.0" debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/types@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.10.0.tgz#f4f0a84aeb2ac546f21a66c6e0da92420e921367" - integrity sha512-36Fq1PWh9dusgo3vH7qmQAj5/AZqARky1Wi6WpINxB6SkQdY5vQoT2/7rW7uBIsPDcvvGCLi4r10p0OJ7ITAeg== +"@typescript-eslint/types@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.11.0.tgz#8ad3aa000cbf4bdc4dcceed96e9b577f15e0bf53" + integrity sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA== -"@typescript-eslint/typescript-estree@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.10.0.tgz#667381eed6f723a1a8ad7590a31f312e31e07697" - integrity sha512-ek0Eyuy6P15LJVeghbWhSrBCj/vJpPXXR+EpaRZqou7achUWL8IdYnMSC5WHAeTWswYQuP2hAZgij/bC9fanBg== +"@typescript-eslint/typescript-estree@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz#7b52c12a623bf7f8ec7f8a79901b9f98eb5c7990" + integrity sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ== dependencies: - "@typescript-eslint/types" "6.10.0" - "@typescript-eslint/visitor-keys" "6.10.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.10.0.tgz#4d76062d94413c30e402c9b0df8c14aef8d77336" - integrity sha512-v+pJ1/RcVyRc0o4wAGux9x42RHmAjIGzPRo538Z8M1tVx6HOnoQBCX/NoadHQlZeC+QO2yr4nNSFWOoraZCAyg== +"@typescript-eslint/utils@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.11.0.tgz#11374f59ef4cea50857b1303477c08aafa2ca604" + integrity sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.10.0" - "@typescript-eslint/types" "6.10.0" - "@typescript-eslint/typescript-estree" "6.10.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/typescript-estree" "6.11.0" semver "^7.5.4" -"@typescript-eslint/visitor-keys@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.10.0.tgz#b9eaf855a1ac7e95633ae1073af43d451e8f84e3" - integrity sha512-xMGluxQIEtOM7bqFCo+rCMh5fqI+ZxV5RUUOa29iVPz1OgCZrtc7rFnz5cLUazlkPKYqX+75iuDq7m0HQ48nCg== +"@typescript-eslint/visitor-keys@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz#d991538788923f92ec40d44389e7075b359f3458" + integrity sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ== dependencies: - "@typescript-eslint/types" "6.10.0" + "@typescript-eslint/types" "6.11.0" eslint-visitor-keys "^3.4.1" "@ungap/structured-clone@^1.2.0": @@ -1476,9 +1481,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001214, caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001541: - version "1.0.30001561" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz#752f21f56f96f1b1a52e97aae98c57c562d5d9da" - integrity sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw== + version "1.0.30001562" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001562.tgz#9d16c5fd7e9c592c4cd5e304bc0f75b0008b2759" + integrity sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng== capital-case@^1.0.4: version "1.0.4" @@ -2039,9 +2044,9 @@ eastasianwidth@^0.2.0: integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== electron-to-chromium@^1.4.535: - version "1.4.581" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz#23b684c67bf56d4284e95598c05a5d266653b6d8" - integrity sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw== + version "1.4.585" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.585.tgz#7b3cb6846bb5cc10a8d5904c351a9b8aaa76ea90" + integrity sha512-B4yBlX0azdA3rVMxpYwLQfDpdwOgcnLCkpvSOd68iFmeedo+WYjaBJS3/W58LVD8CB2nf+o7C4K9xz1l09RkWg== emoji-regex@^8.0.0: version "8.0.0" @@ -4607,9 +4612,9 @@ prettier-plugin-organize-imports@^3.2.4: integrity sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog== prettier@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" - integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== + version "3.1.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e" + integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw== process-nextick-args@~2.0.0: version "2.0.1" @@ -4969,22 +4974,22 @@ rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.0, rollup-pluginutils@^2.8.2: estree-walker "^0.6.1" rollup@^4.3.1: - version "4.4.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.4.0.tgz#4011373bb5adf172180335fd851d2cfc458edb24" - integrity sha512-3L67ubCc1Qm49wUodsQ72FM6JmJ9M37d63rGPjxbcKrzNJrwFipl+lDNHeWd6BId09S6Tb9KiBgYKbWhIuqVyg== + version "4.4.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.4.1.tgz#2f85169f23d13dabb3d9b846d753965757353820" + integrity sha512-idZzrUpWSblPJX66i+GzrpjKE3vbYrlWirUHteoAbjKReZwa0cohAErOYA5efoMmNCdvG9yrJS+w9Kl6csaH4w== optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.4.0" - "@rollup/rollup-android-arm64" "4.4.0" - "@rollup/rollup-darwin-arm64" "4.4.0" - "@rollup/rollup-darwin-x64" "4.4.0" - "@rollup/rollup-linux-arm-gnueabihf" "4.4.0" - "@rollup/rollup-linux-arm64-gnu" "4.4.0" - "@rollup/rollup-linux-arm64-musl" "4.4.0" - "@rollup/rollup-linux-x64-gnu" "4.4.0" - "@rollup/rollup-linux-x64-musl" "4.4.0" - "@rollup/rollup-win32-arm64-msvc" "4.4.0" - "@rollup/rollup-win32-ia32-msvc" "4.4.0" - "@rollup/rollup-win32-x64-msvc" "4.4.0" + "@rollup/rollup-android-arm-eabi" "4.4.1" + "@rollup/rollup-android-arm64" "4.4.1" + "@rollup/rollup-darwin-arm64" "4.4.1" + "@rollup/rollup-darwin-x64" "4.4.1" + "@rollup/rollup-linux-arm-gnueabihf" "4.4.1" + "@rollup/rollup-linux-arm64-gnu" "4.4.1" + "@rollup/rollup-linux-arm64-musl" "4.4.1" + "@rollup/rollup-linux-x64-gnu" "4.4.1" + "@rollup/rollup-linux-x64-musl" "4.4.1" + "@rollup/rollup-win32-arm64-msvc" "4.4.1" + "@rollup/rollup-win32-ia32-msvc" "4.4.1" + "@rollup/rollup-win32-x64-msvc" "4.4.1" fsevents "~2.3.2" run-parallel@^1.1.9: @@ -5841,6 +5846,11 @@ util.promisify@~1.0.0: has-symbols "^1.0.1" object.getownpropertydescriptors "^2.1.0" +uuid@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -5995,9 +6005,9 @@ yargs@^17.2.1, yargs@^17.3.1: yargs-parser "^21.1.1" yarn@^1.22.19: - version "1.22.19" - resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.19.tgz#4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" - integrity sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ== + version "1.22.21" + resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.21.tgz#1959a18351b811cdeedbd484a8f86c3cc3bbaf72" + integrity sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg== yocto-queue@^0.1.0: version "0.1.0" diff --git a/PackageSources/module/Constants.h b/PackageSources/module/Constants.h new file mode 100644 index 0000000..1403a75 --- /dev/null +++ b/PackageSources/module/Constants.h @@ -0,0 +1,5 @@ +#pragma once + +#define PACKAGE_DIR "/work/Files/" +#define COMMANDS "KHOFMANN_PDF_READER_COMMANDS" +#define DATA "KHOFMANN_PDF_READER_DATA" \ No newline at end of file diff --git a/PackageSources/module/FileSystem.hpp b/PackageSources/module/FileSystem.hpp new file mode 100644 index 0000000..58fcc15 --- /dev/null +++ b/PackageSources/module/FileSystem.hpp @@ -0,0 +1,111 @@ +#pragma once + +#include + +#include + +#include "rapidjson/document.h" + +#include "Base64.hpp" +#include "Utils.hpp" + +#include "Constants.h" + +namespace khofmann +{ + /// + /// Read a file and return BASE64 encoded file contents + /// + /// Path of File + /// Allocator + /// BASE64 encoded file contents + static rapidjson::Value readFile(const char* path, rapidjson::Document::AllocatorType& alloc) + { + FILE* file = fopen(path, "r"); + if (file) { + fseek(file, 0, SEEK_END); + long fsize = ftell(file); + fseek(file, 0, SEEK_SET); + + char* string = (char*)calloc(sizeof(char), fsize + 1); + fread(string, fsize, 1, file); + fclose(file); + + return rapidjson::Value(macaron::Base64::Encode(string, fsize).c_str(), alloc); + } + + return rapidjson::Value("", alloc); + } + + /// + /// Enumerate a directory and return list of directories. + /// Return tumbnail as BASE64 and page count if present. + /// + /// Path of directory + /// Allocator + /// List of Files + static rapidjson::Value enumerateDir(const char* path, rapidjson::Document::AllocatorType& alloc) + { + rapidjson::Value files; + files.SetArray(); + + int count = 0; + + DIR* d; + struct dirent* dir; + d = opendir(path); + if (d) + { + while ((dir = readdir(d)) != NULL) + { + if (strcmp(dir->d_name, ".") && strcmp(dir->d_name, "..")) + { + std::string dirPath(path); + dirPath += dir->d_name; + std::string thumb(dirPath); + thumb += "/thumb.png"; + FILE* check = fopen(thumb.c_str(), "r"); + if (check) + { + fclose(check); + DIR* f; + struct dirent* file; + f = opendir(dirPath.c_str()); + if (f) + { + log(stdout, "Found file %s\n", dir->d_name); + while ((file = readdir(f)) != NULL) + { + if (file->d_type == DT_REG) + { + count++; + } + } + rapidjson::Value entry; + entry.SetObject(); + entry.AddMember("name", rapidjson::Value(dir->d_name, alloc).Move(), alloc); + entry.AddMember("pages", count - 1, alloc); + entry.AddMember("thumb", readFile(thumb.c_str(), alloc).Move(), alloc); + entry.AddMember("type", "file", alloc); + files.PushBack(entry.Move(), alloc); + } + closedir(f); + } + else + { + log(stdout, "Found directory %s\n", dir->d_name); + + rapidjson::Value entry; + entry.SetObject(); + entry.AddMember("name", rapidjson::Value(dir->d_name, alloc).Move(), alloc); + entry.AddMember("type", "directory", alloc); + files.PushBack(entry.Move(), alloc); + } + } + } + } + closedir(d); + + return files; + } +} \ No newline at end of file diff --git a/PackageSources/module/Module.cpp b/PackageSources/module/Module.cpp index 2cd0ac4..937f5dc 100644 --- a/PackageSources/module/Module.cpp +++ b/PackageSources/module/Module.cpp @@ -2,10 +2,6 @@ #include #include -#include "rapidjson/document.h" -#include "rapidjson/stringbuffer.h" -#include "rapidjson/writer.h" - #include #include #include @@ -15,136 +11,69 @@ #include #include -#include "Base64.hpp" -#include "Module.h" +#include "rapidjson/document.h" +#include "rapidjson/stringbuffer.h" +#include "rapidjson/writer.h" -#define COMMANDS "KHOFMANN_PDF_READER_COMMANDS" -#define DATA "KHOFMANN_PDF_READER_DATA" +#include "FileSystem.hpp" +#include "Utils.hpp" -FILE* logFile; +#include "Constants.h" static void CommandWasmCallback(const char* args, unsigned int size, void* ctx); -void log(FILE *file, const char *format, void* optionalElement = NULL); -std::string readFile(const char* path); -extern "C" MSFS_CALLBACK void module_init(void) +extern "C" { - log(stdout, "[PDF-Reader Module] Starting init\n"); - - logFile = fopen("\\work\\log.txt", "w"); - if (logFile == NULL) + MSFS_CALLBACK void module_init(void) { - log(stderr, "[PDF-Reader Module] Error creating logfile\n"); - } + khofmann::log(stdout, "[PDF-Reader Module] Starting init\n"); - if (!fsCommBusRegister(COMMANDS, CommandWasmCallback)) - { - log(stderr, "[PDF-Reader Module] Error registering command CommBus\n"); - } - - log(stdout, "[PDF-Reader Module] Inited\n"); -} - -extern "C" MSFS_CALLBACK void module_deinit(void) -{ - log(stdout, "[PDF-Reader Module] Starting deinit\n"); - - int c = fsCommBusUnregister(COMMANDS, CommandWasmCallback); - log(stdout, "%i unregistered", &c); - - log(stdout, "[PDF-Reader Module] Deinited\n"); -} - -static void CommandWasmCallback(const char* args, unsigned int size, void* ctx) -{ - if (strcmp(args, "LIST") == 0) - { - rapidjson::Document jsonDoc; - rapidjson::Document::AllocatorType& allocator = jsonDoc.GetAllocator(); - - jsonDoc.SetObject(); - jsonDoc.AddMember("id", "LIST", allocator); - - rapidjson::Value files; - files.SetArray(); - - DIR* d; - struct dirent* dir; - d = opendir("\\work\\Files"); - if (d) + khofmann::logFile = fopen("/work/log.txt", "w"); + if (khofmann::logFile == NULL) { - log(stdout, "Found files:\n"); - while ((dir = readdir(d)) != NULL) - { - if (dir->d_type == DT_DIR && strcmp(dir->d_name, ".") && strcmp(dir->d_name, "..")) - { - log(stdout, "%s\n", dir->d_name); - - std::string path("\\work\\Files\\"); - path += dir->d_name; - - int count = 0; - DIR* s; - struct dirent* dir_s; - s = opendir(path.c_str()); - if (s) - { - while ((dir_s = readdir(s)) != NULL) - { - if (dir_s->d_type == DT_REG) - { - count++; - } - } - - } - closedir(s); - - std::string thumb(dir->d_name); - thumb += "\\thumb.png"; - - rapidjson::Value name(dir->d_name, allocator); - rapidjson::Value _thumb(readFile(thumb.c_str()).c_str(), allocator); - - rapidjson::Value entry; - entry.SetObject(); - entry.AddMember("name", name.Move(), allocator); - entry.AddMember("thumb", _thumb.Move(), allocator); - entry.AddMember("pages", count - 1, allocator); - - files.PushBack(entry.Move(), allocator); - } - } - - jsonDoc.AddMember("data", files, allocator); - - rapidjson::StringBuffer strbuf; - rapidjson::Writer writer(strbuf); - jsonDoc.Accept(writer); - - fsCommBusCall(DATA, strbuf.GetString(), strbuf.GetSize(), FsCommBusBroadcast_JS); - - closedir(d); + khofmann::log(stderr, "[PDF-Reader Module] Error creating logfile\n"); } + + if (!fsCommBusRegister(COMMANDS, CommandWasmCallback)) + { + khofmann::log(stderr, "[PDF-Reader Module] Error registering command CommBus\n"); + } + + khofmann::log(stdout, "[PDF-Reader Module] Inited\n"); } - else + + extern "C" MSFS_CALLBACK void module_deinit(void) + { + khofmann::log(stdout, "[PDF-Reader Module] Starting deinit\n"); + + int c = fsCommBusUnregister(COMMANDS, CommandWasmCallback); + khofmann::log(stdout, "%i unregistered", &c); + + khofmann::log(stdout, "[PDF-Reader Module] Deinited\n"); + + fclose(khofmann::logFile); + } + + static void CommandWasmCallback(const char* args, unsigned int size, void* ctx) { rapidjson::Document inDoc; inDoc.Parse(args); const char* cmd = inDoc["cmd"].GetString(); - if (strcmp(cmd, "LOAD") == 0) { - const char* data = inDoc["file"].GetString(); - - log(stdout, "Loading file %s\n", (void*)data); + if (strcmp(cmd, "LIST") == 0) + { + std::string path; + path += PACKAGE_DIR; + path += inDoc["path"].GetString(); rapidjson::Document outDoc; rapidjson::Document::AllocatorType& allocator = outDoc.GetAllocator(); outDoc.SetObject(); - outDoc.AddMember("id", "LOAD", allocator); - outDoc.AddMember("data", rapidjson::Value(readFile(data).c_str(), allocator).Move(), allocator); + outDoc.AddMember("id", "LIST", allocator); + + outDoc.AddMember("data", khofmann::enumerateDir(path.c_str(), allocator).Move(), allocator); rapidjson::StringBuffer strbuf; rapidjson::Writer writer(strbuf); @@ -152,37 +81,34 @@ static void CommandWasmCallback(const char* args, unsigned int size, void* ctx) fsCommBusCall(DATA, strbuf.GetString(), strbuf.GetSize(), FsCommBusBroadcast_JS); } + else + { + rapidjson::Document inDoc; + inDoc.Parse(args); + + const char* cmd = inDoc["cmd"].GetString(); + + if (strcmp(cmd, "LOAD") == 0) + { + std::string path; + path += PACKAGE_DIR; + path += inDoc["file"].GetString(); + + khofmann::log(stdout, "Loading file %s\n", (void*)path.c_str()); + + rapidjson::Document outDoc; + rapidjson::Document::AllocatorType& allocator = outDoc.GetAllocator(); + + outDoc.SetObject(); + outDoc.AddMember("id", "LOAD", allocator); + outDoc.AddMember("data", khofmann::readFile(path.c_str(), allocator).Move(), allocator); + + rapidjson::StringBuffer strbuf; + rapidjson::Writer writer(strbuf); + outDoc.Accept(writer); + + fsCommBusCall(DATA, strbuf.GetString(), strbuf.GetSize(), FsCommBusBroadcast_JS); + } + } } } - -std::string readFile(const char* path) -{ - std::string _path; - _path += "\\work\\Files\\"; - _path += path; - - FILE* file = fopen(_path.c_str(), "r"); - if (file) { - fseek(file, 0, SEEK_END); - long fsize = ftell(file); - fseek(file, 0, SEEK_SET); /* same as rewind(f); */ - - char* string = (char*)calloc(sizeof(char), fsize + 1); - fread(string, fsize, 1, file); - fclose(file); - - return macaron::Base64::Encode(string, fsize); - } - - return ""; -} - -void log(FILE* file, const char* format, void* optionalElement) -{ - if (logFile != NULL) - { - fprintf(logFile, format, optionalElement); - fflush(logFile); - } - fprintf(file, format, optionalElement); -} \ No newline at end of file diff --git a/PackageSources/module/Module.h b/PackageSources/module/Module.h deleted file mode 100644 index 6f70f09..0000000 --- a/PackageSources/module/Module.h +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/PackageSources/module/PDF-Reader.vcxproj b/PackageSources/module/PDF-Reader.vcxproj index b158853..a854c79 100644 --- a/PackageSources/module/PDF-Reader.vcxproj +++ b/PackageSources/module/PDF-Reader.vcxproj @@ -45,7 +45,7 @@ - $(ProjectName) + $(ProjectName)-$(Configuration) true .wasm $(MSFS_IncludePath) @@ -55,7 +55,8 @@ false .wasm $(MSFS_IncludePath) - $(SolutionDir)$(Platform)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectName) @@ -78,7 +79,7 @@ Windows true true - $(OutDir)$(TargetName)-$(Configuration)$(TargetExt) + $(OutDir)$(TargetName)$(TargetExt) @@ -106,7 +107,7 @@ true false true - $(OutDir)$(TargetName)-$(Configuration)$(TargetExt) + $(OutDir)$(TargetName)$(TargetExt) @@ -115,11 +116,16 @@ + + + false + false + - + diff --git a/PackageSources/module/PDF-Reader.vcxproj.filters b/PackageSources/module/PDF-Reader.vcxproj.filters index 93c71f3..8b704bd 100644 --- a/PackageSources/module/PDF-Reader.vcxproj.filters +++ b/PackageSources/module/PDF-Reader.vcxproj.filters @@ -2,9 +2,11 @@ + + - - + + \ No newline at end of file diff --git a/PackageSources/module/Utils.hpp b/PackageSources/module/Utils.hpp new file mode 100644 index 0000000..a15b0a3 --- /dev/null +++ b/PackageSources/module/Utils.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +namespace khofmann +{ + static FILE* logFile; + + /// + /// Write to logfile and console + /// + /// Console stream + /// Format string wiht up to one specifier + /// Optional element specified by specifier + static void log(FILE* stream, const char* format, void* optionalElement = NULL) + { + if (logFile != NULL) + { + fprintf(logFile, format, optionalElement); + fflush(logFile); + } + fprintf(stream, format, optionalElement); + } +}