39246-vm/frontend/out/_next/static/chunks/0ef9a7e2ccbfc213.js
2026-03-14 17:32:05 +03:00

1 line
7.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,52749,e=>{"use strict";let a="http://localhost:8000",s=async()=>{let e=await fetch(`${a}/api/config`);if(!e.ok)throw Error("Failed to fetch config");return e.json()},l=async e=>{if(!(await fetch(`${a}/api/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw Error("Failed to save config")};e.s(["fetchConfig",0,s,"saveConfig",0,l])},32545,e=>{"use strict";var a=e.i(43476),s=e.i(71645),l=e.i(52749);let t="http://localhost:8000",n=async()=>{let e=await fetch(`${t}/api/telegram/test`,{method:"POST"});if(!e.ok)throw Error("Telegram test failed");return e.json()},o=()=>window.open(`${t}/api/backup/download`),i=async e=>{let a=new FormData;if(a.append("file",e),!(await fetch(`${t}/api/backup/restore`,{method:"POST",body:a})).ok)throw Error("Restore failed")},r=(0,e.i(68834).create)(e=>({config:{},loaded:!1,setConfig:a=>e({config:a,loaded:!0}),updateKey:(a,s)=>e(e=>({config:{...e.config,[a]:s}}))})),c=({label:e,k:s,cfg:l,onChange:t,type:n="text",mono:o=!1})=>(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("label",{className:"text-xs text-g-faint w-52 shrink-0 leading-snug",children:e}),(0,a.jsx)("input",{type:n,value:l[s]??"",onChange:e=>t(s,e.target.value),className:`g-input h-8 text-sm flex-1 ${o?"font-mono":""}`})]}),g=({title:e,children:s})=>(0,a.jsxs)("div",{className:"g-card overflow-hidden",children:[(0,a.jsx)("div",{className:"px-5 py-3 border-b border-g-border/50",children:(0,a.jsx)("h2",{className:"text-xs font-semibold uppercase tracking-widest text-g-faint",children:e})}),(0,a.jsx)("div",{className:"p-5 space-y-3.5",children:s})]});function d(){let{config:e,loaded:t,setConfig:d,updateKey:h}=r(),[x,f]=(0,s.useState)(!1),[p,b]=(0,s.useState)("");(0,s.useEffect)(()=>{t||(0,l.fetchConfig)().then(d).catch(()=>d({}))},[t,d]);let m=async()=>{f(!0);try{await (0,l.saveConfig)(e),b("Saved.")}catch{b("Save failed.")}f(!1),setTimeout(()=>b(""),3e3)},u=async e=>{let a=e.target.files?.[0];if(a&&confirm("Restore this backup? Current data will be replaced."))try{await i(a),b("Restored. Restart engine.")}catch{b("Restore failed.")}};return t?(0,a.jsxs)("div",{className:"space-y-6 max-w-2xl",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"g-page-title",children:"Settings"}),(0,a.jsx)("p",{className:"g-page-sub",children:"Engine and alert configuration"})]}),(0,a.jsxs)(g,{title:"Telegram",children:[(0,a.jsx)(c,{label:"Bot token",k:"telegram_token",cfg:e,onChange:h,mono:!0}),(0,a.jsx)(c,{label:"Chat ID",k:"telegram_chat_id",cfg:e,onChange:h,mono:!0}),(0,a.jsx)("button",{onClick:async()=>{try{await n(),b("Telegram OK!")}catch{b("Telegram failed.")}},className:"g-btn text-xs",children:"Send test message"})]}),(0,a.jsxs)(g,{title:"Engine",children:[(0,a.jsx)(c,{label:"Scrape interval (s)",k:"timer",cfg:e,onChange:h,type:"number"}),(0,a.jsx)(c,{label:"Browser",k:"browser_choice",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Humanize level",k:"humanize_level",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Show browser (true/false)",k:"show_browser",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Incognito mode",k:"incognito_mode",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Delay launch (s)",k:"delay_launch",cfg:e,onChange:h,type:"number"}),(0,a.jsx)(c,{label:"Delay post-search (s)",k:"delay_post_search",cfg:e,onChange:h,type:"number"}),(0,a.jsx)(c,{label:"Scrape window enabled",k:"scrape_window_enabled",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Window start hour (023)",k:"scrape_start_hour",cfg:e,onChange:h,type:"number"}),(0,a.jsx)(c,{label:"Window end hour (023)",k:"scrape_end_hour",cfg:e,onChange:h,type:"number"}),(0,a.jsx)(c,{label:"Boost interval (min)",k:"boost_interval_mins",cfg:e,onChange:h,type:"number"})]}),(0,a.jsxs)(g,{title:"Alerts",children:[(0,a.jsx)(c,{label:"Alert channels (telegram,discord,email)",k:"alert_channels",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Discord webhook",k:"discord_webhook",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Gmail address",k:"gmail_address",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Gmail app password",k:"gmail_app_password",cfg:e,onChange:h,type:"password",mono:!0}),(0,a.jsx)(c,{label:"Email to",k:"email_to",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Closing alerts (true/false)",k:"closing_alert_enabled",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Alert schedule (min, e.g. 60,30,10)",k:"closing_alert_schedule",cfg:e,onChange:h})]}),(0,a.jsx)(g,{title:"Currency",children:(0,a.jsx)(c,{label:"Display currency (blank = raw)",k:"display_currency",cfg:e,onChange:h})}),(0,a.jsxs)(g,{title:"Proxy",children:[(0,a.jsx)(c,{label:"Proxy enabled (true/false)",k:"proxy_enabled",cfg:e,onChange:h}),(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("label",{className:"text-xs text-g-faint w-52 shrink-0 pt-1.5",children:"Proxy list"}),(0,a.jsx)("textarea",{value:e.proxy_list??"",onChange:e=>h("proxy_list",e.target.value),rows:3,placeholder:"http://proxy1:8080\nsocks5://proxy2:1080",className:"g-input text-sm font-mono resize-none flex-1"})]})]}),(0,a.jsxs)(g,{title:"CAPTCHA",children:[(0,a.jsx)(c,{label:"Solver (2captcha / capsolver)",k:"captcha_solver",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"API key",k:"captcha_api_key",cfg:e,onChange:h,type:"password",mono:!0})]}),(0,a.jsxs)(g,{title:"AI Filter",children:[(0,a.jsx)(c,{label:"AI enabled (true/false)",k:"ai_filter_enabled",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"AI provider (groq/ollama)",k:"ai_provider",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"AI model",k:"ai_model",cfg:e,onChange:h,mono:!0}),(0,a.jsx)(c,{label:"Groq API key",k:"ai_api_key",cfg:e,onChange:h,type:"password",mono:!0}),(0,a.jsx)(c,{label:"Ollama URL",k:"ai_base_url",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"AI debug (true/false)",k:"ai_debug",cfg:e,onChange:h}),(0,a.jsx)(c,{label:"Auto-adapt (true/false)",k:"auto_adapt_enabled",cfg:e,onChange:h})]}),(0,a.jsxs)(g,{title:"Database",children:[(0,a.jsx)(c,{label:"DB URL (blank = SQLite)",k:"db_url",cfg:e,onChange:h,mono:!0}),(0,a.jsx)(c,{label:"Auto-disable after N failures (0 = never)",k:"site_auto_disable_after",cfg:e,onChange:h,type:"number"})]}),(0,a.jsx)(g,{title:"Backup & Restore",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:o,className:"g-btn text-xs",children:"Download backup"}),(0,a.jsxs)("label",{className:"g-btn text-xs cursor-pointer",children:["Restore backup",(0,a.jsx)("input",{type:"file",accept:".db",onChange:u,className:"hidden"})]})]})}),(0,a.jsxs)("div",{className:"flex gap-3 items-center pt-2",children:[(0,a.jsx)("button",{onClick:m,disabled:x,className:"g-btn-primary text-sm px-5 disabled:opacity-50",children:x?"Saving…":"Save settings"}),p&&(0,a.jsx)("span",{className:`text-xs ${p.includes("fail")||p.includes("fail")?"text-g-red":"text-g-green"}`,children:p})]})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-g-faint",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-g-faint animate-pulse"}),"Loading settings…"]})}e.s(["default",()=>d],32545)}]);