mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-23 14:17:46 -04:00
Added a settings to disable SSL certificate validation for Podnapisi. Be careful as it's causing a security risk for a man in the middle (MitM) attack. #1565
This commit is contained in:
parent
9fff275f1c
commit
d851c16da7
4 changed files with 22 additions and 2 deletions
|
@ -134,6 +134,9 @@ defaults = {
|
|||
'username': '',
|
||||
'password': ''
|
||||
},
|
||||
'podnapisi': {
|
||||
'verify_ssl': 'True'
|
||||
},
|
||||
'legendasdivx': {
|
||||
'username': '',
|
||||
'password': '',
|
||||
|
|
|
@ -147,6 +147,7 @@ def get_providers_auth():
|
|||
'podnapisi' : {
|
||||
'only_foreign': False, # fixme
|
||||
'also_foreign': False, # fixme
|
||||
'verify_ssl': settings.podnapisi.getboolean('verify_ssl')
|
||||
},
|
||||
'subscene' : {
|
||||
'username' : settings.subscene.username,
|
||||
|
|
|
@ -135,7 +135,17 @@ export const ProviderList: Readonly<ProviderInfo[]> = [
|
|||
use_hash: "Use Hash",
|
||||
},
|
||||
},
|
||||
{ key: "podnapisi" },
|
||||
{
|
||||
key: "podnapisi",
|
||||
name: "Podnapisi",
|
||||
defaultKey: {
|
||||
verify_ssl: true,
|
||||
},
|
||||
keyNameOverride: {
|
||||
verify_ssl:
|
||||
"Verify SSL certificate (disabling introduce a MitM attack risk)",
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "regielive",
|
||||
name: "RegieLive",
|
||||
|
|
|
@ -109,10 +109,12 @@ class PodnapisiSubtitle(_PodnapisiSubtitle):
|
|||
|
||||
return matches
|
||||
|
||||
|
||||
class PodnapisiAdapter(HTTPAdapter):
|
||||
def init_poolmanager(self, connections, maxsize, block=False):
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.set_ciphers('DEFAULT@SECLEVEL=1')
|
||||
ctx.check_hostname = False
|
||||
self.poolmanager = poolmanager.PoolManager(
|
||||
num_pools=connections,
|
||||
maxsize=maxsize,
|
||||
|
@ -121,6 +123,7 @@ class PodnapisiAdapter(HTTPAdapter):
|
|||
ssl_context=ctx
|
||||
)
|
||||
|
||||
|
||||
class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
|
||||
languages = ({Language('por', 'BR'), Language('srp', script='Latn'), Language('srp', script='Cyrl')} |
|
||||
{Language.fromalpha2(l) for l in language_converters['alpha2'].codes})
|
||||
|
@ -130,12 +133,14 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
|
|||
server_url = 'https://podnapisi.net/subtitles/'
|
||||
only_foreign = False
|
||||
also_foreign = False
|
||||
verify_ssl = True
|
||||
subtitle_class = PodnapisiSubtitle
|
||||
hearing_impaired_verifiable = True
|
||||
|
||||
def __init__(self, only_foreign=False, also_foreign=False):
|
||||
def __init__(self, only_foreign=False, also_foreign=False, verify_ssl=True):
|
||||
self.only_foreign = only_foreign
|
||||
self.also_foreign = also_foreign
|
||||
self.verify_ssl = verify_ssl
|
||||
|
||||
if only_foreign:
|
||||
logger.info("Only searching for foreign/forced subtitles")
|
||||
|
@ -145,6 +150,7 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
|
|||
def initialize(self):
|
||||
super().initialize()
|
||||
self.session.mount('https://', PodnapisiAdapter())
|
||||
self.session.verify = self.verify_ssl
|
||||
|
||||
def list_subtitles(self, video, languages):
|
||||
if video.is_special:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue