Andela Notifications Updated

This commit is contained in:
2026-07-07 19:39:32 +00:00
parent eb0bda57a7
commit dcd00af6bb
16 changed files with 1277 additions and 0 deletions

69
job-notifier/settings.js Normal file
View File

@@ -0,0 +1,69 @@
// settings.js - Handle secure configuration storage
document.addEventListener('DOMContentLoaded', function () {
chrome.storage.local.get(
[
'appsScriptUrl',
'appsScriptKey',
'loginEmail',
'ntfyServer',
'ntfyTopic',
'ntfyToken',
],
function (result) {
if (result.appsScriptUrl)
document.getElementById('appsScriptUrl').value = result.appsScriptUrl;
if (result.appsScriptKey)
document.getElementById('appsScriptKey').value = result.appsScriptKey;
if (result.loginEmail)
document.getElementById('loginEmail').value = result.loginEmail;
document.getElementById('ntfyServer').value =
result.ntfyServer || 'https://notify.tstitagency.com';
if (result.ntfyTopic)
document.getElementById('ntfyTopic').value = result.ntfyTopic;
if (result.ntfyToken)
document.getElementById('ntfyToken').value = result.ntfyToken;
},
);
document.getElementById('saveBtn').addEventListener('click', function () {
var appsScriptUrl = document.getElementById('appsScriptUrl').value.trim();
var appsScriptKey = document.getElementById('appsScriptKey').value.trim();
var loginEmail = document.getElementById('loginEmail').value.trim();
var ntfyServer = document.getElementById('ntfyServer').value.trim();
var ntfyTopic = document.getElementById('ntfyTopic').value.trim();
var ntfyToken = document.getElementById('ntfyToken').value.trim();
if (!appsScriptUrl)
return showStatus('Please enter Apps Script URL', 'error');
if (!appsScriptUrl.startsWith('https://script.google.com/'))
return showStatus('Invalid Apps Script URL', 'error');
if (!appsScriptKey) return showStatus('Please enter Secret Key', 'error');
if (!loginEmail || !loginEmail.includes('@'))
return showStatus('Please enter a valid email', 'error');
chrome.storage.local.set(
{
appsScriptUrl: appsScriptUrl,
appsScriptKey: appsScriptKey,
loginEmail: loginEmail,
ntfyServer: ntfyServer,
ntfyTopic: ntfyTopic,
ntfyToken: ntfyToken,
},
function () {
showStatus('Settings saved successfully!', 'success');
},
);
});
});
function showStatus(message, type) {
var statusEl = document.getElementById('status');
statusEl.textContent = message;
statusEl.className = 'status ' + type;
statusEl.style.display = 'block';
setTimeout(function () {
statusEl.style.display = 'none';
}, 3000);
}