General.svelte 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. <script lang="ts">
  2. import DOMPurify from 'dompurify';
  3. import { getVersionUpdates, getWebhookUrl, updateWebhookUrl } from '$lib/apis';
  4. import {
  5. getAdminConfig,
  6. getLdapConfig,
  7. getLdapServer,
  8. updateAdminConfig,
  9. updateLdapConfig,
  10. updateLdapServer
  11. } from '$lib/apis/auths';
  12. import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
  13. import Switch from '$lib/components/common/Switch.svelte';
  14. import Tooltip from '$lib/components/common/Tooltip.svelte';
  15. import { WEBUI_BUILD_HASH, WEBUI_VERSION } from '$lib/constants';
  16. import { config, showChangelog } from '$lib/stores';
  17. import { compareVersion } from '$lib/utils';
  18. import { onMount, getContext } from 'svelte';
  19. import { toast } from 'svelte-sonner';
  20. import Textarea from '$lib/components/common/Textarea.svelte';
  21. const i18n = getContext('i18n');
  22. export let saveHandler: Function;
  23. let updateAvailable = null;
  24. let version = {
  25. current: '',
  26. latest: ''
  27. };
  28. let adminConfig = null;
  29. let webhookUrl = '';
  30. // LDAP
  31. let ENABLE_LDAP = false;
  32. let LDAP_SERVER = {
  33. label: '',
  34. host: '',
  35. port: '',
  36. attribute_for_mail: 'mail',
  37. attribute_for_username: 'uid',
  38. app_dn: '',
  39. app_dn_password: '',
  40. search_base: '',
  41. search_filters: '',
  42. use_tls: false,
  43. certificate_path: '',
  44. ciphers: ''
  45. };
  46. const checkForVersionUpdates = async () => {
  47. updateAvailable = null;
  48. version = await getVersionUpdates(localStorage.token).catch((error) => {
  49. return {
  50. current: WEBUI_VERSION,
  51. latest: WEBUI_VERSION
  52. };
  53. });
  54. console.info(version);
  55. updateAvailable = compareVersion(version.latest, version.current);
  56. console.info(updateAvailable);
  57. };
  58. const updateLdapServerHandler = async () => {
  59. if (!ENABLE_LDAP) return;
  60. const res = await updateLdapServer(localStorage.token, LDAP_SERVER).catch((error) => {
  61. toast.error(`${error}`);
  62. return null;
  63. });
  64. if (res) {
  65. toast.success($i18n.t('LDAP server updated'));
  66. }
  67. };
  68. const updateHandler = async () => {
  69. webhookUrl = await updateWebhookUrl(localStorage.token, webhookUrl);
  70. const res = await updateAdminConfig(localStorage.token, adminConfig);
  71. await updateLdapConfig(localStorage.token, ENABLE_LDAP);
  72. await updateLdapServerHandler();
  73. if (res) {
  74. saveHandler();
  75. } else {
  76. toast.error($i18n.t('Failed to update settings'));
  77. }
  78. };
  79. onMount(async () => {
  80. checkForVersionUpdates();
  81. await Promise.all([
  82. (async () => {
  83. adminConfig = await getAdminConfig(localStorage.token);
  84. })(),
  85. (async () => {
  86. webhookUrl = await getWebhookUrl(localStorage.token);
  87. })(),
  88. (async () => {
  89. LDAP_SERVER = await getLdapServer(localStorage.token);
  90. })()
  91. ]);
  92. const ldapConfig = await getLdapConfig(localStorage.token);
  93. ENABLE_LDAP = ldapConfig.ENABLE_LDAP;
  94. });
  95. </script>
  96. <form
  97. class="flex flex-col h-full justify-between space-y-3 text-sm"
  98. on:submit|preventDefault={async () => {
  99. updateHandler();
  100. }}
  101. >
  102. <div class="mt-0.5 space-y-3 overflow-y-scroll scrollbar-hidden h-full">
  103. {#if adminConfig !== null}
  104. <div class="">
  105. <div class="mb-3.5">
  106. <div class=" mb-2.5 text-base font-medium">{$i18n.t('General')}</div>
  107. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  108. <div class="mb-2.5">
  109. <div class=" mb-1 text-xs font-medium flex space-x-2 items-center">
  110. <div>
  111. {$i18n.t('Version')}
  112. </div>
  113. </div>
  114. <div class="flex w-full justify-between items-center">
  115. <div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
  116. <div class="flex gap-1">
  117. <Tooltip content={WEBUI_BUILD_HASH}>
  118. v{WEBUI_VERSION}
  119. </Tooltip>
  120. <a
  121. href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
  122. target="_blank"
  123. >
  124. {updateAvailable === null
  125. ? $i18n.t('Checking for updates...')
  126. : updateAvailable
  127. ? `(v${version.latest} ${$i18n.t('available!')})`
  128. : $i18n.t('(latest)')}
  129. </a>
  130. </div>
  131. <button
  132. class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
  133. type="button"
  134. on:click={() => {
  135. showChangelog.set(true);
  136. }}
  137. >
  138. <div>{$i18n.t("See what's new")}</div>
  139. </button>
  140. </div>
  141. <button
  142. class=" text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
  143. type="button"
  144. on:click={() => {
  145. checkForVersionUpdates();
  146. }}
  147. >
  148. {$i18n.t('Check for updates')}
  149. </button>
  150. </div>
  151. </div>
  152. <div class="mb-2.5">
  153. <div class="flex w-full justify-between items-center">
  154. <div class="text-xs pr-2">
  155. <div class="">
  156. {$i18n.t('Help')}
  157. </div>
  158. <div class=" text-xs text-gray-500">
  159. {$i18n.t('Discover how to use Open WebUI and seek support from the community.')}
  160. </div>
  161. </div>
  162. <a
  163. class="flex-shrink-0 text-xs font-medium underline"
  164. href="https://docs.openwebui.com/"
  165. target="_blank"
  166. >
  167. {$i18n.t('Documentation')}
  168. </a>
  169. </div>
  170. <div class="mt-1">
  171. <div class="flex space-x-1">
  172. <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
  173. <img
  174. alt="Discord"
  175. src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
  176. />
  177. </a>
  178. <a href="https://twitter.com/OpenWebUI" target="_blank">
  179. <img
  180. alt="X (formerly Twitter) Follow"
  181. src="https://img.shields.io/twitter/follow/OpenWebUI"
  182. />
  183. </a>
  184. <a href="https://github.com/open-webui/open-webui" target="_blank">
  185. <img
  186. alt="Github Repo"
  187. src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
  188. />
  189. </a>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="mb-2.5">
  194. <div class="flex w-full justify-between items-center">
  195. <div class="text-xs pr-2">
  196. <div class="">
  197. {$i18n.t('License')}
  198. </div>
  199. {#if $config?.license_metadata}
  200. <a
  201. href="https://docs.openwebui.com/enterprise"
  202. target="_blank"
  203. class="text-gray-500 mt-0.5"
  204. >
  205. <span class=" capitalize text-black dark:text-white"
  206. >{$config?.license_metadata?.type}
  207. license</span
  208. >
  209. registered to
  210. <span class=" capitalize text-black dark:text-white"
  211. >{$config?.license_metadata?.organization_name}</span
  212. >
  213. for
  214. <span class=" font-medium text-black dark:text-white"
  215. >{$config?.license_metadata?.seats ?? 'Unlimited'} users.</span
  216. >
  217. </a>
  218. {#if $config?.license_metadata?.html}
  219. <div class="mt-0.5">
  220. {@html DOMPurify.sanitize($config?.license_metadata?.html)}
  221. </div>
  222. {/if}
  223. {:else}
  224. <a
  225. class=" text-xs hover:underline"
  226. href="https://docs.openwebui.com/enterprise"
  227. target="_blank"
  228. >
  229. <span class="text-gray-500">
  230. {$i18n.t(
  231. 'Upgrade to a licensed plan for enhanced capabilities, including custom theming and branding, and dedicated support.'
  232. )}
  233. </span>
  234. </a>
  235. {/if}
  236. </div>
  237. <!-- <button
  238. class="flex-shrink-0 text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
  239. >
  240. {$i18n.t('Activate')}
  241. </button> -->
  242. </div>
  243. </div>
  244. </div>
  245. <div class="mb-3">
  246. <div class=" mb-2.5 text-base font-medium">{$i18n.t('Authentication')}</div>
  247. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  248. <div class=" mb-2.5 flex w-full justify-between">
  249. <div class=" self-center text-xs font-medium">{$i18n.t('Default User Role')}</div>
  250. <div class="flex items-center relative">
  251. <select
  252. class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
  253. bind:value={adminConfig.DEFAULT_USER_ROLE}
  254. placeholder="Select a role"
  255. >
  256. <option value="pending">{$i18n.t('pending')}</option>
  257. <option value="user">{$i18n.t('user')}</option>
  258. <option value="admin">{$i18n.t('admin')}</option>
  259. </select>
  260. </div>
  261. </div>
  262. <div class=" mb-2.5 flex w-full justify-between pr-2">
  263. <div class=" self-center text-xs font-medium">{$i18n.t('Enable New Sign Ups')}</div>
  264. <Switch bind:state={adminConfig.ENABLE_SIGNUP} />
  265. </div>
  266. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  267. <div class=" self-center text-xs font-medium">
  268. {$i18n.t('Show Admin Details in Account Pending Overlay')}
  269. </div>
  270. <Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} />
  271. </div>
  272. <div class="mb-2.5">
  273. <div class=" self-center text-xs font-medium mb-2">
  274. {$i18n.t('Pending User Overlay Title')}
  275. </div>
  276. <Textarea
  277. rows={2}
  278. placeholder={$i18n.t(
  279. 'Enter a title for the pending user info overlay. Leave empty for default.'
  280. )}
  281. bind:value={adminConfig.PENDING_USER_OVERLAY_TITLE}
  282. />
  283. </div>
  284. <div class="mb-2.5">
  285. <div class=" self-center text-xs font-medium mb-2">
  286. {$i18n.t('Pending User Overlay Content')}
  287. </div>
  288. <Textarea
  289. placeholder={$i18n.t(
  290. 'Enter content for the pending user info overlay. Leave empty for default.'
  291. )}
  292. bind:value={adminConfig.PENDING_USER_OVERLAY_CONTENT}
  293. />
  294. </div>
  295. <div class="mb-2.5 flex w-full justify-between pr-2">
  296. <div class=" self-center text-xs font-medium">{$i18n.t('Enable API Key')}</div>
  297. <Switch bind:state={adminConfig.ENABLE_API_KEY} />
  298. </div>
  299. {#if adminConfig?.ENABLE_API_KEY}
  300. <div class="mb-2.5 flex w-full justify-between pr-2">
  301. <div class=" self-center text-xs font-medium">
  302. {$i18n.t('API Key Endpoint Restrictions')}
  303. </div>
  304. <Switch bind:state={adminConfig.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS} />
  305. </div>
  306. {#if adminConfig?.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS}
  307. <div class=" flex w-full flex-col pr-2">
  308. <div class=" text-xs font-medium">
  309. {$i18n.t('Allowed Endpoints')}
  310. </div>
  311. <input
  312. class="w-full mt-1 rounded-lg text-sm dark:text-gray-300 bg-transparent outline-hidden"
  313. type="text"
  314. placeholder={`e.g.) /api/v1/messages, /api/v1/channels`}
  315. bind:value={adminConfig.API_KEY_ALLOWED_ENDPOINTS}
  316. />
  317. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  318. <!-- https://docs.openwebui.com/getting-started/advanced-topics/api-endpoints -->
  319. <a
  320. href="https://docs.openwebui.com/getting-started/api-endpoints"
  321. target="_blank"
  322. class=" text-gray-300 font-medium underline"
  323. >
  324. {$i18n.t('To learn more about available endpoints, visit our documentation.')}
  325. </a>
  326. </div>
  327. </div>
  328. {/if}
  329. {/if}
  330. <div class=" mb-2.5 w-full justify-between">
  331. <div class="flex w-full justify-between">
  332. <div class=" self-center text-xs font-medium">{$i18n.t('JWT Expiration')}</div>
  333. </div>
  334. <div class="flex mt-2 space-x-2">
  335. <input
  336. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  337. type="text"
  338. placeholder={`e.g.) "30m","1h", "10d". `}
  339. bind:value={adminConfig.JWT_EXPIRES_IN}
  340. />
  341. </div>
  342. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  343. {$i18n.t('Valid time units:')}
  344. <span class=" text-gray-300 font-medium"
  345. >{$i18n.t("'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.")}</span
  346. >
  347. </div>
  348. </div>
  349. <div class=" space-y-3">
  350. <div class="mt-2 space-y-2 pr-1.5">
  351. <div class="flex justify-between items-center text-sm">
  352. <div class=" font-medium">{$i18n.t('LDAP')}</div>
  353. <div class="mt-1">
  354. <Switch bind:state={ENABLE_LDAP} />
  355. </div>
  356. </div>
  357. {#if ENABLE_LDAP}
  358. <div class="flex flex-col gap-1">
  359. <div class="flex w-full gap-2">
  360. <div class="w-full">
  361. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  362. {$i18n.t('Label')}
  363. </div>
  364. <input
  365. class="w-full bg-transparent outline-hidden py-0.5"
  366. required
  367. placeholder={$i18n.t('Enter server label')}
  368. bind:value={LDAP_SERVER.label}
  369. />
  370. </div>
  371. <div class="w-full"></div>
  372. </div>
  373. <div class="flex w-full gap-2">
  374. <div class="w-full">
  375. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  376. {$i18n.t('Host')}
  377. </div>
  378. <input
  379. class="w-full bg-transparent outline-hidden py-0.5"
  380. required
  381. placeholder={$i18n.t('Enter server host')}
  382. bind:value={LDAP_SERVER.host}
  383. />
  384. </div>
  385. <div class="w-full">
  386. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  387. {$i18n.t('Port')}
  388. </div>
  389. <Tooltip
  390. placement="top-start"
  391. content={$i18n.t('Default to 389 or 636 if TLS is enabled')}
  392. className="w-full"
  393. >
  394. <input
  395. class="w-full bg-transparent outline-hidden py-0.5"
  396. type="number"
  397. placeholder={$i18n.t('Enter server port')}
  398. bind:value={LDAP_SERVER.port}
  399. />
  400. </Tooltip>
  401. </div>
  402. </div>
  403. <div class="flex w-full gap-2">
  404. <div class="w-full">
  405. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  406. {$i18n.t('Application DN')}
  407. </div>
  408. <Tooltip
  409. content={$i18n.t('The Application Account DN you bind with for search')}
  410. placement="top-start"
  411. >
  412. <input
  413. class="w-full bg-transparent outline-hidden py-0.5"
  414. required
  415. placeholder={$i18n.t('Enter Application DN')}
  416. bind:value={LDAP_SERVER.app_dn}
  417. />
  418. </Tooltip>
  419. </div>
  420. <div class="w-full">
  421. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  422. {$i18n.t('Application DN Password')}
  423. </div>
  424. <SensitiveInput
  425. placeholder={$i18n.t('Enter Application DN Password')}
  426. bind:value={LDAP_SERVER.app_dn_password}
  427. />
  428. </div>
  429. </div>
  430. <div class="flex w-full gap-2">
  431. <div class="w-full">
  432. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  433. {$i18n.t('Attribute for Mail')}
  434. </div>
  435. <Tooltip
  436. content={$i18n.t(
  437. 'The LDAP attribute that maps to the mail that users use to sign in.'
  438. )}
  439. placement="top-start"
  440. >
  441. <input
  442. class="w-full bg-transparent outline-hidden py-0.5"
  443. required
  444. placeholder={$i18n.t('Example: mail')}
  445. bind:value={LDAP_SERVER.attribute_for_mail}
  446. />
  447. </Tooltip>
  448. </div>
  449. </div>
  450. <div class="flex w-full gap-2">
  451. <div class="w-full">
  452. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  453. {$i18n.t('Attribute for Username')}
  454. </div>
  455. <Tooltip
  456. content={$i18n.t(
  457. 'The LDAP attribute that maps to the username that users use to sign in.'
  458. )}
  459. placement="top-start"
  460. >
  461. <input
  462. class="w-full bg-transparent outline-hidden py-0.5"
  463. required
  464. placeholder={$i18n.t(
  465. 'Example: sAMAccountName or uid or userPrincipalName'
  466. )}
  467. bind:value={LDAP_SERVER.attribute_for_username}
  468. />
  469. </Tooltip>
  470. </div>
  471. </div>
  472. <div class="flex w-full gap-2">
  473. <div class="w-full">
  474. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  475. {$i18n.t('Search Base')}
  476. </div>
  477. <Tooltip
  478. content={$i18n.t('The base to search for users')}
  479. placement="top-start"
  480. >
  481. <input
  482. class="w-full bg-transparent outline-hidden py-0.5"
  483. required
  484. placeholder={$i18n.t('Example: ou=users,dc=foo,dc=example')}
  485. bind:value={LDAP_SERVER.search_base}
  486. />
  487. </Tooltip>
  488. </div>
  489. </div>
  490. <div class="flex w-full gap-2">
  491. <div class="w-full">
  492. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  493. {$i18n.t('Search Filters')}
  494. </div>
  495. <input
  496. class="w-full bg-transparent outline-hidden py-0.5"
  497. placeholder={$i18n.t('Example: (&(objectClass=inetOrgPerson)(uid=%s))')}
  498. bind:value={LDAP_SERVER.search_filters}
  499. />
  500. </div>
  501. </div>
  502. <div class="text-xs text-gray-400 dark:text-gray-500">
  503. <a
  504. class=" text-gray-300 font-medium underline"
  505. href="https://ldap.com/ldap-filters/"
  506. target="_blank"
  507. >
  508. {$i18n.t('Click here for filter guides.')}
  509. </a>
  510. </div>
  511. <div>
  512. <div class="flex justify-between items-center text-sm">
  513. <div class=" font-medium">{$i18n.t('TLS')}</div>
  514. <div class="mt-1">
  515. <Switch bind:state={LDAP_SERVER.use_tls} />
  516. </div>
  517. </div>
  518. {#if LDAP_SERVER.use_tls}
  519. <div class="flex w-full gap-2">
  520. <div class="w-full">
  521. <div class=" self-center text-xs font-medium min-w-fit mb-1 mt-1">
  522. {$i18n.t('Certificate Path')}
  523. </div>
  524. <input
  525. class="w-full bg-transparent outline-hidden py-0.5"
  526. placeholder={$i18n.t('Enter certificate path')}
  527. bind:value={LDAP_SERVER.certificate_path}
  528. />
  529. </div>
  530. </div>
  531. <div class="flex justify-between items-center text-xs">
  532. <div class=" font-medium">Validate certificate</div>
  533. <div class="mt-1">
  534. <Switch bind:state={LDAP_SERVER.validate_cert} />
  535. </div>
  536. </div>
  537. <div class="flex w-full gap-2">
  538. <div class="w-full">
  539. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  540. {$i18n.t('Ciphers')}
  541. </div>
  542. <Tooltip content={$i18n.t('Default to ALL')} placement="top-start">
  543. <input
  544. class="w-full bg-transparent outline-hidden py-0.5"
  545. placeholder={$i18n.t('Example: ALL')}
  546. bind:value={LDAP_SERVER.ciphers}
  547. />
  548. </Tooltip>
  549. </div>
  550. <div class="w-full"></div>
  551. </div>
  552. {/if}
  553. </div>
  554. </div>
  555. {/if}
  556. </div>
  557. </div>
  558. </div>
  559. <div class="mb-3">
  560. <div class=" mb-2.5 text-base font-medium">{$i18n.t('Features')}</div>
  561. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  562. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  563. <div class=" self-center text-xs font-medium">
  564. {$i18n.t('Enable Community Sharing')}
  565. </div>
  566. <Switch bind:state={adminConfig.ENABLE_COMMUNITY_SHARING} />
  567. </div>
  568. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  569. <div class=" self-center text-xs font-medium">{$i18n.t('Enable Message Rating')}</div>
  570. <Switch bind:state={adminConfig.ENABLE_MESSAGE_RATING} />
  571. </div>
  572. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  573. <div class=" self-center text-xs font-medium">
  574. {$i18n.t('Notes')} ({$i18n.t('Beta')})
  575. </div>
  576. <Switch bind:state={adminConfig.ENABLE_NOTES} />
  577. </div>
  578. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  579. <div class=" self-center text-xs font-medium">
  580. {$i18n.t('Channels')} ({$i18n.t('Beta')})
  581. </div>
  582. <Switch bind:state={adminConfig.ENABLE_CHANNELS} />
  583. </div>
  584. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  585. <div class=" self-center text-xs font-medium">
  586. {$i18n.t('User Webhooks')}
  587. </div>
  588. <Switch bind:state={adminConfig.ENABLE_USER_WEBHOOKS} />
  589. </div>
  590. <div class="mb-2.5">
  591. <div class=" self-center text-xs font-medium mb-2">
  592. {$i18n.t('Response Watermark')}
  593. </div>
  594. <Textarea
  595. placeholder={$i18n.t('Enter a watermark for the response. Leave empty for none.')}
  596. bind:value={adminConfig.RESPONSE_WATERMARK}
  597. />
  598. </div>
  599. <div class="mb-2.5 w-full justify-between">
  600. <div class="flex w-full justify-between">
  601. <div class=" self-center text-xs font-medium">{$i18n.t('WebUI URL')}</div>
  602. </div>
  603. <div class="flex mt-2 space-x-2">
  604. <input
  605. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  606. type="text"
  607. placeholder={`e.g.) "http://localhost:3000"`}
  608. bind:value={adminConfig.WEBUI_URL}
  609. />
  610. </div>
  611. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  612. {$i18n.t(
  613. 'Enter the public URL of your WebUI. This URL will be used to generate links in the notifications.'
  614. )}
  615. </div>
  616. </div>
  617. <div class=" w-full justify-between">
  618. <div class="flex w-full justify-between">
  619. <div class=" self-center text-xs font-medium">{$i18n.t('Webhook URL')}</div>
  620. </div>
  621. <div class="flex mt-2 space-x-2">
  622. <input
  623. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  624. type="text"
  625. placeholder={`https://example.com/webhook`}
  626. bind:value={webhookUrl}
  627. />
  628. </div>
  629. </div>
  630. </div>
  631. </div>
  632. {/if}
  633. </div>
  634. <div class="flex justify-end pt-3 text-sm font-medium">
  635. <button
  636. class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full"
  637. type="submit"
  638. >
  639. {$i18n.t('Save')}
  640. </button>
  641. </div>
  642. </form>