General.svelte 22 KB

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