hobgoblins
This commit is contained in:
parent
afb0e1aff3
commit
7ad4069b99
10 changed files with 24 additions and 24 deletions
|
@ -148,8 +148,8 @@ export default function Uploader({
|
|||
* Unlike {@link filesWithPaths} which are still user initiated,
|
||||
* {@link desktopFilePaths} can be set via programmatic action. For example,
|
||||
* if the user has setup a folder watch, and a new file is added on their
|
||||
* local filesystem in one of the watched folders, then the relevant path of
|
||||
* the new file would get added to {@link desktopFilePaths}.
|
||||
* local file system in one of the watched folders, then the relevant path
|
||||
* of the new file would get added to {@link desktopFilePaths}.
|
||||
*/
|
||||
const [desktopFilePaths, setDesktopFilePaths] = useState<string[]>([]);
|
||||
/**
|
||||
|
|
|
@ -46,13 +46,13 @@ const exportRecordFileName = "export_status.json";
|
|||
|
||||
/**
|
||||
* Name of the top level directory which we create underneath the selected
|
||||
* directory when the user starts an export to the filesystem.
|
||||
* directory when the user starts an export to the file system.
|
||||
*/
|
||||
const exportDirectoryName = "Ente Photos";
|
||||
|
||||
/**
|
||||
* Name of the directory in which we put our metadata when exporting to the
|
||||
* filesystem.
|
||||
* Name of the directory in which we put our metadata when exporting to the file
|
||||
* system.
|
||||
*/
|
||||
export const exportMetadataDirectoryName = "metadata";
|
||||
|
||||
|
@ -1378,7 +1378,7 @@ const isExportInProgress = (exportStage: ExportStage) =>
|
|||
*
|
||||
* Also move its associated metadata JSON to Trash.
|
||||
*
|
||||
* @param exportDir The root directory on the user's filesystem where we are
|
||||
* @param exportDir The root directory on the user's file system where we are
|
||||
* exporting to.
|
||||
* */
|
||||
const moveToTrash = async (
|
||||
|
|
|
@ -50,7 +50,7 @@ const _generateVideoThumbnail = async (
|
|||
* for the new files that the user is adding.
|
||||
*
|
||||
* @param dataOrPath The input video's data or the path to the video on the
|
||||
* user's local filesystem. See: [Note: Reading a UploadItem].
|
||||
* user's local file system. See: [Note: Reading a UploadItem].
|
||||
*
|
||||
* @returns JPEG data of the generated thumbnail.
|
||||
*
|
||||
|
|
|
@ -178,7 +178,7 @@ const percentageSizeDiff = (
|
|||
* object which we use to perform IPC with the Node.js side of our desktop app.
|
||||
*
|
||||
* @param dataOrPath Contents of an image or video file, or the path to the
|
||||
* image or video file on the user's local filesystem, whose thumbnail we want
|
||||
* image or video file on the user's local file system, whose thumbnail we want
|
||||
* to generate.
|
||||
*
|
||||
* @param fileTypeInfo The type information for {@link dataOrPath}.
|
||||
|
|
|
@ -91,7 +91,7 @@ const maxConcurrentUploads = 4;
|
|||
*
|
||||
* 2. A file drag-and-dropped or selected by the user when we are running in the
|
||||
* context of our desktop app. In such cases, we also have the absolute path
|
||||
* of the file in the user's local filesystem. this is the
|
||||
* of the file in the user's local file system. this is the
|
||||
* {@link FileAndPath} case.
|
||||
*
|
||||
* 3. A file path programmatically requested by the desktop app. For example, we
|
||||
|
|
|
@ -456,21 +456,21 @@ export const uploader = async (
|
|||
};
|
||||
|
||||
/**
|
||||
* Read the given file or path or zip entry into an in-memory representation.
|
||||
* Read the given file or path or zip item into an in-memory representation.
|
||||
*
|
||||
* [Note: Reading a UploadItem]
|
||||
*
|
||||
* The file can be either a web
|
||||
* [File](https://developer.mozilla.org/en-US/docs/Web/API/File), the absolute
|
||||
* path to a file on desk, a combination of these two, or a entry in a zip file
|
||||
* on the user's local filesystem.
|
||||
* on the user's local file system.
|
||||
*
|
||||
* tl;dr; There are four cases:
|
||||
*
|
||||
* 1. web / File
|
||||
* 2. desktop / File (+ path)
|
||||
* 3. desktop / path
|
||||
* 4. desktop / ZipEntry
|
||||
* 4. desktop / ZipItem
|
||||
*
|
||||
* For the when and why, read on.
|
||||
*
|
||||
|
@ -482,9 +482,9 @@ export const uploader = async (
|
|||
*
|
||||
* In the web context, we'll always get a File, since within the browser we
|
||||
* cannot programmatically construct paths to or arbitrarily access files on the
|
||||
* user's filesystem. Note that even if we were to have an absolute path at
|
||||
* user's file system. Note that even if we were to have an absolute path at
|
||||
* hand, we cannot programmatically create such File objects to arbitrary
|
||||
* absolute paths on user's local filesystem for security reasons.
|
||||
* absolute paths on user's local file system for security reasons.
|
||||
*
|
||||
* So in the web context, this will always be a File we get as a result of an
|
||||
* explicit user interaction (e.g. drag and drop).
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @file Utilities for native filesystem access.
|
||||
* @file Utilities for native file system access.
|
||||
*
|
||||
* While they don't have any direct dependencies to our desktop app, they were
|
||||
* written for use by the code that runs in our desktop app.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import type { Electron, ZipItem } from "@/next/types/ipc";
|
||||
|
||||
/**
|
||||
* Stream the given file or zip entry from the user's local filesystem.
|
||||
* Stream the given file or zip entry from the user's local file system.
|
||||
*
|
||||
* This only works when we're running in our desktop app since it uses the
|
||||
* "stream://" protocol handler exposed by our custom code in the Node.js layer.
|
||||
|
@ -18,9 +18,9 @@ import type { Electron, ZipItem } from "@/next/types/ipc";
|
|||
* To avoid accidentally invoking it in a non-desktop app context, it requires
|
||||
* the {@link Electron} object as a parameter (even though it doesn't use it).
|
||||
*
|
||||
* @param pathOrZipEntry Either the path on the file on the user's local
|
||||
* filesystem whose contents we want to stream. Or a tuple containing the path
|
||||
* to a zip file and the name of the entry within it.
|
||||
* @param pathOrZipEntry Either the path on the file on the user's local file
|
||||
* system whose contents we want to stream. Or a tuple containing the path to a
|
||||
* zip file and the name of the entry within it.
|
||||
*
|
||||
* @return A ({@link Response}, size, lastModifiedMs) triple.
|
||||
*
|
||||
|
|
|
@ -34,6 +34,6 @@ meant for larger, tabular data.
|
|||
OPFS is used for caching entire files when we're running under Electron (the Web
|
||||
Cache API is used in the browser).
|
||||
|
||||
As it name suggests, it is an entire filesystem, private for us ("origin"). In
|
||||
As it name suggests, it is an entire file system, private for us ("origin"). In
|
||||
is not undbounded though, and the storage is not guaranteed to be persistent (at
|
||||
least with the APIs we use), hence the cache designation.
|
||||
|
|
|
@ -123,17 +123,17 @@ export interface Electron {
|
|||
skipAppUpdate: (version: string) => void;
|
||||
|
||||
/**
|
||||
* A subset of filesystem access APIs.
|
||||
* A subset of file system access APIs.
|
||||
*
|
||||
* The renderer process, being a web process, does not have full access to
|
||||
* the local filesystem apart from files explicitly dragged and dropped (or
|
||||
* the local file system apart from files explicitly dragged and dropped (or
|
||||
* selected by the user in a native file open dialog).
|
||||
*
|
||||
* The main process, however, has full filesystem access (limited only be an
|
||||
* The main process, however, has full fil system access (limited only be an
|
||||
* OS level sandbox on the entire process).
|
||||
*
|
||||
* When we're running in the desktop app, we want to better utilize the
|
||||
* local filesystem access to provide more integrated features to the user -
|
||||
* local file system access to provide more integrated features to the user;
|
||||
* things that are not currently possible using web technologies. For
|
||||
* example, continuous exports to an arbitrary user chosen location on disk,
|
||||
* or watching some folders for changes and syncing them automatically.
|
||||
|
|
Loading…
Reference in a new issue