refactor(aliyun_office): remove Aliyun Office preview (#169)

* refactor(aliyun_office): load Aliyun Office SDK dynamically

* refactor(aliyun_office): remove Aliyun Office preview
This commit is contained in:
MadDogOwner
2025-08-18 14:02:58 +08:00
committed by GitHub
parent cd3e261313
commit 9fbc33bcf7
4 changed files with 0 additions and 53 deletions

View File

@@ -12,10 +12,6 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="OpenList" />
<link rel="apple-touch-icon" href="https://res.oplist.org/logo/logo.png" />
<script
src="https://g.alicdn.com/IMM/office-js/1.1.5/aliyun-web-office-sdk.min.js"
async
></script>
<link
rel="shortcut icon"
type="image/ico"

6
src/index.d.ts vendored
View File

@@ -1,7 +1 @@
declare module "aplayer"
declare namespace aliyun {
class Config {
setToken(token: { token: string }): any
}
function config(options: { mount: Element; url: string }): Config
}

View File

@@ -1,36 +0,0 @@
import { Box } from "@hope-ui/solid"
import { MaybeLoading } from "~/components"
import { useFetch, useRouter } from "~/hooks"
import { password } from "~/store"
import { PResp } from "~/types"
import { handleResp, r } from "~/utils"
const AliDocPreview = () => {
const { pathname } = useRouter()
const [loading, post] = useFetch(
(): PResp<{ access_token: string; preview_url: string }> =>
r.post("/fs/other", {
path: pathname(),
password: password(),
method: "doc_preview",
}),
)
const init = async () => {
const resp = await post()
handleResp(resp, (data) => {
const docOptions = aliyun.config({
mount: document.querySelector("#office-preview")!,
url: data.preview_url,
})
docOptions.setToken({ token: data.access_token })
})
}
init()
return (
<MaybeLoading loading={loading()}>
<Box w="$full" h="70vh" id="office-preview"></Box>
</MaybeLoading>
)
}
export default AliDocPreview

View File

@@ -120,13 +120,6 @@ const previews: Preview[] = [
component: lazy(() => import("./heic")),
prior: true,
},
{
name: "Aliyun Office Previewer",
exts: ["doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf"],
provider: /^Aliyundrive(Share)?$/,
component: lazy(() => import("./aliyun_office")),
prior: true,
},
{
name: "PDF Preview",
exts: ["pdf"],