Skip to content

Commit

Permalink
fix: blink not launching or rendering on opening
Browse files Browse the repository at this point in the history
  • Loading branch information
prayag17 committed Nov 9, 2024
1 parent 61441b9 commit d586c3e
Show file tree
Hide file tree
Showing 31 changed files with 546 additions and 279 deletions.
2 changes: 1 addition & 1 deletion .million/store.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-tauri/gen/schemas/acl-manifests.json

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion src-tauri/gen/schemas/desktop-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
"definitions": {
"Capability": {
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, \"platforms\": [\"macOS\",\"windows\"] } ```",
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
"type": "object",
"required": [
"identifier",
Expand Down Expand Up @@ -2006,6 +2006,11 @@
"type": "string",
"const": "store:allow-get"
},
{
"description": "Enables the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:allow-get-store"
},
{
"description": "Enables the has command without any pre-configured scope.",
"type": "string",
Expand All @@ -2026,6 +2031,11 @@
"type": "string",
"const": "store:allow-load"
},
{
"description": "Enables the reload command without any pre-configured scope.",
"type": "string",
"const": "store:allow-reload"
},
{
"description": "Enables the reset command without any pre-configured scope.",
"type": "string",
Expand Down Expand Up @@ -2066,6 +2076,11 @@
"type": "string",
"const": "store:deny-get"
},
{
"description": "Denies the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:deny-get-store"
},
{
"description": "Denies the has command without any pre-configured scope.",
"type": "string",
Expand All @@ -2086,6 +2101,11 @@
"type": "string",
"const": "store:deny-load"
},
{
"description": "Denies the reload command without any pre-configured scope.",
"type": "string",
"const": "store:deny-reload"
},
{
"description": "Denies the reset command without any pre-configured scope.",
"type": "string",
Expand Down
22 changes: 21 additions & 1 deletion src-tauri/gen/schemas/windows-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
"definitions": {
"Capability": {
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, \"platforms\": [\"macOS\",\"windows\"] } ```",
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
"type": "object",
"required": [
"identifier",
Expand Down Expand Up @@ -2006,6 +2006,11 @@
"type": "string",
"const": "store:allow-get"
},
{
"description": "Enables the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:allow-get-store"
},
{
"description": "Enables the has command without any pre-configured scope.",
"type": "string",
Expand All @@ -2026,6 +2031,11 @@
"type": "string",
"const": "store:allow-load"
},
{
"description": "Enables the reload command without any pre-configured scope.",
"type": "string",
"const": "store:allow-reload"
},
{
"description": "Enables the reset command without any pre-configured scope.",
"type": "string",
Expand Down Expand Up @@ -2066,6 +2076,11 @@
"type": "string",
"const": "store:deny-get"
},
{
"description": "Denies the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:deny-get-store"
},
{
"description": "Denies the has command without any pre-configured scope.",
"type": "string",
Expand All @@ -2086,6 +2101,11 @@
"type": "string",
"const": "store:deny-load"
},
{
"description": "Denies the reload command without any pre-configured scope.",
"type": "string",
"const": "store:deny-reload"
},
{
"description": "Denies the reset command without any pre-configured scope.",
"type": "string",
Expand Down
25 changes: 17 additions & 8 deletions src/components/buttons/queueButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getTypeIcon } from "../utils/iconsCollection";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useMutation, useQuery } from "@tanstack/react-query";
import "./queueButton.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
const QueueButton = () => {
const api = useApiInContext((s) => s.api);
Expand Down Expand Up @@ -96,7 +97,7 @@ const QueueButton = () => {
{queueItems[currentItemIndex].ImageTags?.Primary ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
queueItems[currentItemIndex]?.Id,
"Primary",
{
Expand All @@ -109,7 +110,7 @@ const QueueButton = () => {
?.length ?? -1) > 0 ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
queueItems[currentItemIndex]?.AlbumId,
"Primary",
{
Expand Down Expand Up @@ -190,17 +191,25 @@ const QueueButton = () => {
{item.ImageTags?.Primary ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(item?.Id, "Primary", {
tag: item.ImageTags?.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item?.Id,
"Primary",
{
tag: item.ImageTags?.Primary,
},
)}
alt={item.Name ?? "image"}
/>
) : (item.AlbumPrimaryImageTag?.length ?? -1) > 0 ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
tag: item.AlbumPrimaryImageTag[0],
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item?.AlbumId,
"Primary",
{
tag: item.AlbumPrimaryImageTag[0],
},
)}
alt={item.Name ?? "image"}
/>
) : (
Expand Down
3 changes: 2 additions & 1 deletion src/components/card/actorCards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Typography from "@mui/material/Typography";
import { Blurhash } from "react-blurhash";
import { useApi } from "../../utils/store/api";
import "./card.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";

/**
* @typedef {Object} Props
Expand Down Expand Up @@ -70,7 +71,7 @@ export const ActorCard = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
seriesId ? item.SeriesId : item.Id,
"Primary",
{
Expand Down
3 changes: 2 additions & 1 deletion src/components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import PlayButton from "../buttons/playButton";
import ErrorBoundary from "../errorBoundary";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";

const CardComponent = ({
Expand Down Expand Up @@ -116,7 +117,7 @@ const CardComponent = ({
src={
overrideIcon === "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl(
: getImageUrlsApi(api).getItemImageUrlById(
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ?? "",
imageType,
{
Expand Down
3 changes: 2 additions & 1 deletion src/components/card/episodeCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Blurhash } from "react-blurhash";
import "./card.scss";

import { getRuntimeCompact } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useNavigate, useRouteContext } from "@tanstack/react-router";
import LikeButton from "../buttons/likeButton";
Expand Down Expand Up @@ -87,7 +88,7 @@ export const EpisodeCard = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(item.Id, "Primary", {
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
quality: 90,
fillHeight: 512,
fillWidth: 512,
Expand Down
89 changes: 47 additions & 42 deletions src/components/carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useApiInContext } from "@/utils/store/api";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import CarouselSlide from "../carouselSlide";

import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import ReactMultiCarousel from "react-multi-carousel";
import Slider from "../Slider";
import { getTypeIcon } from "../utils/iconsCollection";
Expand Down Expand Up @@ -63,51 +64,55 @@ const Carousel = ({
},
};



// Memoize the content mapping
const sliderContent = useMemo(() => {
return content.map((item, index) => (
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
return content.map((item, index) => {
return (
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={api.getItemImageUrl(item.Id, "Thumb", {
tag: item.ImageTags.Primary,
fillWidth: 300,
})}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type)}
</div>
)}
</motion.div>
));
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
}
setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Thumb", {
tag: item.ImageTags.Primary,
fillWidth: 300,
})}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type)}
</div>
)}
</motion.div>
);
});
}, [content, currentSlide, api, setDirection]);

const handleDragEnd = useCallback(
Expand Down
3 changes: 2 additions & 1 deletion src/components/musicTrack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import LikeButton from "../buttons/likeButton";
import PlayButton from "../buttons/playButton";
import TextLink from "../textLink";
import "./musicTrack.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import type { QueryKey } from "@tanstack/react-query";
Expand Down Expand Up @@ -60,7 +61,7 @@ const MusicTrack = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
"Primary",
{
Expand Down
3 changes: 2 additions & 1 deletion src/components/outroCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from "react";
import { getTypeIcon } from "../utils/iconsCollection";

import "./outroCard.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useMutation, useQuery } from "@tanstack/react-query";

Expand Down Expand Up @@ -36,7 +37,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
<img
className="outro-card-content-image"
alt={item.Name ?? "Cover"}
src={api.getItemImageUrl(item.Id, "Primary", {
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
tag: item.ImageTags.Primary,
quality: 80,
})}
Expand Down
Loading

0 comments on commit d586c3e

Please sign in to comment.