mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 15:49:34 +05:00
format
This commit is contained in:
parent
3ef10c07cf
commit
c74170a14d
6 changed files with 20 additions and 8 deletions
5
build.py
5
build.py
|
@ -13,7 +13,10 @@ parser = argparse.ArgumentParser(
|
||||||
epilog="",
|
epilog="",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--no-rebuild", help="don't rebuild Next.js frontend", action="store_true", default=False
|
"--no-rebuild",
|
||||||
|
help="don't rebuild Next.js frontend",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--exe", help="create an executable file", action="store_true", default=False
|
"--exe", help="create an executable file", action="store_true", default=False
|
||||||
|
|
8
dev.py
8
dev.py
|
@ -11,8 +11,12 @@ if __name__ == "__main__":
|
||||||
# TODO: handle multiple package managers line npm(node), deno, yarn
|
# TODO: handle multiple package managers line npm(node), deno, yarn
|
||||||
# TODO?: install node deps automatically
|
# TODO?: install node deps automatically
|
||||||
|
|
||||||
gui_proc = subprocess.Popen(["bun", "run", "dev"], cwd="./gui", env=environment, shell = True)
|
gui_proc = subprocess.Popen(
|
||||||
app_proc = subprocess.Popen(["python", "main.py"], cwd="./src", env=environment, shell = True)
|
["bun", "run", "dev"], cwd="./gui", env=environment, shell=True
|
||||||
|
)
|
||||||
|
app_proc = subprocess.Popen(
|
||||||
|
["python", "main.py"], cwd="./src", env=environment, shell=True
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while gui_proc.poll() is None or app_proc.poll() is None:
|
while gui_proc.poll() is None or app_proc.poll() is None:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|
||||||
api = Blueprint('api', __name__, url_prefix="/api/pack")
|
api = Blueprint("api", __name__, url_prefix="/api/pack")
|
||||||
|
|
||||||
from . import pack
|
from . import pack
|
|
@ -8,6 +8,7 @@ from PIL import Image
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
|
||||||
@api.route("/new", methods=["POST"])
|
@api.route("/new", methods=["POST"])
|
||||||
def APIPackNew():
|
def APIPackNew():
|
||||||
pack = {
|
pack = {
|
||||||
|
@ -54,7 +55,9 @@ def APIPackImageEdit(id):
|
||||||
if image_mime == None or image_mime not in IMG_ALLOWED_MIME:
|
if image_mime == None or image_mime not in IMG_ALLOWED_MIME:
|
||||||
return jsonify({"status": "error", "message": "wrong image format"})
|
return jsonify({"status": "error", "message": "wrong image format"})
|
||||||
|
|
||||||
image_data = base64.b64decode(re.sub("^data:image/.+;base64,", "", request.json.get("image")))
|
image_data = base64.b64decode(
|
||||||
|
re.sub("^data:image/.+;base64,", "", request.json.get("image"))
|
||||||
|
)
|
||||||
|
|
||||||
image = Image.open(BytesIO(image_data))
|
image = Image.open(BytesIO(image_data))
|
||||||
image = image.resize((512, 512), Image.Resampling.LANCZOS)
|
image = image.resize((512, 512), Image.Resampling.LANCZOS)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
PACKS_FOLDER = "./packs"
|
PACKS_FOLDER = "./packs"
|
||||||
if os.getenv("is_dev") == "True":
|
if os.getenv("is_dev") == "True":
|
||||||
PACKS_FOLDER = "../packs"
|
PACKS_FOLDER = "../packs"
|
||||||
|
|
|
@ -24,6 +24,7 @@ app = Flask(
|
||||||
app.register_blueprint(api)
|
app.register_blueprint(api)
|
||||||
if os.getenv("is_dev") == "True":
|
if os.getenv("is_dev") == "True":
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
|
|
||||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue