release web ui

Update python-publish.yml
This commit is contained in:
ForgQi committed 2022-04-29 00:50:51 +08:00
1 parent 5518e59418
commit 3c55cb0353
6 files changed
+45 -12

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine build
npm install
- name: Build and publish
env:
+1 -1
View File
@@ -1,7 +1,7 @@
import logging
import sys
__version__ = "0.2.11"
__version__ = "0.2.12"
LOG_CONF = {
'version': 1,
+3 -3
View File
@@ -20,7 +20,8 @@ def arg_parser():
parser.add_argument('-H', help='web api host [default: localhost]', dest='host')
parser.add_argument('-P', help='web api port [default: 19159]', default=19159, dest='port')
parser.add_argument('--http', action='store_true', help='enable web api')
parser.add_argument('--password',help='web ui password ,default username is biliup', dest='password')
parser.add_argument('--static-dir', help='web static files directory for custom ui')
parser.add_argument('--password', help='web ui password ,default username is biliup', dest='password')
parser.add_argument('-v', '--verbose', action="store_const", const=logging.DEBUG, help="Increase output verbosity")
parser.add_argument('--config', type=argparse.FileType(encoding='UTF-8'),
help='Location of the configuration file (default "./config.yaml")')
@@ -34,7 +35,7 @@ def arg_parser():
parser_restart.set_defaults(func=daemon.restart)
parser.set_defaults(func=lambda: asyncio.run(main(args)))
args = parser.parse_args()
if(args.http):
if args.http:
config.create_without_config_input(args.config)
else:
config.load(args.config)
@@ -48,7 +49,6 @@ def arg_parser():
args.func()
async def main(args):
from .handler import CHECK_UPLOAD, CHECK, event_manager
+5 -2
View File
@@ -80,8 +80,11 @@ async def service(args, event_manager):
app.add_routes([web.post('/api/setconfig', set_streamer_config)])
app.add_routes([web.get('/api/save', save_config)])
app.add_routes([web.get('/', root_handler)])
app.add_routes([web.static('/', files('biliup.web').joinpath('public'), show_index=False)])
app.add_routes([web.static('/build', files('biliup.web').joinpath('public/build'), show_index=False)])
if args.static_dir:
app.add_routes([web.static('/', args.static_dir, show_index=False)])
else:
app.add_routes([web.static('/', files('biliup.web').joinpath('public'), show_index=False)])
app.add_routes([web.static('/build', files('biliup.web').joinpath('public/build'), show_index=False)])
if args.password:
app.middlewares.append(basic_auth_middleware(('/',), {'biliup': args.password}, ))
cors = aiohttp_cors.setup(app, defaults={
+33 -3
View File
@@ -86,6 +86,32 @@
body:JSON.stringify(ret_json)
})
}
let urlStatus;
let streamStatus = {};
fetch('/url-status',{
method: "GET",
}).then(res => res.json())
.then(status => {
urlStatus = status;
console.log(urlStatus);
console.log($template);
statusToColor();
})
function statusToColor() {
for (const item of items) {
streamStatus[item] = 'green';
for (const url of $template[item].url) {
if (urlStatus[url] === 1) {
streamStatus[item] = 'red';
}
if (urlStatus[url] === 2) {
streamStatus[item] = 'yellow';
}
}
}
}
</script>
<div class="flex flex-col w-72 h-screen px-4 pt-8 bg-white border-r overflow-auto"
transition:fly={{delay: 400, x: -100}}>
@@ -171,10 +197,10 @@
<a animate:flip="{{duration: 300}}" class:selected="{$currentTemplate.current === item}"
on:click="{() => select(item)}">
{#if ($template[item].changed)}
{#if streamStatus[item]}
<span class="flex absolute h-1.5 w-1.5 top-0 right-0 flex">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-1.5 w-1.5 bg-purple-500"></span>
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-{streamStatus[item]}-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-1.5 w-1.5 bg-{streamStatus[item]}-500"></span>
</span>
{/if}
<svg class="flex-none w-5 h-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -212,4 +238,8 @@
@apply flex cursor-pointer items-center px-3 py-2 mt-1 text-gray-600 transition-colors duration-200 transform rounded-md hover:bg-gray-200 hover:text-gray-700;
}
.status {
@apply bg-yellow-400 bg-yellow-500 bg-green-400 bg-green-500 bg-red-400 bg-red-500;
}
</style>
+2 -2
View File
@@ -220,8 +220,8 @@
</span>
{/each}
<input bind:value={tempUrl} class="outline-none rounded-lg flex-1 appearance-none w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base " on:keypress={e=>e.key==='Enter' && urlhandleKeypress()}
placeholder="录制链接"
<input bind:value={tempUrl} class="outline-none rounded-lg flex-1 appearance-none w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base " on:keypress={e=>e.key==='Enter' && urlhandleKeypress()}
placeholder="录制链接, 回车输入"
type="text"/>
</div>