mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
Allow users to change proxy settings.
This commit is contained in:
parent
e753d9b9f8
commit
7812a410b3
4 changed files with 183 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# core/serializers.py
|
||||
|
||||
from rest_framework import serializers
|
||||
from .models import UserAgent, StreamProfile, CoreSettings
|
||||
from .models import CoreSettings, UserAgent, StreamProfile, ProxySettings
|
||||
|
||||
class UserAgentSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
@ -17,3 +17,43 @@ class CoreSettingsSerializer(serializers.ModelSerializer):
|
|||
class Meta:
|
||||
model = CoreSettings
|
||||
fields = '__all__'
|
||||
|
||||
class ProxySettingsSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = ProxySettings
|
||||
fields = [
|
||||
'id',
|
||||
'buffering_timeout',
|
||||
'buffering_speed',
|
||||
'redis_chunk_ttl',
|
||||
'channel_shutdown_delay',
|
||||
'channel_init_grace_period',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
]
|
||||
read_only_fields = ['id', 'created_at', 'updated_at']
|
||||
|
||||
def validate_buffering_timeout(self, value):
|
||||
if value < 1 or value > 300:
|
||||
raise serializers.ValidationError("Buffering timeout must be between 1 and 300 seconds")
|
||||
return value
|
||||
|
||||
def validate_buffering_speed(self, value):
|
||||
if value < 0.1 or value > 10.0:
|
||||
raise serializers.ValidationError("Buffering speed must be between 0.1 and 10.0")
|
||||
return value
|
||||
|
||||
def validate_redis_chunk_ttl(self, value):
|
||||
if value < 10 or value > 3600:
|
||||
raise serializers.ValidationError("Redis chunk TTL must be between 10 and 3600 seconds")
|
||||
return value
|
||||
|
||||
def validate_channel_shutdown_delay(self, value):
|
||||
if value < 0 or value > 300:
|
||||
raise serializers.ValidationError("Channel shutdown delay must be between 0 and 300 seconds")
|
||||
return value
|
||||
|
||||
def validate_channel_init_grace_period(self, value):
|
||||
if value < 1 or value > 60:
|
||||
raise serializers.ValidationError("Channel init grace period must be between 1 and 60 seconds")
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue