From 5bebb71f4d44bfc7f43dfcf33f8500ba041b37ec Mon Sep 17 00:00:00 2001 From: kieran Date: Fri, 29 Nov 2024 23:41:47 +0000 Subject: [PATCH] fix: nip96 upload fix: leaky file handles --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- ui_src/.env.development | 1 + ui_src/src/upload/nip96.ts | 2 +- ui_src/src/views/upload.tsx | 3 +-- 5 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 ui_src/.env.development diff --git a/Cargo.lock b/Cargo.lock index b539367..cb0d473 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1077,7 +1077,7 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ffmpeg-rs-raw" version = "0.1.0" -source = "git+https://git.v0l.io/Kieran/ffmpeg-rs-raw.git?rev=4c3e1dfccc46d5487110dd9de5ba672c4d32697f#4c3e1dfccc46d5487110dd9de5ba672c4d32697f" +source = "git+https://git.v0l.io/Kieran/ffmpeg-rs-raw.git?rev=df69b2f05da4279e36ad55086d77b45b2caf5174#df69b2f05da4279e36ad55086d77b45b2caf5174" dependencies = [ "anyhow", "ffmpeg-sys-the-third", @@ -1089,7 +1089,7 @@ dependencies = [ [[package]] name = "ffmpeg-sys-the-third" version = "2.1.0+ffmpeg-7.1" -source = "git+https://git.v0l.io/ffmpeg/ffmpeg-the-third.git?branch=master#0fdfa9ab506f5c92aad5a175db081c8a2c1579a1" +source = "git+https://git.v0l.io/Kieran/ffmpeg-the-third.git?rev=e5f8e077b04b10d5887bce4df1eb1a71738a6c66#e5f8e077b04b10d5887bce4df1eb1a71738a6c66" dependencies = [ "bindgen", "cc", diff --git a/Cargo.toml b/Cargo.toml index 407bc8b..b7ffde7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ reqwest = "0.12.8" clap = { version = "4.5.18", features = ["derive"] } libc = { version = "0.2.153", optional = true } -ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "4c3e1dfccc46d5487110dd9de5ba672c4d32697f", optional = true } +ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "df69b2f05da4279e36ad55086d77b45b2caf5174", optional = true } candle-core = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.7.2", optional = true } candle-nn = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.7.2", optional = true } candle-transformers = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.7.2", optional = true } diff --git a/ui_src/.env.development b/ui_src/.env.development new file mode 100644 index 0000000..3b60c35 --- /dev/null +++ b/ui_src/.env.development @@ -0,0 +1 @@ +VITE_API_URL="http://localhost:8000" \ No newline at end of file diff --git a/ui_src/src/upload/nip96.ts b/ui_src/src/upload/nip96.ts index abf54fc..ecf52c0 100644 --- a/ui_src/src/upload/nip96.ts +++ b/ui_src/src/upload/nip96.ts @@ -32,7 +32,7 @@ export class Nip96 { const fd = new FormData(); fd.append("size", file.size.toString()); fd.append("caption", file.name); - fd.append("media_type", file.type); + fd.append("content_type", file.type); fd.append("file", file); const rsp = await this.#req("", "POST", fd); diff --git a/ui_src/src/views/upload.tsx b/ui_src/src/views/upload.tsx index 47a6055..2dae25e 100644 --- a/ui_src/src/views/upload.tsx +++ b/ui_src/src/views/upload.tsx @@ -23,8 +23,7 @@ export default function Upload() { const login = useLogin(); const pub = usePublisher(); - const url = `${location.protocol}//${location.host}`; - //const url = "http://localhost:8000"; + const url = import.meta.env.VITE_API_URL || `${location.protocol}//${location.host}`; async function doUpload() { if (!pub) return; if (!toUpload) return;