Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
39 changes: 31 additions & 8 deletions content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,38 @@
}
} catch (error) {
console.error("Failed to push solution:", error)
showError(error.message || "Unknown error occurred while pushing solution")

pushBtn.classList.remove("loading")
pushBtn.classList.add("error")
pushBtn.textContent = "Error"
await sleep(2000)
pushBtn.disabled = false
pushBtn.classList.remove("error")
pushBtn.textContent = `Push (${SHORTCUT_DISPLAY})`
// Check if it's an authentication error (401)
const errorMessage = error.message || ""
const isAuthError = errorMessage.includes("401") ||
errorMessage.includes("Authentication failed") ||
errorMessage.includes("invalid or expired")

if (isAuthError) {
// Clear the invalid token
localStorage.removeItem("token")
localStorage.removeItem("branch")

showError("Authentication failed. Your GitHub token is invalid or expired. Please enter a new token.")

// Reset button state first
pushBtn.classList.remove("loading")
pushBtn.disabled = false
pushBtn.textContent = `Push (${SHORTCUT_DISPLAY})`

// Show config modal to let user update credentials
showConfigModal()
} else {
showError(errorMessage || "Unknown error occurred while pushing solution")

pushBtn.classList.remove("loading")
pushBtn.classList.add("error")
pushBtn.textContent = "Error"
await sleep(2000)
pushBtn.disabled = false
pushBtn.classList.remove("error")
pushBtn.textContent = `Push (${SHORTCUT_DISPLAY})`
}
}
}

Expand Down