diff --git a/webapp/app2.tsx b/webapp/app.tsx similarity index 100% rename from webapp/app2.tsx rename to webapp/app.tsx diff --git a/webapp/components2/file-item.tsx b/webapp/components2/file-item.tsx index b1b7fbb6..cbde7424 100644 --- a/webapp/components2/file-item.tsx +++ b/webapp/components2/file-item.tsx @@ -1,4 +1,4 @@ -import { Meta } from "../lib/archive" +import { Meta } from "../libfgg" import logo from "/logo192.png" import { filesize } from "filesize" diff --git a/webapp/components2/recver-file.tsx b/webapp/components2/recver-file.tsx index dbb86097..d6710072 100644 --- a/webapp/components2/recver-file.tsx +++ b/webapp/components2/recver-file.tsx @@ -1,5 +1,5 @@ import FileItem from "./file-item" -import { Box } from "../lib/box" +import { Box } from "../libfgg/index" import { ExpiresAtHumanTime } from "../lib/util" import Qrcode from "./qr-code" import { getRaw, getServer } from "../lib/api" diff --git a/webapp/components2/recver.tsx b/webapp/components2/recver.tsx index bab09344..f540a272 100644 --- a/webapp/components2/recver.tsx +++ b/webapp/components2/recver.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react" -import { Box } from "../lib/box" +import { Box } from "../libfgg/index" import RecverFile from "./recver-file" import { getBox, shareGetRoom } from "../lib/api" diff --git a/webapp/components2/send-area.tsx b/webapp/components2/send-area.tsx index ce722fcf..b8a95977 100644 --- a/webapp/components2/send-area.tsx +++ b/webapp/components2/send-area.tsx @@ -2,15 +2,14 @@ import { useRef, useState, ChangeEvent, useEffect } from "react" import { useAtom } from "jotai" import { filesize } from "filesize" -import Archive, { Meta } from "../lib/archive" +import Archive from "../lib/archive" +import LibFgg, { Box, Meta } from "../libfgg" import { getServer, putBox } from "../lib/api" import { loadHistory } from "../lib/history" -import { Box } from "../lib/box" import FileItem from "./file-item" import { ItemsAtom } from "../store" import SendFile from "./send-file" -import LibFgg from "../libfgg/libfgg" import { ProtoHttpToWs } from "../lib/util" import { DomSendFile } from "../libfgg/pool/file/dom" diff --git a/webapp/components2/send-file.tsx b/webapp/components2/send-file.tsx index aa4f73a2..afb41c31 100644 --- a/webapp/components2/send-file.tsx +++ b/webapp/components2/send-file.tsx @@ -1,5 +1,5 @@ import Qrcode from "./qr-code" -import { Box } from "../lib/box" +import { Box } from "../libfgg/index" import { generateShare } from "../lib/api" export default (props: { file: Box, callback: (_: Box | null) => void }) => { diff --git a/webapp/lib/api.ts b/webapp/lib/api.ts index fafe0014..44391347 100644 --- a/webapp/lib/api.ts +++ b/webapp/lib/api.ts @@ -1,4 +1,4 @@ -import { Box } from "./box" +import { Box } from "../libfgg/index" import { shareGetRoom, generateShare } from "./share" const ws = '/signal/' diff --git a/webapp/lib/archive.ts b/webapp/lib/archive.ts index 4add1f3e..24ec1103 100644 --- a/webapp/lib/archive.ts +++ b/webapp/lib/archive.ts @@ -1,20 +1,9 @@ import PizZip from "pizzip" -import { Item } from "../lib/box" +import { Item, Meta } from "../libfgg/index" const ArchiveName = "filegogo-archive.zip" const ArchiveType = "application/zip" -interface Meta { - name: string - // TODO: mime - type: string - size: number -} - -export type { - Meta -} - export default class Archive { //private files: File[] diff --git a/webapp/lib/history.ts b/webapp/lib/history.ts index 8fc2a819..9986f3d4 100644 --- a/webapp/lib/history.ts +++ b/webapp/lib/history.ts @@ -1,4 +1,4 @@ -import { Box } from "./box" +import { Box } from "../libfgg" import { getBox } from "./api" type warpResult = Promise<{ uxid: string, data: Box }> diff --git a/webapp/lib/box.ts b/webapp/libfgg/box.ts similarity index 86% rename from webapp/lib/box.ts rename to webapp/libfgg/box.ts index f55e5469..a0ff519e 100644 --- a/webapp/lib/box.ts +++ b/webapp/libfgg/box.ts @@ -1,4 +1,4 @@ -import { Meta } from "../lib/archive" +import { Meta } from "./pool/data" interface Item { name: string diff --git a/webapp/libfgg/index.ts b/webapp/libfgg/index.ts new file mode 100644 index 00000000..74279239 --- /dev/null +++ b/webapp/libfgg/index.ts @@ -0,0 +1,11 @@ +import LibFgg from "./libfgg" +import { Box, Item } from "./box" +import { Meta } from "./pool/data" + +export default LibFgg + +export type { + Box, + Item, + Meta, +} diff --git a/webapp/main.tsx b/webapp/main.tsx index 2478c948..01850e0c 100644 --- a/webapp/main.tsx +++ b/webapp/main.tsx @@ -1,22 +1,15 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './app2' +import React from "react" +import ReactDOM from "react-dom/client" +import App from "./app" import { Provider } from "jotai" -import 'virtual:uno.css' -//import '@unocss/reset/normalize.css' -import '@unocss/reset/tailwind.css' -//import '@unocss/reset/tailwind-compat.css' -//import 'virtual:windi.css' -//import 'virtual:windi-devtools' -//import 'virtual:windi-base.css' -//import 'virtual:windi-components.css' -//import 'virtual:windi-utilities.css' +import "virtual:uno.css" +import "@unocss/reset/tailwind.css" -import GithubCorner from 'react-github-corner' +import GithubCorner from "react-github-corner" -ReactDOM.createRoot(document.getElementById('root')!).render( +ReactDOM.createRoot(document.getElementById("root")!).render( diff --git a/webapp/store.ts b/webapp/store.ts index 76901389..8ceaf833 100644 --- a/webapp/store.ts +++ b/webapp/store.ts @@ -1,5 +1,5 @@ import { atom } from "jotai" -import { Box } from "./lib/box" +import { Box } from "./libfgg" const ItemsAtom = atom>([])