mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 03:56:38 +08:00
fix: hide adult libraries across dashboard views
This commit is contained in:
@@ -9,7 +9,12 @@ export interface MediaPage {
|
||||
}
|
||||
|
||||
export const libraryAPI = {
|
||||
list: () => api.get<Library[]>('/libraries').then((r) => r.data),
|
||||
list: (options?: { includeHidden?: boolean }) =>
|
||||
api
|
||||
.get<Library[]>('/libraries', {
|
||||
params: options?.includeHidden ? { include_hidden: 1 } : undefined,
|
||||
})
|
||||
.then((r) => r.data),
|
||||
|
||||
create: (name: string, path: string, type: string) =>
|
||||
api.post<Library>('/libraries', { name, path, type }).then((r) => r.data),
|
||||
|
||||
@@ -60,7 +60,7 @@ function LibraryPanel() {
|
||||
const [path, setPath] = useState('')
|
||||
const [type, setType] = useState('movie')
|
||||
|
||||
const refresh = () => libraryAPI.list().then(setLibs)
|
||||
const refresh = () => libraryAPI.list({ includeHidden: true }).then(setLibs)
|
||||
useEffect(() => {
|
||||
refresh().catch(() => undefined)
|
||||
}, [])
|
||||
|
||||
@@ -249,7 +249,7 @@ export function SettingsPage() {
|
||||
try {
|
||||
const [all, libs] = await Promise.all([
|
||||
adminAPI.listSettings(),
|
||||
libraryAPI.list().catch(() => [] as Library[]),
|
||||
libraryAPI.list({ includeHidden: true }).catch(() => [] as Library[]),
|
||||
])
|
||||
const idx: Record<string, string> = {}
|
||||
for (const s of all as Setting[]) {
|
||||
|
||||
Reference in New Issue
Block a user