Changeset 420 for binary-improvements/MapRendering
- Timestamp:
- Mar 28, 2023, 5:11:02 PM (21 months ago)
- Location:
- binary-improvements/MapRendering
- Files:
-
- 4 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/API.cs
r369 r420 9 9 ModEvents.GameStartDone.RegisterHandler (GameStartDone); 10 10 ModEvents.GameShutdown.RegisterHandler (GameShutdown); 11 ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone);12 11 } 13 12 … … 28 27 private void GameShutdown () { 29 28 webInstance?.Shutdown (); 30 MapRendering.MapRendering.Shutdown ();31 }32 33 private void CalcChunkColorsDone (Chunk _chunk) {34 MapRendering.MapRendering.RenderSingleChunk (_chunk);35 29 } 36 30 } -
binary-improvements/MapRendering/Commands/ReloadWebPermissions.cs
r359 r420 5 5 namespace AllocsFixes.CustomCommands { 6 6 public class ReloadWebPermissions : ConsoleCmdAbstract { 7 p ublic override string GetDescription () {7 protected override string getDescription () { 8 8 return "force reload of web permissions file"; 9 9 } 10 10 11 p ublic override string[] GetCommands () {12 return new[] {"reloadwebpermissions "};11 protected override string[] getCommands () { 12 return new[] {"reloadwebpermissions_legacy"}; 13 13 } 14 14 -
binary-improvements/MapRendering/Commands/WebPermissionsCmd.cs
r372 r420 4 4 namespace AllocsFixes.CustomCommands { 5 5 public class WebPermissionsCmd : ConsoleCmdAbstract { 6 p ublic override string[] GetCommands () {7 return new[] {"webpermission "};6 protected override string[] getCommands () { 7 return new[] {"webpermission_legacy"}; 8 8 } 9 9 10 p ublic override string GetDescription () {10 protected override string getDescription () { 11 11 return "Manage web permission levels"; 12 12 } 13 13 14 p ublic override string GetHelp () {14 protected override string getHelp () { 15 15 return "Set/get permission levels required to access a given web functionality. Default\n" + 16 16 "level required for functions that are not explicitly specified is 0.\n" + 17 17 "Usage:\n" + 18 " webpermission add <webfunction> <level>\n" +19 " webpermission remove <webfunction>\n" +20 " webpermission list";18 " webpermission_legacy add <webfunction> <level>\n" + 19 " webpermission_legacy remove <webfunction>\n" + 20 " webpermission_legacy list"; 21 21 } 22 22 -
binary-improvements/MapRendering/Commands/WebTokens.cs
r326 r420 7 7 private static readonly Regex validNameTokenMatcher = new Regex (@"^\w+$"); 8 8 9 p ublic override string[] GetCommands () {10 return new[] {"webtokens "};9 protected override string[] getCommands () { 10 return new[] {"webtokens_legacy"}; 11 11 } 12 12 13 p ublic override string GetDescription () {13 protected override string getDescription () { 14 14 return "Manage web tokens"; 15 15 } 16 16 17 p ublic override string GetHelp () {17 protected override string getHelp () { 18 18 return "Set/get webtoken permission levels. A level of 0 is maximum permission.\n" + 19 19 "Usage:\n" + 20 " webtokens add <username> <usertoken> <level>\n" +21 " webtokens remove <username>\n" +22 " webtokens list";20 " webtokens_legacy add <username> <usertoken> <level>\n" + 21 " webtokens_legacy remove <username>\n" + 22 " webtokens_legacy list"; 23 23 } 24 24 -
binary-improvements/MapRendering/Commands/webstat.cs
r359 r420 5 5 namespace AllocsFixes.CustomCommands { 6 6 public class webstat : ConsoleCmdAbstract { 7 p ublic override string GetDescription () {7 protected override string getDescription () { 8 8 return "DEBUG PURPOSES ONLY"; 9 9 } 10 10 11 p ublic override string[] GetCommands () {12 return new[] {"webstat "};11 protected override string[] getCommands () { 12 return new[] {"webstat_legacy"}; 13 13 } 14 14 -
binary-improvements/MapRendering/Web/API/ExecuteConsoleCommand.cs
r360 r420 31 31 } 32 32 33 int commandPermissionLevel = GameManager.Instance.adminTools. GetCommandPermissionLevel (command.GetCommands ());33 int commandPermissionLevel = GameManager.Instance.adminTools.Commands.GetCommandPermissionLevel (command.GetCommands ()); 34 34 35 35 if (_permissionLevel > commandPermissionLevel) { -
binary-improvements/MapRendering/Web/API/GetAllowedCommands.cs
r360 r420 9 9 JSONArray entries = new JSONArray (); 10 10 foreach (IConsoleCommand cc in SdtdConsole.Instance.GetCommands ()) { 11 int commandPermissionLevel = GameManager.Instance.adminTools. GetCommandPermissionLevel (cc.GetCommands ());11 int commandPermissionLevel = GameManager.Instance.adminTools.Commands.GetCommandPermissionLevel (cc.GetCommands ()); 12 12 if (_permissionLevel <= commandPermissionLevel) { 13 13 string cmd = string.Empty; -
binary-improvements/MapRendering/Web/API/GetLandClaims.cs
r369 r420 23 23 24 24 JSONObject result = new JSONObject (); 25 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumUtils.Parse<EnumGamePrefs> ( "LandClaimSize"))));25 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumUtils.Parse<EnumGamePrefs> (nameof(EnumGamePrefs.LandClaimSize))))); 26 26 27 27 JSONArray claimOwners = new JSONArray (); -
binary-improvements/MapRendering/Web/API/GetPlayerList.cs
r369 r420 68 68 pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1)); 69 69 70 JSONBoolean banned = admTools != null ? new JSONBoolean (admTools. IsBanned (kvp.Key, out _, out _)) : new JSONBoolean (false);70 JSONBoolean banned = admTools != null ? new JSONBoolean (admTools.Blacklist.IsBanned (kvp.Key, out _, out _)) : new JSONBoolean (false); 71 71 72 72 pJson.Add ("banned", banned); -
binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs
r369 r420 24 24 foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in playersList.Dict) { 25 25 if (admTools != null) { 26 if (admTools. IsBanned (kvp.Key, out _, out _)) {26 if (admTools.Blacklist.IsBanned (kvp.Key, out _, out _)) { 27 27 continue; 28 28 } -
binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
r369 r420 89 89 loadIconsFromFolder (modIconsPath, tintedIcons); 90 90 } catch (Exception e) { 91 Log.Error ("Failed loading icons from mod " + mod. ModInfo.Name.Value);91 Log.Error ("Failed loading icons from mod " + mod.Name); 92 92 Log.Exception (e); 93 93 } -
binary-improvements/MapRendering/Web/Handlers/StaticHandler.cs
r367 r420 1 1 using System.IO; 2 2 using System.Net; 3 using AllocsFixes.FileCache;3 using Webserver.FileCache; 4 4 5 5 namespace AllocsFixes.NetConnections.Servers.Web.Handlers { -
binary-improvements/MapRendering/Web/OpenID.cs
r351 r420 26 26 27 27 private const bool verboseSsl = false; 28 p ublic static booldebugOpenId;28 private static bool debugOpenId => Webserver.OpenID.debugOpenId; 29 29 30 30 static OpenID () { 31 for (int i = 0; i < Environment.GetCommandLineArgs ().Length; i++) {32 if (Environment.GetCommandLineArgs () [i].EqualsCaseInsensitive ("-debugopenid")) {33 debugOpenId = true;34 }35 }36 37 31 ServicePointManager.ServerCertificateValidationCallback = (_srvPoint, _certificate, _chain, _errors) => { 38 32 if (_errors == SslPolicyErrors.None) { -
binary-improvements/MapRendering/Web/Web.cs
r369 r420 7 7 using System.Text; 8 8 using System.Threading; 9 using AllocsFixes.FileCache;10 9 using AllocsFixes.NetConnections.Servers.Web.Handlers; 11 10 using AllocsFixes.NetConnections.Servers.Web.SSE; 12 11 using UnityEngine; 12 using Webserver.FileCache; 13 13 14 14 namespace AllocsFixes.NetConnections.Servers.Web { … … 25 25 public Web () { 26 26 try { 27 int webPort = GamePrefs.GetInt (EnumUtils.Parse<EnumGamePrefs> ( "ControlPanelPort"));27 int webPort = GamePrefs.GetInt (EnumUtils.Parse<EnumGamePrefs> (nameof(EnumGamePrefs.WebDashboardPort))); 28 28 if (webPort < 1 || webPort > 65533) { 29 Log.Out ("Webserver not started ( ControlPanelPort not within 1-65533)");29 Log.Out ("Webserver not started (WebDashboardPort not within 1-65533)"); 30 30 return; 31 31 } 32 32 33 33 if (!Directory.Exists (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location) + 34 "/webserver ")) {35 Log.Out ("Webserver not started (folder \"webserver \" not found in WebInterface mod folder)");34 "/webserver_legacy")) { 35 Log.Out ("Webserver not started (folder \"webserver_legacy\" not found in WebInterface mod folder)"); 36 36 return; 37 37 } … … 40 40 bool useStaticCache = false; 41 41 42 string dataFolder = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location) + "/webserver ";42 string dataFolder = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location) + "/webserver_legacy"; 43 43 44 44 if (!HttpListener.IsSupported) { … … 60 60 RegisterPathHandler ("/map/", new StaticHandler ( 61 61 GameIO.GetSaveGameDir () + "/map", 62 MapRendering.MapRender ing.GetTileCache (),62 MapRendering.MapRenderer.GetTileCache (), 63 63 false, 64 64 "web.map") … … 248 248 if (con != null) { 249 249 _con = con; 250 return GameManager.Instance.adminTools. GetUserPermissionLevel (_con.UserId);250 return GameManager.Instance.adminTools.Users.GetUserPermissionLevel (_con.UserId); 251 251 } 252 252 } … … 270 270 WebConnection con = connectionHandler.LogIn (id, _req.RemoteEndPoint.Address); 271 271 _con = con; 272 int level = GameManager.Instance.adminTools. GetUserPermissionLevel (con.UserId);272 int level = GameManager.Instance.adminTools.Users.GetUserPermissionLevel (con.UserId); 273 273 Log.Out ("Steam OpenID login from {0} with ID {1}, permission level {2}", 274 274 remoteEndpointString, con.UserId, level); -
binary-improvements/MapRendering/Web/WebPermissions.cs
r372 r420 171 171 172 172 private string GetFilePath () { 173 return GamePrefs.GetString (EnumUtils.Parse<EnumGamePrefs> ( "SaveGameFolder"));173 return GamePrefs.GetString (EnumUtils.Parse<EnumGamePrefs> (nameof(EnumGamePrefs.SaveGameFolder))); 174 174 } 175 175 -
binary-improvements/MapRendering/WebAndMapRendering.csproj
r373 r420 9 9 <OutputType>Library</OutputType> 10 10 <RootNamespace>MapRendering</RootNamespace> 11 <AssemblyName> MapRendering</AssemblyName>11 <AssemblyName>AllocsWeb</AssemblyName> 12 12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 13 13 </PropertyGroup> … … 39 39 <Private>False</Private> 40 40 </Reference> 41 <Reference Include="com.rlabrecque.steamworks.net, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> 42 <HintPath>..\7dtd-binaries\com.rlabrecque.steamworks.net.dll</HintPath> 43 <Private>False</Private> 44 </Reference> 41 45 <Reference Include="LogLibrary"> 42 46 <HintPath>..\7dtd-binaries\LogLibrary.dll</HintPath> 47 <Private>False</Private> 48 </Reference> 49 <Reference Include="MapRendering, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> 50 <HintPath>..\7dtd-binaries\MapRendering.dll</HintPath> 43 51 <Private>False</Private> 44 52 </Reference> … … 75 83 <Private>False</Private> 76 84 </Reference> 85 <Reference Include="WebServer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> 86 <HintPath>..\7dtd-binaries\WebServer.dll</HintPath> 87 <Private>False</Private> 88 </Reference> 77 89 </ItemGroup> 78 90 <ItemGroup> 79 91 <Compile Include="AssemblyInfo.cs" /> 80 <Compile Include="MapRendering\MapRendering.cs" />81 <Compile Include="MapRendering\MapRenderBlockBuffer.cs" />82 <Compile Include="MapRendering\Constants.cs" />83 <Compile Include="Commands\RenderMap.cs" />84 <Compile Include="Commands\EnableRendering.cs" />85 92 <Compile Include="API.cs" /> 86 93 <Compile Include="Web\API\GetAnimalsLocation.cs" /> … … 121 128 <Compile Include="Web\WebCommandResult.cs" /> 122 129 <Compile Include="Web\API\GetAllowedCommands.cs" /> 123 <Compile Include="Commands\EnableOpenIDDebug.cs" />124 130 <Compile Include="Web\API\GetPlayerInventories.cs" /> 125 131 </ItemGroup>
Note:
See TracChangeset
for help on using the changeset viewer.