Merge pull request #502 from bunkerity/ui
Merge branch "ui" into branch "dev"
This commit is contained in:
commit
162f1d978a
|
@ -54,7 +54,7 @@ from kubernetes import client as kube_client
|
|||
from kubernetes import config as kube_config
|
||||
from kubernetes.client.exceptions import ApiException as kube_ApiException
|
||||
from os import _exit, getenv, getpid, listdir
|
||||
from os.path import basename
|
||||
from os.path import basename, dirname
|
||||
from re import compile as re_compile
|
||||
from regex import match as regex_match
|
||||
from requests import get
|
||||
|
@ -1231,11 +1231,52 @@ def upload_plugin():
|
|||
|
||||
Path("/var/tmp/bunkerweb/ui").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for file in request.files.values():
|
||||
if not file.filename.endswith((".zip", ".tar.gz", ".tar.xz")):
|
||||
for uploaded_file in request.files.values():
|
||||
if not uploaded_file.filename.endswith((".zip", ".tar.gz", ".tar.xz")):
|
||||
return {"status": "ko"}, 422
|
||||
|
||||
Path(f"/var/tmp/bunkerweb/ui/{file.filename}").write_bytes(file.read())
|
||||
with BytesIO(uploaded_file.read()) as io:
|
||||
io.seek(0, 0)
|
||||
plugins = []
|
||||
if uploaded_file.filename.endswith(".zip"):
|
||||
with ZipFile(io) as zip_file:
|
||||
for file in zip_file.namelist():
|
||||
if file.endswith("plugin.json"):
|
||||
plugins.append(basename(dirname(file)))
|
||||
if len(plugins) > 1:
|
||||
zip_file.extractall("/var/tmp/bunkerweb/ui/")
|
||||
folder_name = uploaded_file.filename.replace(".zip", "")
|
||||
else:
|
||||
with tar_open(fileobj=io) as tar_file:
|
||||
for file in tar_file.getnames():
|
||||
if file.endswith("plugin.json"):
|
||||
plugins.append(basename(dirname(file)))
|
||||
if len(plugins) > 1:
|
||||
tar_file.extractall("/var/tmp/bunkerweb/ui/")
|
||||
folder_name = uploaded_file.filename.replace(".tar.gz", "").replace(
|
||||
".tar.xz", ""
|
||||
)
|
||||
|
||||
if len(plugins) <= 1:
|
||||
io.seek(0, 0)
|
||||
Path(f"/var/tmp/bunkerweb/ui/{uploaded_file.filename}").write_bytes(
|
||||
io.read()
|
||||
)
|
||||
return {"status": "ok"}, 201
|
||||
|
||||
for plugin in plugins:
|
||||
with BytesIO() as tgz:
|
||||
with tar_open(
|
||||
mode="w:gz", fileobj=tgz, dereference=True, compresslevel=3
|
||||
) as tf:
|
||||
tf.add(
|
||||
f"/var/tmp/bunkerweb/ui/{folder_name}/{plugin}",
|
||||
arcname=plugin,
|
||||
)
|
||||
tgz.seek(0, 0)
|
||||
Path(f"/var/tmp/bunkerweb/ui/{plugin}.tar.gz").write_bytes(tgz.read())
|
||||
|
||||
rmtree(f"/var/tmp/bunkerweb/ui/{folder_name}", ignore_errors=True)
|
||||
|
||||
return {"status": "ok"}, 201
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,15 @@
|
|||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@font-face {
|
||||
font-family: "Open Sans";
|
||||
src: url("../webfonts/OpenSans.ttf");
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: "Open Sans", sans-serif !important;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
@apply dark:brightness-90 inline-block px-6 py-3 font-bold text-center text-red-500 border border-red-500 uppercase align-middle transition-all rounded-lg cursor-pointer dark:bg-gray-200 dark:hover:brightness-75 bg-white hover:bg-white/80 focus:bg-white/80 leading-normal ease-in tracking-tight-rem shadow-xs hover:-translate-y-px active:opacity-85 hover:shadow-md;
|
||||
}
|
||||
|
|
|
@ -13,39 +13,32 @@
|
|||
<meta name="author" content="bunkerity" />
|
||||
<title>BunkerWeb UI</title>
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico" />
|
||||
<!-- Fonts and icons -->
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<!-- tailwind style -->
|
||||
<link rel="stylesheet" type="text/css" href="./css/dashboard.css" />
|
||||
|
||||
<script type="module" src="./js/global.js"></script>
|
||||
<script type="module" src="./js/global.js"></script>
|
||||
|
||||
<script
|
||||
src="./js/editor/ace.js"
|
||||
></script>
|
||||
<script src="./js/editor/ace.js"></script>
|
||||
|
||||
{% if current_endpoint == "global_config" %}
|
||||
<script type="module" src="./js/global_config.js"></script>
|
||||
<script type="module" src="./js/global_config.js"></script>
|
||||
{% elif current_endpoint == "configs" %}
|
||||
<script type="module" src="./js/configs.js"></script>
|
||||
<script type="module" src="./js/configs.js"></script>
|
||||
{% elif current_endpoint == "services" %}
|
||||
<script type="module" src="./js/services.js"></script>
|
||||
<script type="module" src="./js/services.js"></script>
|
||||
{% elif current_endpoint == "plugins" %}
|
||||
<script type="module" src="./js/plugins.js"></script>
|
||||
<script type="module" src="./js/plugins.js"></script>
|
||||
{% elif current_endpoint == "cache" %}
|
||||
<script type="module" src="./js/cache.js"></script>
|
||||
<script type="module" src="./js/cache.js"></script>
|
||||
{% elif current_endpoint == "logs" %}
|
||||
<link rel="stylesheet" type="text/css" href="./css/flatpickr.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./css/flatpickr.dark.css" />
|
||||
|
||||
<script type="module" src="./js/utils/flatpickr.js"></script>
|
||||
<script type="module" src="./js/utils/fr.js"></script>
|
||||
<script type="module" src="./js/utils/flatpickr.js"></script>
|
||||
<script type="module" src="./js/utils/fr.js"></script>
|
||||
|
||||
<script type="module" src="./js/logs.js"></script>
|
||||
<script type="module" src="./js/datepicker/datepicker.js"></script>
|
||||
<script type="module" src="./js/logs.js"></script>
|
||||
<script type="module" src="./js/datepicker/datepicker.js"></script>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
<!-- right sidebar -->
|
||||
<aside
|
||||
data-sidebar-info
|
||||
data-sidebar-info
|
||||
class="translate-x-90 -right-0 transition z-sticky dark:bg-slate-850 dark:brightness-110 shadow-3xl max-w-full w-90 ease fixed top-0 left-auto flex h-full min-w-0 flex-col break-words rounded-none border-0 bg-white bg-clip-border px-0.5"
|
||||
>
|
||||
<!-- close btn-->
|
||||
<svg
|
||||
data-sidebar-info-close
|
||||
data-sidebar-info-close
|
||||
class="cursor-pointer fill-gray-600 dark:fill-gray-300 dark:opacity-80 absolute h-8 w-8 top-4 right-4"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 320 512"
|
||||
|
@ -43,7 +43,7 @@ data-sidebar-info
|
|||
<!-- close button -->
|
||||
<div class="float-right mt-6">
|
||||
<button
|
||||
data-sidebar-info-close
|
||||
data-sidebar-info-close
|
||||
class="inline-block p-0 mb-4 text-sm font-bold leading-normal text-center uppercase align-middle transition-all ease-in bg-transparent border-0 rounded-lg shadow-none cursor-pointer hover:-translate-y-px tracking-tight-rem bg-150 bg-x-25 active:opacity-85 dark:text-white text-slate-700"
|
||||
>
|
||||
<i class="fa fa-close"></i>
|
||||
|
@ -90,7 +90,10 @@ data-sidebar-info
|
|||
</div>
|
||||
<div class="block mt-2 mb-4">
|
||||
<div class="relative">
|
||||
<div data-checkbox-handler="newsletter-check" class="relative mb-7 md:mb-0">
|
||||
<div
|
||||
data-checkbox-handler="newsletter-check"
|
||||
class="relative mb-7 md:mb-0"
|
||||
>
|
||||
<input
|
||||
id="newsletter-check"
|
||||
class="mr-2 relative cursor-pointer dark:border-slate-600 dark:bg-slate-700 z-10 checked:z-0 w-5 h-5 ease text-base rounded-1.4 checked:bg-primary checked:border-primary dark:checked:bg-primary dark:checked:border-primary duration-250 float-left mt-1 appearance-none border border-gray-300 bg-white bg-contain bg-center bg-no-repeat align-top transition-all disabled:bg-gray-400 disabled:border-gray-400 dark:disabled:bg-gray-800 dark:disabled:border-gray-800 disabled:text-gray-700 dark:disabled:text-gray-300"
|
||||
|
@ -99,7 +102,7 @@ data-sidebar-info
|
|||
value="no"
|
||||
/>
|
||||
<svg
|
||||
data-checkbox-handler="newsletter-check"
|
||||
data-checkbox-handler="newsletter-check"
|
||||
class="pointer-events-none cursor-pointer absolute fill-white dark:fill-gray-300 left-0 top-0 translate-x-1 translate-y-2 h-3 w-3"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 512 512"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<!-- modal -->
|
||||
<div
|
||||
data-plugins-modal
|
||||
data-plugins-modal
|
||||
class="dark:brightness-110 w-screen h-screen fixed bg-gray-600/50 z-[1001] top-0 left-0 hidden justify-center items-center"
|
||||
>
|
||||
<div
|
||||
data-plugins-modal-card
|
||||
data-plugins-modal-card
|
||||
class="min-w-[500px ]overflow-y-auto mx-3 ml-2 mr-6 sm:mx-6 lg:mx-8 my-3 px-4 pt-4 pb-8 w-full max-w-[400px] flex flex-col break-words bg-white shadow-xl dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border"
|
||||
>
|
||||
<div class="w-full flex justify-between mb-2">
|
||||
<p
|
||||
data-plugins-modal-title
|
||||
data-plugins-modal-title
|
||||
class="transition duration-300 ease-in-out dark:opacity-90 dark:text-gray-300 mb-2 font-sans font-semibold leading-normal uppercase text-md"
|
||||
>
|
||||
DELETE PLUGINS
|
||||
|
@ -28,7 +28,7 @@ data-plugins-modal
|
|||
</div>
|
||||
<!-- delete form-->
|
||||
<form
|
||||
data-plugins-modal-form-delete
|
||||
data-plugins-modal-form-delete
|
||||
class="w-full h-full flex flex-col justify-between"
|
||||
id="form-delete-plugin"
|
||||
method="POST"
|
||||
|
@ -39,14 +39,14 @@ data-plugins-modal
|
|||
<input type="hidden" value="delete" name="operation" id="operation" />
|
||||
<div>
|
||||
<p
|
||||
data-plugins-modal-text
|
||||
data-plugins-modal-text
|
||||
class="text-center mx-2 mb-2 mt-8 font-semibold font-sans leading-normal uppercase text-sm"
|
||||
></p>
|
||||
</div>
|
||||
<!-- action button -->
|
||||
<div class="w-full justify-center flex mt-10">
|
||||
<button
|
||||
data-plugins-modal-close
|
||||
data-plugins-modal-close
|
||||
type="button"
|
||||
class="dark:brightness-90 mr-3 inline-block px-6 py-3 font-bold text-center text-white uppercase align-middle transition-all rounded-lg cursor-pointer bg-red-500 hover:bg-red-500/80 focus:bg-red-500/80 leading-normal text-md ease-in tracking-tight-rem shadow-xs bg-150 bg-x-25 hover:-translate-y-px active:opacity-85 hover:shadow-md"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue