Skip to content

Commit

Permalink
fix custom protocol for android
Browse files Browse the repository at this point in the history
  • Loading branch information
sehnryr committed Dec 13, 2024
1 parent 2627c0d commit 5e03d38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pages/Browse/ExtensionBrowse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,23 @@ const MangaItem = (
) => {
const [loading, setLoading] = useState<boolean>(true);

const platform = import.meta.env.TAURI_ENV_PLATFORM;
let uri: string;

if (platform === "windows" || platform === "android") {
uri = "http://gallery.localhost";
} else {
uri = "gallery://localhost";
}

return (
<Link
to={{ pathname: `/browse/${extensionId}/${manga.id}` }}
state={manga}
>
<div className="w-full aspect-[2/3] skeleton rounded-md">
<LazyImage
src={`gallery://localhost/?url=${
src={`${uri}/?url=${
encodeURIComponent(manga.coverUrl)
}&width=300&height=450`}
alt={manga.title}
Expand Down
4 changes: 4 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import react from "@vitejs/plugin-react";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";

const TAURI_ENV_PLATFORM = Deno.env.get("TAURI_ENV_PLATFORM");
const TAURI_ENV_DEBUG = Deno.env.get("TAURI_ENV_DEBUG");
const TAURI_DEV_HOST = Deno.env.get("TAURI_DEV_HOST");

Expand All @@ -28,4 +29,7 @@ export default defineConfig({
minify: !TAURI_ENV_DEBUG ? "esbuild" : false,
sourcemap: !!TAURI_ENV_DEBUG,
},
define: {
"import.meta.env.TAURI_ENV_PLATFORM": JSON.stringify(TAURI_ENV_PLATFORM),
},
});

0 comments on commit 5e03d38

Please sign in to comment.