diff --git a/public/static/img/marker-icon-2x.png b/public/static/img/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 Binary files /dev/null and b/public/static/img/marker-icon-2x.png differ diff --git a/public/static/img/marker-icon.png b/public/static/img/marker-icon.png new file mode 100644 index 0000000..950edf2 Binary files /dev/null and b/public/static/img/marker-icon.png differ diff --git a/public/static/img/marker-shadow.png b/public/static/img/marker-shadow.png new file mode 100644 index 0000000..9fd2979 Binary files /dev/null and b/public/static/img/marker-shadow.png differ diff --git a/src/component/FileManager/Sidebar/Map/LeafletMapBox.tsx b/src/component/FileManager/Sidebar/Map/LeafletMapBox.tsx index a68c7d4..6acc4a7 100644 --- a/src/component/FileManager/Sidebar/Map/LeafletMapBox.tsx +++ b/src/component/FileManager/Sidebar/Map/LeafletMapBox.tsx @@ -1,8 +1,18 @@ -import "leaflet/dist/leaflet.css"; -import { MapContainer, Marker, TileLayer, useMap } from "react-leaflet"; import { Box, useTheme } from "@mui/material"; -import { MapLoaderProps } from "./MapLoader.tsx"; +import L from "leaflet"; +import "leaflet/dist/leaflet.css"; import { useMemo } from "react"; +import { MapContainer, Marker, TileLayer, useMap } from "react-leaflet"; +import { MapLoaderProps } from "./MapLoader.tsx"; + +// @ts-ignore +delete L.Icon.Default.prototype._getIconUrl; + +L.Icon.Default.mergeOptions({ + iconUrl: "/static/img/marker-icon.png", // .src removed + iconRetinaUrl: "/static/img/marker-icon-2x.png", // .src removed + shadowUrl: "/static/img/marker-shadow.png", // .src removed +}); /* Majority users of Cloudreve in China prefer not to include Ukraine flag. Feel free to remove it if you want to display it. @@ -18,14 +28,7 @@ const FlagRemoval = () => { return null; }; -const LeafletMapBox = ({ - center, - height, - mapProvider, - googleTileType, - sx, - ...rest -}: MapLoaderProps) => { +const LeafletMapBox = ({ center, height, mapProvider, googleTileType, sx, ...rest }: MapLoaderProps) => { const theme = useTheme(); const googleTileUrl = useMemo(() => { switch (googleTileType) { diff --git a/src/redux/thunks/share.ts b/src/redux/thunks/share.ts index 25becb9..a027607 100644 --- a/src/redux/thunks/share.ts +++ b/src/redux/thunks/share.ts @@ -150,10 +150,11 @@ function getFileAndShareById( let file: FileResponse | undefined = undefined; if (singleFile) { - file = (await dispatch(getFileList({ uri: share.source_uri ?? "", page_size: 50 })))?.files[0]; + const root = new CrUri(share.source_uri ?? ""); + file = await dispatch(getFileInfo({ uri: root.join(share.name ?? "").toString() })); } else { file = await dispatch(getFileInfo({ uri: share.source_uri ?? "" })); } return { share, file }; }; -} +} \ No newline at end of file