mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 13:47:04 -04:00
Mock FreeSO API
- Until the real FreeSO API server is properly reconfigured, a mock API will take it's place using Mockoon. - Ported over a few elements from FSO.Common into the client.
This commit is contained in:
parent
49820cd42c
commit
a380de3a44
10 changed files with 1114 additions and 29 deletions
|
@ -25,17 +25,15 @@ namespace FSO.Server.Api.Core.Controllers.Admin
|
|||
if (order == null) order = "start_day";
|
||||
var api = Api.INSTANCE;
|
||||
api.DemandModerator(Request);
|
||||
using (var da = api.DAFactory.Get())
|
||||
using var da = api.DAFactory.Get();
|
||||
|
||||
if (limit > 100)
|
||||
{
|
||||
|
||||
if (limit > 100)
|
||||
{
|
||||
limit = 100;
|
||||
}
|
||||
|
||||
var result = da.Events.All((int)offset, (int)limit, order);
|
||||
return ApiResponse.PagedList<DbEvent>(Request, HttpStatusCode.OK, result);
|
||||
limit = 100;
|
||||
}
|
||||
|
||||
var result = da.Events.All((int)offset, (int)limit, order);
|
||||
return ApiResponse.PagedList<DbEvent>(Request, HttpStatusCode.OK, result);
|
||||
}
|
||||
|
||||
[HttpGet("presets")]
|
||||
|
@ -50,7 +48,7 @@ namespace FSO.Server.Api.Core.Controllers.Admin
|
|||
}
|
||||
|
||||
[HttpPost("presets")]
|
||||
public IActionResult CreatePreset([FromBody]PresetCreateModel request)
|
||||
public IActionResult CreatePreset([FromBody] PresetCreateModel request)
|
||||
{
|
||||
var api = Api.INSTANCE;
|
||||
api.DemandModerator(Request);
|
||||
|
@ -104,7 +102,7 @@ namespace FSO.Server.Api.Core.Controllers.Admin
|
|||
|
||||
// POST admin/updates (start update generation)
|
||||
[HttpPost]
|
||||
public IActionResult Post([FromBody]EventCreateModel request)
|
||||
public IActionResult Post([FromBody] EventCreateModel request)
|
||||
{
|
||||
var api = Api.INSTANCE;
|
||||
api.DemandModerator(Request);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net45</TargetFramework>
|
||||
<TargetFrameworks>net45;net8.0</TargetFrameworks>
|
||||
<OutputType>Library</OutputType>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||
|
@ -11,7 +11,8 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<Reference
|
||||
Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<HintPath>..\packages/Newtonsoft.Json.13.0.1/lib/net45/Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
|
|
@ -8,6 +8,6 @@ As the API server is already complete, zTSO's client and server will have separa
|
|||
|
||||
## Support Cycle
|
||||
|
||||
| Version | Release Date | Type | End of Support |
|
||||
| ------- | ------------ | ---- | -------------- |
|
||||
| 0.88 | March 31 | LTS | TBA |
|
||||
| Version | Release Date | Type | End of Support |
|
||||
| ------- | ------------ | ---- | ------------------ |
|
||||
| 0.88 | March 31 | LTS | January 10th, 2027 |
|
||||
|
|
146
server/fsomockapi.json
Normal file
146
server/fsomockapi.json
Normal file
|
@ -0,0 +1,146 @@
|
|||
{
|
||||
"uuid": "2addc65d-3a58-4d34-8aab-8376800669de",
|
||||
"lastMigration": 32,
|
||||
"name": "FreeSO API",
|
||||
"endpointPrefix": "api",
|
||||
"latency": 0,
|
||||
"port": 3001,
|
||||
"hostname": "",
|
||||
"folders": [],
|
||||
"routes": [
|
||||
{
|
||||
"uuid": "bd0b74a7-5b82-4934-bd6f-13b69df8b7f0",
|
||||
"type": "http",
|
||||
"documentation": "Returns every reserved lot, its name, online lots, and all online lot's populations.",
|
||||
"method": "get",
|
||||
"endpoint": "city/1",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "d8127941-3c34-4c78-9737-572ccfa112fa",
|
||||
"body": "{\n \"names\": [\n \"Town Hall\",\n \"M.O.M.I. Headquarters\"\n ],\n \"reservedLots\": [\n 13828397,\n 13828398\n ],\n \"activeLots\": [\n 13828397\n ],\n \"onlineCount\": [\n 10\n ]\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "f3fb2f37-5402-4547-8781-8791a8795997",
|
||||
"type": "http",
|
||||
"documentation": "OAuth Reponse",
|
||||
"method": "get",
|
||||
"endpoint": "oauth/token",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "dad8bcb1-bf62-4eaf-9ad7-53ec5bf0021d",
|
||||
"body": "{\n \"access_token\": \"ROoPRE007bqYBABGylS3TJREv8kOh49E6z7Qa2wXBryCxcRn8NFWrV48SNTKVL1K7wkwAEsqeKMHoIi6F4WOkZYUiKZ8ar0II3JqOZB9db3rgfHpZELcYvsCNM0CBy4pIaofhnoj2qI4JVy7mq27i9O0ZiIMLB9JLksxsmMAMefm8482VU5RjhDQRX16jFNjoEK8Rtb3rBJq340LCeAA9XOgnisG4iwjeaK1zjgU93i8VCe1GTpCowS5C9UX2\",\n \"expires_in\": 3600\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "OAuth",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "eb27265e-acbf-4d0e-84cc-b1ffc573bc02",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "city/1/avatars/456",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "30119a6a-e6ae-4afc-8e54-d2b42dbf4da8",
|
||||
"body": "{\n \"avatar_id\": 456,\n \"shard_id\": 1,\n \"name\": \"Tony Bark\",\n \"gender\": 0,\n \"date\": 1486420929,\n \"description\": \"Arf! That's me. Tony Bark.\",\n \"current_job\": 5,\n \"mayor_nhood\": null\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
}
|
||||
],
|
||||
"rootChildren": [
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "bd0b74a7-5b82-4934-bd6f-13b69df8b7f0"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "f3fb2f37-5402-4547-8781-8791a8795997"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "eb27265e-acbf-4d0e-84cc-b1ffc573bc02"
|
||||
}
|
||||
],
|
||||
"proxyMode": false,
|
||||
"proxyHost": "",
|
||||
"proxyRemovePrefix": false,
|
||||
"tlsOptions": {
|
||||
"enabled": false,
|
||||
"type": "CERT",
|
||||
"pfxPath": "",
|
||||
"certPath": "",
|
||||
"keyPath": "",
|
||||
"caPath": "",
|
||||
"passphrase": ""
|
||||
},
|
||||
"cors": true,
|
||||
"headers": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"proxyReqHeaders": [
|
||||
{
|
||||
"key": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"proxyResHeaders": [
|
||||
{
|
||||
"key": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"data": [],
|
||||
"callbacks": []
|
||||
}
|
|
@ -44,7 +44,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net45</TargetFramework>
|
||||
<TargetFrameworks>net45;net8.0</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
@ -87,9 +87,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="MP3Sharp" Version="1.0.5" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Common.Logging" Version="3.4.1" />
|
||||
<PackageReference Include="Common.Logging.Core" Version="3.4.1" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
{
|
||||
public class SymmetricMatrix
|
||||
{
|
||||
public SymmetricMatrix(double c) {
|
||||
for (int i=0; i<10; i++) m[i] = c;
|
||||
public SymmetricMatrix(double c)
|
||||
{
|
||||
for (int i = 0; i < 10; i++) m[i] = c;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,9 +14,9 @@
|
|||
double m44)
|
||||
{
|
||||
m[0] = m11; m[1] = m12; m[2] = m13; m[3] = m14;
|
||||
m[4] = m22; m[5] = m23; m[6] = m24;
|
||||
m[7] = m33; m[8] = m34;
|
||||
m[9] = m44;
|
||||
m[4] = m22; m[5] = m23; m[6] = m24;
|
||||
m[7] = m33; m[8] = m34;
|
||||
m[9] = m44;
|
||||
}
|
||||
|
||||
// Make plane
|
||||
|
@ -28,7 +29,8 @@
|
|||
m[9] = d * d;
|
||||
}
|
||||
|
||||
public double this[int c] {
|
||||
public double this[int c]
|
||||
{
|
||||
get { return m[c]; }
|
||||
set { m[c] = value; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue