diff --git a/index.html b/index.html index 9217910..9f0e9f6 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ + { + const { pathname } = useRouter(); + const [loading, post] = useFetch( + (): Promise> => + r.post("/fs/other", { + path: pathname(), + password: password(), + method: "doc_preview" + }) + ); + const init = async () => { + const resp = await post(); + handleRresp(resp, (data) => { + const docOptions = aliyun.config({ + mount: document.querySelector("#office-preview")!, + url: data.preview_url, + }); + docOptions.setToken({ token: data.access_token }); + }); + }; + init(); + return ( + + + + ); +}; + +export default AliDocPreview; diff --git a/src/pages/home/previews/index.ts b/src/pages/home/previews/index.ts index 6a18468..77f7df7 100644 --- a/src/pages/home/previews/index.ts +++ b/src/pages/home/previews/index.ts @@ -55,6 +55,12 @@ const previews: Preview[] = [ exts: ["plist"], component: lazy(() => import("./plist")), }, + { + name: "Aliyun Office Previewer", + exts: ["doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf"], + provider: /Aliyundrive/, + component: lazy(() => import("./aliyun_office")), + }, ]; export const getPreviews = (