Fix : noAuth support for providers and adjusted MITM restart settings.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
# v0.3.89 (2026-04-13)
|
||||||
|
|
||||||
|
## Improvements
|
||||||
|
- Improved dashboard access control by blocking tunnel/Tailscale access when disabled
|
||||||
|
|
||||||
# v0.3.87 (2026-04-13)
|
# v0.3.87 (2026-04-13)
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ export const PROVIDERS = {
|
|||||||
opencode: {
|
opencode: {
|
||||||
baseUrl: "https://opencode.ai",
|
baseUrl: "https://opencode.ai",
|
||||||
format: "openai",
|
format: "openai",
|
||||||
headers: { "x-opencode-client": "desktop" }
|
headers: { "x-opencode-client": "desktop" },
|
||||||
|
noAuth: true
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export class BaseExecutor {
|
|||||||
constructor(provider, config) {
|
constructor(provider, config) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.noAuth = config?.noAuth || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getProvider() {
|
getProvider() {
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ export async function handleChatCore({ body, modelInfo, credentials, log, onCred
|
|||||||
return createErrorResult(HTTP_STATUS.BAD_GATEWAY, errMsg);
|
return createErrorResult(HTTP_STATUS.BAD_GATEWAY, errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle 401/403 - try token refresh
|
// Handle 401/403 - try token refresh (skip for noAuth providers)
|
||||||
if (providerResponse.status === HTTP_STATUS.UNAUTHORIZED || providerResponse.status === HTTP_STATUS.FORBIDDEN) {
|
if (!executor.noAuth && (providerResponse.status === HTTP_STATUS.UNAUTHORIZED || providerResponse.status === HTTP_STATUS.FORBIDDEN)) {
|
||||||
try {
|
try {
|
||||||
const newCredentials = await refreshWithRetry(() => executor.refreshCredentials(credentials, log), 3, log);
|
const newCredentials = await refreshWithRetry(() => executor.refreshCredentials(credentials, log), 3, log);
|
||||||
if (newCredentials?.accessToken || newCredentials?.copilotToken) {
|
if (newCredentials?.accessToken || newCredentials?.copilotToken) {
|
||||||
|
|||||||
@@ -228,12 +228,13 @@ export async function handleEmbeddingsCore({
|
|||||||
return createErrorResult(HTTP_STATUS.BAD_GATEWAY, errMsg);
|
return createErrorResult(HTTP_STATUS.BAD_GATEWAY, errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle 401/403 — try token refresh
|
// Handle 401/403 — try token refresh (skip for noAuth providers)
|
||||||
|
const executor = getExecutor(provider);
|
||||||
if (
|
if (
|
||||||
providerResponse.status === HTTP_STATUS.UNAUTHORIZED ||
|
!executor.noAuth &&
|
||||||
providerResponse.status === HTTP_STATUS.FORBIDDEN
|
(providerResponse.status === HTTP_STATUS.UNAUTHORIZED ||
|
||||||
|
providerResponse.status === HTTP_STATUS.FORBIDDEN)
|
||||||
) {
|
) {
|
||||||
const executor = getExecutor(provider);
|
|
||||||
const newCredentials = await refreshWithRetry(
|
const newCredentials = await refreshWithRetry(
|
||||||
() => executor.refreshCredentials(credentials, log),
|
() => executor.refreshCredentials(credentials, log),
|
||||||
3,
|
3,
|
||||||
|
|||||||
@@ -865,7 +865,7 @@ export default function ProviderDetailPage() {
|
|||||||
<h2 className="text-lg font-semibold">Connections</h2>
|
<h2 className="text-lg font-semibold">Connections</h2>
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
{/* Thinking config */}
|
{/* Thinking config */}
|
||||||
{/* {thinkingConfig && (
|
{thinkingConfig && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="text-xs text-text-muted font-medium">Thinking</span>
|
<span className="text-xs text-text-muted font-medium">Thinking</span>
|
||||||
<select
|
<select
|
||||||
@@ -878,7 +878,7 @@ export default function ProviderDetailPage() {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
)} */}
|
)}
|
||||||
{/* Round Robin toggle */}
|
{/* Round Robin toggle */}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="text-xs text-text-muted font-medium">Round Robin</span>
|
<span className="text-xs text-text-muted font-medium">Round Robin</span>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export async function GET() {
|
|||||||
try {
|
try {
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
const requireLogin = settings.requireLogin !== false;
|
const requireLogin = settings.requireLogin !== false;
|
||||||
const tunnelDashboardAccess = settings.tunnelDashboardAccess === true;
|
const tunnelDashboardAccess = settings.tunnelDashboardAccess !== false;
|
||||||
const tunnelUrl = settings.tunnelUrl || "";
|
const tunnelUrl = settings.tunnelUrl || "";
|
||||||
const tailscaleUrl = settings.tailscaleUrl || "";
|
const tailscaleUrl = settings.tailscaleUrl || "";
|
||||||
return NextResponse.json({ requireLogin, tunnelDashboardAccess, tunnelUrl, tailscaleUrl });
|
return NextResponse.json({ requireLogin, tunnelDashboardAccess, tunnelUrl, tailscaleUrl });
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export async function proxy(request) {
|
|||||||
if (pathname.startsWith("/dashboard")) {
|
if (pathname.startsWith("/dashboard")) {
|
||||||
const origin = request.nextUrl.origin;
|
const origin = request.nextUrl.origin;
|
||||||
let requireLogin = true;
|
let requireLogin = true;
|
||||||
let tunnelDashboardAccess = false;
|
let tunnelDashboardAccess = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${origin}/api/settings/require-login`);
|
const res = await fetch(`${origin}/api/settings/require-login`);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ const MITM_PORT = 443;
|
|||||||
const MITM_WIN_NODE_PORT = 8443;
|
const MITM_WIN_NODE_PORT = 8443;
|
||||||
const PID_FILE = path.join(MITM_DIR, ".mitm.pid");
|
const PID_FILE = path.join(MITM_DIR, ".mitm.pid");
|
||||||
|
|
||||||
const MITM_MAX_RESTARTS = 5;
|
const MITM_MAX_RESTARTS = 2;
|
||||||
const MITM_RESTART_DELAYS_MS = [5000, 10000, 20000, 30000, 60000];
|
const MITM_RESTART_DELAYS_MS = [5000, 10000];
|
||||||
const MITM_RESTART_RESET_MS = 60000;
|
const MITM_RESTART_RESET_MS = 60000;
|
||||||
|
|
||||||
let mitmRestartCount = 0;
|
let mitmRestartCount = 0;
|
||||||
@@ -323,7 +323,8 @@ async function scheduleMitmRestart(apiKey) {
|
|||||||
if (aliveMs >= MITM_RESTART_RESET_MS) mitmRestartCount = 0;
|
if (aliveMs >= MITM_RESTART_RESET_MS) mitmRestartCount = 0;
|
||||||
|
|
||||||
if (mitmRestartCount >= MITM_MAX_RESTARTS) {
|
if (mitmRestartCount >= MITM_MAX_RESTARTS) {
|
||||||
err("Max restart attempts reached. Giving up.");
|
err("Max restart attempts reached. Auto-disabling MITM.");
|
||||||
|
await saveMitmSettings(false, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user