Commit e4d409b4 authored by echel0n's avatar echel0n
Browse files

Fixed issue with validation of sickrage.direct SSL certificates

Refactored get_show_list function to allow for offset and limit props
parent a897c625
......@@ -56,5 +56,5 @@ def find_show_by_location(location):
return show
def get_show_list():
return list(sickrage.app.shows.values())
def get_show_list(offset=0, limit=0):
return list(sickrage.app.shows.values())[offset:(limit + offset if limit else None)]
......@@ -20,13 +20,14 @@
# ##############################################################################
import os
import re
from itertools import zip_longest
from tornado.escape import json_decode
import sickrage
from sickrage.core.common import Quality, Qualities, EpisodeStatus
from sickrage.core.databases.main import MainDB
from sickrage.core.databases.main.schemas import IMDbInfoSchema, BlacklistSchema, WhitelistSchema
from sickrage.core.databases.main.schemas import IMDbInfoSchema, BlacklistSchema, WhitelistSchema, TVShowSchema
from sickrage.core.enums import SearchFormat, SeriesProviderID
from sickrage.core.exceptions import CantUpdateShowException, NoNFOException, CantRefreshShowException
from sickrage.core.helpers import checkbox_to_value, sanitize_file_name, make_dir, chmod_as_parent
......@@ -78,14 +79,29 @@ class ApiV2SeriesHandler(ApiV2BaseHandler):
NotFoundSchema
"""
offset = int(self.get_argument('offset', 0))
limit = int(self.get_argument('limit', 0))
if not series_slug:
all_series = []
for show in get_show_list():
# with sickrage.app.main_db.session() as session:
# for series in session.query(MainDB.TVShow).with_entities(MainDB.TVShow.series_id, MainDB.TVShow.series_provider_id, MainDB.TVShow.name):
# json_data = TVShowSchema().dump(series)
# json_data['seriesSlug'] = f'{series.series_id}-{series.series_provider_id}'
# json_data['isLoading'] = False
# json_data['images'] = {
# 'poster': series_image(series.series_id, series.series_provider_id, SeriesImageType.POSTER).url,
# 'banner': ''
# }
#
# all_series.append(json_data)
for show in get_show_list(offset, limit):
if sickrage.app.show_queue.is_being_removed(show.series_id):
continue
all_series.append(show.to_json(progress=True))
all_series.append(show.to_json(progress=False))
return self.json_response(all_series)
......
......@@ -72,17 +72,14 @@ def is_certificate_valid(cert_file):
if 'ZeroSSL' not in issuer.value:
return False
if subject.value != f'{sickrage.app.config.general.server_id}.external.sickrage.direct':
if subject.value != f'*.{sickrage.app.config.general.server_id}.sickrage.direct':
return False
try:
ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value
sans = ext.get_values_for_type(x509.DNSName)
domains = [
f'{sickrage.app.config.general.server_id}.external.sickrage.direct',
f'{sickrage.app.config.general.server_id}.internal.sickrage.direct'
]
domains = [f'*.{sickrage.app.config.general.server_id}.sickrage.direct']
for domain in sans:
if domain not in domains:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment