feat: ComfyUI video assistant SaaS plan + shared types cleanup
- Add plan/2026-05-18-comfyui-video-assistant-saas.md (gpt-5.5 generated) - Add src/server/ and src/shared/ type definitions - Update comfyui routes and api_key auth - Remove old metapi docs, deploy/k3s, and deprecated configs
This commit is contained in:
+19
-2
@@ -21,6 +21,7 @@ pub enum DownstreamAuthResult {
|
||||
pub async fn authorize_downstream_token(
|
||||
token: &str,
|
||||
pool: &SqlitePool,
|
||||
global_proxy_token: Option<&str>,
|
||||
) -> Result<DownstreamAuthResult, String> {
|
||||
// Try managed keys first
|
||||
if token.starts_with("sk-") {
|
||||
@@ -36,11 +37,27 @@ pub async fn authorize_downstream_token(
|
||||
return Ok(DownstreamAuthResult::Managed { key: k });
|
||||
}
|
||||
|
||||
// Key not found in table
|
||||
if global_proxy_token
|
||||
.map(|global| !global.is_empty() && token == global)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Ok(DownstreamAuthResult::Global {
|
||||
token: token.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
return Err("Invalid API key".to_string());
|
||||
}
|
||||
|
||||
// Not an sk- key, can't be a downstream key
|
||||
if global_proxy_token
|
||||
.map(|global| !global.is_empty() && token == global)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Ok(DownstreamAuthResult::Global {
|
||||
token: token.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
Err("Invalid API key format".to_string())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user