parsav  Diff

Differences From Artifact [5e16c3f22b]:

To Artifact [ae96c17fe6]:


   172    172   	elseif path.ct == 1 then
   173    173   		lib.render.docpage(co, rstring.null())
   174    174   	else
   175    175   		co:complain(404, 'no such documentation', 'invalid documentation URL')
   176    176   	end
   177    177   end
   178    178   
   179         -terra http.configure(co: &lib.srv.convo, path: hpath)
   180         -	lib.render.conf(co,path)
          179  +terra http.configure(co: &lib.srv.convo, path: hpath, meth: method.t)
          180  +	var msg = pstring.null()
          181  +	if meth == method.post and path.ct >= 1 then
          182  +		var user_refresh = false var fail = false
          183  +		if path(1):cmp(lib.str.lit 'profile') then
          184  +			co.who.bio = co:postv('bio')._0
          185  +			co.who.nym = co:postv('nym')._0
          186  +			if co.who.bio ~= nil and @co.who.bio == 0 then co.who.bio = nil end
          187  +			if co.who.nym ~= nil and @co.who.nym == 0 then co.who.nym = nil end
          188  +			co.who.source:actor_save(co.who)
          189  +			msg = lib.str.plit 'profile changes saved'
          190  +			--user_refresh = true -- not really necessary here, actually
          191  +		elseif path(1):cmp(lib.str.lit 'srv') then
          192  +		elseif path(1):cmp(lib.str.lit 'users') then
          193  +
          194  +		end
          195  +
          196  +		if user_refresh then -- refresh the user info for the renderer
          197  +			var usr = co.srv:actor_fetch_uid(co.who.id)
          198  +			lib.mem.heapf(co.who)
          199  +			co.who = usr.ptr
          200  +		end
          201  +		var go,golen = co:getv('go')
          202  +		if not fail and go ~= nil then
          203  +			co:reroute(go)
          204  +			return
          205  +		end
          206  +	end
          207  +	lib.render.conf(co,path,msg)
   181    208   end
   182    209   
   183    210   do local branches = quote end
   184    211   	local filename, flen = symbol(&int8), symbol(intptr)
   185    212   	local page = symbol(lib.http.page)
   186    213   	local send = label()
   187    214   	local storage = data.stmap
................................................................................
   270    297   		elseif path.ptr[0]:cmp(lib.str.lit('tl')) then
   271    298   			http.timeline(co, path)
   272    299   		elseif path.ptr[0]:cmp(lib.str.lit('doc')) then
   273    300   			if meth ~= method.get and meth ~= method.head then goto wrongmeth end
   274    301   			http.documentation(co, path)
   275    302   		elseif path.ptr[0]:cmp(lib.str.lit('conf')) then
   276    303   			if co.aid == 0 then goto unauth end
   277         -			http.configure(co,path)
          304  +			http.configure(co,path,meth)
   278    305   		else goto notfound end
   279    306   		return
   280    307   	end
   281    308   
   282    309   	::wrongmeth:: co:complain(405, 'method not allowed', 'that method is not meaningful for this endpoint') do return end
   283    310   	::notfound:: co:complain(404, 'not found', 'no such resource available') do return end
   284    311   	::unauth:: co:complain(401, 'unauthorized', 'this content is not available at your clearance level') do return end
   285    312   end