jiayi.xie commited on
Commit
c48ce72
·
1 Parent(s): f721a91

feat(mirror): allow relay gateway hosts

Browse files

Gateway /v1/videos/.../content links normally carry CORS themselves, but when a
direct read fails the mirror fallback should still be able to reach them.

Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -14,8 +14,11 @@ MAX_BYTES = int(os.environ.get("MAX_BYTES", str(30 * 1024 * 1024)))
14
  # /mirror streams somebody else's object storage back with CORS headers. It stores nothing.
15
  MIRROR_MAX_BYTES = int(os.environ.get("MIRROR_MAX_BYTES", str(300 * 1024 * 1024)))
16
  DEFAULT_MIRROR_HOSTS = (
 
17
  "aliyuncs.com,r2.cloudflarestorage.com,amazonaws.com,myqcloud.com,bcebos.com,"
18
- "volces.com,byteimg.com,volccdn.com,googleapis.com,cloudfront.net,oaiusercontent.com"
 
 
19
  )
20
  MIRROR_ALLOW_HOSTS = tuple(host.strip().lower() for host in os.environ.get("MIRROR_ALLOW_HOSTS", DEFAULT_MIRROR_HOSTS).split(",") if host.strip())
21
  # Optional shared upload token. If UPLOAD_TOKEN is unset, uploads are open (temp use).
 
14
  # /mirror streams somebody else's object storage back with CORS headers. It stores nothing.
15
  MIRROR_MAX_BYTES = int(os.environ.get("MIRROR_MAX_BYTES", str(300 * 1024 * 1024)))
16
  DEFAULT_MIRROR_HOSTS = (
17
+ # object storage the generated videos actually live on
18
  "aliyuncs.com,r2.cloudflarestorage.com,amazonaws.com,myqcloud.com,bcebos.com,"
19
+ "volces.com,byteimg.com,volccdn.com,googleapis.com,cloudfront.net,oaiusercontent.com,"
20
+ # relay gateways whose own /v1/videos/.../content links may need mirroring
21
+ "diwdiw.cn,hjmie.cc.cd"
22
  )
23
  MIRROR_ALLOW_HOSTS = tuple(host.strip().lower() for host in os.environ.get("MIRROR_ALLOW_HOSTS", DEFAULT_MIRROR_HOSTS).split(",") if host.strip())
24
  # Optional shared upload token. If UPLOAD_TOKEN is unset, uploads are open (temp use).