Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/lib/screens/connect_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class _ConnectScreenState extends State<ConnectScreen> {
await state.connect(url: _controller.text.trim());
if (mounted && !state.isConnected) {
setState(() {
_error = 'Cannot reach the server.\nMake sure NexaNote backend is running:\n python main.py';
_error = 'Cannot reach the server.\nStart NexaNote backend from the project folder:\n bash nexanote.sh\nor run:\n python main.py';
_connecting = false;
});
}
Expand Down Expand Up @@ -150,9 +150,9 @@ class _ConnectScreenState extends State<ConnectScreen> {
color: scheme.onSurface.withOpacity(0.7))),
]),
const SizedBox(height: 8),
_code('cd ~/NexaNote'),
_code('source venv/bin/activate'),
_code('cd <your-folder>/NexaNote'),
_code('python main.py'),
_code('# or: bash nexanote.sh'),
],
),
),
Expand Down
14 changes: 13 additions & 1 deletion launch_app.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/bash
GDK_BACKEND=x11 ~/NexaNote/app/build/linux/x64/release/bundle/app
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_BIN="$SCRIPT_DIR/app/build/linux/x64/release/bundle/app"

if [[ ! -x "$APP_BIN" ]]; then
echo "Binaire Flutter introuvable: $APP_BIN"
echo "Compilez d'abord l'app avec:"
echo " cd $SCRIPT_DIR/app && flutter build linux --release"
exit 1
fi

GDK_BACKEND=x11 "$APP_BIN"
33 changes: 25 additions & 8 deletions nexanote.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
#!/bin/bash
NEXANOTE_DIR="$HOME/NexaNote"
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NEXANOTE_DIR="$SCRIPT_DIR"
APP_DIR="$NEXANOTE_DIR/app"
VENV="$NEXANOTE_DIR/venv/bin/activate"
VENV_ACTIVATE="$NEXANOTE_DIR/venv/bin/activate"
LOG_FILE="/tmp/nexanote_backend.log"
BACKEND_PID=""

cleanup() {
if [[ -n "${BACKEND_PID}" ]]; then
kill "$BACKEND_PID" 2>/dev/null || true
fi
}
trap cleanup EXIT

if ! curl -s http://127.0.0.1:8766/health > /dev/null 2>&1; then
if ! curl -s http://127.0.0.1:8766/health >/dev/null 2>&1; then
echo "🚀 Démarrage du backend..."
source "$VENV"
if [[ -f "$VENV_ACTIVATE" ]]; then
# shellcheck source=/dev/null
source "$VENV_ACTIVATE"
else
echo "⚠️ venv introuvable ($VENV_ACTIVATE), utilisation du Python système"
fi

cd "$NEXANOTE_DIR"
python main.py > "$LOG_FILE" 2>&1 &
python main.py >"$LOG_FILE" 2>&1 &
BACKEND_PID=$!

echo -n "⏳ Attente"
for i in $(seq 1 20); do
for _ in $(seq 1 20); do
sleep 0.5
echo -n "."
if curl -s http://127.0.0.1:8766/health > /dev/null 2>&1; then
if curl -s http://127.0.0.1:8766/health >/dev/null 2>&1; then
echo " ✅"
break
fi
Expand All @@ -25,4 +43,3 @@ fi

cd "$APP_DIR"
GDK_BACKEND=x11 flutter run -d linux
kill $BACKEND_PID 2>/dev/null
5 changes: 4 additions & 1 deletion nexanote/sync/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import argparse
import hashlib
import importlib.util
import logging
import sys
from pathlib import Path
Expand Down Expand Up @@ -80,14 +81,16 @@ def build_app(

# Middleware
"middleware_stack": [
"wsgidav.debug_filter.WsgiDavDebugFilter",
"wsgidav.error_printer.ErrorPrinter",
"wsgidav.http_authenticator.HTTPAuthenticator",
"wsgidav.dir_browser.WsgiDavDirBrowser",
"wsgidav.request_resolver.RequestResolver",
],
}

if importlib.util.find_spec("wsgidav.debug_filter"):
config["middleware_stack"].insert(0, "wsgidav.debug_filter.WsgiDavDebugFilter")

return WsgiDAVApp(config)


Expand Down
Loading