Creating new /api/archive/upload which accepts a file from the SingleFile browser extension and converts it to an Archive.

This commit is contained in:
Roland 2025-01-26 12:44:16 -07:00
parent 01338e4d89
commit 531ec3d65e
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
62 changed files with 1000 additions and 562 deletions

View file

@ -18,6 +18,8 @@ import {
getStatistics,
getStatus,
getVideo,
getVideoCaptions,
getVideoComments,
getVideosStatistics,
postDumpConfig,
postImportConfig,
@ -423,6 +425,42 @@ export const useVideo = (videoId) => {
return {videoFile, prevFile, nextFile, fetchVideo};
}
export const useVideoExtras = (videoId) => {
// Fetches extra data to display on a Video's page.
const [comments, setComments] = useState(null);
const [captions, setCaptions] = useState(null);
const fetchComments = async () => {
try {
const result = await getVideoComments(videoId);
setComments(result.comments);
} catch (e) {
console.error(e);
}
}
const fetchCaptions = async () => {
try {
const result = await getVideoCaptions(videoId);
setCaptions(result.captions);
} catch (e) {
console.error(e);
}
}
useEffect(() => {
if (videoId) {
fetchComments();
fetchCaptions();
} else {
setComments(null);
setCaptions(null);
}
}, [videoId]);
return {comments, captions}
}
export const useChannel = (channel_id) => {
const emptyChannel = {
name: '',
@ -500,6 +538,37 @@ export const useChannels = () => {
return {channels, fetchChannels}
}
export const useSearchRecentFiles = () => {
const [searchFiles, setSearchFiles] = useState(null);
const [loading, setLoading] = useState(false);
const localSearchFiles = async () => {
setLoading(true);
try {
let [file_groups, total] = await filesSearch(
null, 12, null, null, null, [], false,
null, null, null, false, 'viewed');
setSearchFiles(file_groups);
} catch (e) {
console.error(e);
toast({
type: 'error',
title: 'Unexpected server response',
description: 'Could not get recent files',
time: 5000,
});
} finally {
setLoading(false);
}
}
React.useEffect(() => {
localSearchFiles();
}, []);
return {searchFiles, loading, fetchFiles: localSearchFiles};
}
export const useSearchFiles = (defaultLimit = 48, emptySearch = false, model) => {
const {
activeTags, anyTag,