mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
Merge remote-tracking branch 'fly/master'
This commit is contained in:
commit
8c1efb6b21
5 changed files with 61 additions and 2 deletions
|
@ -19,6 +19,8 @@ ________________________________________________________________________
|
||||||
________________________________________________________________________
|
________________________________________________________________________
|
||||||
== NUISANCES worth fixing, possibly ====================================
|
== NUISANCES worth fixing, possibly ====================================
|
||||||
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
|
- how is it that /join #foo.bar tries to connect a host called foo.bar?
|
||||||
|
|
||||||
- offline messages not being output (which *can* work even with OTR!)
|
- offline messages not being output (which *can* work even with OTR!)
|
||||||
<<< did i fix that recently?
|
<<< did i fix that recently?
|
||||||
|
|
||||||
|
|
|
@ -1005,6 +1005,22 @@ _PAGES_error
|
||||||
|
|
|
|
||||||
|{_HTML_tail}
|
|{_HTML_tail}
|
||||||
|
|
||||||
|
_PAGES_group_challenge
|
||||||
|
|<title>challenge for [_nick_place]@{_VAR_host}</title>
|
||||||
|
|
|
||||||
|
|{_HTML_head}
|
||||||
|
|<div align="center">
|
||||||
|
|<h1>[_challenge]</h1>
|
||||||
|
|
|
||||||
|
|## action="/@[_nick_place]" doesn't make it better
|
||||||
|
|<form method="GET">
|
||||||
|
|<input type="string" name="answer">
|
||||||
|
|<input type="hidden" name="parameters" value="[_parameters]">
|
||||||
|
|</form>
|
||||||
|
|
|
||||||
|
|</div>
|
||||||
|
|{_HTML_tail}
|
||||||
|
|
||||||
_PAGES_group_scratchpad
|
_PAGES_group_scratchpad
|
||||||
|<title>scratchpad for [_nick_place]@{_VAR_host}</title>
|
|<title>scratchpad for [_nick_place]@{_VAR_host}</title>
|
||||||
|
|
|
|
||||||
|
|
|
@ -168,8 +168,7 @@ process() {
|
||||||
P4(("found cookie: %O\n", t))
|
P4(("found cookie: %O\n", t))
|
||||||
if (t && sscanf(t, "psyced=\"%s\"", t)) {
|
if (t && sscanf(t, "psyced=\"%s\"", t)) {
|
||||||
P3(("got cookie: %O\n", t))
|
P3(("got cookie: %O\n", t))
|
||||||
query = url_parse_query(query, t);
|
qs = qs ? t+"&"+qs : t;
|
||||||
P4(("parsed cookie: %O\n", query))
|
|
||||||
}
|
}
|
||||||
#ifdef GENERIC_COOKIES // we might need them someday..?
|
#ifdef GENERIC_COOKIES // we might need them someday..?
|
||||||
// if within the same domain other cookies are being used, like
|
// if within the same domain other cookies are being used, like
|
||||||
|
@ -197,6 +196,8 @@ process() {
|
||||||
query = url_parse_query(query, body);
|
query = url_parse_query(query, body);
|
||||||
}
|
}
|
||||||
P4(("parsed query: %O\n", query))
|
P4(("parsed query: %O\n", query))
|
||||||
|
// remember original form of item in headers mapping
|
||||||
|
headers["item"] = item;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "/favicon.ico":
|
case "/favicon.ico":
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -610,6 +610,45 @@ htget(prot, query, headers, qs) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CHALLENGE_MATCH
|
||||||
|
#include <sys/regexp.h>
|
||||||
|
|
||||||
|
// maybe this all belongs into archetype.gen.. chesmo!
|
||||||
|
htget(prot, query, headers, qs, data, noprocess) {
|
||||||
|
if (stringp(headers["cookie"]) && regmatch(headers["cookie"],
|
||||||
|
"challenge=complete&answer="+ md5(CHALLENGE_MATCH)))
|
||||||
|
# ifdef HTGET
|
||||||
|
return HTGET;
|
||||||
|
# else
|
||||||
|
return ::htget(prot, query, headers, qs, data, noprocess);
|
||||||
|
# endif
|
||||||
|
string item = headers[item] || "/@"+ MYNICK;
|
||||||
|
if (stringp(query["answer"]) && headers["cookie"] &&
|
||||||
|
regmatch(headers["cookie"], "challenge=given") &&
|
||||||
|
regmatch(lower_case(query["answer"]), CHALLENGE_MATCH)) {
|
||||||
|
// lazy me could have used referer here ;)
|
||||||
|
string nu = stringp(query["parameters"]) &&
|
||||||
|
strlen(query["parameters"]) ?
|
||||||
|
item +"?"+ query["parameters"] : item;
|
||||||
|
htredirect(prot, nu, "Reload, please", 0, "Set-Cookie: psycplace=\"challenge=complete&answer="+ md5(CHALLENGE_MATCH) +"\"; path="+ item +";\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
sTextPath(query["layout"], query["lang"], "html");
|
||||||
|
// using a non-psyced cookie here so that you can't construct a
|
||||||
|
// url that allows other people to bypass the challenge.
|
||||||
|
// could add a timeout here...
|
||||||
|
htok3(prot, 0, "Set-Cookie: psycplace=\"challenge=given\"; path="+ item +";\n");
|
||||||
|
w("_PAGES_group_challenge", 0,
|
||||||
|
([ "_challenge" : htquote(CHALLENGE_QUESTION),
|
||||||
|
// if the user failed the challenge,
|
||||||
|
// we maintain the original qs for next attempt:
|
||||||
|
"_parameters" : query["parameters"] || qs,
|
||||||
|
"_nick_place" : MYNICK ]) );
|
||||||
|
// printf("%O vs %O\n", query, headers);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HISTORY
|
#ifdef HISTORY
|
||||||
# if defined(HISTORY_METHOD) || defined(HISTORY_MAY_LOG)
|
# if defined(HISTORY_METHOD) || defined(HISTORY_MAY_LOG)
|
||||||
mayLog(mc) {
|
mayLog(mc) {
|
||||||
|
|
|
@ -670,6 +670,7 @@ htget(prot, query, headers, qs, data, noprocess) {
|
||||||
write("\n\nYou are looking at the "+MYNICK+" default page.\n");
|
write("\n\nYou are looking at the "+MYNICK+" default page.\n");
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
//printf("%O: %O (%O) in %O\n", this_interactive(), query, qs, headers);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue