Browse Source

[release] v0.7.8

Yann Stepienik 2 years ago
parent
commit
aa569f8c90

+ 2 - 1
changelog.md

@@ -1,4 +1,5 @@
-## Version 0.7.1 -> 0.7.7
+## Version 0.7.1 -> 0.7.8
+ - Fix issue where multiple DBs get created at the setup
  - Add more special characters to be used for password validation
  - Add more special characters to be used for password validation
  - Add configurable default data path for binds
  - Add configurable default data path for binds
  - Remove Redirects from home page
  - Remove Redirects from home page

+ 7 - 56
client/src/api/index.jsx

@@ -53,62 +53,13 @@ let isOnline = () => {
 }
 }
 
 
 let newInstall = (req, onProgress) => {
 let newInstall = (req, onProgress) => {
-  if(req.step == '2') {
-    const requestOptions = {
-      method: 'POST',
-      headers: {
-        'Content-Type': 'application/json'
-      },
-      body: JSON.stringify(req)
-    };
-  
-    return fetch('/cosmos/api/newInstall', requestOptions)
-      .then(response => {
-        if (!response.ok) {
-          throw new Error(response.statusText);
-        }
-  
-        // The response body is a ReadableStream. This code reads the stream and passes chunks to the callback.
-        const reader = response.body.getReader();
-  
-        // Read the stream and pass chunks to the callback as they arrive
-        return new ReadableStream({
-          start(controller) {
-            function read() {
-              return reader.read().then(({ done, value }) => {
-                if (done) {
-                  controller.close();
-                  return;
-                }
-                // Decode the UTF-8 text
-                let text = new TextDecoder().decode(value);
-                // Split by lines in case there are multiple lines in one chunk
-                let lines = text.split('\n');
-                for (let line of lines) {
-                  if (line) {
-                    // Call the progress callback
-                    onProgress(line);
-                  }
-                }
-                controller.enqueue(value);
-                return read();
-              });
-            }
-            return read();
-          }
-        });
-      }).catch((e) => {
-        alert(e);
-      });
-  } else {
-    return wrap(fetch('/cosmos/api/newInstall', {
-      method: 'POST',
-      headers: {
-        'Content-Type': 'application/json'
-      },
-      body: JSON.stringify(req)
-    }))
-  }
+  return wrap(fetch('/cosmos/api/newInstall', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    body: JSON.stringify(req)
+  }))
 }
 }
 
 
 let checkHost = (host) => {
 let checkHost = (host) => {

+ 4 - 4
client/src/pages/home/index.jsx

@@ -73,7 +73,7 @@ export const TransparentHeader = () => {
 
 
 const HomePage = () => {
 const HomePage = () => {
     const { routeName } = useParams();
     const { routeName } = useParams();
-    const [serveApps, setServeApps] = useState([]);
+    const [servApps, setServApps] = useState([]);
     const [config, setConfig] = useState(null);
     const [config, setConfig] = useState(null);
     const [coStatus, setCoStatus] = useState(null);
     const [coStatus, setCoStatus] = useState(null);
     const [containers, setContainers] = useState(null);
     const [containers, setContainers] = useState(null);
@@ -105,7 +105,7 @@ const HomePage = () => {
 
 
     const refreshConfig = () => {
     const refreshConfig = () => {
         API.docker.list().then((res) => {
         API.docker.list().then((res) => {
-            setServeApps(res.data);
+            setServApps(res.data);
         });
         });
         API.config.get().then((res) => {
         API.config.get().then((res) => {
             setConfig(res.data);
             setConfig(res.data);
@@ -166,11 +166,11 @@ const HomePage = () => {
         </Stack>
         </Stack>
 
 
         <Grid2 container spacing={2} style={{ zIndex: 2 }}>
         <Grid2 container spacing={2} style={{ zIndex: 2 }}>
-            {config && serveApps && routes.map((route) => {
+            {config && servApps && routes.map((route) => {
                 let skip = route.Mode == "REDIRECT";
                 let skip = route.Mode == "REDIRECT";
                 if(route.Mode == "SERVAPP") {
                 if(route.Mode == "SERVAPP") {
                     const containerName = route.Target.split(':')[1].slice(2);
                     const containerName = route.Target.split(':')[1].slice(2);
-                    const container = serveApps.find((c) => c.Names.includes('/' + containerName));
+                    const container = servApps.find((c) => c.Names.includes('/' + containerName));
                     if(!container || container.State != "running") {
                     if(!container || container.State != "running") {
                         skip = true
                         skip = true
                     }
                     }

+ 4 - 4
client/src/pages/servapps/actionBar.jsx

@@ -8,7 +8,7 @@ const GetActions = ({
   Id,
   Id,
   state,
   state,
   image,
   image,
-  refreshServeApps,
+  refreshServApps,
   setIsUpdatingId,
   setIsUpdatingId,
   updateAvailable
   updateAvailable
 }) => {
 }) => {
@@ -30,10 +30,10 @@ const GetActions = ({
     setIsUpdatingId(Id, true);
     setIsUpdatingId(Id, true);
     return API.docker.manageContainer(Id, action).then((res) => {
     return API.docker.manageContainer(Id, action).then((res) => {
       setIsUpdating(false);
       setIsUpdating(false);
-      refreshServeApps();
+      refreshServApps();
     }).catch((err) => {
     }).catch((err) => {
       setIsUpdating(false);
       setIsUpdating(false);
-      refreshServeApps();
+      refreshServApps();
     });
     });
   };
   };
 
 
@@ -119,7 +119,7 @@ const GetActions = ({
       request={pullRequest}
       request={pullRequest}
       title="Updating ServeApp..."
       title="Updating ServeApp..."
       OnSuccess={() => {
       OnSuccess={() => {
-        refreshServeApps();
+        refreshServApps();
       }}
       }}
     />
     />
     
     

+ 1 - 1
client/src/pages/servapps/containers/overview.jsx

@@ -93,7 +93,7 @@ const ContainerOverview = ({ containerInfo, config, refresh, updatesAvailable, s
                 Id={containerInfo.Name}
                 Id={containerInfo.Name}
                 image={Image}
                 image={Image}
                 state={State.Status}
                 state={State.Status}
-                refreshServeApps={() => {
+                refreshServApps={() => {
                   refreshAll()
                   refreshAll()
                 }}
                 }}
                 setIsUpdatingId={() => {
                 setIsUpdatingId={() => {

+ 2 - 2
client/src/pages/servapps/index.jsx

@@ -9,7 +9,7 @@ import * as API from '../../api';
 import { CheckOutlined, ClockCircleOutlined, DashboardOutlined, DeleteOutlined, DownOutlined, LockOutlined, UpOutlined } from "@ant-design/icons";
 import { CheckOutlined, ClockCircleOutlined, DashboardOutlined, DeleteOutlined, DownOutlined, LockOutlined, UpOutlined } from "@ant-design/icons";
 import IsLoggedIn from '../../isLoggedIn';
 import IsLoggedIn from '../../isLoggedIn';
 import PrettyTabbedView from '../../components/tabbedView/tabbedView';
 import PrettyTabbedView from '../../components/tabbedView/tabbedView';
-import ServeApps from './servapps';
+import ServApps from './servapps';
 import VolumeManagementList from './volumes';
 import VolumeManagementList from './volumes';
 import NetworkManagementList from './networks';
 import NetworkManagementList from './networks';
 
 
@@ -20,7 +20,7 @@ const ServappsIndex = () => {
     <PrettyTabbedView path="/cosmos-ui/servapps/:tab" tabs={[
     <PrettyTabbedView path="/cosmos-ui/servapps/:tab" tabs={[
         {
         {
           title: 'Containers',
           title: 'Containers',
-          children: <ServeApps />,
+          children: <ServApps />,
           path: 'containers'
           path: 'containers'
         },
         },
         {
         {

+ 15 - 15
client/src/pages/servapps/servapps.jsx

@@ -35,8 +35,8 @@ const noOver = {
   height: "50px"
   height: "50px"
 }
 }
 
 
-const ServeApps = () => {
-  const [serveApps, setServeApps] = useState([]);
+const ServApps = () => {
+  const [servApps, setServApps] = useState([]);
   const [isUpdating, setIsUpdating] = useState({});
   const [isUpdating, setIsUpdating] = useState({});
   const [search, setSearch] = useState("");
   const [search, setSearch] = useState("");
   const [config, setConfig] = useState(null);
   const [config, setConfig] = useState(null);
@@ -47,9 +47,9 @@ const ServeApps = () => {
   const [openRestartModal, setOpenRestartModal] = useState(false);
   const [openRestartModal, setOpenRestartModal] = useState(false);
   const [selfName, setSelfName] = useState("");
   const [selfName, setSelfName] = useState("");
 
 
-  const refreshServeApps = () => {
+  const refreshServApps = () => {
     API.docker.list().then((res) => {
     API.docker.list().then((res) => {
-      setServeApps(res.data);
+      setServApps(res.data);
     });
     });
     API.config.get().then((res) => {
     API.config.get().then((res) => {
       setConfig(res.data);
       setConfig(res.data);
@@ -67,7 +67,7 @@ const ServeApps = () => {
   }
   }
 
 
   useEffect(() => {
   useEffect(() => {
-    refreshServeApps();
+    refreshServApps();
   }, []);
   }, []);
   
   
   function updateRoutes(newRoute) {
   function updateRoutes(newRoute) {
@@ -123,7 +123,7 @@ const ServeApps = () => {
     <ExposeModal
     <ExposeModal
       openModal={openModal} 
       openModal={openModal} 
       setOpenModal={setOpenModal}
       setOpenModal={setOpenModal}
-      container={serveApps.find((app) => {
+      container={servApps.find((app) => {
         return app.Names[0].replace('/', '') === (openModal && openModal.Names[0].replace('/', ''));
         return app.Names[0].replace('/', '') === (openModal && openModal.Names[0].replace('/', ''));
       })}
       })}
       config={config}
       config={config}
@@ -148,7 +148,7 @@ const ServeApps = () => {
           }}
           }}
         />
         />
         <ResponsiveButton variant="contained" startIcon={<ReloadOutlined />} onClick={() => {
         <ResponsiveButton variant="contained" startIcon={<ReloadOutlined />} onClick={() => {
-          refreshServeApps();
+          refreshServApps();
         }}>Refresh</ResponsiveButton>
         }}>Refresh</ResponsiveButton>
         <Link to="/cosmos-ui/servapps/new-service">
         <Link to="/cosmos-ui/servapps/new-service">
           <ResponsiveButton
           <ResponsiveButton
@@ -156,7 +156,7 @@ const ServeApps = () => {
             startIcon={<AppstoreAddOutlined />}
             startIcon={<AppstoreAddOutlined />}
             >Start ServApp</ResponsiveButton>
             >Start ServApp</ResponsiveButton>
         </Link>
         </Link>
-        <DockerComposeImport refresh={refreshServeApps}/>
+        <DockerComposeImport refresh={refreshServApps}/>
       </Stack>
       </Stack>
       
       
       <Grid2 container spacing={{xs: 1, sm: 1, md: 2 }}>
       <Grid2 container spacing={{xs: 1, sm: 1, md: 2 }}>
@@ -165,7 +165,7 @@ const ServeApps = () => {
             <Alert severity="info">Update are available for {Object.keys(updatesAvailable).join(', ')}</Alert>
             <Alert severity="info">Update are available for {Object.keys(updatesAvailable).join(', ')}</Alert>
           </Item>
           </Item>
         </Grid2>}
         </Grid2>}
-        {serveApps && serveApps.filter(app => search.length < 2 || app.Names[0].toLowerCase().includes(search.toLowerCase())).map((app) => {
+        {servApps && servApps.filter(app => search.length < 2 || app.Names[0].toLowerCase().includes(search.toLowerCase())).map((app) => {
           return <Grid2 style={gridAnim} xs={12} sm={6} md={6} lg={6} xl={4} key={app.Id} item>
           return <Grid2 style={gridAnim} xs={12} sm={6} md={6} lg={6} xl={4} key={app.Id} item>
             <Item>
             <Item>
             <Stack justifyContent='space-around' direction="column" spacing={2} padding={2} divider={<Divider orientation="horizontal" flexItem />}>
             <Stack justifyContent='space-around' direction="column" spacing={2} padding={2} divider={<Divider orientation="horizontal" flexItem />}>
@@ -202,7 +202,7 @@ const ServeApps = () => {
                     image={app.Image}
                     image={app.Image}
                     state={app.State}
                     state={app.State}
                     setIsUpdatingId={setIsUpdatingId}
                     setIsUpdatingId={setIsUpdatingId}
-                    refreshServeApps={refreshServeApps}
+                    refreshServApps={refreshServApps}
                     updateAvailable={updatesAvailable && updatesAvailable[app.Names[0]]}
                     updateAvailable={updatesAvailable && updatesAvailable[app.Names[0]]}
                   />
                   />
                 </Stack>
                 </Stack>
@@ -247,11 +247,11 @@ const ServeApps = () => {
                         API.docker.secure(name, e.target.checked).then(() => {
                         API.docker.secure(name, e.target.checked).then(() => {
                           setTimeout(() => {
                           setTimeout(() => {
                             setIsUpdatingId(name, false);
                             setIsUpdatingId(name, false);
-                            refreshServeApps();
+                            refreshServApps();
                           }, 3000);
                           }, 3000);
                         }).catch(() => {
                         }).catch(() => {
                           setIsUpdatingId(name, false);
                           setIsUpdatingId(name, false);
-                          refreshServeApps();
+                          refreshServApps();
                         })
                         })
                       }}
                       }}
                     /> Force Secure Network <ContainerNetworkWarning container={app} />
                     /> Force Secure Network <ContainerNetworkWarning container={app} />
@@ -267,11 +267,11 @@ const ServeApps = () => {
                         API.docker.autoUpdate(name, e.target.checked).then(() => {
                         API.docker.autoUpdate(name, e.target.checked).then(() => {
                           setTimeout(() => {
                           setTimeout(() => {
                             setIsUpdatingId(name, false);
                             setIsUpdatingId(name, false);
-                            refreshServeApps();
+                            refreshServApps();
                           }, 3000);
                           }, 3000);
                         }).catch(() => {
                         }).catch(() => {
                           setIsUpdatingId(name, false);
                           setIsUpdatingId(name, false);
-                          refreshServeApps();
+                          refreshServApps();
                         })
                         })
                       }}
                       }}
                     /> Auto Update Container
                     /> Auto Update Container
@@ -321,4 +321,4 @@ const ServeApps = () => {
   </div>
   </div>
 }
 }
 
 
-export default ServeApps;
+export default ServApps;

+ 2 - 2
client/src/routes/MainRoutes.jsx

@@ -6,7 +6,7 @@ import MainLayout from '../layout/MainLayout';
 import UserManagement from '../pages/config/users/usermanagement';
 import UserManagement from '../pages/config/users/usermanagement';
 import ConfigManagement from '../pages/config/users/configman';
 import ConfigManagement from '../pages/config/users/configman';
 import ProxyManagement from '../pages/config/users/proxyman';
 import ProxyManagement from '../pages/config/users/proxyman';
-import ServeAppsIndex from '../pages/servapps/';
+import ServAppsIndex from '../pages/servapps/';
 import { Navigate } from 'react-router';
 import { Navigate } from 'react-router';
 import RouteConfigPage from '../pages/config/routeConfigPage';
 import RouteConfigPage from '../pages/config/routeConfigPage';
 import logo from '../assets/images/icons/cosmos.png';
 import logo from '../assets/images/icons/cosmos.png';
@@ -57,7 +57,7 @@ const MainRoutes = {
         },
         },
         {
         {
             path: '/cosmos-ui/servapps',
             path: '/cosmos-ui/servapps',
-            element: <ServeAppsIndex />
+            element: <ServAppsIndex />
         },
         },
         {
         {
             path: '/cosmos-ui/config-users',
             path: '/cosmos-ui/config-users',

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "cosmos-server",
   "name": "cosmos-server",
-  "version": "0.7.7",
+  "version": "0.7.8",
   "description": "",
   "description": "",
   "main": "test-server.js",
   "main": "test-server.js",
   "bugs": {
   "bugs": {

+ 0 - 1
src/newInstall.go

@@ -121,7 +121,6 @@ func NewInstallRoute(w http.ResponseWriter, req *http.Request) {
 			utils.SaveConfigTofile(newConfig)
 			utils.SaveConfigTofile(newConfig)
 			utils.LoadBaseMainConfig(newConfig)
 			utils.LoadBaseMainConfig(newConfig)
 		} else if (request.Step == "4") {
 		} else if (request.Step == "4") {
-			
 			adminObj := AdminJSON{
 			adminObj := AdminJSON{
 				Nickname: request.Nickname,
 				Nickname: request.Nickname,
 				Password: request.Password,
 				Password: request.Password,