### Docker Setup Function Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Enables the locale input and proceeds to the next page. Specific to Docker environment setup. ```javascript function dockerSetup(){ $("#inputLocale").attr("disabled", false); nextPage(); } ``` -------------------------------- ### Windows Setup Function Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Disables the locale input and proceeds to the next page. Specific to Windows environment setup. ```javascript function windowsSetup(){ $("#inputLocale").attr("disabled", true); nextPage(); } ``` -------------------------------- ### Download and Run LubeLogger with Docker Compose Source: https://github.com/hargata/lubelog/wiki/Home Use these commands to download the Docker Compose file, pull the necessary images, and start LubeLogger in detached mode. ```bash curl https://raw.githubusercontent.com/hargata/lubelog/main/docker-compose.yml -o docker-compose.yml docker compose pull docker compose up -d ``` -------------------------------- ### Build LubeLogger Docker Image from Source Source: https://github.com/hargata/lubelog/wiki/Home Clone the repository and use this command to build a Docker image for LubeLogger, specifying the target architecture. ```bash docker build --build-arg="TARGETARCH=linux/amd64" -t lubelogger -f Dockerfile . ``` -------------------------------- ### Restore .NET Project Dependencies Source: https://github.com/hargata/lubelog/wiki/Home After cloning the repository, run this command in the console to restore the project's dependencies. ```bash dotnet restore ``` -------------------------------- ### Handle AppSettings Upload and Merge Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Triggers file upload and merges uploaded appsettings.json content with existing configurations. Requires elements with IDs 'appSettingsUpload' and 'outputModalText'. ```javascript function uploadAndMerge(){ $("#appSettingsUpload").click(); } function readUploadedFile(){ let fl_files = $("#appSettingsUpload")[0].files; if (fl_files.length == 0) { return; } let fl_file = fl_files[0]; let reader = new FileReader(); let display_file = ( e ) => { mergeIntoUploadedFile(e.target.result); }; let on_reader_load = ( fl ) => { return display_file; }; reader.onload = on_reader_load( fl_file ); reader.readAsText( fl_file ); } function mergeIntoUploadedFile(fileContents){ var newJsonObject = JSON.parse("{\"" + $("#outputModalText").text() + "\"}"); var currentJsonObject = JSON.parse(fileContents); var mergedJsonObject = {...currentJsonObject, ...newJsonObject}; $("#outputModalLabel").text("Content for appsettings.json"); $("#outputModalText").text(JSON.stringify(mergedJsonObject, null, 2)); $("#appSettingsUpload").val(""); } ``` -------------------------------- ### Generate appsettings.json Configuration Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Generates and displays the appsettings.json configuration based on user inputs. Handles Kestrel endpoint configuration with inline certificate details. ```javascript if ($('#inputCertPath').val().trim() != ''){ windowConfig\["Kestrel"\ ] = { Endpoints: { Http: { Url: $("#inputHttpURL").val() }, HttpsInlineCertFile: { Url: $("#inputHttpsURL").val(), Certificate: { Path: $("#inputCertPath").val(), Password: $("#inputCertPassword").val() } } } } } $("#outputModalLabel").text("Append into appsettings.json"); $("#outputModalText").text(JSON.stringify(windowConfig, null, 2).slice(1,-1)); $(".btn-strip").hide(); if (jQuery.isEmptyObject(windowConfig)){ $(".btn-upload").hide(); } else { $(".btn-upload").show(); } $("#outputModal").modal("show"); ``` -------------------------------- ### Generate .env File Configuration Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Generates and displays the .env file content based on user inputs. Supports various settings including locale, file extensions, URLs, database connections, and authentication configurations. ```javascript var dockerConfig = [] if ($('#inputLocale').val().trim() != ''){ dockerConfig.push(`LC_ALL=${$('#inputLocale').val()}`); dockerConfig.push(`LANG=${$('#inputLocale').val()}`); } if ($('#inputFileExtensions').val().trim() != ''){ dockerConfig.push(`LUBELOGGER_ALLOWED_FILE_EXTENSIONS="${$('#inputFileExtensions').val()}"`); } if ($('#inputCustomLogo').val().trim() != ''){ dockerConfig.push(`LUBELOGGER_LOGO_URL="${$('#inputCustomLogo').val()}"`); } if ($('#inputCustomSmallLogo').val().trim() != ''){ dockerConfig.push(`LUBELOGGER_LOGO_SMALL_URL="${$('#inputCustomSmallLogo').val()}"`); } if ($('#inputMOTD').val().trim() != '') { dockerConfig.push(`LUBELOGGER_MOTD="${$('#inputMOTD').val()}"`); } if ($('#inputWebHook').val().trim() != '') { dockerConfig.push(`LUBELOGGER_WEBHOOK="${$('#inputWebHook').val()}"`); } if ($("#inputPostgres").val().trim() != ''){ dockerConfig.push(`POSTGRES_CONNECTION="${$('#inputPostgres').val()}"`); } if ($("#inputServerDomain").val().trim() != ''){ dockerConfig.push(`LUBELOGGER_DOMAIN="${$('#inputServerDomain').val()}"`); } if ($("#inputCustomWidgets").is(":checked")){ dockerConfig.push(`LUBELOGGER_CUSTOM_WIDGETS="${$('#inputCustomWidgets').is(':checked')}"`); } if ($("#inputInvariantAPI").is(":checked")){ dockerConfig.push(`LUBELOGGER_INVARIANT_API="${$('#inputInvariantAPI').is(':checked')}"`); } if ($('#inputSmtpServer').val().trim() != ''){ dockerConfig.push(`MailConfig__EmailServer="${$('#inputSmtpServer').val()}"`); dockerConfig.push(`MailConfig__EmailFrom="${$('#inputSmtpFrom').val()}"`); dockerConfig.push(`MailConfig__Port=${$('#inputSmtpPort').val()}`); dockerConfig.push(`MailConfig__Username="${$('#inputSmtpUsername').val()}"`); dockerConfig.push(`MailConfig__Password="${$('#inputSmtpPassword').val()}"`); } if ($('#inputOIDCName').val().trim() != ''){ dockerConfig.push(`OpenIDConfig__Name="${$('#inputOIDCName').val()}"`); dockerConfig.push(`OpenIDConfig__ClientId="${$('#inputOIDCClientId').val()}"`); dockerConfig.push(`OpenIDConfig__ClientSecret="${$('#inputOIDCClientSecret').val()}"`); dockerConfig.push(`OpenIDConfig__AuthURL="${$('#inputOIDCAuthURL').val()}"`); dockerConfig.push(`OpenIDConfig__TokenURL="${$('#inputOIDCTokenURL').val()}"`); dockerConfig.push(`OpenIDConfig__UserInfoURL="${$('#inputOIDCUserInfoURL').val()}"`); dockerConfig.push(`OpenIDConfig__RedirectURL="${redirectUrl}"`); dockerConfig.push(`OpenIDConfig__Scope="${$('#inputOIDCScope').val()}"`); dockerConfig.push(`OpenIDConfig__ValidateState=${$('#inputOIDCValidateState').is(':checked')}`); dockerConfig.push(`OpenIDConfig__UsePKCE=${$('#inputOIDCUsePKCE').is(':checked')}`); dockerConfig.push(`OpenIDConfig__DisableRegularLogin=${$('#inputOIDCOnly').is(':checked')}`); dockerConfig.push(`OpenIDConfig__LogOutURL="${$('#inputOIDCLogOutURL').val()}"`); } if ($('#inputCertPath').val().trim() != ''){ dockerConfig.push(`ASPNETCORE_Kestrel__Certificates__Default__Path="${$('#inputCertPath').val()}"`); dockerConfig.push(`ASPNETCORE_Kestrel__Certificates__Default__Password="${$('#inputCertPassword').val()}"`); dockerConfig.push(`ASPNETCORE_URLS="${$('#inputHttpURL').val()};${$('#inputHttpsURL').val()}"`); } $("#outputModalLabel").text("Content for .env"); $("#outputModalText").text(dockerConfig.join("\r\n")); $(".btn-strip").show(); $(".btn-upload").hide(); $("#outputModal").modal("show"); ``` -------------------------------- ### Navigate to Previous Page Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Navigates the user to the previous page in a multi-page interface. Hides the current page and displays the previous one, adjusting navigation button states. ```javascript function previousPage(){ var nextPageIndex = parseInt($(".page:not('.d-none')").attr('data-page-order')) - 1; var nextPage = $(\`.page[data-page-order='${nextPageIndex}']"); if (nextPage.length > 0){ $(".page").addClass("d-none"); nextPage.removeClass("d-none"); //check if first page var pageIndexes = $(".page").m ``` -------------------------------- ### Set Locale Input from Browser Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Sets the value of an input field to the user's browser language, replacing hyphens with underscores. Initializes the locale input. ```javascript function setLocaleInput(){ var browserLocale = navigator.language; $("#inputLocale").val(browserLocale.replace('-','_')); } setLocaleInput(); ``` -------------------------------- ### Navigate to Next Page Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Advances the user to the next page in a multi-page interface. Hides the current page and shows the next one, updating navigation button visibility. ```javascript function nextPage(){ var nextPageIndex = parseInt($(".page:not('.d-none')").attr('data-page-order')) + 1; var nextPage = $(\`.page[data-page-order='${nextPageIndex}']"); if (nextPage.length > 0){ $(".page").addClass("d-none"); nextPage.removeClass("d-none"); //check if last page var pageIndexes = $(".page").map((x,y)=>{ return $(y).attr("data-page-order"); }).toArray(); if (nextPageIndex == pageIndexes[pageIndexes.length - 1]){ $(".btn-next").addClass("d-none"); $(".btn-prev").removeClass("d-none"); $(".btn-done").removeClass("d-none"); } else { $(".btn-next").removeClass("d-none"); $(".btn-prev").removeClass("d-none"); } } } ``` -------------------------------- ### Generate LubeLogger Configuration Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Generates configuration settings based on user inputs from various form elements. It constructs a configuration object, including nested objects for MailConfig and OpenIDConfig, and updates the UI with the generated JSON. ```javascript function generateConfig(){ var winSetup = $("#inputLocale").attr("disabled"); var redirectUrl = $("#inputOIDCRedirectURL").val().trim(); if (redirectUrl != ''){ if (!redirectUrl.includes('/Login/RemoteAuth')) { if (redirectUrl.slice(-1) == "/"){ redirectUrl += 'Login/RemoteAuth'; } else { redirectUrl += '/Login/RemoteAuth'; } } } if (winSetup){ var windowConfig = {}; if ($('#inputFileExtensions').val().trim() != ''){ windowConfig["LUBELOGGER_ALLOWED_FILE_EXTENSIONS"] = $("#inputFileExtensions").val(); } if ($('#inputCustomLogo').val().trim() != ''){ windowConfig["LUBELOGGER_LOGO_URL"] = $("#inputCustomLogo").val(); } if ($('#inputCustomSmallLogo').val().trim() != ''){ windowConfig["LUBELOGGER_LOGO_SMALL_URL"] = $("#inputCustomSmallLogo").val(); } if ($('#inputMOTD').val().trim() != '') { windowConfig["LUBELOGGER_MOTD"] = $("#inputMOTD").val(); } if ($('#inputWebHook').val().trim() != '') { windowConfig["LUBELOGGER_WEBHOOK"] = $("#inputWebHook").val(); } if ($("#inputPostgres").val().trim() != ''){ windowConfig["POSTGRES_CONNECTION"]=$("#inputPostgres").val(); } if ($("#inputCustomWidgets").is(":checked")){ windowConfig["LUBELOGGER_CUSTOM_WIDGETS"]=$('#inputCustomWidgets').is(':checked'); } if ($("#inputInvariantAPI").is(":checked")){ windowConfig["LUBELOGGER_INVARIANT_API"]=$('#inputInvariantAPI').is(':checked'); } if ($("#inputServerDomain").val().trim() != ''){ windowConfig["LUBELOGGER_DOMAIN"] = $('#inputServerDomain').val(); } if ($('#inputSmtpServer').val().trim() != ''){ windowConfig["MailConfig"] = { EmailServer: $("#inputSmtpServer").val(), EmailFrom: $("#inputSmtpFrom").val(), Port: $("#inputSmtpPort").val(), Username: $("#inputSmtpUsername").val(), Password: $("#inputSmtpPassword").val() }; } if ($('#inputOIDCName').val().trim() != ''){ windowConfig["OpenIDConfig"] = { Name: $("#inputOIDCName").val(), ClientId: $("#inputOIDCClientId").val(), ClientSecret: $("#inputOIDCClientSecret").val(), AuthURL: $("#inputOIDCAuthURL").val(), TokenURL: $("#inputOIDCTokenURL").val(), UserInfoURL: $("#inputOIDCUserInfoURL").val(), RedirectURL: redirectUrl, Scope: $("#inputOIDCScope").val(), ValidateState: $("#inputOIDCValidateState").is(":checked"), UsePKCE: $("#inputOIDCUsePKCE").is(":checked"), DisableRegularLogin: $("#inputOIDCOnly").is(":checked"), LogOutURL: $("#inputOIDCLogOutURL").val() }; } if ($('#inpu ``` -------------------------------- ### Filter and Sum Insurance Costs from Tax Records API Source: https://github.com/hargata/lubelog/wiki/Scope-and-Purpose This pseudo-code demonstrates how to fetch tax records for a vehicle, filter them for insurance-related entries using tags, and calculate the total insurance cost. Ensure the API endpoint and data structure match your implementation. ```javascript var insuranceDataArray = fetch(`/api/vehicle/taxrecords?vehicleId=${GetVehicleId().vehicleId}`) var totalInsuranceCost = 0; insuranceDataArray.filter(x => x.tags.includes('insurance')).map(x=>{totalInsuranceCost += parseInt(x.cost)}); ``` -------------------------------- ### Control Navigation Button Visibility Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Hides or shows navigation buttons based on the current page index. Use when controlling step-by-step processes. ```javascript ap((x,y)=>{ return $(y).attr("data-page-order"); }).toArray(); if (nextPageIndex == pageIndexes[0]){ $(".btn-prev").addClass("d-none"); $(".btn-next").addClass("d-none"); $(".btn-done").addClass("d-none"); } else { $(".btn-prev").removeClass("d-none"); $(".btn-next").removeClass("d-none"); $(".btn-done").addClass("d-none"); } ``` -------------------------------- ### Copy Text to Clipboard Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Copies the value from a text area to the clipboard and provides visual feedback. Requires browser clipboard API support. ```javascript function copyToClipboard(){ navigator.clipboard.writeText($("#outputModalText").val()); $(".btn-copy").text("Copied"); setTimeout(() =>{ $(".btn-copy").text("Copy"); }, 500) } ``` -------------------------------- ### Toggle Password Visibility Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Switches an input field between password and text types, updating the associated icon. Toggles between eye and eye-slash icons. ```javascript function togglePasswordVisibility(elem) { var passwordField = $(elem).parent().siblings("input"); var passwordButton = $(elem).find('.bi'); if (passwordField.attr("type") == "password") { passwordField.attr("type", "text"); passwordButton.removeClass('bi-eye'); passwordButton.addClass('bi-eye-slash'); } else { passwordField.attr("type", "password"); passwordButton.removeClass('bi-eye-slash'); passwordButton.addClass('bi-eye'); } } ``` -------------------------------- ### Remove Double Quotes from Text Source: https://github.com/hargata/lubelog/blob/main/docs/configure/configurator.html Removes all double quotes from the text content of the element with ID 'outputModalText'. ```javascript function removeDoubleQuotes(){ var currentText = $("#outputModalText").text(); $("#outputModalText").text(currentText.replaceAll('"', '')); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.