(true);
+
+ const { data, error } = useConfiguration();
+
+ const [updateScrapingConfig] = useConfigureScraping({
+ scraperUserAgent,
+ scraperCDPPath,
+ scraperCertCheck,
+ });
+
+ useEffect(() => {
+ if (!data?.configuration || error) return;
+
+ const conf = data.configuration;
+ if (conf.scraping) {
+ setScraperUserAgent(conf.scraping.scraperUserAgent ?? undefined);
+ setScraperCDPPath(conf.scraping.scraperCDPPath ?? undefined);
+ setScraperCertCheck(conf.scraping.scraperCertCheck);
+ }
+ }, [data, error]);
+
async function onReloadScrapers() {
await mutateReloadScrapers().catch((e) => Toast.error(e));
}
+ async function onSave() {
+ try {
+ await updateScrapingConfig();
+ Toast.success({
+ content: intl.formatMessage(
+ { id: "toast.updated_entity" },
+ {
+ entity: intl
+ .formatMessage({ id: "configuration" })
+ .toLocaleLowerCase(),
+ }
+ ),
+ });
+ } catch (e) {
+ Toast.error(e);
+ }
+ }
+
function renderPerformerScrapeTypes(types: ScrapeType[]) {
const typeStrings = types
.filter((t) => t !== ScrapeType.Fragment)
.map((t) => {
switch (t) {
case ScrapeType.Name:
- return intl.formatMessage({ id: "config.scrapers.search_by_name" });
+ return intl.formatMessage({ id: "config.scraping.search_by_name" });
default:
return t;
}
@@ -117,7 +164,7 @@ export const SettingsScrapersPanel: React.FC = () => {
switch (t) {
case ScrapeType.Fragment:
return intl.formatMessage(
- { id: "config.scrapers.entity_metadata" },
+ { id: "config.scraping.entity_metadata" },
{ entityType: intl.formatMessage({ id: "scene" }) }
);
default:
@@ -139,7 +186,7 @@ export const SettingsScrapersPanel: React.FC = () => {
switch (t) {
case ScrapeType.Fragment:
return intl.formatMessage(
- { id: "config.scrapers.entity_metadata" },
+ { id: "config.scraping.entity_metadata" },
{ entityType: intl.formatMessage({ id: "gallery" }) }
);
default:
@@ -161,7 +208,7 @@ export const SettingsScrapersPanel: React.FC = () => {
switch (t) {
case ScrapeType.Fragment:
return intl.formatMessage(
- { id: "config.scrapers.entity_metadata" },
+ { id: "config.scraping.entity_metadata" },
{ entityType: intl.formatMessage({ id: "movie" }) }
);
default:
@@ -195,7 +242,7 @@ export const SettingsScrapersPanel: React.FC = () => {
return renderTable(
intl.formatMessage(
- { id: "config.scrapers.entity_scrapers" },
+ { id: "config.scraping.entity_scrapers" },
{ entityType: intl.formatMessage({ id: "scene" }) }
),
elements
@@ -217,7 +264,7 @@ export const SettingsScrapersPanel: React.FC = () => {
return renderTable(
intl.formatMessage(
- { id: "config.scrapers.entity_scrapers" },
+ { id: "config.scraping.entity_scrapers" },
{ entityType: intl.formatMessage({ id: "gallery" }) }
),
elements
@@ -241,7 +288,7 @@ export const SettingsScrapersPanel: React.FC = () => {
return renderTable(
intl.formatMessage(
- { id: "config.scrapers.entity_scrapers" },
+ { id: "config.scraping.entity_scrapers" },
{ entityType: intl.formatMessage({ id: "performer" }) }
),
elements
@@ -261,7 +308,7 @@ export const SettingsScrapersPanel: React.FC = () => {
return renderTable(
intl.formatMessage(
- { id: "config.scrapers.entity_scrapers" },
+ { id: "config.scraping.entity_scrapers" },
{ entityType: intl.formatMessage({ id: "movie" }) }
),
elements
@@ -271,25 +318,24 @@ export const SettingsScrapersPanel: React.FC = () => {
function renderTable(title: string, elements: JSX.Element[]) {
if (elements.length > 0) {
return (
-
-
{title}
+
{intl.formatMessage({ id: "name" })} |
{intl.formatMessage({
- id: "config.scrapers.supported_types",
+ id: "config.scraping.supported_types",
})}
|
- {intl.formatMessage({ id: "config.scrapers.supported_urls" })}
+ {intl.formatMessage({ id: "config.scraping.supported_urls" })}
|
{elements}
-
+
);
}
}
@@ -299,7 +345,63 @@ export const SettingsScrapersPanel: React.FC = () => {
return (
<>
- {intl.formatMessage({ id: "config.categories.scrapers" })}
+
+ {intl.formatMessage({ id: "config.general.scraping" })}
+
+
+ {intl.formatMessage({ id: "config.general.scraper_user_agent" })}
+
+ ) =>
+ setScraperUserAgent(e.currentTarget.value)
+ }
+ />
+
+ {intl.formatMessage({
+ id: "config.general.scraper_user_agent_desc",
+ })}
+
+
+
+
+
+ {intl.formatMessage({ id: "config.general.chrome_cdp_path" })}
+
+ ) =>
+ setScraperCDPPath(e.currentTarget.value)
+ }
+ />
+
+ {intl.formatMessage({ id: "config.general.chrome_cdp_path_desc" })}
+
+
+
+
+ setScraperCertCheck(!scraperCertCheck)}
+ />
+
+ {intl.formatMessage({
+ id: "config.general.check_for_insecure_certificates_desc",
+ })}
+
+
+
+
+
+
+ {intl.formatMessage({ id: "config.scraping.scrapers" })}
+
+
+
+
+
>
);
};
diff --git a/ui/v2.5/src/core/StashService.ts b/ui/v2.5/src/core/StashService.ts
index b0adfdbc8..44fc90b10 100644
--- a/ui/v2.5/src/core/StashService.ts
+++ b/ui/v2.5/src/core/StashService.ts
@@ -761,6 +761,13 @@ export const useRemoveTempDLNAIP = () => GQL.useRemoveTempDlnaipMutation();
export const useLoggingSubscribe = () => GQL.useLoggingSubscribeSubscription();
+export const useConfigureScraping = (input: GQL.ConfigScrapingInput) =>
+ GQL.useConfigureScrapingMutation({
+ variables: { input },
+ refetchQueries: getQueryNames([GQL.ConfigurationDocument]),
+ update: deleteCache([GQL.ConfigurationDocument]),
+ });
+
export const querySystemStatus = () =>
client.query({
query: GQL.SystemStatusDocument,
diff --git a/ui/v2.5/src/locales/de-DE.json b/ui/v2.5/src/locales/de-DE.json
index e60a157c2..e22e410cf 100644
--- a/ui/v2.5/src/locales/de-DE.json
+++ b/ui/v2.5/src/locales/de-DE.json
@@ -151,7 +151,7 @@
"interface": "Oberfläche",
"logs": "Protokoll",
"plugins": "Plugins",
- "scrapers": "Scraper",
+ "scraping": "Scraping",
"tasks": "Aufgaben",
"tools": "Werkzeuge"
},
@@ -240,9 +240,10 @@
"hooks": "Hooks",
"triggers_on": "Auslösen bei"
},
- "scrapers": {
+ "scraping": {
"entity_metadata": "{entityType} Metadaten",
"entity_scrapers": "{entityType} Scraper",
+ "scrapers": "Scraper",
"search_by_name": "Suche nach Name",
"supported_types": "Unterstützte Typen",
"supported_urls": "URLs"
diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json
index 5ea435dbc..b29a24db7 100644
--- a/ui/v2.5/src/locales/en-GB.json
+++ b/ui/v2.5/src/locales/en-GB.json
@@ -151,7 +151,7 @@
"interface": "Interface",
"logs": "Logs",
"plugins": "Plugins",
- "scrapers": "Scrapers",
+ "scraping": "Scraping",
"tasks": "Tasks",
"tools": "Tools"
},
@@ -240,9 +240,10 @@
"hooks": "Hooks",
"triggers_on": "Triggers on"
},
- "scrapers": {
+ "scraping": {
"entity_metadata": "{entityType} Metadata",
"entity_scrapers": "{entityType} scrapers",
+ "scrapers": "Scrapers",
"search_by_name": "Search by name",
"supported_types": "Supported types",
"supported_urls": "URLs"
diff --git a/ui/v2.5/src/locales/pt-BR.json b/ui/v2.5/src/locales/pt-BR.json
index d7d4e620d..c56139dcd 100644
--- a/ui/v2.5/src/locales/pt-BR.json
+++ b/ui/v2.5/src/locales/pt-BR.json
@@ -151,7 +151,7 @@
"interface": "Interface",
"logs": "Logs",
"plugins": "Plugins",
- "scrapers": "Scrapers",
+ "scraping": "Scraping",
"tasks": "Tarefas",
"tools": "Ferramentas"
},
@@ -240,9 +240,10 @@
"hooks": "Hooks",
"triggers_on": "Triggers on"
},
- "scrapers": {
+ "scraping": {
"entity_metadata": "{entityType} metadados",
"entity_scrapers": "{entityType} scrapers",
+ "scrapers": "Scrapers",
"search_by_name": "Buscar por nome",
"supported_types": "Tipos suportados",
"supported_urls": "URLs"
diff --git a/ui/v2.5/src/locales/zh-TW.json b/ui/v2.5/src/locales/zh-TW.json
index ebf1beeb3..83afac442 100644
--- a/ui/v2.5/src/locales/zh-TW.json
+++ b/ui/v2.5/src/locales/zh-TW.json
@@ -144,7 +144,7 @@
"interface": "介面",
"logs": "日誌",
"plugins": "插件",
- "scrapers": "爬蟲",
+ "scraping": "爬蟲設定",
"tasks": "排程",
"tools": "工具"
},
@@ -229,9 +229,10 @@
"logs": {
"log_level": "日誌級別"
},
- "scrapers": {
+ "scraping": {
"entity_metadata": "{entityType}資訊",
"entity_scrapers": "{entityType}爬蟲",
+ "scrapers": "爬蟲",
"search_by_name": "透過名稱搜尋",
"supported_types": "支援類型",
"supported_urls": "支援網址"