Spaces:
Running
Running
BinaryONe
commited on
Commit
·
6c92dfc
1
Parent(s):
49fbec6
Circular Import Fix
Browse files
FileStream/server/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from aiohttp import web
|
2 |
-
import aiohttp_cors
|
3 |
from .routes_main import routes
|
4 |
from .routes_api import api
|
5 |
from .routes_app import sub_app
|
@@ -18,11 +18,4 @@ def web_server():
|
|
18 |
web_app.add_subapp('/api', api)
|
19 |
return web_app
|
20 |
|
21 |
-
|
22 |
-
"*": aiohttp_cors.ResourceOptions(
|
23 |
-
allow_credentials=True,
|
24 |
-
expose_headers="*",
|
25 |
-
allow_headers="*",
|
26 |
-
allow_methods=["GET"] # Allowing specific methods
|
27 |
-
)
|
28 |
-
})
|
|
|
1 |
from aiohttp import web
|
2 |
+
#import aiohttp_cors
|
3 |
from .routes_main import routes
|
4 |
from .routes_api import api
|
5 |
from .routes_app import sub_app
|
|
|
18 |
web_app.add_subapp('/api', api)
|
19 |
return web_app
|
20 |
|
21 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileStream/server/routes_api.py
CHANGED
@@ -6,6 +6,7 @@ import math
|
|
6 |
import logging
|
7 |
import asyncio
|
8 |
import traceback
|
|
|
9 |
from aiohttp import web
|
10 |
from pyrogram import raw
|
11 |
from bson import ObjectId
|
@@ -18,7 +19,6 @@ from FileStream.Database import Database
|
|
18 |
from FileStream.TMDB.Endpoint import search_tmdb_any,search_tmdb_tv,search_tmdb_movies
|
19 |
from FileStream.server.exceptions import FIleNotFound, InvalidHash
|
20 |
|
21 |
-
from FileStream.server import cors
|
22 |
from .Functions.downloader import media_streamer
|
23 |
|
24 |
async def handle_v2(request):
|
@@ -228,6 +228,16 @@ async def stream_handler(request: web.Request):
|
|
228 |
|
229 |
|
230 |
api = web.Application()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
api.router.add_get('/', handle_v2)
|
232 |
api.router.add_get('/files', list_all_files_db)
|
233 |
api.router.add_get('/files/mix', list_all_files)
|
|
|
6 |
import logging
|
7 |
import asyncio
|
8 |
import traceback
|
9 |
+
import aiohttp_cors
|
10 |
from aiohttp import web
|
11 |
from pyrogram import raw
|
12 |
from bson import ObjectId
|
|
|
19 |
from FileStream.TMDB.Endpoint import search_tmdb_any,search_tmdb_tv,search_tmdb_movies
|
20 |
from FileStream.server.exceptions import FIleNotFound, InvalidHash
|
21 |
|
|
|
22 |
from .Functions.downloader import media_streamer
|
23 |
|
24 |
async def handle_v2(request):
|
|
|
228 |
|
229 |
|
230 |
api = web.Application()
|
231 |
+
|
232 |
+
cors = aiohttp_cors.setup(app, defaults={
|
233 |
+
"*": aiohttp_cors.ResourceOptions(
|
234 |
+
allow_credentials=True,
|
235 |
+
expose_headers="*",
|
236 |
+
allow_headers="*",
|
237 |
+
allow_methods=["GET"] # Allowing specific methods
|
238 |
+
)
|
239 |
+
})
|
240 |
+
|
241 |
api.router.add_get('/', handle_v2)
|
242 |
api.router.add_get('/files', list_all_files_db)
|
243 |
api.router.add_get('/files/mix', list_all_files)
|