This commit is contained in:
@@ -1547,6 +1547,8 @@ class ApiHandler(BaseHTTPRequestHandler):
|
||||
if requested == 'google_browser_search' and bool(payload.get('enabled', False)) and os.environ.get('GOOGLE_BROWSER_SEARCH_ENABLED', '').strip().lower() != 'true': return self.send_json(409,{"error":"source_feature_disabled","detail":"GOOGLE_BROWSER_SEARCH_ENABLED=true is required"})
|
||||
if contains_secret(config):return self.send_json(400,{"error":"secret_not_permitted"})
|
||||
if any(field in config for field in DISCOVERY_CRITERIA_FIELDS):return self.send_json(400,{"error":"source_configuration_contains_criteria"})
|
||||
if config.get('terms_status') == 'approved' and 'terms_accepted' not in config:
|
||||
config = dict(config); config['terms_accepted'] = True
|
||||
policy = payload.get('policy', {}) if isinstance(payload.get('policy', {}), dict) else {}
|
||||
quota = payload.get('quota', {}) if isinstance(payload.get('quota', {}), dict) else {}
|
||||
owner = str(policy.get('owner', config.get('owner', ''))).strip()
|
||||
@@ -1576,6 +1578,8 @@ class ApiHandler(BaseHTTPRequestHandler):
|
||||
config=payload.get('config')
|
||||
if not isinstance(config,dict) or contains_secret(config): return self.send_json(400,{"error":"invalid_source_config"})
|
||||
if any(field in config for field in DISCOVERY_CRITERIA_FIELDS): return self.send_json(400,{"error":"source_configuration_contains_criteria"})
|
||||
if config.get('terms_status') == 'approved' and 'terms_accepted' not in config:
|
||||
config = dict(config); config['terms_accepted'] = True
|
||||
adapter=adapter_for(source['source_code'] or source['kind']); validation=adapter.validate_config(config)
|
||||
if not validation.valid: return self.send_json(400,{"error":"invalid_source_config","details":validation.errors})
|
||||
db.execute("UPDATE sources SET config_json=?,updated_at=CURRENT_TIMESTAMP WHERE id=? AND organization_id=?",(json.dumps(config,sort_keys=True),sid,user['organization_id']))
|
||||
|
||||
Reference in New Issue
Block a user