Subversion Repositories Koakuma

Rev

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

Rev 9 Rev 11
Line 1... Line 1...
1
# $Id: rpc.tcl 9 2024-10-01 23:05:52Z nishi $
1
# $Id: rpc.tcl 11 2024-10-02 00:56:50Z 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 {
6
catch {
Line 71... Line 71...
71
		::http::cleanup $tok
71
		::http::cleanup $tok
72
		lappend result "$code"
72
		lappend result "$code"
73
		lappend result "$body"
73
		lappend result "$body"
74
		return $result
74
		return $result
75
	}
75
	}
-
 
76
	proc init {} {
-
 
77
		puts -nonewline "Authentication: "
-
 
78
		set status [::rpc::require-auth]
-
 
79
		if { $status == 1 } {
-
 
80
			puts "Required"
-
 
81
			if { ![::rpc::ask-auth] } {
-
 
82
				puts "Authentication failure"
-
 
83
				exit 1
-
 
84
			}
-
 
85
		} elseif { $status < 0 } {
-
 
86
			puts "Got forbidden, cannot continue"
-
 
87
			exit 1
-
 
88
		} else {
-
 
89
			puts "Not required"
-
 
90
		}
-
 
91
	}
76
}
92
}