Compare commits

...

2 commits

Author SHA1 Message Date
11c2b23c16
fix: disable BAPS beta mode 2024-04-01 01:34:47 +01:00
26ba37b3eb
feat: package server ui 2024-04-01 01:30:28 +01:00
4 changed files with 61 additions and 4 deletions

View file

@ -17,6 +17,24 @@
webstudio = import ./webstudio.nix {
inherit pkgs;
};
ui-templates = pkgs.stdenv.mkDerivation {
name = "baps-ui-templates";
src = ./ui-templates;
phases = "installPhase";
installPhase = ''
mkdir -p $out
cp -R $src/. $out
'';
};
ui-static = pkgs.stdenv.mkDerivation {
name = "baps-ui-static";
src = ./ui-static;
phases = "installPhase";
installPhase = ''
mkdir -p $out
cp -R $src/. $out
'';
};
dependencies = ps: with ps; [
setuptools
wheel
@ -51,7 +69,10 @@
(pkgs.substituteAll {
src = ./patches/1-presenter-build-path.patch;
baps_presenter = "${webstudio}";
ui_static = "${ui-static}";
ui_templates = "${ui-templates}";
})
./patches/2-not-beta.patch
];
};

View file

@ -1,9 +1,25 @@
diff --git a/web_server.py b/web_server.py
index ccc3979..dc36db3 100644
index ccc3979..2909ff8 100644
--- a/web_server.py
+++ b/web_server.py
@@ -449,11 +449,11 @@ app.static(
app.static("/static", resolve_local_file_path("ui-static"), name="ui-static")
@@ -32,7 +32,7 @@ import package
from baps_types.happytime import happytime
env = Environment(
- loader=FileSystemLoader("%s/ui-templates/" % os.path.dirname(__file__)),
+ loader=FileSystemLoader("@ui_templates@"),
autoescape=select_autoescape(),
)
@@ -444,16 +444,16 @@ async def audio_file(request, type: str, id: int):
# Static Files
app.static(
- "/favicon.ico", resolve_local_file_path("ui-static/favicon.ico"), name="ui-favicon"
+ "/favicon.ico", "@ui_static@/favicon.ico", name="ui-favicon"
)
-app.static("/static", resolve_local_file_path("ui-static"), name="ui-static")
+app.static("/static", "@ui_static@", name="ui-static")
-dist_directory = resolve_local_file_path("presenter-build")

21
patches/2-not-beta.patch Normal file
View file

@ -0,0 +1,21 @@
diff --git a/package.py b/package.py
index 1689140..bacf68f 100644
--- a/package.py
+++ b/package.py
@@ -12,15 +12,7 @@ with open(resolve_local_file_path("package.json")) as file:
build_commit = "Dev"
build_branch = "Local"
- build_beta = True
- try:
- import build
-
- build_commit = build.BUILD
- build_branch = build.BRANCH
- build_beta = build_branch != "release"
- except (ModuleNotFoundError, AttributeError):
- pass
+ build_beta = False
BUILD: str = build_commit
BRANCH: str = build_branch
BETA: bool = build_beta

View file

@ -12,7 +12,6 @@ let
};
in
pkgs.stdenv.mkDerivation {
pname = "baps-presenter";
name = "baps-presenter";
inherit src;