mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
Added "view page source"
This commit is contained in:
@@ -14,11 +14,12 @@ import type {
|
||||
import { useProcesses } from "contexts/process";
|
||||
import { useSession } from "contexts/session";
|
||||
import { useWebGPUCheck } from "hooks/useWebGPUCheck";
|
||||
import { dirname, extname, join } from "path";
|
||||
import { basename, dirname, extname, join } from "path";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import {
|
||||
DESKTOP_PATH,
|
||||
FOLDER_ICON,
|
||||
INDEX_FILE,
|
||||
MENU_SEPERATOR,
|
||||
MOUNTABLE_EXTENSIONS,
|
||||
isFileSystemMappingSupported,
|
||||
@@ -69,6 +70,7 @@ const useFolderContextMenu = (
|
||||
): ContextMenuCapture => {
|
||||
const { contextMenu } = useMenu();
|
||||
const {
|
||||
exists,
|
||||
mapFs,
|
||||
pasteList = {},
|
||||
readFile,
|
||||
@@ -360,6 +362,21 @@ const useFolderContextMenu = (
|
||||
...(isDesktop
|
||||
? [
|
||||
MENU_SEPERATOR,
|
||||
{
|
||||
action: async () => {
|
||||
if (!(await exists(INDEX_FILE))) {
|
||||
const response = await fetch(document.location.href);
|
||||
const buffer = Buffer.from(await response.arrayBuffer());
|
||||
|
||||
await writeFile(INDEX_FILE, buffer);
|
||||
|
||||
updateFolder(dirname(INDEX_FILE), basename(INDEX_FILE));
|
||||
}
|
||||
|
||||
open("MonacoEditor", { url: INDEX_FILE });
|
||||
},
|
||||
label: "View page source",
|
||||
},
|
||||
{
|
||||
action: () => open("DevTools", { url: "dom" }),
|
||||
label: "Inspect",
|
||||
@@ -373,6 +390,7 @@ const useFolderContextMenu = (
|
||||
canCapture,
|
||||
captureScreen,
|
||||
contextMenu,
|
||||
exists,
|
||||
hasWebGPU,
|
||||
isAscending,
|
||||
isDesktop,
|
||||
@@ -387,6 +405,7 @@ const useFolderContextMenu = (
|
||||
updateSorting,
|
||||
url,
|
||||
wallpaperImage,
|
||||
writeFile,
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
@@ -58,6 +58,8 @@ export const HOME = "/Users/Public";
|
||||
|
||||
export const PICTURES_FOLDER = `${HOME}/Pictures`;
|
||||
|
||||
export const INDEX_FILE = "/index.html";
|
||||
|
||||
export const PROMPT_FILE = "prompts.json";
|
||||
|
||||
export const SLIDESHOW_FILE = "slideshow.json";
|
||||
|
||||
Reference in New Issue
Block a user