mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
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:
parent
01338e4d89
commit
531ec3d65e
62 changed files with 1000 additions and 562 deletions
|
|
@ -4,7 +4,7 @@ import {Grid, Header as SHeader, Image,} from "semantic-ui-react";
|
|||
import {TagsSelector} from "../Tags";
|
||||
import {Media} from "../contexts/contexts";
|
||||
import {encodeMediaPath} from "./Common";
|
||||
import {fetchFile, getFile, tagFileGroup, untagFileGroup} from "../api";
|
||||
import {getFile, tagFileGroup, untagFileGroup} from "../api";
|
||||
import {StlViewer} from "react-stl-viewer";
|
||||
import {Button, Modal, ModalActions, ModalContent, ModalHeader} from "./Theme";
|
||||
import {toast} from "react-semantic-toasts-2";
|
||||
|
|
@ -200,7 +200,7 @@ export function FilePreviewProvider({children}) {
|
|||
// Get the file again with its Tags.
|
||||
const {path, primary_path} = previewFile;
|
||||
try {
|
||||
const file = await fetchFile(primary_path ?? path);
|
||||
const file = await getFile(primary_path ?? path);
|
||||
setPreviewFile(file);
|
||||
} finally {
|
||||
await handleCallbacks();
|
||||
|
|
@ -310,6 +310,7 @@ export function FilePreviewProvider({children}) {
|
|||
const lowerPath = path.toLowerCase();
|
||||
const url = getMediaPathURL(previewFile);
|
||||
const downloadURL = getDownloadPathURL(previewFile);
|
||||
|
||||
if (mimetype.startsWith('text/') && size > MAXIMUM_TEXT_SIZE) {
|
||||
// Large text files should be downloaded.
|
||||
window.open(downloadURL);
|
||||
|
|
@ -336,6 +337,14 @@ export function FilePreviewProvider({children}) {
|
|||
// No special handler for this file type, just open it.
|
||||
setModalContent(getGenericPreviewModal(previewFile), url, downloadURL, path, taggable);
|
||||
}
|
||||
|
||||
// Fetch the file so `FileGroup.viewed` is set.
|
||||
try {
|
||||
getFile(path);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error('Failed to get file to set FileGroup.viewed');
|
||||
}
|
||||
}
|
||||
}, [previewFile]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue