1
0
Fork 0
mirror of https://github.com/fastogt/fastocloud_admin.git synced 2025-03-09 23:38:52 +00:00

User agent

This commit is contained in:
topilski 2019-06-11 00:02:04 -04:00
parent ca8462b2f1
commit 6203746a70
6 changed files with 33 additions and 13 deletions

View file

@ -1,3 +1,8 @@
1.2.0 /
[Alexandr Topilski]
- User agents
- Subscribers
1.1.0 / June 6, 2019 1.1.0 / June 6, 2019
[Alexandr Topilski] [Alexandr Topilski]
- User type - User type

View file

@ -19,7 +19,7 @@ class Url(EmbeddedDocument):
class InputUrl(Url): class InputUrl(Url):
pass user_agent = IntField(default=constants.UserAgent.GSTREAMER, required=True)
class OutputUrl(Url): class OutputUrl(Url):

View file

@ -1,6 +1,6 @@
from wtforms import Form from wtforms import Form
from flask_babel import lazy_gettext from flask_babel import lazy_gettext
from wtforms.fields import StringField, FieldList, IntegerField, FormField, FloatField from wtforms.fields import StringField, FieldList, IntegerField, FormField, FloatField, SelectField
from wtforms.validators import InputRequired, Length, NumberRange from wtforms.validators import InputRequired, Length, NumberRange
import app.constants as constants import app.constants as constants
@ -16,7 +16,9 @@ class UrlForm(Form):
class InputUrlForm(UrlForm): class InputUrlForm(UrlForm):
pass user_agent = SelectField(lazy_gettext(u'User agent:'),
validators=[InputRequired()],
choices=constants.AVAILABLE_USER_AGENTS, coerce=constants.UserAgent.coerce)
class InputUrlsForm(Form): class InputUrlsForm(Form):
@ -25,7 +27,7 @@ class InputUrlsForm(Form):
def get_data(self) -> InputUrls: def get_data(self) -> InputUrls:
urls = InputUrls() urls = InputUrls()
for url in self.data['urls']: for url in self.data['urls']:
urls.urls.append(InputUrl(url['id'], url['uri'])) urls.urls.append(InputUrl(url['id'], url['uri'], url['user_agent']))
return urls return urls

View file

@ -3,4 +3,4 @@ PUBLIC_CONFIG = {'site': {'title': 'FastoCloud', 'keywords': 'video,cloud,iptv,s
'support': {'contact_email': 'support@fastogt.com', 'support': {'contact_email': 'support@fastogt.com',
'contact_address': 'Republic of Belarus, Minsk, Stadionnay str. 5', 'contact_address': 'Republic of Belarus, Minsk, Stadionnay str. 5',
'community_channel': 'https://discord.gg/cnUXsws'}, 'community_channel': 'https://discord.gg/cnUXsws'},
'project': {'version': '1.1.0', 'version_type': 'release'}} 'project': {'version': '1.2.0', 'version_type': 'release'}}

View file

@ -195,3 +195,22 @@ class Roles(IntEnum):
def __str__(self): def __str__(self):
return str(self.value) return str(self.value)
class UserAgent(IntEnum):
GSTREAMER = 0
VLC = 1
@classmethod
def choices(cls):
return [(choice, choice.name) for choice in cls]
@classmethod
def coerce(cls, item):
return cls(int(item)) if not isinstance(item, cls) else item
def __str__(self):
return str(self.value)
AVAILABLE_USER_AGENTS = [(UserAgent.GSTREAMER, 'GStreamer'), (UserAgent.VLC, 'VLC'), ]

View file

@ -588,11 +588,12 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
} }
function edit_stream_entry(url) { function edit_stream_entry(url) {
var data_ser = $('#stream_entry_form').serialize();
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
dataType: 'json', dataType: 'json',
data: $('#stream_entry_form').serialize(), data: data_ser,
success: function (response) { success: function (response) {
console.log(response); console.log(response);
$('#stream_dialog').modal('hide'); $('#stream_dialog').modal('hide');
@ -808,12 +809,5 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
} }
}); });
} }
</script> </script>
{% endblock %} {% endblock %}