mirror of
https://github.com/stashapp/stash.git
synced 2026-05-09 05:05:29 +02:00
Format
This commit is contained in:
parent
438636a836
commit
e29fd8a0a6
3 changed files with 40 additions and 22 deletions
|
|
@ -248,7 +248,9 @@ type Query {
|
|||
validateStashBoxCredentials(input: StashBoxInput!): StashBoxValidationResult!
|
||||
|
||||
"List pending fingerprint submissions for a stash-box endpoint"
|
||||
pendingFingerprintSubmissions(stash_box_endpoint: String!): [FingerprintSubmission!]!
|
||||
pendingFingerprintSubmissions(
|
||||
stash_box_endpoint: String!
|
||||
): [FingerprintSubmission!]!
|
||||
|
||||
# System status
|
||||
systemStatus: SystemStatus!
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import React, { useState, useEffect, useRef, useMemo } from "react";
|
||||
import {
|
||||
initialConfig,
|
||||
ITaggerConfig,
|
||||
} from "src/components/Tagger/constants";
|
||||
import { initialConfig, ITaggerConfig } from "src/components/Tagger/constants";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import {
|
||||
queryFindPerformer,
|
||||
|
|
@ -86,9 +83,7 @@ export interface ITaggerContextState {
|
|||
stashBoxSceneId: string,
|
||||
vote: GQL.FingerprintVote
|
||||
) => Promise<void>;
|
||||
removeFingerprintSubmission: (
|
||||
stashBoxSceneId: string
|
||||
) => Promise<void>;
|
||||
removeFingerprintSubmission: (stashBoxSceneId: string) => Promise<void>;
|
||||
isReported: (sceneId: string, remoteSceneId: string) => boolean;
|
||||
}
|
||||
|
||||
|
|
@ -160,9 +155,12 @@ export const TaggerContext: React.FC = ({ children }) => {
|
|||
const [updateTag] = useTagUpdate();
|
||||
|
||||
// Fingerprint submission mutations and query
|
||||
const [queueFingerprintMutation] = GQL.useQueueFingerprintSubmissionMutation();
|
||||
const [removeFingerprintMutation] = GQL.useRemoveFingerprintSubmissionMutation();
|
||||
const [submitFingerprintsMutation] = GQL.useSubmitFingerprintSubmissionsMutation();
|
||||
const [queueFingerprintMutation] =
|
||||
GQL.useQueueFingerprintSubmissionMutation();
|
||||
const [removeFingerprintMutation] =
|
||||
GQL.useRemoveFingerprintSubmissionMutation();
|
||||
const [submitFingerprintsMutation] =
|
||||
GQL.useSubmitFingerprintSubmissionsMutation();
|
||||
|
||||
useEffect(() => {
|
||||
if (!stashConfig || !Scrapers.data) {
|
||||
|
|
@ -244,10 +242,11 @@ export const TaggerContext: React.FC = ({ children }) => {
|
|||
|
||||
// Query pending fingerprint submissions from the backend
|
||||
const endpoint = currentSource?.sourceInput.stash_box_endpoint;
|
||||
const { data: pendingData, refetch: refetchPending } = GQL.usePendingFingerprintSubmissionsQuery({
|
||||
variables: { stash_box_endpoint: endpoint ?? "" },
|
||||
skip: !endpoint,
|
||||
});
|
||||
const { data: pendingData, refetch: refetchPending } =
|
||||
GQL.usePendingFingerprintSubmissionsQuery({
|
||||
variables: { stash_box_endpoint: endpoint ?? "" },
|
||||
skip: !endpoint,
|
||||
});
|
||||
|
||||
const pendingFingerprints = useMemo((): IPendingSubmission[] => {
|
||||
if (!pendingData?.pendingFingerprintSubmissions) return [];
|
||||
|
|
@ -562,7 +561,11 @@ export const TaggerContext: React.FC = ({ children }) => {
|
|||
});
|
||||
|
||||
if (queueFingerprint && stashBoxSceneId) {
|
||||
await queueFingerprintSubmission(sceneCreateInput.id, stashBoxSceneId, GQL.FingerprintVote.Valid);
|
||||
await queueFingerprintSubmission(
|
||||
sceneCreateInput.id,
|
||||
stashBoxSceneId,
|
||||
GQL.FingerprintVote.Valid
|
||||
);
|
||||
}
|
||||
clearSearchResults(sceneCreateInput.id);
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -160,8 +160,7 @@ function matchChecksums(
|
|||
const isMatch = stashScene.files.some((ff) =>
|
||||
ff.fingerprints.some(
|
||||
(fp) =>
|
||||
fp.value === f.hash &&
|
||||
(fp.type === "oshash" || fp.type === "md5")
|
||||
fp.value === f.hash && (fp.type === "oshash" || fp.type === "md5")
|
||||
)
|
||||
);
|
||||
|
||||
|
|
@ -535,12 +534,20 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||
delete sceneCreateInput.stash_ids;
|
||||
}
|
||||
|
||||
await saveScene(sceneCreateInput, includeStashID, scene.remote_site_id ?? undefined);
|
||||
await saveScene(
|
||||
sceneCreateInput,
|
||||
includeStashID,
|
||||
scene.remote_site_id ?? undefined
|
||||
);
|
||||
}
|
||||
|
||||
async function handleReportWrong() {
|
||||
if (!scene.remote_site_id) return;
|
||||
await queueFingerprintSubmission(stashScene.id, scene.remote_site_id, GQL.FingerprintVote.Invalid);
|
||||
await queueFingerprintSubmission(
|
||||
stashScene.id,
|
||||
scene.remote_site_id,
|
||||
GQL.FingerprintVote.Invalid
|
||||
);
|
||||
onReportWrong?.();
|
||||
}
|
||||
|
||||
|
|
@ -942,7 +949,11 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className={cx(isActive ? "col-lg-6" : "", { "marked-wrong": isReportedWrong })}>
|
||||
<div
|
||||
className={cx(isActive ? "col-lg-6" : "", {
|
||||
"marked-wrong": isReportedWrong,
|
||||
})}
|
||||
>
|
||||
<div className="row mx-0">
|
||||
{maybeRenderCoverImage()}
|
||||
<div className="d-flex flex-column justify-content-center scene-metadata">
|
||||
|
|
@ -1075,7 +1086,9 @@ export const SceneSearchResults: React.FC<ISceneSearchResults> = ({
|
|||
scene={s}
|
||||
stashScene={target}
|
||||
onReportWrong={
|
||||
i === selectedResult ? () => setSelectedResult(undefined) : undefined
|
||||
i === selectedResult
|
||||
? () => setSelectedResult(undefined)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in a new issue