Fix Settings not returning as JSON
This commit is contained in:
parent
2d848843d0
commit
6f3bba99b0
@ -198,7 +198,7 @@ public class Server : GlobalBase
|
|||||||
SendResponse(HttpStatusCode.OK, response, _parent.jobBoss.jobs.Where(jjob => jjob is DownloadNewChapters).OrderBy(jjob => ((DownloadNewChapters)jjob).manga.sortName));
|
SendResponse(HttpStatusCode.OK, response, _parent.jobBoss.jobs.Where(jjob => jjob is DownloadNewChapters).OrderBy(jjob => ((DownloadNewChapters)jjob).manga.sortName));
|
||||||
break;
|
break;
|
||||||
case "Settings":
|
case "Settings":
|
||||||
SendResponse(HttpStatusCode.OK, response, TrangaSettings.Serialize());
|
SendResponse(HttpStatusCode.OK, response, TrangaSettings.AsJObject());
|
||||||
break;
|
break;
|
||||||
case "Settings/userAgent":
|
case "Settings/userAgent":
|
||||||
SendResponse(HttpStatusCode.OK, response, TrangaSettings.userAgent);
|
SendResponse(HttpStatusCode.OK, response, TrangaSettings.userAgent);
|
||||||
|
@ -154,7 +154,7 @@ public static class TrangaSettings
|
|||||||
File.WriteAllText(settingsFilePath, Serialize());
|
File.WriteAllText(settingsFilePath, Serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Serialize()
|
public static JObject AsJObject()
|
||||||
{
|
{
|
||||||
JObject jobj = new JObject();
|
JObject jobj = new JObject();
|
||||||
jobj.Add("downloadLocation", JToken.FromObject(TrangaSettings.downloadLocation));
|
jobj.Add("downloadLocation", JToken.FromObject(TrangaSettings.downloadLocation));
|
||||||
@ -164,9 +164,11 @@ public static class TrangaSettings
|
|||||||
jobj.Add("aprilFoolsMode", JToken.FromObject(TrangaSettings.aprilFoolsMode));
|
jobj.Add("aprilFoolsMode", JToken.FromObject(TrangaSettings.aprilFoolsMode));
|
||||||
jobj.Add("version", JToken.FromObject(TrangaSettings.version));
|
jobj.Add("version", JToken.FromObject(TrangaSettings.version));
|
||||||
jobj.Add("requestLimits", JToken.FromObject(TrangaSettings.requestLimits));
|
jobj.Add("requestLimits", JToken.FromObject(TrangaSettings.requestLimits));
|
||||||
return jobj.ToString();
|
return jobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string Serialize() => AsJObject().ToString();
|
||||||
|
|
||||||
public static void Deserialize(string serialized)
|
public static void Deserialize(string serialized)
|
||||||
{
|
{
|
||||||
JObject jobj = JObject.Parse(serialized);
|
JObject jobj = JObject.Parse(serialized);
|
||||||
|
Loading…
Reference in New Issue
Block a user