Fix opening Web, Desktop setup links on first run from Desktop app

Previous version failed to open the setup links
This commit is contained in:
Debanjum Singh Solanky 2024-06-16 13:10:51 +05:30
parent 632f55a9e8
commit 6814dadd21

View file

@ -880,14 +880,18 @@
function renderFirstRunSetupMessage() { function renderFirstRunSetupMessage() {
first_run_message = `<p class="first-run-message-heading">Hi 👋🏾, to get started:<p> first_run_message = `<p class="first-run-message-heading">Hi 👋🏾, to get started:<p>
<ol> <ol>
<li class="first-run-message-text">Generate an API token <a class='first-run-message-link' href="#" onclick="window.navigateAPI.navigateToWebSettings()">Khoj Web settings</a></li> <li class="first-run-message-text">Generate an API token <a id='first-run-web-config' class='first-run-message-link'>Khoj Web settings</a></li>
<li class="first-run-message-text">Paste it into the API Key field <a class='first-run-message-link' href="#" onclick="window.navigateAPI.navigateToSettings()">Khoj Desktop settings</a></li> <li class="first-run-message-text">Paste it into the API Key field <a id='first-run-desktop-config' class='first-run-message-link'>Khoj Desktop settings</a></li>
</ol>` </ol>`
.trim() .trim()
.replace(/(\r\n|\n|\r)/gm, ""); .replace(/(\r\n|\n|\r)/gm, "");
renderMessage(first_run_message, "khoj", null, null, true); renderMessage(first_run_message, "khoj", null, null, true);
// Open relevant setup links
document.getElementById("first-run-web-config").addEventListener('click', (event) => window.navigateAPI.navigateToWebSettings('config'));
document.getElementById("first-run-desktop-config").addEventListener('click', (event) => window.navigateAPI.navigateToSettings('config.html'));
// Disable chat input field and update placeholder text // Disable chat input field and update placeholder text
document.getElementById("chat-input").setAttribute("disabled", "disabled"); document.getElementById("chat-input").setAttribute("disabled", "disabled");
document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat"); document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat");