aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Sonix.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-07 12:18:29 +0100
committerDanilo M. <danix@danix.xyz>2026-11-07 12:18:29 +0100
commitafd271be2187b350cc9963dcf0cf51bb0fef937d (patch)
tree74937a7e3f0d01bbe7fa2559ef102a7f2bf26357 /desktop/Sonix.qml
parent9aef136ab4c6af5590867e49fc46054d968f3043 (diff)
downloadquickshell-afd271be2187b350cc9963dcf0cf51bb0fef937d.tar.gz
quickshell-afd271be2187b350cc9963dcf0cf51bb0fef937d.zip
sonix: final review fixes: header, stale state, curl errors, plain text
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/Sonix.qml')
-rw-r--r--desktop/Sonix.qml10
1 files changed, 7 insertions, 3 deletions
diff --git a/desktop/Sonix.qml b/desktop/Sonix.qml
index d279dc6..46a5c61 100644
--- a/desktop/Sonix.qml
+++ b/desktop/Sonix.qml
@@ -7,6 +7,7 @@
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
pragma Singleton
@@ -62,7 +63,7 @@ Singleton {
onExited: code => { console.warn("sonix: beacon relay exited", code); respawn.restart(); }
}
Timer { id: respawn; interval: 5000; onTriggered: { beacon.running = false; beacon.running = true; } }
- Timer { id: lost; interval: 6000; onTriggered: { root.present = false; console.log("sonix: gone"); } }
+ Timer { id: lost; interval: 6000; onTriggered: { root.present = false; root.player = ({}); root.error = ""; console.log("sonix: gone"); } }
Timer {
interval: 1000
@@ -124,8 +125,10 @@ Singleton {
h=$1 f=$2 d=$3
curl -s -m 3 -o /dev/null "http://$h/" || exit 3
curl -s -m 10 -o /dev/null --data-urlencode "path=$d" "http://$h/create"
- code=$(curl -s -m 120 -o /dev/null -w '%{http_code}' --form-string "path=$d/" -F "files[]=@\"$f\"" "http://$h/upload") \
- || { echo "curl failed"; exit 1; }
+ err=$(mktemp) || exit 1
+ code=$(curl -sS -m 120 -o /dev/null -w '%{http_code}' --form-string "path=$d/" -F "files[]=@\"$f\"" "http://$h/upload" 2>"$err") \
+ || { cat "$err"; rm -f "$err"; exit 1; }
+ rm -f "$err"
[ "$code" = 200 ] || { echo "HTTP $code"; exit 1; }
`
Process {
@@ -143,6 +146,7 @@ Singleton {
}
}
function upload(file, cardDir, cb) {
+ if (/["\\]/.test(file)) { cb(1, "the output folder name contains \" or \\"); return; }
if (up.running) { cb(1, "an upload is already running"); return; }
up.cb = cb;
up.code = -1;