M bin/up.tcl => bin/up.tcl +1 -4
@@ 48,11 48,8 @@ if {$conf(avatar) != {}} {
set fd [open $conf(avatar) r]
fconfigure $fd -translation binary
- set avatar [read $fd]
- close $fd
- unset fd
- lassign [agent xrpc com.atproto.repo.uploadBlob -type $mime $avatar] av_ncode av_data
+ lassign [agent xrpc com.atproto.repo.uploadBlob -type $mime -chan $fd] av_ncode av_data
puts "upload: $av_data"
if {$av_ncode != 200} { return -code error "got $av_ncode uploading avatar!\n$av_data" }
M lib/atpagent.tcl => lib/atpagent.tcl +18 -8
@@ 53,15 53,25 @@ proc atpagent_inner {statename cmd argv} {
set rest [lassign $rest _ mime]
}
- if {[llength $rest] > 1 && $mime == "application/json"} {
- set rest [::json::write object {*}$rest]
- }
+ if {[lindex $rest 0] == "-chan"} {
+ lassign $rest _ chan
+
+ set http_state [http::geturl \
+ [dict get $state service]/xrpc/$endpoint \
+ -headers $headers \
+ -querychannel $chan \
+ -type $mime]
+ } else {
+ if {[llength $rest] > 1 && $mime == "application/json"} {
+ set rest [::json::write object {*}$rest]
+ }
- set http_state [http::geturl \
- [dict get $state service]/xrpc/$endpoint \
- -headers $headers \
- -query $rest \
- -type $mime]
+ set http_state [http::geturl \
+ [dict get $state service]/xrpc/$endpoint \
+ -headers $headers \
+ -query $rest \
+ -type $mime]
+ }
set ncode [::http::ncode $http_state]
set data [::json::json2dict [::http::data $http_state]]