aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--example/var/www/html/footer.html55
-rw-r--r--example/var/www/html/header.html16
-rw-r--r--example/var/www/html/headerDebug.html26
-rw-r--r--src/sledjchisl/sledjchisl.c144
4 files changed, 132 insertions, 109 deletions
diff --git a/example/var/www/html/footer.html b/example/var/www/html/footer.html
new file mode 100644
index 0000000..f514fb6
--- /dev/null
+++ b/example/var/www/html/footer.html
@@ -0,0 +1,55 @@
1 </div>
2 <div class='top-right'>
3 <h1>Experimental account manager</h1>
4 <p>This account manager system is currently experimental, and under heavy development. &nbsp;
5 Which means it's not all written yet, and things may break.</p>
6 <p>To create an account, choose a name and password, type them in, click the 'create account' button.</p>
7 <p>On the next page, fill in all your details, then click on the 'confirm' button.</p>
8 <p>We follow the usual web site registration process, which sends a validation email, with a link to click. &nbsp;
9 When you get that email, click on the link, or copy it into a web browser.</p>
10 <p>You will then be logged off. &nbsp; Now you have to wait for an admin to approve your new account. &nbsp;
11 They should check with the person you listed as vouching for you first. &nbsp; They will tell you after they approve your account.</p>
12 <p>Missing bits that are still being written - editing accounts, listing accounts, deleting accounts.</p>
13 <h1>Experimental chat thingy</h1>
14 <p>In the bottom right corner is an experimental chat thingy, based on Jabber / XMPP.</p>
15 <p>Click on the 'Toggle chat' button to pop it up, then use your grid user name for the 'XMPP Address:' field. &nbsp;
16 Your user name has to be in the format 'first.last', two words with a dot in the middle. &nbsp;
17 Then put your grid account password in the 'Password' field and click the 'Log in' button. &nbsp;
18 <p>Note that the chat windows can be resized by dragging their top or left edges, which I suggest you do, coz the default size is too small.</p>
19 <p>You can also use any other Jabber / XMPP client as well. So your JID for other clients is first.last@<!--#echo var="host" --></p>
20 <p>Remember this is <b>EXPERIMENTAL</b>, I'll be changing things. &nbsp; Next I'll make it so you don't have to log in to both this chat thingy and the account page separataly.<p>
21 <p>P.S. &nbsp; Yes, I hate the default theme to. &nbsp; lol</p>
22 </div>
23 <div class='bottom-left'>
24 <iframe src='stats.html' style='border:none;height:100%;width:100%;'></iframe>
25 </div>
26 <div class='bottom-right'>
27 </div>
28 </font>
29</body>
30
31<script>
32 converse.initialize({
33 allow_registration: false,
34 assets_path: '/converse.js/dist/',
35 bosh_service_url: 'https://<!--#echo var="host" -->:5281/http-bind/',
36 default_domain: '<!--#echo var="host" -->',
37 muc_clear_messages_on_leave: false,
38 muc_domain: 'chat.<!--#echo var="host" -->',
39 muc_history_max_stanzas: 0,
40 muc_instant_rooms: false,
41 muc_send_probes: true,
42 notify_all_room_messages: true,
43 notification_delay: 500000,
44 notification_icon: '/converse.js/dist/images/logo/conversejs-filled.svg',
45 omemo_default: true,
46 play_sounds: true,
47 registration_domain: '<!--#echo var="host" -->',
48 show_chat_state_notifications: true,
49 show_message_avatar: true,
50 theme: 'dracula',
51 time_format: 'dddd YYYY-MMM-DD HH:mm:ss',
52 view_mode: 'overlayed'
53 })
54</script>
55</html>
diff --git a/example/var/www/html/header.html b/example/var/www/html/header.html
new file mode 100644
index 0000000..b56d057
--- /dev/null
+++ b/example/var/www/html/header.html
@@ -0,0 +1,16 @@
1<html>
2 <head>
3 <title><!--#echo var="title" --></title>
4 <meta charset="UTF-8">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=0.5" />
7 <link rel="manifest" href="/converse.js/manifest.json">
8 <link type='text/css' rel='stylesheet' href='/converse.js/dist/converse.min.css' media='screen' />
9 <script src='/converse.js/3rdparty/libsignal-protocol.min.js'></script>
10 <script src='/converse.js/dist/converse.min.js'></script>
11 <link rel="shortcut icon" href="/SledjHamrIconSmall.png">
12 <link type='text/css' rel='stylesheet' href='/SledjChisl.css' media='all' />
13 </head>
14 <body bgcolor='black' text='white' link='aqua' vlink='fuchsia' alink='red' id='page-top' data-spy='scroll' class='converse-website'>
15 <font face='sans-serif'>
16 <div class='top-left'>
diff --git a/example/var/www/html/headerDebug.html b/example/var/www/html/headerDebug.html
new file mode 100644
index 0000000..df0fc99
--- /dev/null
+++ b/example/var/www/html/headerDebug.html
@@ -0,0 +1,26 @@
1<html>
2 <head>
3 <title><!--#echo var="title" --></title>
4 <meta charset="UTF-8">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=0.5" />
7 <link rel="manifest" href="/converse.js/manifest.json">
8 <link type='text/css' rel='stylesheet' href='/converse.js/dist/converse.min.css' media='screen' />
9 <script src='/converse.js/3rdparty/libsignal-protocol.min.js'></script>
10 <script src='/converse.js/dist/converse.min.js'></script>
11 <link rel="shortcut icon" href="/SledjHamrIconSmall.png">
12 <link type='text/css' rel='stylesheet' href='/SledjChisl.css' media='all' />
13 <link type='text/css' rel='stylesheet' href='/debugStyle.css' media='all' />
14 </head>
15 <body bgcolor='black' text='white' link='aqua' vlink='fuchsia' alink='red' id='page-top' data-spy='scroll' class='converse-website'>
16 <font face='sans-serif'>
17 <div class='top-left'>
18 <p class='hoverItem'>
19 <div class='hoverWrapper0'>
20 <p>DEBUG</p>
21 <div id='hoverShow0'>
22 <h1>DEBUG log</h1>
23 <!--#echo var="DEBUG" -->
24 </div>
25 </div>
26 </p>
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index adfc2f9..ec24b22 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -488,7 +488,7 @@ struct _reqData
488{ 488{
489 lua_State *L; 489 lua_State *L;
490 qhashtbl_t *configs, *queries, *body, *cookies, *headers, *valid, *stuff, *database, *Rcookies, *Rheaders; 490 qhashtbl_t *configs, *queries, *body, *cookies, *headers, *valid, *stuff, *database, *Rcookies, *Rheaders;
491 char *Scheme, *Host, *Method, *Script, *Path, *RUri, *doit, *form, *output, *outQuery; 491 char *Scheme, *Host, *Method, *Script, *Path, *RUri, *doit, *form, *output, *outQuery, *title;
492 sesh shs, *lnk; 492 sesh shs, *lnk;
493 gridStats *stats; 493 gridStats *stats;
494 qlist_t *errors, *messages; 494 qlist_t *errors, *messages;
@@ -4689,53 +4689,6 @@ struct _fragment
4689 char *text; 4689 char *text;
4690}; 4690};
4691 4691
4692static void HTMLdebug(qgrow_t *reply)
4693{
4694 reply->addstrf(reply,
4695 " <p class='hoverItem'>\n"
4696 " <div class='hoverWrapper0'>\n"
4697 " <p>DEBUG</p>\n"
4698 " <div id='hoverShow0'>\n"
4699 " <h1>DEBUG log</h1>\n"
4700 " <!--#echo var=\"DEBUG\" -->\n"
4701 " </div>\n"
4702 " </div>\n"
4703 " </p>\n"
4704 );
4705}
4706
4707static void HTMLheader(qgrow_t *reply, char *title)
4708{
4709 reply->addstrf(reply,
4710 "<html>\n"
4711 " <head>\n"
4712 " <title>%s</title>\n"
4713 " <meta charset=\"UTF-8\">\n"
4714 " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"
4715 " <meta name=\"viewport\" content=\"width=device-width, initial-scale=0.5\" />\n"
4716// " <meta name=\"description\" content=\"Converse XMPP/Jabber Chat\"/>\n"
4717// " <meta name=\"author\" content=\"JC Brand\" />\n"
4718 " <link rel=\"manifest\" href=\"/converse.js/manifest.json\">\n"
4719 " <link type='text/css' rel='stylesheet' href='/converse.js/dist/converse.min.css' media='screen' />\n"
4720 " <script src='/converse.js/3rdparty/libsignal-protocol.min.js'></script>\n"
4721 " <script src='/converse.js/dist/converse.min.js'></script>\n"
4722 " <link rel=\"shortcut icon\" href=\"/SledjHamrIconSmall.png\">\n"
4723 " <link type='text/css' rel='stylesheet' href='/SledjChisl.css' media='all' />\n"
4724
4725 , title);
4726
4727 if (DEBUG)
4728 reply->addstrf(reply, " <link type='text/css' rel='stylesheet' href='/debugStyle.css' media='all' />\n");
4729
4730 reply->addstrf(reply,
4731 " </head>\n"
4732 " <body bgcolor='black' text='white' link='aqua' vlink='fuchsia' alink='red' id='page-top' data-spy='scroll' class='converse-website'>\n"
4733 " <font face='sans-serif'>\n"
4734 );
4735 reply->addstrf(reply, " <div class='top-left'>\n");
4736 if (DEBUG)
4737 HTMLdebug(reply);
4738}
4739 4692
4740// TODO - maybe escape non printables as well? 4693// TODO - maybe escape non printables as well?
4741char *HTMLentities[] = 4694char *HTMLentities[] =
@@ -5056,6 +5009,10 @@ void HTMLfill(reqData *Rd, enum fragmentType type, char *text, int length)
5056 outize(Rd->reply, Rd->Rheaders, "Reply HEADERS"); 5009 outize(Rd->reply, Rd->Rheaders, "Reply HEADERS");
5057 } 5010 }
5058 } 5011 }
5012 else if (strcmp("host", text) == 0)
5013 Rd->reply->addstrf(Rd->reply, "%s", Rd->Host);
5014 else if (strcmp("title", text) == 0)
5015 Rd->reply->addstrf(Rd->reply, "%s", Rd->title);
5059 else if (strcmp("URL", text) == 0) 5016 else if (strcmp("URL", text) == 0)
5060 Rd->reply->addstrf(Rd->reply, "%s://%s%s", Rd->Scheme, Rd->Host, Rd->Script); 5017 Rd->reply->addstrf(Rd->reply, "%s://%s%s", Rd->Scheme, Rd->Host, Rd->Script);
5061 else 5018 else
@@ -5073,66 +5030,6 @@ void HTMLfill(reqData *Rd, enum fragmentType type, char *text, int length)
5073 } 5030 }
5074} 5031}
5075 5032
5076static void HTMLfooter(reqData *Rd)
5077{
5078 Rd->reply->addstrf(Rd->reply, " </div>\n");
5079 Rd->reply->addstr(Rd->reply,
5080 " <div class='top-right'>\n"
5081 " <h1>Experimental account manager</h1>\n"
5082 " <p>This account manager system is currently experimental, and under heavy development. &nbsp; "
5083 " Which means it's not all written yet, and things may break.</p>\n"
5084 " <p>To create an account, choose a name and password, type them in, click the 'create account' button.</p>"
5085 " <p>On the next page, fill in all your details, then click on the 'confirm' button.</p>"
5086 " <p>We follow the usual web site registration process, which sends a validation email, with a link to click. &nbsp; "
5087 " When you get that email, click on the link, or copy it into a web browser.</p>"
5088 " <p>You will then be logged off. &nbsp; Now you have to wait for an admin to approve your new account. &nbsp; "
5089 " They should check with the person you listed as vouching for you first. &nbsp; They will tell you after they approve your account.</p>"
5090 " <p>Missing bits that are still being written - editing accounts, listing accounts, deleting accounts.</p>\n"
5091 " <h1>Experimental chat thingy</h1>\n"
5092 " <p>In the bottom right corner is an experimental chat thingy, based on Jabber / XMPP.</p>\n"
5093 " <p>Click on the 'Toggle chat' button to pop it up, then use your grid user name for the 'XMPP Address:' field. &nbsp; "
5094 " Your user name has to be in the format 'first.last', two words with a dot in the middle. &nbsp; "
5095 " Then put your grid account password in the 'Password' field and click the 'Log in' button. &nbsp; "
5096 " Ignore the 'Don't have a chat account? Create an account' bit.</p>\n"
5097 " <p>Note that the chat windows can be resized by dragging their top or left edges, which I suggest you do, coz the default size is too small.</p>\n"
5098 " <p>You can also use any other Jabber / XMPP client as well.</p>\n"
5099 " <p>Remember this is <b>EXPERIMENTAL</b>, I'll be changing things. &nbsp; Next I'll make it so you don't have to log in to both this chat thingy and the account page separataly.<p>"
5100 " <p>P.S. &nbsp; Yes, I hate the default theme to. &nbsp; lol</p>\n"
5101 " </div>\n");
5102// Rd->reply->addstr(Rd->reply, " <div class='centre'>\n </div>\n");
5103 Rd->reply->addstrf(Rd->reply,
5104 " <div class='bottom-left'>\n"
5105 " <iframe src='stats.html' style='border:none;height:100%;width:100%;'></iframe>\n"
5106 " </div>\n"
5107 " <div class='bottom-right'>\n"
5108 " </div>\n"
5109 " </font>\n"
5110 "</body>\n"
5111
5112 "<script>\n"
5113 " converse.initialize({\n"
5114 " assets_path: '/converse.js/dist/',\n"
5115 " bosh_service_url: 'https://%s:5281/http-bind/',\n"
5116 " view_mode: 'overlayed',\n"
5117 " default_domain: '%s',\n"
5118 " muc_clear_messages_on_leave: false,\n"
5119 " muc_domain: 'chat.%s',\n"
5120 " muc_history_max_stanzas: 0,\n"
5121 " muc_send_probes: true,\n"
5122 " notify_all_room_messages: true,\n"
5123 " notification_delay:500000,\n"
5124 " play_sounds: true,\n"
5125 " registration_domain: '%s',\n"
5126 " show_chat_state_notifications: true,\n"
5127 " show_message_avatar: false,\n"
5128 " theme: 'dracula',\n"
5129 " time_format: 'dddd YYYY-MMM-DD HH:mm:ss'\n"
5130 " });\n"
5131 "</script>\n"
5132 "</html>\n", webHost, webHost, webHost, webHost);
5133}
5134
5135
5136fragment *newFragment(enum fragmentType type, char *text, int len) 5033fragment *newFragment(enum fragmentType type, char *text, int len)
5137{ 5034{
5138 fragment *frg = xmalloc(sizeof(fragment)); 5035 fragment *frg = xmalloc(sizeof(fragment));
@@ -5298,9 +5195,36 @@ HTMLfile *checkHTMLcache(char *file)
5298 return ret; 5195 return ret;
5299} 5196}
5300 5197
5198static void HTMLheader(reqData *Rd, /*qgrow_t *reply,*/ char *title)
5199{
5200 char *f = NULL;
5301 5201
5202 Rd->title = xmprintf(title);
5203 if (DEBUG)
5204 f = xmprintf("%s%s/headerDebug.html", scRoot, webRoot);
5205 else
5206 f = xmprintf("%s%s/header.html", scRoot, webRoot);
5207 HTMLfile *thisFile = checkHTMLcache(f);
5208 if (NULL != thisFile)
5209 unfragize(thisFile->fragments, Rd, FALSE);
5210 else
5211 E("Can't find %s file!", f);
5212 free(thisFile);
5213 free(f);
5214}
5302 5215
5216static void HTMLfooter(reqData *Rd)
5217{
5218 char *f = xmprintf("%s%s/footer.html", scRoot, webRoot);
5303 5219
5220 HTMLfile *thisFile = checkHTMLcache(f);
5221 if (NULL != thisFile)
5222 unfragize(thisFile->fragments, Rd, FALSE);
5223 else
5224 E("Can't find %s file!", f);
5225 free(thisFile);
5226 free(f);
5227}
5304 5228
5305/* TODO - 5229/* TODO -
5306 5230
@@ -7067,7 +6991,8 @@ static void accountWebHeaders(reqData *Rd, inputForm *oF) //, char *name)
7067{ 6991{
7068 char *linky = checkLinky(Rd); 6992 char *linky = checkLinky(Rd);
7069 6993
7070 HTMLheader(Rd->reply, "<!--#echo var=\"grid\" --> account manager"); 6994 Rd->title = xmprintf("<!--#echo var=\"grid\" --> account manager");
6995 HTMLheader(Rd, "<!--#echo var=\"grid\" --> account manager");
7071 Rd->reply->addstrf(Rd->reply, "<h1><!--#echo var=\"grid\" --> account manager</h1>\n"); 6996 Rd->reply->addstrf(Rd->reply, "<h1><!--#echo var=\"grid\" --> account manager</h1>\n");
7072 if (NULL != Rd->shs.name) 6997 if (NULL != Rd->shs.name)
7073 { 6998 {
@@ -9931,6 +9856,7 @@ fcgiDone:
9931 qhashtbl_free(Rd->queries); 9856 qhashtbl_free(Rd->queries);
9932 if (Rd->lnk) free(Rd->lnk); 9857 if (Rd->lnk) free(Rd->lnk);
9933 free(Rd->RUri); 9858 free(Rd->RUri);
9859 free(Rd->title);
9934 9860
9935 struct timespec now; 9861 struct timespec now;
9936 if (-1 == clock_gettime(CLOCK_REALTIME, &now)) 9862 if (-1 == clock_gettime(CLOCK_REALTIME, &now))