about summary refs log tree commit diff
path: root/client.nix
diff options
context:
space:
mode:
Diffstat (limited to 'client.nix')
-rw-r--r--client.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/client.nix b/client.nix
index ad58693..8744f2b 100644
--- a/client.nix
+++ b/client.nix
@@ -24,20 +24,25 @@ writeShellApplication {
       ssh = "sshpass -p ${sshPassword} ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${toString sshPort}";
       guest = "root@127.0.0.1";
       documentDir = "/home/root/.local/share/remarkable/xochitl";
+      baseUrl = "http://127.0.0.1:${toString httpPort}";
     in
     ''
       in="$1"
       out="$2"
 
-      in_basename="$(basename "$in")"
-
       ${ssh} ${guest} rm -rf ${documentDir}
       ${ssh} ${guest} mkdir ${documentDir}
 
-      rsync --rsh="${ssh}" "$in" ${guest}:${documentDir}
-      ${ssh} ${guest} "unzip '${documentDir}/$in_basename' -d ${documentDir}"
+      curl \
+        '${baseUrl}/upload' \
+        -H 'Origin: http://10.11.99.1' \
+        -H 'Accept: */*' \
+        -H 'Referer: http://10.11.99.1/' \
+        -H 'Connection: keep-alive' \
+        -F "file=@$in;filename=to-render.rmdoc;type=application/octet-stream"
+
       doc_id="$(${ssh} ${guest} find ${documentDir} -name '\*.metadata' -exec basename {} .metadata '\;')"
 
-      curl -f -o "$out" "http://127.0.0.1:${toString httpPort}/download/$doc_id/placeholder"
+      curl -f -o "$out" "${baseUrl}/download/$doc_id/placeholder"
     '';
 }