forked from kenzuya/unshackle
feat(remote): cap server CDM licensing by height per API key and service
A session above the cap licenses with the client's own device, and a track above it in an uncapped -q run is handed back to the client. Also names the fallback in the ccextractor crash warning.
This commit is contained in:
@@ -22,6 +22,7 @@ from unshackle.core.api.handlers import (
|
||||
rate_limit_response,
|
||||
request_secret_key,
|
||||
server_account_regions,
|
||||
server_cdm_max_height_error,
|
||||
validate_server_accounts,
|
||||
)
|
||||
from unshackle.core.api.stats import key_rate_limit, rate_limit_error, ring, stats, stats_middleware
|
||||
@@ -295,6 +296,10 @@ def serve(
|
||||
if isinstance(user_cfg, dict):
|
||||
if problem := rate_limit_error(f"serve.users.{username}", user_cfg.get("rate_limit")):
|
||||
raise click.ClickException(problem)
|
||||
if problem := server_cdm_max_height_error(
|
||||
f"serve.users.{username}", user_cfg.get("server_cdm_max_height")
|
||||
):
|
||||
raise click.ClickException(problem)
|
||||
limit = key_rate_limit(user_key)
|
||||
if limit:
|
||||
log.info(f"User '{username}' rate limited to {limit} requests/hour")
|
||||
|
||||
Reference in New Issue
Block a user