diff --git a/elemes.sh b/elemes.sh index 84d9ef1..ee7befd 100755 --- a/elemes.sh +++ b/elemes.sh @@ -5,6 +5,26 @@ PARENT_DIR="$(dirname "$SCRIPT_DIR")" EXAMPLES_DIR="$SCRIPT_DIR/examples" PROJECT_NAME="$(basename "$PARENT_DIR")" +# Check for --verbose flag +VERBOSE=0 +for arg in "$@"; do + if [ "$arg" == "--verbose" ]; then + VERBOSE=1 + break + fi +done + +# Function to run podman-compose quietly unless verbose +run_compose() { + # Ensure we are in the script directory so podman-compose finds the yaml file + cd "$SCRIPT_DIR" || exit + if [ "$VERBOSE" -eq 1 ]; then + podman-compose -p "$PROJECT_NAME" --env-file "$PARENT_DIR/.env" "$@" + else + podman-compose -p "$PROJECT_NAME" --env-file "$PARENT_DIR/.env" "$@" >/dev/null 2>&1 + fi +} + case "$1" in init) echo "โจ === Elemes Quick Start === โจ" @@ -61,7 +81,7 @@ init) ;; stop | run | runbuild | runclearbuild) echo "๐ Menghentikan container yang sedang berjalan..." - podman-compose -p "$PROJECT_NAME" --env-file ../.env down + run_compose down ;;& stop) echo "โ Container berhasil dihentikan." @@ -70,20 +90,20 @@ runclearbuild) echo "๐งน Membersihkan container dan image (prune)..." podman image prune -f echo "๐๏ธ Membangun ulang container dari awal (no-cache)..." - podman-compose -p "$PROJECT_NAME" --env-file ../.env build --no-cache + run_compose build --no-cache ;;& runbuild) echo "๐๏ธ Membangun container..." - podman-compose -p "$PROJECT_NAME" --env-file ../.env build + run_compose build ;;& runbuild | runclearbuild) echo "๐ Menjalankan container di background..." - podman-compose -p "$PROJECT_NAME" --env-file ../.env up --force-recreate -d + run_compose up --force-recreate -d echo "โ Elemes berhasil dijalankan!" ;; run) echo "๐ Menjalankan container..." - podman-compose -p "$PROJECT_NAME" --env-file ../.env up + run_compose up -d echo "โ Elemes berhasil dijalankan!" ;; generatetoken) @@ -93,6 +113,7 @@ generatetoken) exportall) echo "๐ฆ === Mengekspor Semua Image (Pre-Compiled Bundle) ===" TAR_FILE="lms-c-precompiled.tar" + cd "$SCRIPT_DIR" || exit echo "๐๏ธ 1. Mem-build Backend Elemes..." podman build -t lms-c-backend:latest -f Dockerfile . @@ -179,31 +200,6 @@ verify) fi done ;; -loadtest) - echo "๐ === Elemes Load Testing ===" - cd "$SCRIPT_DIR/load-test" || exit - - if [ ! -d "env" ]; then - echo "โ๏ธ Membuat Python Virtual Environment (env/)..." - python3 -m venv env - fi - - echo "โ๏ธ Mengaktifkan environment & menginstall requirements..." - source env/bin/activate - pip install -r requirements.txt >/dev/null 2>&1 - - echo "โ๏ธ Mempersiapkan Test Data & menginjeksi akun Bot..." - python3 content_parser.py --num-tokens 50 - - echo "" - echo "๐ Memulai Locust Test Suite..." - echo "๐ Buka http://localhost:8089 di browser web milikmu." - echo "๐ Masukkan URL backend Elemes sebagai Host (contoh: http://localhost:5000)" - echo "๐ Tekan CTRL+C di terminal ini untuk menghentikan test." - echo "" - - locust -f locustfile.py - ;; *) echo "๐ก Cara Penggunaan elemes.sh:" echo " ./elemes.sh init # Inisialisasi konfigurasi, folder, & data tokens" diff --git a/frontend/src/lib/actions/renderCircuitEmbeds.ts b/frontend/src/lib/actions/renderCircuitEmbeds.ts index f6b9733..0c8af3c 100644 --- a/frontend/src/lib/actions/renderCircuitEmbeds.ts +++ b/frontend/src/lib/actions/renderCircuitEmbeds.ts @@ -15,8 +15,10 @@ function loadCircuitEmbed(div: HTMLElement) { wrapper.style.width = width; wrapper.style.height = height; + const isDark = document.documentElement.getAttribute('data-theme') === 'dark'; + const iframe = document.createElement('iframe'); - iframe.src = '/circuitjs1/circuitjs.html'; + iframe.src = `/circuitjs1/circuitjs.html?whiteBackground=${!isDark}`; iframe.style.width = '100%'; iframe.style.height = '100%'; iframe.style.border = 'none'; diff --git a/frontend/src/lib/components/CircuitEditor.svelte b/frontend/src/lib/components/CircuitEditor.svelte index 142230b..be9faf9 100644 --- a/frontend/src/lib/components/CircuitEditor.svelte +++ b/frontend/src/lib/components/CircuitEditor.svelte @@ -1,6 +1,7 @@