Fix: sidebar navigation from settings, missing thumbnails in all documents, and hiding upload buttons in office modes
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m16s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m16s
This commit is contained in:
parent
f9b0f515c5
commit
ffa2954cd9
2 changed files with 30 additions and 15 deletions
|
|
@ -306,10 +306,23 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
ModTime string `json:"mod_time"`
|
ModTime string `json:"mod_time"`
|
||||||
|
Checksum string `json:"checksum,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var results []OfficeFile
|
var results []OfficeFile
|
||||||
|
|
||||||
|
checksums := make(map[string]string)
|
||||||
|
rows, err := h.DB.Query("SELECT path, checksum FROM files WHERE checksum != '' AND is_trashed = 0")
|
||||||
|
if err == nil {
|
||||||
|
defer rows.Close()
|
||||||
|
for rows.Next() {
|
||||||
|
var p, c string
|
||||||
|
if rows.Scan(&p, &c) == nil {
|
||||||
|
checksums[p] = c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
filepath.Walk(h.Config.StorageDir, func(path string, info os.FileInfo, err error) error {
|
filepath.Walk(h.Config.StorageDir, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -325,11 +338,13 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
|
||||||
|
|
||||||
if strings.HasSuffix(strings.ToLower(info.Name()), ext) {
|
if strings.HasSuffix(strings.ToLower(info.Name()), ext) {
|
||||||
relPath, _ := filepath.Rel(h.Config.StorageDir, path)
|
relPath, _ := filepath.Rel(h.Config.StorageDir, path)
|
||||||
|
relPathSlash := filepath.ToSlash(relPath)
|
||||||
results = append(results, OfficeFile{
|
results = append(results, OfficeFile{
|
||||||
Name: info.Name(),
|
Name: info.Name(),
|
||||||
Path: filepath.ToSlash(relPath),
|
Path: relPathSlash,
|
||||||
Size: info.Size(),
|
Size: info.Size(),
|
||||||
ModTime: info.ModTime().UTC().Format("2006-01-02T15:04:05Z"),
|
ModTime: info.ModTime().UTC().Format("2006-01-02T15:04:05Z"),
|
||||||
|
Checksum: checksums[relPathSlash],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -1403,7 +1403,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-1 px-3 py-4 border-b" style={{ borderColor: 'var(--color-border-subtle)' }}>
|
<div className="flex flex-col gap-1 px-3 py-4 border-b" style={{ borderColor: 'var(--color-border-subtle)' }}>
|
||||||
<button
|
<button
|
||||||
onClick={() => { setAppMode('drive'); setEditingFile(null); }}
|
onClick={() => { setAppMode('drive'); setEditingFile(null); setActiveSection('files'); }}
|
||||||
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: appMode === 'drive' ? 'var(--color-accent-subtle)' : 'transparent',
|
backgroundColor: appMode === 'drive' ? 'var(--color-accent-subtle)' : 'transparent',
|
||||||
|
|
@ -1417,7 +1417,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => { setAppMode('docs'); setEditingFile(null); }}
|
onClick={() => { setAppMode('docs'); setEditingFile(null); setActiveSection('files'); }}
|
||||||
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: appMode === 'docs' ? 'var(--color-accent-subtle)' : 'transparent',
|
backgroundColor: appMode === 'docs' ? 'var(--color-accent-subtle)' : 'transparent',
|
||||||
|
|
@ -1431,7 +1431,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => { setAppMode('slides'); setEditingFile(null); }}
|
onClick={() => { setAppMode('slides'); setEditingFile(null); setActiveSection('files'); }}
|
||||||
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: appMode === 'slides' ? 'var(--color-accent-subtle)' : 'transparent',
|
backgroundColor: appMode === 'slides' ? 'var(--color-accent-subtle)' : 'transparent',
|
||||||
|
|
@ -1445,7 +1445,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => { setAppMode('sheets'); setEditingFile(null); }}
|
onClick={() => { setAppMode('sheets'); setEditingFile(null); setActiveSection('files'); }}
|
||||||
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: appMode === 'sheets' ? 'var(--color-accent-subtle)' : 'transparent',
|
backgroundColor: appMode === 'sheets' ? 'var(--color-accent-subtle)' : 'transparent',
|
||||||
|
|
@ -1766,7 +1766,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
</div>
|
</div>
|
||||||
{activeSection === 'files' && (
|
{activeSection === 'files' && appMode === 'drive' && (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<button
|
<button
|
||||||
onClick={() => setMobileFabOpen(!mobileFabOpen)}
|
onClick={() => setMobileFabOpen(!mobileFabOpen)}
|
||||||
|
|
@ -1872,7 +1872,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{activeSection === 'files' && (
|
{activeSection === 'files' && appMode === 'drive' && (
|
||||||
<button
|
<button
|
||||||
id="new-folder-button"
|
id="new-folder-button"
|
||||||
onClick={() => setShowNewFolder(true)}
|
onClick={() => setShowNewFolder(true)}
|
||||||
|
|
@ -1884,7 +1884,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{activeSection === 'files' && (
|
{activeSection === 'files' && appMode === 'drive' && (
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
id="upload-button"
|
id="upload-button"
|
||||||
|
|
|
||||||
Reference in a new issue