Posted to tcl by mookie at Sat Nov 01 01:57:37 GMT 2025view pretty
namespace eval crystal::netdisc::fountain { crystal::debug 1 "" "-> [file tail [info script]]"}
variable namespace "crystal::netdisc::[file rootname [file tail [info script]]]"
# Method # URI # Procedure to execute # CraftSheet / HTML Method
crystal::register "GET" "/::crystal/fountain" "${namespace}" "fountain" "get"
crystal::register "POST" "/::crystal/fountain" "${namespace}" "fountain" "post"
##
# crystal::ghui ghui/system.ix
# crystal::prompt::load prompt/system.ix
# crystal::render crystal/render.ix
# crystal::construct crystal/construct.ix
##
proc crystal::netdisc::fountain {{args}} {
namespace eval crystal::netdisc::execute {}
variable base32_input [crystal::lidx $args 0]
variable base32_phase [crystal::lidx $args 1]
crystal::debug 0 "$base32_input" "base32_input"
crystal::debug 0 "$base32_phase" "base32_phase"
proc crystal::netdisc::execute {base32_input base32_phase} {
variable crystal [crystal::client::construct $base32_input]
interp eval $crystal [list variable base32_phase $base32_phase]
interp eval $crystal {
# Switch method
# Dependent on if it's GET or POST
# Set or Get a idx
# Case
# post - Get the client_key via formvalue
# get - Get the identity via URL query
switch $base32_phase {
post {
variable base16_crystal [crystal::client::set "base16_indentity" [crystal::client::get formvalue "formkey"]]
variable base16_client_key [crystal::client::get identity $base16_crystal]
}
get {
variable base16_crystal [crystal::client::set "base16_indentity" [crystal::client::query]]
variable base16_client_key [crystal::client::get identity $base16_crystal]
}
} ;# end switch
# Store the craftsheet in to the client keys store
crystal::hextdict "insert_to" "$base16_client_key" "ghui" "craftsheet" \
"[crystal::render::craftsheet $base32_input]"
crystal::prompt load $base16_client_key $base32_input
# crystal::prompt::load $base16_client_key $base32_input
# Render our data retrieved from our clients dictonary
# Construct the query string passed from client and render
crystal::render [crystal::construct $base16_client_key "$base32_input"]
} ;# end interp
} ;# end proc
crystal::netdisc::execute $base32_input $base32_phase
} ;#end proc