diff options
Added REST-handler interface for the http server and changed the Admin Web front end to one.
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices.UserServer/OpenGridServices.UserServer.csproj | 40 | ||||
-rw-r--r-- | OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build | 1 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/AdminWebFront.cs | 164 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/IRestHandler.cs | 11 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/SimHttp.cs | 177 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSim.RegionServer.csproj | 44 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSim.RegionServer.dll.build | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 1 | ||||
-rw-r--r-- | bin/login.htm | 2 |
9 files changed, 258 insertions, 184 deletions
diff --git a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj index b0c0407..1b67165 100644 --- a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj +++ b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{36895293-A627-42EC-BA77-6AF6F5A4A7DF}</ProjectGuid> | 6 | <ProjectGuid>{36895293-A627-42EC-BA77-6AF6F5A4A7DF}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGridServices.UserServer</AssemblyName> | 13 | <AssemblyName>OpenGridServices.UserServer</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Exe</OutputType> | 18 | <OutputType>Exe</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenGridServices.UserServer</RootNamespace> | 21 | <RootNamespace>OpenGridServices.UserServer</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,30 +61,31 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Data" > | 72 | <Reference Include="System.Data"> |
66 | <HintPath>System.Data.dll</HintPath> | 73 | <HintPath>System.Data.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System.Xml" > | 76 | <Reference Include="System.Xml"> |
70 | <HintPath>System.Xml.dll</HintPath> | 77 | <HintPath>System.Xml.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="OpenSim.Framework.dll" > | 80 | <Reference Include="OpenSim.Framework.dll"> |
74 | <HintPath>..\bin\OpenSim.Framework.dll</HintPath> | 81 | <HintPath>..\bin\OpenSim.Framework.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="OpenSim.Framework.Console.dll" > | 84 | <Reference Include="OpenSim.Framework.Console.dll"> |
78 | <HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath> | 85 | <HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
81 | <Reference Include="libsecondlife.dll" > | 88 | <Reference Include="libsecondlife.dll"> |
82 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 89 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
83 | <Private>False</Private> | 90 | <Private>False</Private> |
84 | </Reference> | 91 | </Reference> |
@@ -86,9 +93,6 @@ | |||
86 | <ItemGroup> | 93 | <ItemGroup> |
87 | </ItemGroup> | 94 | </ItemGroup> |
88 | <ItemGroup> | 95 | <ItemGroup> |
89 | <Compile Include="ConsoleCmds.cs"> | ||
90 | <SubType>Code</SubType> | ||
91 | </Compile> | ||
92 | <Compile Include="Main.cs"> | 96 | <Compile Include="Main.cs"> |
93 | <SubType>Code</SubType> | 97 | <SubType>Code</SubType> |
94 | </Compile> | 98 | </Compile> |
@@ -106,4 +110,4 @@ | |||
106 | <PostBuildEvent> | 110 | <PostBuildEvent> |
107 | </PostBuildEvent> | 111 | </PostBuildEvent> |
108 | </PropertyGroup> | 112 | </PropertyGroup> |
109 | </Project> | 113 | </Project> \ No newline at end of file |
diff --git a/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build index f1c6180..1cb35dd 100644 --- a/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build +++ b/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build | |||
@@ -11,7 +11,6 @@ | |||
11 | <resources prefix="OpenGridServices.UserServer" dynamicprefix="true" > | 11 | <resources prefix="OpenGridServices.UserServer" dynamicprefix="true" > |
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="ConsoleCmds.cs" /> | ||
15 | <include name="Main.cs" /> | 14 | <include name="Main.cs" /> |
16 | <include name="UserHttp.cs" /> | 15 | <include name="UserHttp.cs" /> |
17 | <include name="Properties/AssemblyInfo.cs" /> | 16 | <include name="Properties/AssemblyInfo.cs" /> |
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs new file mode 100644 index 0000000..ea32589 --- /dev/null +++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs | |||
@@ -0,0 +1,164 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.IO; | ||
5 | |||
6 | namespace OpenSim.CAPS | ||
7 | { | ||
8 | public class AdminWebFront : IRestHandler | ||
9 | { | ||
10 | private string AdminPage; | ||
11 | private string NewAccountForm; | ||
12 | private string LoginForm; | ||
13 | private string passWord = "Admin"; | ||
14 | |||
15 | public AdminWebFront(string password) | ||
16 | { | ||
17 | passWord = password; | ||
18 | LoadAdminPage(); | ||
19 | } | ||
20 | |||
21 | public string HandleREST(string requestBody, string requestURL, string requestMethod) | ||
22 | { | ||
23 | string responseString = ""; | ||
24 | try | ||
25 | { | ||
26 | switch (requestURL) | ||
27 | { | ||
28 | case "/Admin": | ||
29 | if (requestMethod == "GET") | ||
30 | { | ||
31 | responseString = AdminPage; | ||
32 | } | ||
33 | break; | ||
34 | case "/Admin/Accounts": | ||
35 | if (requestMethod == "GET") | ||
36 | { | ||
37 | responseString = "<p> Account management </p>"; | ||
38 | responseString += "<br> "; | ||
39 | responseString += "<p> Create New Account </p>"; | ||
40 | responseString += NewAccountForm; | ||
41 | } | ||
42 | break; | ||
43 | case "/Admin/Clients": | ||
44 | if (requestMethod == "GET") | ||
45 | { | ||
46 | responseString = " <p> Listing connected Clients </p>"; | ||
47 | OpenSim.world.Avatar TempAv; | ||
48 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) | ||
49 | { | ||
50 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | ||
51 | { | ||
52 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; | ||
53 | responseString += "<p>"; | ||
54 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); | ||
55 | responseString += "</p>"; | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | break; | ||
60 | case "/Admin/NewAccount": | ||
61 | if (requestMethod == "POST") | ||
62 | { | ||
63 | string[] comp = new string[10]; | ||
64 | string[] passw = new string[3]; | ||
65 | string delimStr = "&"; | ||
66 | char[] delimiter = delimStr.ToCharArray(); | ||
67 | string delimStr2 = "="; | ||
68 | char[] delimiter2 = delimStr2.ToCharArray(); | ||
69 | |||
70 | //Console.WriteLine(requestBody); | ||
71 | comp = requestBody.Split(delimiter); | ||
72 | passw = comp[3].Split(delimiter2); | ||
73 | if (passw[1] == passWord) | ||
74 | { | ||
75 | responseString = "<p> New Account created </p>"; | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; | ||
80 | responseString += "<br><br>" + LoginForm; | ||
81 | } | ||
82 | } | ||
83 | break; | ||
84 | case "/Admin/Login": | ||
85 | if (requestMethod == "POST") | ||
86 | { | ||
87 | // Console.WriteLine(requestBody); | ||
88 | if (requestBody == passWord) | ||
89 | { | ||
90 | responseString = "<p> Login Successful </p>"; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | responseString = "<p> Password Error </p>"; | ||
95 | responseString += "<p> Please Login with the correct password </p>"; | ||
96 | responseString += "<br><br> " + LoginForm; | ||
97 | } | ||
98 | } | ||
99 | break; | ||
100 | case "/Admin/Welcome": | ||
101 | if (requestMethod == "GET") | ||
102 | { | ||
103 | responseString = "Welcome to the OpenSim Admin Page"; | ||
104 | responseString += "<br><br><br> " + LoginForm; | ||
105 | |||
106 | } | ||
107 | break; | ||
108 | } | ||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | Console.WriteLine(e.ToString()); | ||
113 | } | ||
114 | return responseString; | ||
115 | } | ||
116 | |||
117 | private void LoadAdminPage() | ||
118 | { | ||
119 | try | ||
120 | { | ||
121 | StreamReader SR; | ||
122 | string lines; | ||
123 | AdminPage = ""; | ||
124 | NewAccountForm = ""; | ||
125 | LoginForm = ""; | ||
126 | SR = File.OpenText("testadmin.htm"); | ||
127 | |||
128 | while (!SR.EndOfStream) | ||
129 | { | ||
130 | lines = SR.ReadLine(); | ||
131 | AdminPage += lines + "\n"; | ||
132 | |||
133 | } | ||
134 | SR.Close(); | ||
135 | |||
136 | SR = File.OpenText("newaccountform.htm"); | ||
137 | |||
138 | while (!SR.EndOfStream) | ||
139 | { | ||
140 | lines = SR.ReadLine(); | ||
141 | NewAccountForm += lines + "\n"; | ||
142 | |||
143 | } | ||
144 | SR.Close(); | ||
145 | |||
146 | SR = File.OpenText("login.htm"); | ||
147 | |||
148 | while (!SR.EndOfStream) | ||
149 | { | ||
150 | lines = SR.ReadLine(); | ||
151 | LoginForm += lines + "\n"; | ||
152 | |||
153 | } | ||
154 | SR.Close(); | ||
155 | } | ||
156 | catch (Exception e) | ||
157 | { | ||
158 | Console.WriteLine(e.ToString()); | ||
159 | } | ||
160 | |||
161 | } | ||
162 | |||
163 | } | ||
164 | } | ||
diff --git a/OpenSim.RegionServer/CAPS/IRestHandler.cs b/OpenSim.RegionServer/CAPS/IRestHandler.cs new file mode 100644 index 0000000..f269600 --- /dev/null +++ b/OpenSim.RegionServer/CAPS/IRestHandler.cs | |||
@@ -0,0 +1,11 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.CAPS | ||
6 | { | ||
7 | public interface IRestHandler | ||
8 | { | ||
9 | string HandleREST(string requestBody, string requestURL, string requestMethod); | ||
10 | } | ||
11 | } | ||
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs index c3f4801..a1073f0 100644 --- a/OpenSim.RegionServer/CAPS/SimHttp.cs +++ b/OpenSim.RegionServer/CAPS/SimHttp.cs | |||
@@ -48,17 +48,13 @@ namespace OpenSim.CAPS | |||
48 | { | 48 | { |
49 | public Thread HTTPD; | 49 | public Thread HTTPD; |
50 | public HttpListener Listener; | 50 | public HttpListener Listener; |
51 | private string AdminPage; | 51 | private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>(); |
52 | private string NewAccountForm; | ||
53 | private string LoginForm; | ||
54 | private string passWord = "Admin"; | ||
55 | 52 | ||
56 | public SimCAPSHTTPServer() | 53 | public SimCAPSHTTPServer() |
57 | { | 54 | { |
58 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | 55 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); |
59 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | 56 | HTTPD = new Thread(new ThreadStart(StartHTTP)); |
60 | HTTPD.Start(); | 57 | HTTPD.Start(); |
61 | LoadAdminPage(); | ||
62 | } | 58 | } |
63 | 59 | ||
64 | public void StartHTTP() | 60 | public void StartHTTP() |
@@ -84,7 +80,18 @@ namespace OpenSim.CAPS | |||
84 | } | 80 | } |
85 | } | 81 | } |
86 | 82 | ||
87 | private string ParseXMLRPC(string requestBody) | 83 | public bool AddRestHandler(string path, IRestHandler handler) |
84 | { | ||
85 | if (!this.restHandlers.ContainsKey(path)) | ||
86 | { | ||
87 | this.restHandlers.Add(path, handler); | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | //must already have a handler for that path so return false | ||
92 | return false; | ||
93 | } | ||
94 | protected virtual string ParseXMLRPC(string requestBody) | ||
88 | { | 95 | { |
89 | try | 96 | try |
90 | { | 97 | { |
@@ -116,104 +123,34 @@ namespace OpenSim.CAPS | |||
116 | return ""; | 123 | return ""; |
117 | } | 124 | } |
118 | 125 | ||
119 | private string ParseREST(string requestBody, string requestURL, string requestMethod) | 126 | protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod) |
120 | { | 127 | { |
128 | string[] path; | ||
129 | string pathDelimStr = "/"; | ||
130 | char[] pathDelimiter = pathDelimStr.ToCharArray(); | ||
131 | path = requestURL.Split(pathDelimiter); | ||
132 | |||
121 | string responseString = ""; | 133 | string responseString = ""; |
122 | try | 134 | |
135 | //path[0] should be empty so we are interested in path[1] | ||
136 | if (path.Length > 1) | ||
123 | { | 137 | { |
124 | switch (requestURL) | 138 | if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1]))) |
125 | { | 139 | { |
126 | case "/Admin/Accounts": | 140 | responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); |
127 | if (requestMethod == "GET") | ||
128 | { | ||
129 | responseString = "<p> Account management </p>"; | ||
130 | responseString += "<br> "; | ||
131 | responseString += "<p> Create New Account </p>"; | ||
132 | responseString += NewAccountForm; | ||
133 | } | ||
134 | break; | ||
135 | case "/Admin/Clients": | ||
136 | if (requestMethod == "GET") | ||
137 | { | ||
138 | responseString = " <p> Listing connected Clients </p>"; | ||
139 | OpenSim.world.Avatar TempAv; | ||
140 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) | ||
141 | { | ||
142 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | ||
143 | { | ||
144 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; | ||
145 | responseString += "<p>"; | ||
146 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); | ||
147 | responseString += "</p>"; | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | break; | ||
152 | case "/Admin/NewAccount": | ||
153 | if (requestMethod == "POST") | ||
154 | { | ||
155 | string[] comp = new string[10]; | ||
156 | string[] passw = new string[3]; | ||
157 | string delimStr = "&"; | ||
158 | char[] delimiter = delimStr.ToCharArray(); | ||
159 | string delimStr2 = "="; | ||
160 | char[] delimiter2 = delimStr2.ToCharArray(); | ||
161 | |||
162 | //Console.WriteLine(requestBody); | ||
163 | comp = requestBody.Split(delimiter); | ||
164 | passw = comp[3].Split(delimiter2); | ||
165 | if (passw[1] == passWord) | ||
166 | { | ||
167 | responseString = "<p> New Account created </p>"; | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; | ||
172 | responseString += "<br><br>" + LoginForm; | ||
173 | } | ||
174 | } | ||
175 | break; | ||
176 | case "/Admin/Login": | ||
177 | if (requestMethod == "POST") | ||
178 | { | ||
179 | // Console.WriteLine(requestBody); | ||
180 | if (requestBody == passWord) | ||
181 | { | ||
182 | responseString = "<p> Login Successful </p>"; | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | responseString = "<p> Password Error </p>"; | ||
187 | responseString += "<p> Please Login with the correct password </p>"; | ||
188 | responseString += "<br><br> " + LoginForm; | ||
189 | } | ||
190 | } | ||
191 | break; | ||
192 | case "/Admin/Welcome": | ||
193 | if (requestMethod == "GET") | ||
194 | { | ||
195 | responseString = "Welcome to the OpenSim Admin Page"; | ||
196 | responseString += "<br><br><br> " + LoginForm; | ||
197 | |||
198 | } | ||
199 | break; | ||
200 | } | 141 | } |
201 | } | 142 | } |
202 | catch (Exception e) | 143 | |
203 | { | ||
204 | Console.WriteLine(e.ToString()); | ||
205 | } | ||
206 | |||
207 | return responseString; | 144 | return responseString; |
208 | } | 145 | } |
209 | 146 | ||
210 | private string ParseLLSDXML(string requestBody) | 147 | protected virtual string ParseLLSDXML(string requestBody) |
211 | { | 148 | { |
212 | // dummy function for now - IMPLEMENT ME! | 149 | // dummy function for now - IMPLEMENT ME! |
213 | return ""; | 150 | return ""; |
214 | } | 151 | } |
215 | 152 | ||
216 | public void HandleRequest(Object stateinfo) | 153 | public virtual void HandleRequest(Object stateinfo) |
217 | { | 154 | { |
218 | // Console.WriteLine("new http incoming"); | 155 | // Console.WriteLine("new http incoming"); |
219 | HttpListenerContext context = (HttpListenerContext)stateinfo; | 156 | HttpListenerContext context = (HttpListenerContext)stateinfo; |
@@ -258,17 +195,9 @@ namespace OpenSim.CAPS | |||
258 | break; | 195 | break; |
259 | 196 | ||
260 | case null: | 197 | case null: |
261 | if ((request.HttpMethod == "GET") && (request.RawUrl == "/Admin")) | 198 | // must be REST or invalid crap, so pass to the REST parser |
262 | { | 199 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); |
263 | responseString = AdminPage; | 200 | response.AddHeader("Content-type", "text/html"); |
264 | response.AddHeader("Content-type", "text/html"); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | // must be REST or invalid crap, so pass to the REST parser | ||
269 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
270 | response.AddHeader("Content-type", "text/html"); | ||
271 | } | ||
272 | break; | 201 | break; |
273 | 202 | ||
274 | } | 203 | } |
@@ -280,52 +209,6 @@ namespace OpenSim.CAPS | |||
280 | output.Write(buffer, 0, buffer.Length); | 209 | output.Write(buffer, 0, buffer.Length); |
281 | output.Close(); | 210 | output.Close(); |
282 | } | 211 | } |
283 | |||
284 | private void LoadAdminPage() | ||
285 | { | ||
286 | try | ||
287 | { | ||
288 | StreamReader SR; | ||
289 | string lines; | ||
290 | AdminPage = ""; | ||
291 | NewAccountForm = ""; | ||
292 | LoginForm = ""; | ||
293 | SR = File.OpenText("testadmin.htm"); | ||
294 | |||
295 | while (!SR.EndOfStream) | ||
296 | { | ||
297 | lines = SR.ReadLine(); | ||
298 | AdminPage += lines + "\n"; | ||
299 | |||
300 | } | ||
301 | SR.Close(); | ||
302 | |||
303 | SR = File.OpenText("newaccountform.htm"); | ||
304 | |||
305 | while (!SR.EndOfStream) | ||
306 | { | ||
307 | lines = SR.ReadLine(); | ||
308 | NewAccountForm += lines + "\n"; | ||
309 | |||
310 | } | ||
311 | SR.Close(); | ||
312 | |||
313 | SR = File.OpenText("login.htm"); | ||
314 | |||
315 | while (!SR.EndOfStream) | ||
316 | { | ||
317 | lines = SR.ReadLine(); | ||
318 | LoginForm += lines + "\n"; | ||
319 | |||
320 | } | ||
321 | SR.Close(); | ||
322 | } | ||
323 | catch (Exception e) | ||
324 | { | ||
325 | Console.WriteLine(e.ToString()); | ||
326 | } | ||
327 | |||
328 | } | ||
329 | } | 212 | } |
330 | 213 | ||
331 | 214 | ||
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 2455f79..f376e04 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{4171D545-81F5-4C64-AD29-6D7414C38181}</ProjectGuid> | 6 | <ProjectGuid>{4171D545-81F5-4C64-AD29-6D7414C38181}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.RegionServer</AssemblyName> | 13 | <AssemblyName>OpenSim.RegionServer</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.RegionServer</RootNamespace> | 21 | <RootNamespace>OpenSim.RegionServer</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,26 +61,28 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Xml" > | 72 | <Reference Include="System.Data" /> |
73 | <Reference Include="System.Xml"> | ||
66 | <HintPath>System.Xml.dll</HintPath> | 74 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 75 | <Private>False</Private> |
68 | </Reference> | 76 | </Reference> |
69 | <Reference Include="libsecondlife.dll" > | 77 | <Reference Include="libsecondlife.dll"> |
70 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 78 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
71 | <Private>False</Private> | 79 | <Private>False</Private> |
72 | </Reference> | 80 | </Reference> |
73 | <Reference Include="Axiom.MathLib.dll" > | 81 | <Reference Include="Axiom.MathLib.dll"> |
74 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> | 82 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> |
75 | <Private>False</Private> | 83 | <Private>False</Private> |
76 | </Reference> | 84 | </Reference> |
77 | <Reference Include="Db4objects.Db4o.dll" > | 85 | <Reference Include="Db4objects.Db4o.dll"> |
78 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> | 86 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> |
79 | <Private>False</Private> | 87 | <Private>False</Private> |
80 | </Reference> | 88 | </Reference> |
@@ -84,25 +92,27 @@ | |||
84 | <Name>OpenSim.Framework.Console</Name> | 92 | <Name>OpenSim.Framework.Console</Name> |
85 | <Project>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</Project> | 93 | <Project>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 94 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 95 | <Private>False</Private> |
88 | </ProjectReference> | 96 | </ProjectReference> |
89 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | 97 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> |
90 | <Name>OpenSim.Physics.Manager</Name> | 98 | <Name>OpenSim.Physics.Manager</Name> |
91 | <Project>{0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}</Project> | 99 | <Project>{0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}</Project> |
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 100 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
93 | <Private>False</Private> | 101 | <Private>False</Private> |
94 | </ProjectReference> | 102 | </ProjectReference> |
95 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> | 103 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> |
96 | <Name>OpenSim.Framework</Name> | 104 | <Name>OpenSim.Framework</Name> |
97 | <Project>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</Project> | 105 | <Project>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</Project> |
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
99 | <Private>False</Private> | 107 | <Private>False</Private> |
100 | </ProjectReference> | 108 | </ProjectReference> |
101 | </ItemGroup> | 109 | </ItemGroup> |
102 | <ItemGroup> | 110 | <ItemGroup> |
103 | <Compile Include="AgentAssetUpload.cs"> | 111 | <Compile Include="AgentAssetUpload.cs"> |
104 | <SubType>Code</SubType> | 112 | <SubType>Code</SubType> |
105 | </Compile> | 113 | </Compile> |
114 | <Compile Include="CAPS\AdminWebFront.cs" /> | ||
115 | <Compile Include="CAPS\IRestHandler.cs" /> | ||
106 | <Compile Include="ConsoleCmds.cs"> | 116 | <Compile Include="ConsoleCmds.cs"> |
107 | <SubType>Code</SubType> | 117 | <SubType>Code</SubType> |
108 | </Compile> | 118 | </Compile> |
@@ -183,4 +193,4 @@ | |||
183 | <PostBuildEvent> | 193 | <PostBuildEvent> |
184 | </PostBuildEvent> | 194 | </PostBuildEvent> |
185 | </PropertyGroup> | 195 | </PropertyGroup> |
186 | </Project> | 196 | </Project> \ No newline at end of file |
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build index 37e4c3a..4e44c4b 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build | |||
@@ -23,6 +23,8 @@ | |||
23 | <include name="VersionInfo.cs" /> | 23 | <include name="VersionInfo.cs" /> |
24 | <include name="Assets/AssetCache.cs" /> | 24 | <include name="Assets/AssetCache.cs" /> |
25 | <include name="Assets/InventoryCache.cs" /> | 25 | <include name="Assets/InventoryCache.cs" /> |
26 | <include name="CAPS/AdminWebFront.cs" /> | ||
27 | <include name="CAPS/IRestHandler.cs" /> | ||
26 | <include name="CAPS/SimHttp.cs" /> | 28 | <include name="CAPS/SimHttp.cs" /> |
27 | <include name="types/Mesh.cs" /> | 29 | <include name="types/Mesh.cs" /> |
28 | <include name="types/Triangle.cs" /> | 30 | <include name="types/Triangle.cs" /> |
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index e26f200..7425fca 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -114,6 +114,7 @@ namespace OpenSim | |||
114 | 114 | ||
115 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); | 115 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); |
116 | OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(); | 116 | OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(); |
117 | OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin")); | ||
117 | 118 | ||
118 | timer1.Enabled = true; | 119 | timer1.Enabled = true; |
119 | timer1.Interval = 100; | 120 | timer1.Interval = 100; |
diff --git a/bin/login.htm b/bin/login.htm index 2becee9..683af10 100644 --- a/bin/login.htm +++ b/bin/login.htm | |||
@@ -1,5 +1,5 @@ | |||
1 | <form action="javascript:setpass();" name="logon" id="logon"> | 1 | <form action="javascript:setpass();" name="logon" id="logon"> |
2 | <p> Admin PassWord: <input type="password" id="Adminpss" size="17" maxlength="34"> </P> | 2 | <p> Admin Password: <input type="password" id="Adminpss" size="17" maxlength="34"> </P> |
3 | <input type="button" name="button" value="Login" | 3 | <input type="button" name="button" value="Login" |
4 | onclick="javascript:setpass(this.parentNode);"> | 4 | onclick="javascript:setpass(this.parentNode);"> |
5 | </form> \ No newline at end of file | 5 | </form> \ No newline at end of file |