source: binary-improvements2/MapRendering/Web/API/GetWebMods.cs@ 388

Last change on this file since 388 was 387, checked in by alloc, 2 years ago

Big refactoring in Web to pass around a Context instead of a bunch of individual arguments all the time

File size: 977 bytes
Line 
1using AllocsFixes.JSON;
2
3namespace AllocsFixes.NetConnections.Servers.Web.API {
4 public class GetWebMods : AbsWebAPI {
5 private readonly JSONArray loadedWebMods = new JSONArray ();
6
7 public GetWebMods (Web _parent) {
8 foreach (WebMod webMod in _parent.webMods) {
9 JSONObject modJson = new JSONObject ();
10
11 modJson.Add ("name", new JSONString (webMod.ParentMod.ModInfo.Name.Value));
12
13 string webModReactBundle = webMod.ReactBundle;
14 if (webModReactBundle != null) {
15 modJson.Add ("bundle", new JSONString (webModReactBundle));
16 }
17
18 string webModCssFile = webMod.CssPath;
19 if (webModCssFile != null) {
20 modJson.Add ("css", new JSONString (webModCssFile));
21 }
22
23 loadedWebMods.Add (modJson);
24 }
25 }
26
27 public override void HandleRequest (RequestContext _context) {
28 WebUtils.WriteJson (_context.Response, loadedWebMods);
29 }
30
31 public override int DefaultPermissionLevel () {
32 return 2000;
33 }
34 }
35}
Note: See TracBrowser for help on using the repository browser.