Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Migration from Basic Authentication #4

Merged
merged 7 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Popup/CS for Ignored
  • Loading branch information
smashedr committed Aug 26, 2024
commit 8217c2758c370aa1fc5ce2109f7b86cde82a1839
2 changes: 1 addition & 1 deletion src/html/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</div>
<button id="delete-saved" class="btn btn-outline-warning d-none">
<i class="fa-regular fa-trash-can me-1"></i>
Delete Saved Credentials
<span>Delete Saved Credentials</span>
</button>
<div id="username" class="text-center text-ellipsis d-none">
Username: <span class="fw-bold text-success-emphasis"></span>
Expand Down
21 changes: 13 additions & 8 deletions src/js/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ if (!chrome.storage.onChanged.hasListener(onChanged)) {
// console.debug('creds:', creds)
if (creds) {
tabEnabled = true
console.debug(
'%cFound Credentials for Current Site.',
'color: LimeGreen'
)
await chrome.runtime.sendMessage({
badgeText: 'On',
badgeColor: 'green',
})
if (creds === 'ignored') {
console.debug('%cSite is currently ignored.', 'color: Yellow')
await chrome.runtime.sendMessage({
badgeText: 'Off',
badgeColor: 'yellow',
})
} else {
console.debug('%cFound credentials for site.', 'color: LimeGreen')
await chrome.runtime.sendMessage({
badgeText: 'On',
badgeColor: 'green',
})
}
}
})()

Expand Down
15 changes: 11 additions & 4 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,25 @@ async function initPopup() {
const url = new URL(tab.url)
const creds = await Hosts.get(url.host)
if (creds) {
hostnameEl.classList.add('border-success')
if (creds === 'ignored') {
hostnameEl.classList.add('border-warning')
deleteSaved.querySelector('span').textContent =
'Remove Host from Ignore'
} else {
hostnameEl.classList.add('border-success')
usernameEl.querySelector('span').textContent =
creds.split(':')[0]
usernameEl.classList.remove('d-none')
}
hostnameEl.textContent = url.host
deleteSaved.classList.remove('d-none')
deleteSaved.dataset.value = url.host
deleteSaved.addEventListener('click', deleteHost)
usernameEl.querySelector('span').textContent = creds.split(':')[0]
usernameEl.classList.remove('d-none')
confirmDelete.dataset.value = url.host
confirmDeleteHost.textContent = url.host
} else {
hostnameEl.textContent = 'No Credentials Found for Tab.'
hostnameEl.classList.remove('border-success')
hostnameEl.classList.remove('border-success', 'border-warning')
deleteSaved.classList.add('d-none')
usernameEl.classList.add('d-none')
}
Expand Down