From 9dc16550fa849d6e820b56fb0934c24628ac1d47 Mon Sep 17 00:00:00 2001 From: frikky Date: Tue, 9 Aug 2022 00:52:58 +0200 Subject: [PATCH] Fixed some minor SSR issues in search grids --- .github/push_nightly.sh | 8 +- backend/app_sdk/app_base.py | 8 +- docker-compose.yml | 76 +++++------ frontend/src/components/AppGrid.jsx | 1 + frontend/src/views/Docs.jsx | 199 ++++++++++++++-------------- frontend/src/views/Search.jsx | 40 +++--- 6 files changed, 173 insertions(+), 159 deletions(-) diff --git a/.github/push_nightly.sh b/.github/push_nightly.sh index 9c55b01c..98dba76a 100644 --- a/.github/push_nightly.sh +++ b/.github/push_nightly.sh @@ -4,11 +4,11 @@ docker pull frikky/shuffle-backend:nightly docker pull frikky/shuffle-frontend:nightly -docker tag frikky/shuffle-backend:nightly ghcr.io/frikky/shuffle-backend:latest -docker tag frikky/shuffle-frontend:nightly ghcr.io/frikky/shuffle-frontend:latest +docker tag frikky/shuffle-backend:nightly ghcr.io/frikky/shuffle-backend:nightly +docker tag frikky/shuffle-frontend:nightly ghcr.io/frikky/shuffle-frontend:nightly docker push ghcr.io/frikky/shuffle-backend:nightly docker push ghcr.io/frikky/shuffle-frontend:nightly -docker push ghcr.io/frikky/shuffle-backend:latest -docker push ghcr.io/frikky/shuffle-frontend:latest +#docker push ghcr.io/frikky/shuffle-backend:latest +#docker push ghcr.io/frikky/shuffle-frontend:latest diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index b7742f12..6d1833b7 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1046,8 +1046,6 @@ class AppBase: # "ids": ret1.json(), #} - def get_file_namespace_ids(self, namespace): - return get_file_category_ids(self, namespace) # Downloads all files from a namespace # Currently only working on local version of Shuffle @@ -1081,6 +1079,12 @@ class AppBase: return myzipfile + def get_file_namespace_ids(self, namespace): + return self.get_file_category_ids(self, namespace) + + def get_file_category(self, category): + return self.get_file_namespace(self, category) + # Things to consider for files: # - How can you download / stream a file? # - Can you decide if you want a stream or the files directly? diff --git a/docker-compose.yml b/docker-compose.yml index 6cde7541..7c619ae9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,43 +1,43 @@ version: '3' services: - frontend: - #build: ./frontend - image: ghcr.io/frikky/shuffle-frontend:nightly - container_name: shuffle-frontend - hostname: shuffle-frontend - ports: - - "${FRONTEND_PORT}:80" - - "${FRONTEND_PORT_HTTPS}:443" - networks: - - shuffle - environment: - - BACKEND_HOSTNAME=${BACKEND_HOSTNAME} - restart: unless-stopped - depends_on: - - backend - backend: - #build: ./backend - image: ghcr.io/frikky/shuffle-backend:nightly - container_name: shuffle-backend - hostname: ${BACKEND_HOSTNAME} - # Here for debugging: - ports: - - "${BACKEND_PORT}:5001" - networks: - - shuffle - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ${SHUFFLE_APP_HOTLOAD_LOCATION}:/shuffle-apps:z - - ${SHUFFLE_FILE_LOCATION}:/shuffle-files:z - #- ${SHUFFLE_OPENSEARCH_CERTIFICATE_FILE}:/shuffle-files/es_certificate - env_file: .env - environment: - #- DOCKER_HOST=tcp://docker-socket-proxy:2375 - - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps - - SHUFFLE_FILE_LOCATION=/shuffle-files - restart: unless-stopped - #depends_on: - #- opensearch #Not necessary because dependancy is handled within the backend itself instead + #frontend: + # #build: ./frontend + # image: ghcr.io/frikky/shuffle-frontend:nightly + # container_name: shuffle-frontend + # hostname: shuffle-frontend + # ports: + # - "${FRONTEND_PORT}:80" + # - "${FRONTEND_PORT_HTTPS}:443" + # networks: + # - shuffle + # environment: + # - BACKEND_HOSTNAME=${BACKEND_HOSTNAME} + # restart: unless-stopped + # depends_on: + # - backend + #backend: + # #build: ./backend + # image: ghcr.io/frikky/shuffle-backend:nightly + # container_name: shuffle-backend + # hostname: ${BACKEND_HOSTNAME} + # # Here for debugging: + # ports: + # - "${BACKEND_PORT}:5001" + # networks: + # - shuffle + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # - ${SHUFFLE_APP_HOTLOAD_LOCATION}:/shuffle-apps:z + # - ${SHUFFLE_FILE_LOCATION}:/shuffle-files:z + # #- ${SHUFFLE_OPENSEARCH_CERTIFICATE_FILE}:/shuffle-files/es_certificate + # env_file: .env + # environment: + # #- DOCKER_HOST=tcp://docker-socket-proxy:2375 + # - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps + # - SHUFFLE_FILE_LOCATION=/shuffle-files + # restart: unless-stopped + # #depends_on: + # #- opensearch #Not necessary because dependancy is handled within the backend itself instead #- database orborus: image: ghcr.io/frikky/shuffle-orborus:nightly diff --git a/frontend/src/components/AppGrid.jsx b/frontend/src/components/AppGrid.jsx index 2878f570..54760432 100644 --- a/frontend/src/components/AppGrid.jsx +++ b/frontend/src/components/AppGrid.jsx @@ -27,6 +27,7 @@ const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e52 //const searchClient = algoliasearch("L55H18ZINA", "a19be455e7e75ee8f20a93d26b9fc6d6") const AppGrid = props => { const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, userdata } = props + const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io"; diff --git a/frontend/src/views/Docs.jsx b/frontend/src/views/Docs.jsx index 74c882fc..376ac40b 100644 --- a/frontend/src/views/Docs.jsx +++ b/frontend/src/views/Docs.jsx @@ -112,8 +112,9 @@ const Docs = (defaultprops) => { const SideBar = { minWidth: 250, maxWidth: 300, - position: "sticky", - top: 100, + position: "absolute", + top: 15, + left: 0, maxHeight: "83vh", overflowX: "hidden", overflowY: "auto", @@ -592,105 +593,107 @@ const Docs = (defaultprops) => {
- - Documentation - -
- link="mailto:support@shuffler.io" /> - link="https://discord.gg/B2CBzUm" /> -
- -
- Tutorial - - Dive in. Hands-on is the best approach to see how Shuffle can transform your security operations. Our set of tutorials and videos teach you how to build your skills. Check out the getting started section to give it a go! + + Documentation +
+ link="mailto:support@shuffler.io" /> + link="https://discord.gg/B2CBzUm" /> +
- Why Shuffle? - - Security first. We incentivize trying before buying, and give you the full set of tools you need to automate your operations. What's more is we also help you find usecases that fit your your unique needs. Accessibility is key, and we intend to help every SOC globally use and share their usecases. - +
+ Tutorial + + Dive in. Hands-on is the best approach to see how Shuffle can transform your security operations. Our set of tutorials and videos teach you how to build your skills. Check out the getting started section to give it a go! + - Get help - - Our promise is to make it easier and easier to automate your operations. In some cases however, it may be good with a helping hand. That's where Shuffle's consultancy and support services come in handy. We help you build and automate your operational processes to a level you haven't seen before with the help of our usecases. - + Why Shuffle? + + Security first. We incentivize trying before buying, and give you the full set of tools you need to automate your operations. What's more is we also help you find usecases that fit your your unique needs. Accessibility is key, and we intend to help every SOC globally use and share their usecases. + - APIs - - Learn. We're all about learning, and are continuously creating documentation and video tutorials to better understand how to get started. APIs are an extremely important part of how the internet works today, and our goal is helping every security professional learn about them. - + Get help + + Our promise is to make it easier and easier to automate your operations. In some cases however, it may be good with a helping hand. That's where Shuffle's consultancy and support services come in handy. We help you build and automate your operational processes to a level you haven't seen before with the help of our usecases. + - Workflow building - - Build. Creating workflows has never been easier. Jump into things with our getting Started section and build to your hearts content. Workflows make it all come together, with an easy to use area. - + APIs + + Learn. We're all about learning, and are continuously creating documentation and video tutorials to better understand how to get started. APIs are an extremely important part of how the internet works today, and our goal is helping every security professional learn about them. + - Managing Shuffle - - Organize. Whether an organization of 1000 or 1, management tools are necessary. In Shuffle we offer full user management, MFA and single-signon options, multi-tenancy and a lot more - for free! - -
+ Workflow building + + Build. Creating workflows has never been easier. Jump into things with our getting Started section and build to your hearts content. Workflows make it all come together, with an easy to use area. + - {/* - - {list.map((data, index) => { - const item = data.name; - if (item === undefined) { - return null; - } + Managing Shuffle + + Organize. Whether an organization of 1000 or 1, management tools are necessary. In Shuffle we offer full user management, MFA and single-signon options, multi-tenancy and a lot more - for free! + +
- const path = "/docs/" + item; - const newname = - item.charAt(0).toUpperCase() + - item.substring(1).split("_").join(" ").split("-").join(" "); + {/* + + {list.map((data, index) => { + const item = data.name; + if (item === undefined) { + return null; + } - const itemMatching = props.match.params.key === undefined ? false : - props.match.params.key.toLowerCase() === item.toLowerCase(); + const path = "/docs/" + item; + const newname = + item.charAt(0).toUpperCase() + + item.substring(1).split("_").join(" ").split("-").join(" "); - return ( - - - - ) - })} - - */} + const itemMatching = props.match.params.key === undefined ? false : + props.match.params.key.toLowerCase() === item.toLowerCase(); - {/* - + + + ) + })} + + */} + + {/* + { - console.log("Change: ", event.target.value) - }} - /> - */} + }} + InputProps={{ + style:{ + color: "white", + height: 50, + }, + }} + placeholder={"Search Knowledgebase"} + color="primary" + fullWidth={true} + type="firstname" + id={"Searchfield"} + margin="normal" + variant="outlined" + onChange={(event) => { + console.log("Change: ", event.target.value) + }} + /> + */}
const postDataBrowser = @@ -766,20 +769,22 @@ const Docs = (defaultprops) => { {props.match.params.key === undefined ? mainpageInfo : -
- -
+
+
+ +
+
} ); diff --git a/frontend/src/views/Search.jsx b/frontend/src/views/Search.jsx index f8955c7f..9fedc697 100644 --- a/frontend/src/views/Search.jsx +++ b/frontend/src/views/Search.jsx @@ -38,6 +38,28 @@ const Search = (props) => { const [curTab, setCurTab] = useState(0); const iconStyle = { marginRight: 10 }; + useEffect(() => { + if (serverside !== true && window.location.search !== undefined && window.location.search !== null) { + const urlSearchParams = new URLSearchParams(window.location.search) + const params = Object.fromEntries(urlSearchParams.entries()) + const foundTab = params["tab"] + if (foundTab !== null && foundTab !== undefined) { + for (var key in Object.keys(views)) { + const value = views[key] + console.log(key, value) + if (value === foundTab) { + setConfig("", key) + break + } + } + } + } + }, []) + + if (serverside === true) { + return null + } + const boxStyle = { color: "white", flex: "1", @@ -91,24 +113,6 @@ const Search = (props) => { } } - useEffect(() => { - if (serverside !== true && window.location.search !== undefined && window.location.search !== null) { - const urlSearchParams = new URLSearchParams(window.location.search) - const params = Object.fromEntries(urlSearchParams.entries()) - const foundTab = params["tab"] - if (foundTab !== null && foundTab !== undefined) { - for (var key in Object.keys(views)) { - const value = views[key] - console.log(key, value) - if (value === foundTab) { - setConfig("", key) - break - } - } - } - } - }, []) - if (isLoaded === false) { return null }