// Credentials schema per provider name. Defines the fields to collect and how to label them. const PROVIDER_CREDENTIAL_SCHEMAS = { // todo Figure out SOTA authentication // see e.g. https://github.com/ham2k/app-polo/blob/main/src/extensions/activities/sota/SOTAAccount.jsx // https://github.com/ham2k/app-polo/blob/main/src/store/apis/apiSOTA/apiSOTA.js // Refresh token? Way to show user that they need to log in again because cached credentials aren't valid? // todo type: text/password distinction on text boxes so API keys can be obscured "SOTA": [ {key: "access_token", label: "SOTA Access Token", help: ""}, {key: "id_token", label: "SOTA ID Token", help: "TODO SOTA authentication to provide this..."} ], "ParksNPeaks": [ {key: "user_id", label: "Parks N Peaks User ID", help: ""}, {key: "api_key", label: "Parks N Peaks API Key", help: "Get your API key from your Parks N Peaks account."} ], "ZLOTA": [ {key: "user_id", label: "ZLOTA User ID", help: ""}, {key: "api_key", label: "ZLOTA User PIN", help: "Get your PIN from your ZLOTA account."} ], "Tiles": [ { key: "offline_spot_gateway_pin", label: "Offline Spot Gateway PIN", help: "Get your PIN from your Tiles on the Air account profile." } ] }; // Load and inject the reCAPTCHA script function loadRecaptcha() { if (!document.getElementById('recaptcha-script')) { const script = document.createElement('script'); script.id = 'recaptcha-script'; script.src = 'https://www.google.com/recaptcha/api.js?render=explicit&onload=renderRecaptcha'; script.async = true; script.defer = true; document.head.appendChild(script); } $("#recaptcha-area").show(); } // Called by reCAPTCHA after its script loads function renderRecaptcha() { window._recaptchaWidgetId = grecaptcha.render('recaptcha-widget', { sitekey: RECAPTCHA_SITE_KEY, size: 'normal' }); } // Update the "Send spot to..." area based on the currently selected activity function updateUpstreamArea() { if (!ALLOW_UPSTREAM_SPOTTING) { $("#upstream-area").hide(); return; } const providers = SPOT_SUBMIT_PROVIDERS[$("#activity").val()] || []; if (providers.length === 0) { $("#upstream-area").hide(); return; } $("#upstream-area").show(); // Update the provider selector $("#upstream-provider-select").empty(); $.each(providers, function (i, name) { $("#upstream-provider-select").append($('