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