diff --git a/README.md b/README.md index 9c6dcf1..ddf2df0 100644 --- a/README.md +++ b/README.md @@ -60,20 +60,23 @@ Just push to the `main` branch. - [x] Dashboard with URLs and Notes - [x] News -- [ ] Files UI -- [ ] Notes UI -- [ ] Photos UI +- [x] Files UI - [ ] Desktop app for selective file sync (WebDav or potentially just `rclone` or `rsync`) - [ ] Mobile app for offline file sync - [ ] Add notes support for mobile app - [ ] Add photos/sync support for mobile client +- [ ] Notes UI +- [ ] Photos UI - [ ] Address `TODO:`s in code -- [ ] Basic Contacts UI via CardDav? -- [ ] Basic Calendar UI via CalDav? -- [ ] Basic Tasks UI via CalDav? ## Where's Contacts/Calendar (CardDav/CalDav)?! Wasn't this supposed to be a core Nextcloud replacement? [Check this tag/release for more info and the code where/when that was being done](https://github.com/bewcloud/bewcloud/releases/tag/v0.0.1-self-made-carddav-caldav). Contacts/CardDav worked and Calendar/CalDav mostly worked as well at that point. My focus is still to get me to replace Nextcloud for me and my family ASAP, but turns out it's not easy to do it all in a single, installable _thing_, so I'm focusing on the Files UI, sync, and sharing, since [Radicale](https://radicale.org/v3.html) solved my other issues better than my own solution (and it's already _very_ efficient). + +## How does file sharing work? + +[Check this PR for advanced sharing with internal and external users, with read and write access that was being done and almost working](https://github.com/bewcloud/bewcloud/pull/4). I ditched all that complexity for simply using [symlinks](https://en.wikipedia.org/wiki/Symbolic_link), as it served my use case (I have multiple data backups and trust the people I provide accounts to, with the symlinks). + +You can simply `ln -s /// ///` to create a shared directory between two users, and the same directory can have different names, now. diff --git a/components/files/SearchFiles.tsx b/components/files/SearchFiles.tsx index 78fa0b5..7e5511e 100644 --- a/components/files/SearchFiles.tsx +++ b/components/files/SearchFiles.tsx @@ -2,7 +2,7 @@ import { useSignal } from '@preact/signals'; import { useEffect } from 'preact/hooks'; import { Directory, DirectoryFile } from '/lib/types.ts'; -// import { RequestBody, ResponseBody } from '/routes/api/files/search.tsx'; +import { RequestBody, ResponseBody } from '/routes/api/files/search.tsx'; interface SearchFilesProps {} export default function SearchFiles({}: SearchFilesProps) { @@ -32,31 +32,30 @@ export default function SearchFiles({}: SearchFilesProps) { areResultsVisible.value = false; - searchTimeout.value = setTimeout(() => { + searchTimeout.value = setTimeout(async () => { isSearching.value = true; - // TODO: Build this - // try { - // const requestBody: RequestBody = { searchTerm }; - // const response = await fetch(`/api/files/search`, { - // method: 'POST', - // body: JSON.stringify(requestBody), - // }); - // const result = await response.json() as ResponseBody; + try { + const requestBody: RequestBody = { searchTerm }; + const response = await fetch(`/api/files/search`, { + method: 'POST', + body: JSON.stringify(requestBody), + }); + const result = await response.json() as ResponseBody; - // if (!result.success) { - // throw new Error('Failed to search files!'); - // } + if (!result.success) { + throw new Error('Failed to search files!'); + } - // matchingDirectories.value = result.matchingDirectories; - // matchingFiles.value = result.matchingFiles; + matchingDirectories.value = [...result.directories]; + matchingFiles.value = [...result.files]; - // if (matchingDirectories.value.length > 0 || matchingFiles.value.length > 0) { - // areResultsVisible.value = true; - // } - // } catch (error) { - // console.error(error); - // } + if (matchingDirectories.value.length > 0 || matchingFiles.value.length > 0) { + areResultsVisible.value = true; + } + } catch (error) { + console.error(error); + } isSearching.value = false; }, 500); @@ -104,9 +103,9 @@ export default function SearchFiles({}: SearchFilesProps) { {isSearching.value ? : null} {areResultsVisible.value ? ( -
+