aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs5
-rw-r--r--OpenSim/Server/Handlers/Web/WebServerInConnector.cs107
-rw-r--r--bin/Robust.ini21
-rw-r--r--bin/config-include/config_IG.ini23
-rw-r--r--bin/config-include/config_MG.ini23
-rw-r--r--bin/config-include/config_localhost.ini1
-rw-r--r--example/config/config.ini2
-rw-r--r--example/web/SledjHamr.pngbin0 -> 2025959 bytes
-rw-r--r--example/web/about.html9
-rw-r--r--example/web/help.html9
-rw-r--r--example/web/loginpage.html24
-rw-r--r--example/web/password_help.html9
-rw-r--r--example/web/register.html11
13 files changed, 236 insertions, 8 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 18d6e4a..1afc5a4 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1303,6 +1303,11 @@ namespace OpenSim.Framework
1303 return Path.Combine("..", "logs"); 1303 return Path.Combine("..", "logs");
1304 } 1304 }
1305 1305
1306 public static string webDir()
1307 {
1308 return Path.Combine("..", Path.Combine("..", "web"));
1309 }
1310
1306 public static string logFile() 1311 public static string logFile()
1307 { 1312 {
1308 foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) 1313 foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
diff --git a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
new file mode 100644
index 0000000..94c636f
--- /dev/null
+++ b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Net;
33using System.Reflection;
34using System.Security;
35using System.Text;
36using log4net;
37using OpenMetaverse;
38using OpenMetaverse.StructuredData;
39using Nini.Config;
40using OpenSim.Framework;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base;
43
44namespace OpenSim.Server.Handlers.Web
45{
46 public class WebServerInConnector : ServiceConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 private IConfigSource m_Config;
50 private Hashtable mime = new Hashtable();
51
52 public WebServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName)
53 {
54 m_Config = config;
55 mime.Add(".html", "text/html");
56 mime.Add(".htm", "text/html");
57 mime.Add(".shtml", "text/html");
58 mime.Add(".txt", "text/plain");
59 mime.Add(".css", "text/css");
60 mime.Add(".js", "application/javascript");
61 mime.Add(".png", "image/png");
62 mime.Add(".jpeg", "image/jpeg");
63 server.AddHTTPHandler("/web/", WebRequestHandler);
64 }
65
66 private Hashtable WebRequestHandler(Hashtable request)
67 {
68 Hashtable reply = new Hashtable();
69
70 string reqpath = (string) request["uri"];
71 string[] query = (string[]) request["querystringkeys"];
72 Hashtable headers = (Hashtable) request["headers"];
73 string method = (string) request["http-method"];
74 string type = (string) request["content-type"];
75 string body = (string) request["body"];
76 string file = Path.Combine(Util.webDir(), reqpath.Remove(0, 5));
77
78 reply["int_response_code"] = 200;
79 if (File.Exists(file))
80 {
81 string m = (string) mime[Path.GetExtension(file)];
82 reply["content_type"] = m;
83 if (("image/jpeg" == m) || ("image/png" == m))
84 {
85 reply["bin_response_data"] = File.ReadAllBytes(file);
86 }
87 else
88 {
89 StreamReader csr = File.OpenText(file);
90 reply["str_response_string"] = csr.ReadToEnd();
91 csr.Close();
92 }
93 }
94 else
95 {
96 m_log.ErrorFormat("[WEB SERVICE]: Unable to read {0}.", file);
97 reply["int_response_code"] = 404;
98 reply["content_type"] = "text/html";
99 reply["str_response_string"] = "<html><title>404 Unknown page</title><head></head><body bgcolor=\"black\" text=\"white\" alink=\"red\" link=\"blue\" vlink=\"purple\">" +
100 "404 error, can't find the " + reqpath + " page.<p>&nbsp;</p></body></html>";
101 }
102
103 return reply;
104 }
105
106 }
107}
diff --git a/bin/Robust.ini b/bin/Robust.ini
index 00ad2ca..ca5829c 100644
--- a/bin/Robust.ini
+++ b/bin/Robust.ini
@@ -87,6 +87,10 @@
87 ;; Uncomment this if you want Groups V2, HG to work 87 ;; Uncomment this if you want Groups V2, HG to work
88 HGGroupsServiceConnector = "${Const|PublicPort}/OpenSim.Addons.Groups.dll:HGGroupsServiceRobustConnector" 88 HGGroupsServiceConnector = "${Const|PublicPort}/OpenSim.Addons.Groups.dll:HGGroupsServiceRobustConnector"
89 89
90 ;; Basic web server.
91 WebServerInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:WebServerInConnector"
92
93
90; * This is common for all services, it's the network setup for the entire 94; * This is common for all services, it's the network setup for the entire
91; * server instance, if none is specified above 95; * server instance, if none is specified above
92; * 96; *
@@ -563,32 +567,32 @@
563 567
564 ; login page: optional: if it exists it will be used to tell the client to use 568 ; login page: optional: if it exists it will be used to tell the client to use
565 ; this as splash page 569 ; this as splash page
566 welcome = ${Const|BaseURL}/drupal/loginpage 570 welcome = ${Const|BaseURL}:${Const|PublicPort}/web/loginpage.html
567 571
568 ; helper uri: optional: if it exists it will be used to tell the client to use 572 ; helper uri: optional: if it exists it will be used to tell the client to use
569 ; this for all economy related things 573 ; this for all economy related things
570 ;economy = ${Const|BaseURL}/economy 574 ;economy = ${Const|BaseURL}/economy
571 575
572 ; web page of grid: optional: page providing further information about your grid 576 ; web page of grid: optional: page providing further information about your grid
573 about = ${Const|BaseURL}/drupal/ 577 about = ${Const|BaseURL}:${Const|PublicPort}/web/about.html
574 578
575 ; account creation: optional: page providing further information about obtaining 579 ; account creation: optional: page providing further information about obtaining
576 ; a user account on your grid 580 ; a user account on your grid
577 register = ${Const|BaseURL}/drupal/content/How_to_join 581 register = ${Const|BaseURL}:${Const|PublicPort}/web/register.html
578 582
579 ; help: optional: page providing further assistance for users of your grid 583 ; help: optional: page providing further assistance for users of your grid
580 help = ${Const|BaseURL}/drupal/Tags/help 584 help = ${Const|BaseURL}:${Const|PublicPort}/web/help.html
581 585
582 ; password help: optional: page providing password assistance for users of your grid 586 ; password help: optional: page providing password assistance for users of your grid
583 password = ${Const|BaseURL}/drupal 587 password = ${Const|BaseURL}:${Const|PublicPort}/web/password_help.html
584 588
585 ; HG address of the gatekeeper, if you have one 589 ; HG address of the gatekeeper, if you have one
586 ; this is the entry point for all the regions of the world 590 ; this is the entry point for all the regions of the world
587 ; gatekeeper = ${Const|BaseURL}:${Const|PublicPort}/ 591 gatekeeper = ${Const|BaseURL}:${Const|PublicPort}/
588 592
589 ; HG user domain, if you have one 593 ; HG user domain, if you have one
590 ; this is the entry point for all user-related HG services 594 ; this is the entry point for all user-related HG services
591 ; uas = ${Const|BaseURL}:${Const|PublicPort}/ 595 uas = ${Const|BaseURL}:${Const|PublicPort}/
592 596
593 597
594[GatekeeperService] 598[GatekeeperService]
@@ -783,3 +787,6 @@
783 787
784[MuteListService] 788[MuteListService]
785 LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService" 789 LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService"
790
791
792[WebService]
diff --git a/bin/config-include/config_IG.ini b/bin/config-include/config_IG.ini
index abe159b..81c5c9d 100644
--- a/bin/config-include/config_IG.ini
+++ b/bin/config-include/config_IG.ini
@@ -18,6 +18,7 @@
18 ConfigPath = "../../config" 18 ConfigPath = "../../config"
19 DbPath = "../../db" 19 DbPath = "../../db"
20 LogPath = "../../logs" 20 LogPath = "../../logs"
21 WebPath = "../../web"
21 22
22[Const] 23[Const]
23 MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some." 24 MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some."
@@ -77,3 +78,25 @@
77 Region_Welcome = "DefaultRegion, FallbackRegion, Persistent" 78 Region_Welcome = "DefaultRegion, FallbackRegion, Persistent"
78 Region_Sandbox = "DefaultRegion, FallbackRegion, Persistent" 79 Region_Sandbox = "DefaultRegion, FallbackRegion, Persistent"
79 Region_Kellietown = "DefaultRegion, FallbackRegion, Persistent" 80 Region_Kellietown = "DefaultRegion, FallbackRegion, Persistent"
81
82[GridInfoService]
83 ; login page: optional: if it exists it will be used to tell the client to use
84 ; this as splash page
85 welcome = ${Const|BaseURL}/drupal/loginpage
86
87 ; helper uri: optional: if it exists it will be used to tell the client to use
88 ; this for all economy related things
89 ;economy = ${Const|BaseURL}/economy
90
91 ; web page of grid: optional: page providing further information about your grid
92 about = ${Const|BaseURL}/drupal/
93
94 ; account creation: optional: page providing further information about obtaining
95 ; a user account on your grid
96 register = ${Const|BaseURL}/drupal/content/How_to_join
97
98 ; help: optional: page providing further assistance for users of your grid
99 help = ${Const|BaseURL}/drupal/Tags/help
100
101 ; password help: optional: page providing password assistance for users of your grid
102 password = ${Const|BaseURL}/drupal
diff --git a/bin/config-include/config_MG.ini b/bin/config-include/config_MG.ini
index a8992f8..62b523c 100644
--- a/bin/config-include/config_MG.ini
+++ b/bin/config-include/config_MG.ini
@@ -18,6 +18,7 @@
18 ConfigPath = "../../config" 18 ConfigPath = "../../config"
19 DbPath = "../../db" 19 DbPath = "../../db"
20 LogPath = "../../logs" 20 LogPath = "../../logs"
21 WebPath = "../../web"
21 22
22[Const] 23[Const]
23 MOTD = "All of the World is a Stage, and Everyone's a Critic." 24 MOTD = "All of the World is a Stage, and Everyone's a Critic."
@@ -98,3 +99,25 @@
98 Region_MisFitz_HyperPort = "FallbackRegion" 99 Region_MisFitz_HyperPort = "FallbackRegion"
99 Region_MisFitz_Sandbox = "FallbackRegion" 100 Region_MisFitz_Sandbox = "FallbackRegion"
100 Region_MisFitz_Continuum= "DefaultHGRegion" 101 Region_MisFitz_Continuum= "DefaultHGRegion"
102
103[GridInfoService]
104 ; login page: optional: if it exists it will be used to tell the client to use
105 ; this as splash page
106 welcome = ${Const|jOpensimURL}/index.php?option=com_opensim
107
108 ; helper uri: optional: if it exists it will be used to tell the client to use
109 ; this for all economy related things
110 economy = ${Const|BaseURL}/_tools/helper/
111
112 ; web page of grid: optional: page providing further information about your grid
113 ;about = ${Const|BaseURL}/about
114
115 ; account creation: optional: page providing further information about obtaining
116 ; a user account on your grid
117 ;register = ${Const|BaseURL}/register
118
119 ; help: optional: page providing further assistance for users of your grid
120 ;help = ${Const|BaseURL}/help
121
122 ; password help: optional: page providing password assistance for users of your grid
123 ;password = ${Const|BaseURL}/password
diff --git a/bin/config-include/config_localhost.ini b/bin/config-include/config_localhost.ini
index 9959ae1..e95b04c 100644
--- a/bin/config-include/config_localhost.ini
+++ b/bin/config-include/config_localhost.ini
@@ -18,6 +18,7 @@
18 ConfigPath = "../../config" 18 ConfigPath = "../../config"
19 DbPath = "../../db" 19 DbPath = "../../db"
20 LogPath = "../../logs" 20 LogPath = "../../logs"
21 WebPath = "../../web"
21 22
22[Const] 23[Const]
23 MOTD = "Welcome to your local grid." 24 MOTD = "Welcome to your local grid."
diff --git a/example/config/config.ini b/example/config/config.ini
index 7efdb44..e95b04c 100644
--- a/example/config/config.ini
+++ b/example/config/config.ini
@@ -18,7 +18,7 @@
18 ConfigPath = "../../config" 18 ConfigPath = "../../config"
19 DbPath = "../../db" 19 DbPath = "../../db"
20 LogPath = "../../logs" 20 LogPath = "../../logs"
21 21 WebPath = "../../web"
22 22
23[Const] 23[Const]
24 MOTD = "Welcome to your local grid." 24 MOTD = "Welcome to your local grid."
diff --git a/example/web/SledjHamr.png b/example/web/SledjHamr.png
new file mode 100644
index 0000000..1660a90
--- /dev/null
+++ b/example/web/SledjHamr.png
Binary files differ
diff --git a/example/web/about.html b/example/web/about.html
new file mode 100644
index 0000000..e45f00a
--- /dev/null
+++ b/example/web/about.html
@@ -0,0 +1,9 @@
1<html>
2<title>About this grid</title>
3<head>
4</head>
5<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple">
6This is a virtual world, usually called a grid, based on <a href="https://sledjhamr.org/cgit/opensim-SC/?h=SledjChisl">OpenSim_SC</a>.
7<p>&nbsp;</p>
8</body>
9</html>
diff --git a/example/web/help.html b/example/web/help.html
new file mode 100644
index 0000000..64194ca
--- /dev/null
+++ b/example/web/help.html
@@ -0,0 +1,9 @@
1<html>
2<title>Help for this grid</title>
3<head>
4</head>
5<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple">
6Include help for your grid here.
7<p>&nbsp;</p>
8</body>
9</html>
diff --git a/example/web/loginpage.html b/example/web/loginpage.html
new file mode 100644
index 0000000..aa58e6b
--- /dev/null
+++ b/example/web/loginpage.html
@@ -0,0 +1,24 @@
1<html>
2<title>This grid</title>
3<head>
4</head>
5<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple" background="SledjHamr.png">
6<p>&nbsp;</p>
7<p>&nbsp;</p>
8<h1>Add your fancy splash page for your grid here.</h1>
9<p>&nbsp;</p>
10<p>&nbsp;</p>
11<p>There may be some new members. &nbsp; Welcome new members.</p>
12<p>&nbsp;</p>
13<p>There are likely some members of this grid.</p>
14<p>&nbsp;</p>
15<p>There maybe some people online now.</p>
16<p>&nbsp;</p>
17<p>There maybe some visitors from the hypergrid.</p>
18<p>&nbsp;</p>
19<p>There is probably at least one region, maybe more.</p>
20<p>&nbsp;</p>
21<p>Some people might have been on in the last month.</p>
22<p>&nbsp;</p>
23</body>
24</html>
diff --git a/example/web/password_help.html b/example/web/password_help.html
new file mode 100644
index 0000000..129fb7d
--- /dev/null
+++ b/example/web/password_help.html
@@ -0,0 +1,9 @@
1<html>
2<title>Password help for this grid</title>
3<head>
4</head>
5<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple">
6Include password help for your grid here.
7<p>&nbsp;</p>
8</body>
9</html>
diff --git a/example/web/register.html b/example/web/register.html
new file mode 100644
index 0000000..a316f41
--- /dev/null
+++ b/example/web/register.html
@@ -0,0 +1,11 @@
1<html>
2<title>Account for this grid</title>
3<head>
4</head>
5<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple">
6Include account registration help for your grid here.
7<p>&nbsp;</p>
8<p>If you want to register an acocunt on this grid, ask the person that runs it to do that for you.</p>
9<p>&nbsp;</p>
10</body>
11</html>