Merge branch 'master' of https://github.com/biliup/biliup
This commit is contained in:
1 parent
5567301278
commit
7d18feadc0
5 files changed
+48
-8
No files matched your search
@@ -431,9 +431,9 @@ bilibili支持 mp4 mkv webm 无需筛选也能上传
|
||||
<br />
|
||||
twitch_cookie获取方式:在浏览器中打开Twitch.tv,F12调出控制台,在控制台中执行:
|
||||
<br />
|
||||
<code>document.cookie.split("; ").find(item={'>'}item.startsWith("auth-token="))?.split("=")[1]</code>
|
||||
<code>{`document.cookie.split("; ").find(item={'>'}item.startsWith("auth-token="))?.split("=")[1]`}</code>
|
||||
<br />
|
||||
twitch_cookie需要在downloader= "ffmpeg"时候才会生效
|
||||
twitch_cookie需要在downloader= "ffmpeg"时候才会生效
|
||||
</div>
|
||||
}
|
||||
label="twitch_cookie"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const Players: React.FC<{url: string}> = ({url}) => {
|
||||
player?.destroy();
|
||||
player = null;
|
||||
};
|
||||
}, [])
|
||||
}, [url])
|
||||
return <div id="mse"></div>;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ const TemplateFields: React.FC<FormFCChild> = ({ formState, formApi, values }) =
|
||||
<br />
|
||||
简介:{'\u007B'}streamer{'\u007D'}主播直播间地址:{'\u007B'}url{'\u007D'} 【@credit】
|
||||
<br />
|
||||
其中的"@credits"会依次替换为下面输入的@
|
||||
其中的"@credits"会依次替换为下面输入的@
|
||||
</div>
|
||||
<Button icon={<IconPlusCircle />} onClick={add} theme="light">
|
||||
添加行
|
||||
|
||||
@@ -212,7 +212,7 @@ const TemplateModal: React.FC<TemplateModalProps> = ({ children, entity , onOk})
|
||||
{({ add, arrayFields }) => (
|
||||
<Form.Section text="ffmpeg参数">
|
||||
<div className="semi-form-field-extra">
|
||||
如:"-ss"、"00:00:16",每个参数需单独一行
|
||||
如:"-ss"、"00:00:16",每个参数需单独一行
|
||||
</div>
|
||||
<Button icon={<IconPlusCircle />} onClick={add} theme="light">
|
||||
添加行
|
||||
|
||||
+43
-3
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
import aiohttp_cors
|
||||
import requests
|
||||
@@ -381,9 +382,17 @@ async def service(args):
|
||||
if args.static_dir:
|
||||
app.add_routes([web.static('/', args.static_dir, show_index=False)])
|
||||
else:
|
||||
res = [web.static('/', files('biliup.web').joinpath('public'))]
|
||||
for fdir in find_all_folders(files('biliup.web').joinpath('public')):
|
||||
res.append(web.static('/'+fdir.replace('\\', '/'), files('biliup.web').joinpath('public/'+fdir)))
|
||||
# res = [web.static('/', files('biliup.web').joinpath('public'))]
|
||||
res = []
|
||||
for fdir in pathlib.Path(files('biliup.web').joinpath('public')).glob('*.html'):
|
||||
fname = fdir.relative_to(files('biliup.web').joinpath('public'))
|
||||
def _copy(fname):
|
||||
async def static_view(request):
|
||||
return web.FileResponse(files('biliup.web').joinpath('public/' + str(fname)))
|
||||
return static_view
|
||||
res.append(web.get('/' + str(fname.with_suffix('')), _copy(fname)))
|
||||
# res.append(web.static('/'+fdir.replace('\\', '/'), files('biliup.web').joinpath('public/'+fdir)))
|
||||
res.append(web.static('/', files('biliup.web').joinpath('public')))
|
||||
app.add_routes(res)
|
||||
if args.password:
|
||||
app.middlewares.append(basic_auth_middleware(('/',), {'biliup': args.password}, ))
|
||||
@@ -402,6 +411,37 @@ async def service(args):
|
||||
cors.add(route)
|
||||
|
||||
runner = web.AppRunner(app)
|
||||
setup_middlewares(app)
|
||||
await runner.setup()
|
||||
site = web.TCPSite(runner, host=args.host, port=args.port)
|
||||
return runner, site
|
||||
|
||||
|
||||
async def handle_404(request):
|
||||
return web.HTTPFound('404')
|
||||
|
||||
|
||||
def create_error_middleware(overrides):
|
||||
|
||||
@web.middleware
|
||||
async def error_middleware(request, handler):
|
||||
try:
|
||||
return await handler(request)
|
||||
except web.HTTPException as ex:
|
||||
override = overrides.get(ex.status)
|
||||
if override:
|
||||
return await override(request)
|
||||
|
||||
raise
|
||||
except Exception:
|
||||
request.protocol.logger.exception("Error handling request")
|
||||
return await overrides[500](request)
|
||||
|
||||
return error_middleware
|
||||
|
||||
|
||||
def setup_middlewares(app):
|
||||
error_middleware = create_error_middleware({
|
||||
404: handle_404
|
||||
})
|
||||
app.middlewares.append(error_middleware)
|
||||
Reference in new issue
Block a user