lists: allow provider selection for bc2
This commit is contained in:
parent
80890c2127
commit
7ef321280e
1 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
import builtins
|
import builtins
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List, Dict, Union
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ class BypassCensorship2(BaseModel):
|
||||||
title = "Bypass Censorship Version 2"
|
title = "Bypass Censorship Version 2"
|
||||||
|
|
||||||
|
|
||||||
def mirror_sites():
|
def mirror_sites(provider: str = "cloudfront") -> Dict[
|
||||||
|
str, Union[str, List[Dict[Union[str, List[Dict[str, str]]]]]]]:
|
||||||
return {
|
return {
|
||||||
"version": "2.0",
|
"version": "2.0",
|
||||||
"sites": [{
|
"sites": [{
|
||||||
|
@ -55,7 +56,10 @@ def mirror_sites():
|
||||||
"updated_at": str(a.updated),
|
"updated_at": str(a.updated),
|
||||||
"url": a.url
|
"url": a.url
|
||||||
} for a in x.proxies if
|
} for a in x.proxies if
|
||||||
a.url is not None and not a.deprecated and not a.destroyed and a.provider == "cloudfront"
|
a.url is not None
|
||||||
|
and not a.deprecated
|
||||||
|
and not a.destroyed
|
||||||
|
and a.provider == provider
|
||||||
]} for x in Origin.query.order_by(Origin.domain_name).all() if x.destroyed is None
|
]} for x in Origin.query.order_by(Origin.domain_name).all() if x.destroyed is None
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue