aboutsummaryrefslogtreecommitdiffstats
path: root/src/copyparty/mod.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-19 02:45:49 +0200
committersalmonik <salmonik@tuta.io>2026-08-19 02:45:49 +0200
commit850fad62f12b4e764f5e64036db35259237994cb (patch)
treed5b25e9c00f01e3fd19f47b0270a88e1e5f5576e /src/copyparty/mod.rs
parentfeat: local TTS via piper subprocess with Google fallback (diff)
downloadsenator-sperma-850fad62f12b4e764f5e64036db35259237994cb.tar.gz
senator-sperma-850fad62f12b4e764f5e64036db35259237994cb.zip
fix: Various cron fixes
Not saving full URL Not using autocompletion content, just label
Diffstat (limited to 'src/copyparty/mod.rs')
-rw-r--r--src/copyparty/mod.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/copyparty/mod.rs b/src/copyparty/mod.rs
index 164c9f8..a9f7d01 100644
--- a/src/copyparty/mod.rs
+++ b/src/copyparty/mod.rs
@@ -158,11 +158,7 @@ impl CopypartyClient {
158 /// if a password is configured. Path can be absolute (e.g. `/music/foo.mp3`) 158 /// if a password is configured. Path can be absolute (e.g. `/music/foo.mp3`)
159 /// or relative (`music/foo.mp3`). 159 /// or relative (`music/foo.mp3`).
160 pub fn build_url(&self, path: &str) -> String { 160 pub fn build_url(&self, path: &str) -> String {
161 let prefixed = if path.starts_with('/') { 161 let prefixed = self.build_url_no_pw(path);
162 format!("{}{}", self.base_url, path)
163 } else {
164 format!("{}/{}", self.base_url, path)
165 };
166 if let Some(pw) = &self.password { 162 if let Some(pw) = &self.password {
167 format!("{prefixed}?pw={pw}") 163 format!("{prefixed}?pw={pw}")
168 } else { 164 } else {
@@ -170,6 +166,15 @@ impl CopypartyClient {
170 } 166 }
171 } 167 }
172 168
169 /// Build full URL without the password parameter.
170 pub fn build_url_no_pw(&self, path: &str) -> String {
171 if path.starts_with('/') {
172 format!("{}{}", self.base_url, path)
173 } else {
174 format!("{}/{}", self.base_url, path)
175 }
176 }
177
173 /// Search copyparty via the jPOST `/?srch` endpoint. 178 /// Search copyparty via the jPOST `/?srch` endpoint.
174 /// 179 ///
175 /// Uses `serde_json::Value` for flexible response parsing (mirroring the Python 180 /// Uses `serde_json::Value` for flexible response parsing (mirroring the Python