[release] v0.18.0-unstable6

This commit is contained in:
Yann Stepienik
2025-02-05 23:31:30 +00:00
parent 5110d7ef5a
commit ce0bd48420
8 changed files with 53 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
- Localizations improvements (Thanks @madejackson)
- Improved local IP detection (Thanks @r41d)
- Updated LEGO to 4.21.0
- Fixed file picker prefix issue in docker container
- Fix RClone not starting
## Version 0.17.7

View File

@@ -26,12 +26,11 @@ function listSnapshots(name: string) {
}
function listFolders(name: string, snapshot: string, path?: string) {
return wrap(fetch(`/cosmos/api/backups/${name}/folders?path=${path || ''}`, {
return wrap(fetch(`/cosmos/api/backups/${name}/${snapshot}/folders?path=${path || '/'}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ snapshot })
}))
}

View File

@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { Box, Tab, Tabs, Typography, MenuItem, Select, useMediaQuery, CircularProgress } from '@mui/material';
import { styled } from '@mui/system';
import { createPartiallyEmittedExpression } from 'typescript';
const StyledTabs = styled(Tabs)`
border-right: 1px solid ${({ theme }) => theme.palette.divider};
@@ -37,13 +38,35 @@ const a11yProps = (index) => {
};
};
const PrettyTabbedView = ({ tabs, isLoading, currentTab, setCurrentTab }) => {
const PrettyTabbedView = ({ rootURL, tabs, isLoading, currentTab, setCurrentTab }) => {
const [value, setValue] = useState(0);
const isMobile = useMediaQuery((theme) => theme.breakpoints.down('md'));
const [initialMount, setInitialMount] = useState(true);
if((currentTab != null && typeof currentTab === 'number') && value !== currentTab)
setValue(currentTab);
useEffect(() => {
if (!rootURL) return;
if (initialMount) {
// On initial mount, check if URL matches any tab
const currentPath = decodeURIComponent(window.location.pathname).replace(/\/$/, '');
const matchingTabIndex = tabs.findIndex(tab => {
return tab.url != '/' && currentPath.startsWith(`${rootURL}${tab.url}`);
});
if (matchingTabIndex !== -1) {
setValue(matchingTabIndex);
}
setInitialMount(false);
} else {
// After initial mount, update URL when value changes
window.history.pushState({}, '', `${rootURL}${tabs[value].url}`);
}
}, [rootURL, tabs, value]);
const handleChange = (event, newValue) => {
setValue(newValue);
setCurrentTab && setCurrentTab(newValue);

View File

@@ -28,6 +28,12 @@ const SudoModal = () => {
try {
setLoading(true);
await API.auth.sudo(values);
// if on /cosmos-ui/config-general refresh page because we need new infos
if (window.location.pathname.includes('/cosmos-ui/config-general')) {
window.location.reload();
}
setOpen(false);
resetForm();
} catch (error) {

View File

@@ -19,6 +19,7 @@ import { CronManager } from '../pages/cron/jobsManage';
import PrivateRoute from '../PrivateRoute';
import TrustPage from '../pages/config/trust';
import { Backups } from '../pages/backups';
import SingleBackupIndex from '../pages/backups/single-backup-index';
// ==============================|| MAIN ROUTING ||============================== //
@@ -48,6 +49,14 @@ const MainRoutes = {
path: '/cosmos-ui/backups',
element: <Backups />
},
{
path: '/cosmos-ui/backups/:backupName/',
element: <SingleBackupIndex />
},
{
path: '/cosmos-ui/backups/:backupName/:subpath',
element: <SingleBackupIndex />
},
{
path: '/cosmos-ui/storage',
element: <StorageIndex />

View File

@@ -8,9 +8,8 @@
<a href="https://github.com/Fortcraft"><img src="https://avatars.githubusercontent.com/Fortcraft" style="border-radius:48px" width="48" height="48" alt="null" title="null" /></a>
<a href="https://github.com/phobes"><img src="https://avatars.githubusercontent.com/phobes" style="border-radius:48px" width="48" height="48" alt="Phobes" title="Phobes" /></a>
<a href="https://github.com/AstroMando"><img src="https://avatars.githubusercontent.com/AstroMando" style="border-radius:48px" width="48" height="48" alt="null" title="null" /></a>
<a href="https://github.com/riczescaran"><img src="https://avatars.githubusercontent.com/riczescaran" style="border-radius:48px" width="48" height="48" alt="Ricardo Escaran" title="Ricardo Escaran" /></a>
<a href="https://github.com/AKAHackoon"><img src="https://avatars.githubusercontent.com/AKAHackoon" style="border-radius:48px" width="48" height="48" alt="null" title="null" /></a>
<a href="https://github.com/jwr1"><img src="https://avatars.githubusercontent.com/jwr1" style="border-radius:48px" width="48" height="48" alt="null" title="null" /></a>
<a href="https://github.com/jwr1"><img src="https://avatars.githubusercontent.com/jwr1" style="border-radius:48px" width="48" height="48" alt="jwr1" title="jwr1" /></a>
<a href="https://github.com/jkri-ch"><img src="https://avatars.githubusercontent.com/jkri-ch" style="border-radius:48px" width="48" height="48" alt="John Richardson" title="John Richardson" /></a>
</p><!-- /sponsors -->

View File

@@ -560,7 +560,7 @@ func InitServer() *mux.Router {
srapiAdmin.HandleFunc("/api/list-dir", storage.ListDirectoryRoute)
srapiAdmin.HandleFunc("/api/backups/{name}/snapshots", backups.ListSnapshotsRoute)
srapiAdmin.HandleFunc("/api/backups/{name}/folders", backups.ListFoldersRoute)
srapiAdmin.HandleFunc("/api/backups/{name}/{snapshot}/folders", backups.ListFoldersRoute)
srapiAdmin.HandleFunc("/api/backups/{name}/restore", backups.RestoreBackupRoute)
srapiAdmin.HandleFunc("/api/backups", backups.AddBackupRoute)
srapiAdmin.HandleFunc("/api/backups/{name}", backups.RemoveBackupRoute)

View File

@@ -6,6 +6,7 @@ import (
"path/filepath"
"io/ioutil"
"syscall"
"strings"
"github.com/azukaar/cosmos-server/src/utils"
)
@@ -132,6 +133,12 @@ func ListDirectory(path string) ([]DirectoryListing, error) {
}
}
fullPath := filepath.Join(path, file.Name())
if utils.IsInsideContainer {
fullPath = strings.TrimPrefix(fullPath, "/mnt/host")
}
listing := DirectoryListing{
Name: file.Name(),
Ext: filepath.Ext(file.Name()),
@@ -141,7 +148,7 @@ func ListDirectory(path string) ([]DirectoryListing, error) {
Created: file.ModTime().Unix(),
UID: uid,
GID: gid,
FullPath: filepath.Join(path, file.Name()),
FullPath: fullPath,
}
listings = append(listings, listing)
}