fix: file paths
This commit is contained in:
parent
d2b8484697
commit
0e04cf827d
@ -7,7 +7,8 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview",
|
||||||
|
"deploy": "yarn build && yarn dlx wrangler pages deploy dist"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/hashes": "^1.3.2",
|
"@noble/hashes": "^1.3.2",
|
||||||
|
@ -8,6 +8,7 @@ import * as bencode from "../bencode";
|
|||||||
import { sha1 } from "@noble/hashes/sha1";
|
import { sha1 } from "@noble/hashes/sha1";
|
||||||
import { bytesToHex } from "@noble/hashes/utils";
|
import { bytesToHex } from "@noble/hashes/utils";
|
||||||
import { SnortContext } from "@snort/system-react";
|
import { SnortContext } from "@snort/system-react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
async function openFile(): Promise<File | undefined> {
|
async function openFile(): Promise<File | undefined> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -45,6 +46,7 @@ async function openFile(): Promise<File | undefined> {
|
|||||||
export function NewPage() {
|
export function NewPage() {
|
||||||
const login = useLogin();
|
const login = useLogin();
|
||||||
const system = useContext(SnortContext);
|
const system = useContext(SnortContext);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [obj, setObj] = useState({
|
const [obj, setObj] = useState({
|
||||||
name: "",
|
name: "",
|
||||||
@ -78,7 +80,7 @@ export function NewPage() {
|
|||||||
tags: [],
|
tags: [],
|
||||||
files: (info.files ?? [{ length: info.length, path: [info.name] }]).map((a) => ({
|
files: (info.files ?? [{ length: info.length, path: [info.name] }]).map((a) => ({
|
||||||
size: a.length,
|
size: a.length,
|
||||||
name: dec.decode(a.path[0]),
|
name: a.path.map(b => dec.decode(b)).join("/"),
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -107,6 +109,7 @@ export function NewPage() {
|
|||||||
if (ev) {
|
if (ev) {
|
||||||
await system.BroadcastEvent(ev);
|
await system.BroadcastEvent(ev);
|
||||||
}
|
}
|
||||||
|
navigate("/")
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCategories(a: Category, tags: Array<string>): ReactNode {
|
function renderCategories(a: Category, tags: Array<string>): ReactNode {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user