Subversion Repositories Koakuma

Rev

Rev 5 | Rev 9 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 8
Line 1... Line 1...
1
# $Id: rpc.tcl 5 2024-10-01 18:07:27Z nishi $
1
# $Id: rpc.tcl 8 2024-10-01 23:05:34Z nishi $
2
package require http
2
package require http
3
package require base64
3
package require base64
4
package require term::ansi::ctrl::unix
4
package require term::ansi::ctrl::unix
5
 
5
 
-
 
6
catch {
-
 
7
	package require tls
-
 
8
	::http::register https 443 ::tls::socket
-
 
9
}
-
 
10
 
-
 
11
set RPC_URL "http://127.0.0.1/koakuma/rpc"
-
 
12
if { [info exists "env(KOAKUMA_RPC)"] } {
-
 
13
	set RPC_URL "$env(KOAKUMA_RPC)"
-
 
14
}
-
 
15
set RPC_URL "[regsub {/+$} "$RPC_URL" ""]"
-
 
16
 
6
namespace eval rpc {
17
namespace eval rpc {
7
	proc require-auth {} {
18
	proc require-auth {} {
8
		global RPC_URL
19
		global RPC_URL
9
		set tok [::http::geturl "$RPC_URL"]
20
		set tok [::http::geturl "$RPC_URL"]
10
		set code [::http::ncode $tok]
21
		set code [::http::ncode $tok]