Do not mandate the usage of an API key for Pi-hole v6

pull/927/head
tanasegabriel 2025-05-06 10:26:22 +00:00
parent 517de68e74
commit 7c27ae03ad
1 changed files with 3 additions and 13 deletions

View File

@ -116,14 +116,6 @@ export default {
this.sessionExpiry = null;
},
authenticate: async function () {
if (!this.item.apikey) {
this.handleError(
"API key is required for PiHole authentication",
"disabled",
);
return false;
}
try {
const authResponse = await this.fetch("/api/auth", {
method: "POST",
@ -166,7 +158,7 @@ export default {
},
fetchStatus: async function () {
try {
if (!this.isAuthenticated) {
if (!this.isAuthenticated && this.item.apikey) {
const authenticated = await this.authenticate();
if (!authenticated) return;
}
@ -182,10 +174,8 @@ export default {
this.percent_blocked = response.queries.percent_blocked;
this.retryCount = 0;
} catch (e) {
if (
e.message.includes("401 error") ||
e.message.includes("403 error")
) {
const isAuthError = e.message.includes("401 error") || e.message.includes("403 error");
if (isAuthError && this.item.apikey) {
this.removeCacheSession();
return this.retryWithDelay();
}